diff --git a/Cargo.lock b/Cargo.lock index 80e008db..23337ce4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -159,9 +159,11 @@ dependencies = [ "lang", "lazy-regex", "log", + "macros", "mailer", "media", "mongodb", + "openapi", "owo-colors 3.5.0", "parking_lot 0.12.1", "paste", @@ -261,7 +263,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -334,7 +336,7 @@ checksum = "a564d521dd56509c4c47480d00b80ee55f7e385ae48db5744c67ad50c92d2ebf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -900,7 +902,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -1279,7 +1281,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -1301,7 +1303,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -1340,6 +1342,7 @@ dependencies = [ "macros", "mongodb", "once_cell", + "openapi", "parking_lot 0.12.1", "paste", "prex", @@ -1986,7 +1989,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -2064,7 +2067,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -2076,7 +2079,7 @@ dependencies = [ "proc-macro2", "quote", "regex", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -2103,6 +2106,7 @@ dependencies = [ "ip2geo", "log", "macros", + "schemars", "serde", "strum", "ts-rs", @@ -2932,6 +2936,7 @@ dependencies = [ name = "lang" version = "0.1.0" dependencies = [ + "schemars", "serde", "ts-rs", ] @@ -3384,7 +3389,7 @@ dependencies = [ "quote", "regex", "regex_static", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -3407,7 +3412,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -3724,6 +3729,17 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +[[package]] +name = "openapi" +version = "0.1.0" +dependencies = [ + "schemars", + "serde", + "serde_json", + "thiserror", + "ts-rs", +] + [[package]] name = "openstream" version = "0.1.0" @@ -4183,9 +4199,9 @@ checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -4296,9 +4312,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.32" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50f3b39ccfb720540debaa0164757101c08ecb8d326b15358ce76a62c7e85965" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -4786,7 +4802,7 @@ dependencies = [ "proc-macro2", "quote", "rust-embed-utils", - "syn 2.0.29", + "syn 2.0.48", "walkdir", ] @@ -4986,7 +5002,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -5066,9 +5082,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.188" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] @@ -5084,6 +5100,7 @@ dependencies = [ "iso8601-timestamp", "log", "mongodb", + "openapi", "schemars", "serde", "serde_json", @@ -5103,13 +5120,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.188" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -5125,9 +5142,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "indexmap 2.0.0", "itoa 1.0.5", @@ -5224,7 +5241,7 @@ dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -5832,9 +5849,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.29" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c324c494eba9d92503e6f1ef2e6df781e78f6a7705a0202d9801b198807d518a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -5938,22 +5955,22 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c" [[package]] name = "thiserror" -version = "1.0.49" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1177e8c6d7ede7afde3585fd2513e611227efd6481bd78d2e82ba1ce16557ed4" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.49" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10712f02019e9288794769fba95cd6847df9874d49d871d062172f9dd41bc4cc" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] @@ -6083,7 +6100,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.29", + "syn 2.0.48", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 14caa89a..2375417c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ members = [ "rs/config/constants", + "rs/packages/openapi", "rs/packages/ip-counter", "rs/packages/macros", "rs/packages/macros-build", diff --git a/defs/DateTime.ts b/defs/DateTime.ts index 9d648c20..112500a5 100644 --- a/defs/DateTime.ts +++ b/defs/DateTime.ts @@ -1,3 +1,3 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. -export type DateTime = string; +export type DateTime = /* DateTime */ string; diff --git a/defs/Device.schema.json b/defs/Device.schema.json deleted file mode 100644 index 00651d3b..00000000 --- a/defs/Device.schema.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "type": "object", - "required": [ - "_id", - "created_at", - "ip", - "is_current", - "ua" - ], - "properties": { - "_id": { - "type": "string" - }, - "is_current": { - "type": "boolean" - }, - "ip": { - "type": "string", - "format": "ip" - }, - "ua": { - "description": "UserAgent is an owned value it does allocate in favor of simplicity", - "type": "object", - "properties": { - "ua": { - "type": "string", - "nullable": true - }, - "category": { - "type": "string", - "nullable": true - }, - "browser_type": { - "type": "string", - "nullable": true - }, - "vendor": { - "type": "string", - "nullable": true - }, - "name": { - "type": "string", - "nullable": true - }, - "version": { - "type": "string", - "nullable": true - }, - "os": { - "type": "string", - "nullable": true - }, - "os_version": { - "type": "string", - "nullable": true - } - } - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "last_used_at": { - "type": "string", - "format": "date-time", - "nullable": true - }, - "user_id": { - "type": "string", - "nullable": true - }, - "admin_id": { - "type": "string", - "nullable": true - } - } -} \ No newline at end of file diff --git a/defs/TimezoneDateTime.ts b/defs/TimezoneDateTime.ts new file mode 100644 index 00000000..6224e2ae --- /dev/null +++ b/defs/TimezoneDateTime.ts @@ -0,0 +1,3 @@ +// This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. + +export type TimezoneDateTime = /* TimezoneDateTime */ string; diff --git a/defs/analytics/Analytics.ts b/defs/analytics/Analytics.ts index a1e7710c..7e86783f 100644 --- a/defs/analytics/Analytics.ts +++ b/defs/analytics/Analytics.ts @@ -4,6 +4,7 @@ import type { AnalyticsQueryKind } from "./AnalyticsQueryKind"; import type { AnalyticsStation } from "./AnalyticsStation"; import type { CountryCode } from "../CountryCode"; import type { DateTime } from "../DateTime"; +import type { TimezoneDateTime } from "../TimezoneDateTime"; import type { YearMonthDay } from "./YearMonthDay"; import type { YearMonthDayHour } from "./YearMonthDayHour"; @@ -11,8 +12,8 @@ export type Analytics = { is_now: boolean; kind: AnalyticsQueryKind; stations: Array; - since: /** time::DateTime */ string; - until: /** time::DateTime */ string; + since: TimezoneDateTime; + until: TimezoneDateTime; utc_offset_minutes: number; sessions: number; ips: number; diff --git a/defs/analytics/AnalyticsQueryKind.ts b/defs/analytics/AnalyticsQueryKind.ts index b93aeb78..b3492474 100644 --- a/defs/analytics/AnalyticsQueryKind.ts +++ b/defs/analytics/AnalyticsQueryKind.ts @@ -1,10 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TimezoneDateTime } from "../TimezoneDateTime"; -export type AnalyticsQueryKind = { - now: { offset_date: /** time::DateTime */ string }; -} | { - time_range: { - since: /** time::DateTime */ string; - until: /** time::DateTime */ string; - }; +export type AnalyticsQueryKind = { now: { offset_date: TimezoneDateTime } } | { + time_range: { since: TimezoneDateTime; until: TimezoneDateTime }; }; diff --git a/defs/api/accounts/GET/Output.schema.json b/defs/api/accounts/GET/Output.schema.json new file mode 100644 index 00000000..6d281155 --- /dev/null +++ b/defs/api/accounts/GET/Output.schema.json @@ -0,0 +1,299 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/GET/Query.schema.json b/defs/api/accounts/GET/Query.schema.json new file mode 100644 index 00000000..c1384b2e --- /dev/null +++ b/defs/api/accounts/GET/Query.schema.json @@ -0,0 +1,29 @@ +{ + "type": "object", + "properties": { + "user_id": { + "type": "string", + "nullable": true + }, + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/POST/Output.schema.json b/defs/api/accounts/POST/Output.schema.json new file mode 100644 index 00000000..6ca31431 --- /dev/null +++ b/defs/api/accounts/POST/Output.schema.json @@ -0,0 +1,279 @@ +{ + "type": "object", + "required": [ + "account" + ], + "properties": { + "account": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/POST/Payload.schema.json b/defs/api/accounts/POST/Payload.schema.json new file mode 100644 index 00000000..4a06c28b --- /dev/null +++ b/defs/api/accounts/POST/Payload.schema.json @@ -0,0 +1,34 @@ +{ + "type": "object", + "required": [ + "name", + "payment_method_id", + "plan_id" + ], + "properties": { + "name": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "user_id": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "payment_method_id": { + "type": "string" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/DELETE/Output.schema.json b/defs/api/accounts/[account]/DELETE/Output.schema.json new file mode 100644 index 00000000..8975792d --- /dev/null +++ b/defs/api/accounts/[account]/DELETE/Output.schema.json @@ -0,0 +1,271 @@ +{ + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/GET/Output.schema.json b/defs/api/accounts/[account]/GET/Output.schema.json new file mode 100644 index 00000000..053e772f --- /dev/null +++ b/defs/api/accounts/[account]/GET/Output.schema.json @@ -0,0 +1,283 @@ +{ + "type": "object", + "required": [ + "account", + "is_owner" + ], + "properties": { + "is_owner": { + "type": "boolean" + }, + "account": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/PATCH/Output.schema.json b/defs/api/accounts/[account]/PATCH/Output.schema.json new file mode 100644 index 00000000..8975792d --- /dev/null +++ b/defs/api/accounts/[account]/PATCH/Output.schema.json @@ -0,0 +1,271 @@ +{ + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/PATCH/Payload.schema.json b/defs/api/accounts/[account]/PATCH/Payload.schema.json new file mode 100644 index 00000000..4aea9d8d --- /dev/null +++ b/defs/api/accounts/[account]/PATCH/Payload.schema.json @@ -0,0 +1,26 @@ +{ + "type": "object", + "properties": { + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1, + "nullable": true + }, + "plan_id": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/members/GET/Member.schema.json b/defs/api/accounts/[account]/members/GET/Member.schema.json new file mode 100644 index 00000000..cfae320a --- /dev/null +++ b/defs/api/accounts/[account]/members/GET/Member.schema.json @@ -0,0 +1,31 @@ +{ + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name", + "relation" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "relation": { + "type": "string", + "enum": [ + "owner", + "staff" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/members/GET/Output.schema.json b/defs/api/accounts/[account]/members/GET/Output.schema.json new file mode 100644 index 00000000..3a30919d --- /dev/null +++ b/defs/api/accounts/[account]/members/GET/Output.schema.json @@ -0,0 +1,42 @@ +{ + "type": "object", + "required": [ + "members" + ], + "properties": { + "members": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name", + "relation" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "relation": { + "type": "string", + "enum": [ + "owner", + "staff" + ] + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/members/[member]/DELETE/Output.schema.json b/defs/api/accounts/[account]/members/[member]/DELETE/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/DELETE/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/members/[member]/set-role/POST/AccessKind.schema.json b/defs/api/accounts/[account]/members/[member]/set-role/POST/AccessKind.schema.json new file mode 100644 index 00000000..e786409c --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/set-role/POST/AccessKind.schema.json @@ -0,0 +1,7 @@ +{ + "type": "string", + "enum": [ + "owner", + "staff" + ] +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/members/[member]/set-role/POST/Output.schema.json b/defs/api/accounts/[account]/members/[member]/set-role/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/set-role/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/members/[member]/set-role/POST/Payload.schema.json b/defs/api/accounts/[account]/members/[member]/set-role/POST/Payload.schema.json new file mode 100644 index 00000000..ec27f3f8 --- /dev/null +++ b/defs/api/accounts/[account]/members/[member]/set-role/POST/Payload.schema.json @@ -0,0 +1,15 @@ +{ + "type": "object", + "required": [ + "role" + ], + "properties": { + "role": { + "type": "string", + "enum": [ + "owner", + "staff" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/stream-stats/GET/Output.schema.json b/defs/api/accounts/[account]/stream-stats/GET/Output.schema.json new file mode 100644 index 00000000..4ea31a68 --- /dev/null +++ b/defs/api/accounts/[account]/stream-stats/GET/Output.schema.json @@ -0,0 +1,99 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "last_24h", + "last_30d", + "last_7d", + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_24h": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_7d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_30d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/stream-stats/last-[num][unit]/GET/Output.schema.json b/defs/api/accounts/[account]/stream-stats/last-[num][unit]/GET/Output.schema.json new file mode 100644 index 00000000..c74bc97d --- /dev/null +++ b/defs/api/accounts/[account]/stream-stats/last-[num][unit]/GET/Output.schema.json @@ -0,0 +1,28 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/stream-stats/last-[num][unit]/count/GET/Output.schema.json b/defs/api/accounts/[account]/stream-stats/last-[num][unit]/count/GET/Output.schema.json new file mode 100644 index 00000000..ca4bb8c1 --- /dev/null +++ b/defs/api/accounts/[account]/stream-stats/last-[num][unit]/count/GET/Output.schema.json @@ -0,0 +1,13 @@ +{ + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/stream-stats/now/GET/Output.schema.json b/defs/api/accounts/[account]/stream-stats/now/GET/Output.schema.json new file mode 100644 index 00000000..c74bc97d --- /dev/null +++ b/defs/api/accounts/[account]/stream-stats/now/GET/Output.schema.json @@ -0,0 +1,28 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/stream-stats/now/count-by-station/GET/Output.schema.json b/defs/api/accounts/[account]/stream-stats/now/count-by-station/GET/Output.schema.json new file mode 100644 index 00000000..b36cc451 --- /dev/null +++ b/defs/api/accounts/[account]/stream-stats/now/count-by-station/GET/Output.schema.json @@ -0,0 +1,16 @@ +{ + "type": "object", + "required": [ + "by_station" + ], + "properties": { + "by_station": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } +} \ No newline at end of file diff --git a/defs/api/accounts/[account]/stream-stats/now/count/GET/Output.schema.json b/defs/api/accounts/[account]/stream-stats/now/count/GET/Output.schema.json new file mode 100644 index 00000000..ca4bb8c1 --- /dev/null +++ b/defs/api/accounts/[account]/stream-stats/now/count/GET/Output.schema.json @@ -0,0 +1,13 @@ +{ + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } +} \ No newline at end of file diff --git a/defs/api/admins/GET/Output.schema.json b/defs/api/admins/GET/Output.schema.json new file mode 100644 index 00000000..07db8c80 --- /dev/null +++ b/defs/api/admins/GET/Output.schema.json @@ -0,0 +1,71 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/admins/GET/Query.schema.json b/defs/api/admins/GET/Query.schema.json new file mode 100644 index 00000000..705cf495 --- /dev/null +++ b/defs/api/admins/GET/Query.schema.json @@ -0,0 +1,25 @@ +{ + "type": "object", + "properties": { + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/admins/POST/Output.schema.json b/defs/api/admins/POST/Output.schema.json new file mode 100644 index 00000000..bc98f2d2 --- /dev/null +++ b/defs/api/admins/POST/Output.schema.json @@ -0,0 +1,51 @@ +{ + "type": "object", + "required": [ + "admin" + ], + "properties": { + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/admins/POST/Payload.schema.json b/defs/api/admins/POST/Payload.schema.json new file mode 100644 index 00000000..5ae0774a --- /dev/null +++ b/defs/api/admins/POST/Payload.schema.json @@ -0,0 +1,29 @@ +{ + "type": "object", + "required": [ + "email", + "first_name", + "last_name", + "password" + ], + "properties": { + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/admins/[admin]/GET/Output.schema.json b/defs/api/admins/[admin]/GET/Output.schema.json new file mode 100644 index 00000000..bc98f2d2 --- /dev/null +++ b/defs/api/admins/[admin]/GET/Output.schema.json @@ -0,0 +1,51 @@ +{ + "type": "object", + "required": [ + "admin" + ], + "properties": { + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/admins/[admin]/PATCH/Output.schema.json b/defs/api/admins/[admin]/PATCH/Output.schema.json new file mode 100644 index 00000000..eced69de --- /dev/null +++ b/defs/api/admins/[admin]/PATCH/Output.schema.json @@ -0,0 +1,43 @@ +{ + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/admins/[admin]/PATCH/Payload.schema.json b/defs/api/admins/[admin]/PATCH/Payload.schema.json new file mode 100644 index 00000000..e52b8107 --- /dev/null +++ b/defs/api/admins/[admin]/PATCH/Payload.schema.json @@ -0,0 +1,19 @@ +{ + "type": "object", + "properties": { + "first_name": { + "type": "string", + "nullable": true + }, + "last_name": { + "type": "string", + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/admins/[admin]/change-password/POST/Output.schema.json b/defs/api/admins/[admin]/change-password/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/admins/[admin]/change-password/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/admins/[admin]/change-password/POST/Payload.schema.json b/defs/api/admins/[admin]/change-password/POST/Payload.schema.json new file mode 100644 index 00000000..93ea319a --- /dev/null +++ b/defs/api/admins/[admin]/change-password/POST/Payload.schema.json @@ -0,0 +1,15 @@ +{ + "type": "object", + "required": [ + "current_password", + "new_password" + ], + "properties": { + "current_password": { + "type": "string" + }, + "new_password": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/analytics/GET/CountryCodeOrZZ.schema.json b/defs/api/analytics/GET/CountryCodeOrZZ.schema.json new file mode 100644 index 00000000..67a601ae --- /dev/null +++ b/defs/api/analytics/GET/CountryCodeOrZZ.schema.json @@ -0,0 +1,265 @@ +{ + "anyOf": [ + { + "type": "string", + "enum": [ + "ZZ" + ] + }, + { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + } + ] +} \ No newline at end of file diff --git a/defs/api/analytics/GET/Output.schema.json b/defs/api/analytics/GET/Output.schema.json new file mode 100644 index 00000000..f3027386 --- /dev/null +++ b/defs/api/analytics/GET/Output.schema.json @@ -0,0 +1,797 @@ +{ + "type": "object", + "required": [ + "analytics" + ], + "properties": { + "analytics": { + "type": "object", + "required": [ + "by_browser", + "by_country", + "by_day", + "by_domain", + "by_os", + "by_station", + "ips", + "is_now", + "kind", + "max_concurrent_listeners", + "sessions", + "since", + "stations", + "total_duration_ms", + "total_transfer_bytes", + "until", + "utc_offset_minutes" + ], + "properties": { + "is_now": { + "type": "boolean" + }, + "kind": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "stations": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + }, + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + }, + "utc_offset_minutes": { + "type": "integer", + "format": "int16" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "by_day": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_hour": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "hour", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "hour": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "nullable": true + }, + "by_browser": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_os": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_country": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_station": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_domain": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/analytics/GET/Query.schema.json b/defs/api/analytics/GET/Query.schema.json new file mode 100644 index 00000000..8710590c --- /dev/null +++ b/defs/api/analytics/GET/Query.schema.json @@ -0,0 +1,355 @@ +{ + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "stations": { + "description": "ommiting this value means all available stations for the current access scope (this is valid only for admin and global access token scopes)", + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "browser": { + "default": null, + "type": "string", + "nullable": true + }, + "os": { + "default": null, + "type": "string", + "nullable": true + }, + "domain": { + "default": null, + "type": "string", + "nullable": true + }, + "country_code": { + "default": null, + "anyOf": [ + { + "type": "string", + "enum": [ + "ZZ" + ] + }, + { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + } + ], + "nullable": true + }, + "min_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/analytics/GET/ZZ.schema.json b/defs/api/analytics/GET/ZZ.schema.json new file mode 100644 index 00000000..9795e32c --- /dev/null +++ b/defs/api/analytics/GET/ZZ.schema.json @@ -0,0 +1,6 @@ +{ + "type": "string", + "enum": [ + "ZZ" + ] +} \ No newline at end of file diff --git a/defs/api/app-analytics/GET/CountryCodeOrZZ.schema.json b/defs/api/app-analytics/GET/CountryCodeOrZZ.schema.json new file mode 100644 index 00000000..67a601ae --- /dev/null +++ b/defs/api/app-analytics/GET/CountryCodeOrZZ.schema.json @@ -0,0 +1,265 @@ +{ + "anyOf": [ + { + "type": "string", + "enum": [ + "ZZ" + ] + }, + { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + } + ] +} \ No newline at end of file diff --git a/defs/api/app-analytics/GET/Output.schema.json b/defs/api/app-analytics/GET/Output.schema.json new file mode 100644 index 00000000..d7695e78 --- /dev/null +++ b/defs/api/app-analytics/GET/Output.schema.json @@ -0,0 +1,753 @@ +{ + "type": "object", + "required": [ + "analytics" + ], + "properties": { + "analytics": { + "type": "object", + "required": [ + "by_app_kind", + "by_app_version", + "by_country", + "by_day", + "by_station", + "ips", + "is_now", + "kind", + "max_concurrent_listeners", + "sessions", + "since", + "stations", + "total_duration_ms", + "until", + "utc_offset_minutes" + ], + "properties": { + "is_now": { + "type": "boolean" + }, + "kind": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "stations": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + }, + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + }, + "utc_offset_minutes": { + "type": "integer", + "format": "int16" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "by_day": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_hour": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "hour", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + }, + "hour": { + "type": "integer", + "format": "uint8", + "minimum": 0.0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "nullable": true + }, + "by_country": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_station": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_app_kind": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_app_version": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "properties": { + "kind": { + "type": "string", + "nullable": true + }, + "version": { + "type": "integer", + "format": "uint32", + "minimum": 0.0, + "nullable": true + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/app-analytics/GET/Query.schema.json b/defs/api/app-analytics/GET/Query.schema.json new file mode 100644 index 00000000..c045f9b6 --- /dev/null +++ b/defs/api/app-analytics/GET/Query.schema.json @@ -0,0 +1,350 @@ +{ + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "stations": { + "description": "ommiting this value means all available stations for the current access scope (this is valid only for admin and global access token scopes)", + "default": [], + "type": "array", + "items": { + "type": "string" + } + }, + "app_kind": { + "default": null, + "type": "string", + "nullable": true + }, + "app_version": { + "default": null, + "type": "string", + "nullable": true + }, + "country_code": { + "default": null, + "anyOf": [ + { + "type": "string", + "enum": [ + "ZZ" + ] + }, + { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + } + ], + "nullable": true + }, + "min_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/app-analytics/GET/ZZ.schema.json b/defs/api/app-analytics/GET/ZZ.schema.json new file mode 100644 index 00000000..9795e32c --- /dev/null +++ b/defs/api/app-analytics/GET/ZZ.schema.json @@ -0,0 +1,6 @@ +{ + "type": "string", + "enum": [ + "ZZ" + ] +} \ No newline at end of file diff --git a/defs/api/auth/admin/delegate/[user]/POST/Output.schema.json b/defs/api/auth/admin/delegate/[user]/POST/Output.schema.json new file mode 100644 index 00000000..078b7969 --- /dev/null +++ b/defs/api/auth/admin/delegate/[user]/POST/Output.schema.json @@ -0,0 +1,72 @@ +{ + "type": "object", + "required": [ + "media_key", + "token", + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/admin/delegate/[user]/POST/Payload.schema.json b/defs/api/auth/admin/delegate/[user]/POST/Payload.schema.json new file mode 100644 index 00000000..40686f9b --- /dev/null +++ b/defs/api/auth/admin/delegate/[user]/POST/Payload.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "title" + ], + "properties": { + "title": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/admin/login/POST/Output.schema.json b/defs/api/auth/admin/login/POST/Output.schema.json new file mode 100644 index 00000000..12d8e432 --- /dev/null +++ b/defs/api/auth/admin/login/POST/Output.schema.json @@ -0,0 +1,59 @@ +{ + "type": "object", + "required": [ + "admin", + "media_key", + "token" + ], + "properties": { + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/admin/login/POST/Payload.schema.json b/defs/api/auth/admin/login/POST/Payload.schema.json new file mode 100644 index 00000000..16697b17 --- /dev/null +++ b/defs/api/auth/admin/login/POST/Payload.schema.json @@ -0,0 +1,20 @@ +{ + "type": "object", + "required": [ + "device_id", + "email", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "device_id": { + "type": "string" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/auth/admin/logout/POST/Output.schema.json b/defs/api/auth/admin/logout/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/auth/admin/logout/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/auth/email-verification/send-code/POST/Output.schema.json b/defs/api/auth/email-verification/send-code/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/auth/email-verification/send-code/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/auth/email-verification/send-code/POST/Payload.schema.json b/defs/api/auth/email-verification/send-code/POST/Payload.schema.json new file mode 100644 index 00000000..b471192b --- /dev/null +++ b/defs/api/auth/email-verification/send-code/POST/Payload.schema.json @@ -0,0 +1,12 @@ +{ + "type": "object", + "required": [ + "email" + ], + "properties": { + "email": { + "type": "string" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/auth/user/email-exists/[email]/GET/Output.schema.json b/defs/api/auth/user/email-exists/[email]/GET/Output.schema.json new file mode 100644 index 00000000..82683e22 --- /dev/null +++ b/defs/api/auth/user/email-exists/[email]/GET/Output.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "exists" + ], + "properties": { + "exists": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/user/login/POST/Output.schema.json b/defs/api/auth/user/login/POST/Output.schema.json new file mode 100644 index 00000000..cdc0781c --- /dev/null +++ b/defs/api/auth/user/login/POST/Output.schema.json @@ -0,0 +1,67 @@ +{ + "type": "object", + "required": [ + "media_key", + "token", + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/user/login/POST/Payload.schema.json b/defs/api/auth/user/login/POST/Payload.schema.json new file mode 100644 index 00000000..16697b17 --- /dev/null +++ b/defs/api/auth/user/login/POST/Payload.schema.json @@ -0,0 +1,20 @@ +{ + "type": "object", + "required": [ + "device_id", + "email", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "device_id": { + "type": "string" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/auth/user/logout/POST/Output.schema.json b/defs/api/auth/user/logout/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/auth/user/logout/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/auth/user/recover/POST/Output.schema.json b/defs/api/auth/user/recover/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/auth/user/recover/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/auth/user/recover/POST/Payload.schema.json b/defs/api/auth/user/recover/POST/Payload.schema.json new file mode 100644 index 00000000..b471192b --- /dev/null +++ b/defs/api/auth/user/recover/POST/Payload.schema.json @@ -0,0 +1,12 @@ +{ + "type": "object", + "required": [ + "email" + ], + "properties": { + "email": { + "type": "string" + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/auth/user/recovery-token/[token]/GET/Output.schema.json b/defs/api/auth/user/recovery-token/[token]/GET/Output.schema.json new file mode 100644 index 00000000..7f2c2f19 --- /dev/null +++ b/defs/api/auth/user/recovery-token/[token]/GET/Output.schema.json @@ -0,0 +1,56 @@ +{ + "oneOf": [ + { + "type": "object", + "required": [ + "already_used", + "expired", + "kind", + "user_email", + "user_first_name", + "user_id", + "user_last_name" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "found" + ] + }, + "user_id": { + "type": "string" + }, + "user_first_name": { + "type": "string" + }, + "user_last_name": { + "type": "string" + }, + "user_email": { + "type": "string" + }, + "already_used": { + "type": "boolean" + }, + "expired": { + "type": "boolean" + } + } + }, + { + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "not_found" + ] + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/auth/user/recovery-token/[token]/set-password/POST/Output.schema.json b/defs/api/auth/user/recovery-token/[token]/set-password/POST/Output.schema.json new file mode 100644 index 00000000..67a9b010 --- /dev/null +++ b/defs/api/auth/user/recovery-token/[token]/set-password/POST/Output.schema.json @@ -0,0 +1,15 @@ +{ + "type": "object", + "required": [ + "user_email", + "user_id" + ], + "properties": { + "user_id": { + "type": "string" + }, + "user_email": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/user/recovery-token/[token]/set-password/POST/Payload.schema.json b/defs/api/auth/user/recovery-token/[token]/set-password/POST/Payload.schema.json new file mode 100644 index 00000000..1576c77c --- /dev/null +++ b/defs/api/auth/user/recovery-token/[token]/set-password/POST/Payload.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "new_password" + ], + "properties": { + "new_password": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/user/register/POST/Output.schema.json b/defs/api/auth/user/register/POST/Output.schema.json new file mode 100644 index 00000000..133c173b --- /dev/null +++ b/defs/api/auth/user/register/POST/Output.schema.json @@ -0,0 +1,399 @@ +{ + "type": "object", + "required": [ + "account", + "media_key", + "token", + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + }, + "account": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/auth/user/register/POST/Payload.schema.json b/defs/api/auth/user/register/POST/Payload.schema.json new file mode 100644 index 00000000..3e23c957 --- /dev/null +++ b/defs/api/auth/user/register/POST/Payload.schema.json @@ -0,0 +1,76 @@ +{ + "type": "object", + "required": [ + "account_name", + "device_id", + "email", + "email_verification_code", + "first_name", + "last_name", + "password", + "payment_method_nonce", + "plan_id" + ], + "properties": { + "plan_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "account_name": { + "type": "string" + }, + "user_user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "user_system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "account_user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "account_system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "email_verification_code": { + "type": "string" + }, + "device_id": { + "type": "string" + }, + "payment_method_nonce": { + "type": "string" + }, + "payment_device_data": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/invitations/GET/Output.schema.json b/defs/api/invitations/GET/Output.schema.json new file mode 100644 index 00000000..13440591 --- /dev/null +++ b/defs/api/invitations/GET/Output.schema.json @@ -0,0 +1,212 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/invitations/GET/Query.schema.json b/defs/api/invitations/GET/Query.schema.json new file mode 100644 index 00000000..af80c581 --- /dev/null +++ b/defs/api/invitations/GET/Query.schema.json @@ -0,0 +1,41 @@ +{ + "type": "object", + "properties": { + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "receiver_email": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string", + "nullable": true + }, + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/invitations/POST/Output.schema.json b/defs/api/invitations/POST/Output.schema.json new file mode 100644 index 00000000..9fbb89e5 --- /dev/null +++ b/defs/api/invitations/POST/Output.schema.json @@ -0,0 +1,192 @@ +{ + "type": "object", + "required": [ + "invitation" + ], + "properties": { + "invitation": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/invitations/POST/Payload.schema.json b/defs/api/invitations/POST/Payload.schema.json new file mode 100644 index 00000000..745b243c --- /dev/null +++ b/defs/api/invitations/POST/Payload.schema.json @@ -0,0 +1,15 @@ +{ + "type": "object", + "required": [ + "account_id", + "email" + ], + "properties": { + "account_id": { + "type": "string" + }, + "email": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/invitations/[invitation]/DELETE/Output.schema.json b/defs/api/invitations/[invitation]/DELETE/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/invitations/[invitation]/DELETE/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/invitations/[invitation]/GET/Output.schema.json b/defs/api/invitations/[invitation]/GET/Output.schema.json new file mode 100644 index 00000000..9fbb89e5 --- /dev/null +++ b/defs/api/invitations/[invitation]/GET/Output.schema.json @@ -0,0 +1,192 @@ +{ + "type": "object", + "required": [ + "invitation" + ], + "properties": { + "invitation": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/invitations/accept/POST/Output.schema.json b/defs/api/invitations/accept/POST/Output.schema.json new file mode 100644 index 00000000..fb2f4e75 --- /dev/null +++ b/defs/api/invitations/accept/POST/Output.schema.json @@ -0,0 +1,130 @@ +{ + "oneOf": [ + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "ok" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "not-found" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "expired" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-accepted" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-rejected" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-in-account" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "account-deleted" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "account-not-found" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "email-exists" + ] + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/invitations/accept/POST/Payload.schema.json b/defs/api/invitations/accept/POST/Payload.schema.json new file mode 100644 index 00000000..81758bbb --- /dev/null +++ b/defs/api/invitations/accept/POST/Payload.schema.json @@ -0,0 +1,42 @@ +{ + "anyOf": [ + { + "type": "object", + "required": [ + "first_name", + "last_name", + "password", + "token" + ], + "properties": { + "token": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "password": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "invitation_id" + ], + "properties": { + "invitation_id": { + "type": "string" + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/invitations/accept/POST/UnauthenticatedAcceptPayloadData.schema.json b/defs/api/invitations/accept/POST/UnauthenticatedAcceptPayloadData.schema.json new file mode 100644 index 00000000..dd784d4f --- /dev/null +++ b/defs/api/invitations/accept/POST/UnauthenticatedAcceptPayloadData.schema.json @@ -0,0 +1,27 @@ +{ + "type": "object", + "required": [ + "first_name", + "last_name", + "password", + "token" + ], + "properties": { + "token": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "password": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/invitations/get-by-token/[token]/GET/Output.schema.json b/defs/api/invitations/get-by-token/[token]/GET/Output.schema.json new file mode 100644 index 00000000..66991eeb --- /dev/null +++ b/defs/api/invitations/get-by-token/[token]/GET/Output.schema.json @@ -0,0 +1,217 @@ +{ + "oneOf": [ + { + "type": "object", + "required": [ + "invitation", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "ok" + ] + }, + "invitation": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } + }, + { + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "not-found" + ] + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/invitations/reject/POST/Output.schema.json b/defs/api/invitations/reject/POST/Output.schema.json new file mode 100644 index 00000000..2da17ab4 --- /dev/null +++ b/defs/api/invitations/reject/POST/Output.schema.json @@ -0,0 +1,74 @@ +{ + "oneOf": [ + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "ok" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "not-found" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "expired" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-accepted" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-rejected" + ] + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/invitations/reject/POST/Payload.schema.json b/defs/api/invitations/reject/POST/Payload.schema.json new file mode 100644 index 00000000..47440be6 --- /dev/null +++ b/defs/api/invitations/reject/POST/Payload.schema.json @@ -0,0 +1,26 @@ +{ + "anyOf": [ + { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "invitation_id" + ], + "properties": { + "invitation_id": { + "type": "string" + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/me/GET/Output.schema.json b/defs/api/me/GET/Output.schema.json new file mode 100644 index 00000000..2b944f63 --- /dev/null +++ b/defs/api/me/GET/Output.schema.json @@ -0,0 +1,202 @@ +{ + "oneOf": [ + { + "type": "object", + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "global" + ] + } + } + }, + { + "type": "object", + "required": [ + "admin", + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "admin" + ] + }, + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + }, + { + "type": "object", + "required": [ + "scope", + "user" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "user" + ] + }, + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/me/api-keys/GET/Output.schema.json b/defs/api/me/api-keys/GET/Output.schema.json new file mode 100644 index 00000000..03b884bf --- /dev/null +++ b/defs/api/me/api-keys/GET/Output.schema.json @@ -0,0 +1,65 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "is_current", + "title" + ], + "properties": { + "_id": { + "type": "string" + }, + "is_current": { + "type": "boolean" + }, + "title": { + "type": "string" + }, + "user_id": { + "type": "string", + "nullable": true + }, + "admin_id": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "last_used_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/me/api-keys/GET/Query.schema.json b/defs/api/me/api-keys/GET/Query.schema.json new file mode 100644 index 00000000..246a2799 --- /dev/null +++ b/defs/api/me/api-keys/GET/Query.schema.json @@ -0,0 +1,33 @@ +{ + "type": "object", + "properties": { + "user_id": { + "type": "string", + "nullable": true + }, + "admin_id": { + "type": "string", + "nullable": true + }, + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/me/api-keys/POST/Output.schema.json b/defs/api/me/api-keys/POST/Output.schema.json new file mode 100644 index 00000000..6244c4fd --- /dev/null +++ b/defs/api/me/api-keys/POST/Output.schema.json @@ -0,0 +1,53 @@ +{ + "type": "object", + "required": [ + "api_key", + "media_key", + "token" + ], + "properties": { + "api_key": { + "type": "object", + "required": [ + "_id", + "created_at", + "is_current", + "title" + ], + "properties": { + "_id": { + "type": "string" + }, + "is_current": { + "type": "boolean" + }, + "title": { + "type": "string" + }, + "user_id": { + "type": "string", + "nullable": true + }, + "admin_id": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "last_used_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/me/api-keys/POST/Payload.schema.json b/defs/api/me/api-keys/POST/Payload.schema.json new file mode 100644 index 00000000..2a7e52a8 --- /dev/null +++ b/defs/api/me/api-keys/POST/Payload.schema.json @@ -0,0 +1,15 @@ +{ + "type": "object", + "required": [ + "password", + "title" + ], + "properties": { + "title": { + "type": "string" + }, + "password": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/me/api-keys/[id]/DELETE/Output.schema.json b/defs/api/me/api-keys/[id]/DELETE/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/me/api-keys/[id]/DELETE/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/me/api-keys/[id]/PATCH/Output.schema.json b/defs/api/me/api-keys/[id]/PATCH/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/me/api-keys/[id]/PATCH/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/me/api-keys/[id]/PATCH/Payload.schema.json b/defs/api/me/api-keys/[id]/PATCH/Payload.schema.json new file mode 100644 index 00000000..937d19a7 --- /dev/null +++ b/defs/api/me/api-keys/[id]/PATCH/Payload.schema.json @@ -0,0 +1,9 @@ +{ + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/payment-methods/GET/Output.schema.json b/defs/api/payment-methods/GET/Output.schema.json new file mode 100644 index 00000000..082885c0 --- /dev/null +++ b/defs/api/payment-methods/GET/Output.schema.json @@ -0,0 +1,90 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "card_type", + "kind", + "last_4" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "card" + ] + }, + "card_type": { + "type": "string" + }, + "last_4": { + "type": "string" + }, + "expiration_year": { + "type": "string", + "nullable": true + }, + "expiration_month": { + "type": "string", + "nullable": true + } + } + } + ], + "required": [ + "_id", + "created_at", + "updated_at", + "user_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/payment-methods/GET/Query.schema.json b/defs/api/payment-methods/GET/Query.schema.json new file mode 100644 index 00000000..c1384b2e --- /dev/null +++ b/defs/api/payment-methods/GET/Query.schema.json @@ -0,0 +1,29 @@ +{ + "type": "object", + "properties": { + "user_id": { + "type": "string", + "nullable": true + }, + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/payment-methods/POST/Output.schema.json b/defs/api/payment-methods/POST/Output.schema.json new file mode 100644 index 00000000..e64c9b33 --- /dev/null +++ b/defs/api/payment-methods/POST/Output.schema.json @@ -0,0 +1,70 @@ +{ + "type": "object", + "required": [ + "payment_method" + ], + "properties": { + "payment_method": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "card_type", + "kind", + "last_4" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "card" + ] + }, + "card_type": { + "type": "string" + }, + "last_4": { + "type": "string" + }, + "expiration_year": { + "type": "string", + "nullable": true + }, + "expiration_month": { + "type": "string", + "nullable": true + } + } + } + ], + "required": [ + "_id", + "created_at", + "updated_at", + "user_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/payment-methods/POST/Payload.schema.json b/defs/api/payment-methods/POST/Payload.schema.json new file mode 100644 index 00000000..86d85fbc --- /dev/null +++ b/defs/api/payment-methods/POST/Payload.schema.json @@ -0,0 +1,19 @@ +{ + "type": "object", + "required": [ + "device_data", + "nonce" + ], + "properties": { + "user_id": { + "type": "string", + "nullable": true + }, + "nonce": { + "type": "string" + }, + "device_data": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/payment-methods/[payment-method]/GET/Output.schema.json b/defs/api/payment-methods/[payment-method]/GET/Output.schema.json new file mode 100644 index 00000000..e64c9b33 --- /dev/null +++ b/defs/api/payment-methods/[payment-method]/GET/Output.schema.json @@ -0,0 +1,70 @@ +{ + "type": "object", + "required": [ + "payment_method" + ], + "properties": { + "payment_method": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "card_type", + "kind", + "last_4" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "card" + ] + }, + "card_type": { + "type": "string" + }, + "last_4": { + "type": "string" + }, + "expiration_year": { + "type": "string", + "nullable": true + }, + "expiration_month": { + "type": "string", + "nullable": true + } + } + } + ], + "required": [ + "_id", + "created_at", + "updated_at", + "user_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/plans/GET/Output.schema.json b/defs/api/plans/GET/Output.schema.json new file mode 100644 index 00000000..124cdba4 --- /dev/null +++ b/defs/api/plans/GET/Output.schema.json @@ -0,0 +1,116 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/plans/GET/Query.schema.json b/defs/api/plans/GET/Query.schema.json new file mode 100644 index 00000000..b7293415 --- /dev/null +++ b/defs/api/plans/GET/Query.schema.json @@ -0,0 +1,26 @@ +{ + "description": "TODO: add pagination", + "type": "object", + "properties": { + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/plans/POST/Output.schema.json b/defs/api/plans/POST/Output.schema.json new file mode 100644 index 00000000..5ea5b816 --- /dev/null +++ b/defs/api/plans/POST/Output.schema.json @@ -0,0 +1,88 @@ +{ + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/plans/POST/Payload.schema.json b/defs/api/plans/POST/Payload.schema.json new file mode 100644 index 00000000..181a3b30 --- /dev/null +++ b/defs/api/plans/POST/Payload.schema.json @@ -0,0 +1,62 @@ +{ + "type": "object", + "required": [ + "color", + "display_name", + "identifier", + "is_user_selectable", + "listeners", + "price", + "slug", + "stations", + "storage", + "transfer" + ], + "properties": { + "identifier": { + "type": "string", + "minLength": 1 + }, + "slug": { + "type": "string", + "minLength": 1 + }, + "display_name": { + "type": "string", + "minLength": 1 + }, + "is_user_selectable": { + "type": "boolean" + }, + "price": { + "type": "number", + "format": "double", + "minimum": 0.0 + }, + "color": { + "type": "string", + "minLength": 1 + }, + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/plans/[plan]/DELETE/Output.schema.json b/defs/api/plans/[plan]/DELETE/Output.schema.json new file mode 100644 index 00000000..50fbc535 --- /dev/null +++ b/defs/api/plans/[plan]/DELETE/Output.schema.json @@ -0,0 +1,96 @@ +{ + "type": "object", + "required": [ + "plan" + ], + "properties": { + "plan": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/plans/[plan]/GET/Output.schema.json b/defs/api/plans/[plan]/GET/Output.schema.json new file mode 100644 index 00000000..50fbc535 --- /dev/null +++ b/defs/api/plans/[plan]/GET/Output.schema.json @@ -0,0 +1,96 @@ +{ + "type": "object", + "required": [ + "plan" + ], + "properties": { + "plan": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/plans/[plan]/PATCH/Output.schema.json b/defs/api/plans/[plan]/PATCH/Output.schema.json new file mode 100644 index 00000000..5ea5b816 --- /dev/null +++ b/defs/api/plans/[plan]/PATCH/Output.schema.json @@ -0,0 +1,88 @@ +{ + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/plans/[plan]/PATCH/Payload.schema.json b/defs/api/plans/[plan]/PATCH/Payload.schema.json new file mode 100644 index 00000000..52c0d998 --- /dev/null +++ b/defs/api/plans/[plan]/PATCH/Payload.schema.json @@ -0,0 +1,59 @@ +{ + "type": "object", + "properties": { + "price": { + "type": "number", + "format": "double", + "minimum": 0.0, + "nullable": true + }, + "identifier": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "slug": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "display_name": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "color": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "is_user_selectable": { + "type": "boolean", + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/plans/by-slug/[slug]/GET/Output.schema.json b/defs/api/plans/by-slug/[slug]/GET/Output.schema.json new file mode 100644 index 00000000..50fbc535 --- /dev/null +++ b/defs/api/plans/by-slug/[slug]/GET/Output.schema.json @@ -0,0 +1,96 @@ +{ + "type": "object", + "required": [ + "plan" + ], + "properties": { + "plan": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/runtime/external-relay-updated/[station]/POST/Output.schema.json b/defs/api/runtime/external-relay-updated/[station]/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/runtime/external-relay-updated/[station]/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/runtime/restart-playlist/[station]/POST/Output.schema.json b/defs/api/runtime/restart-playlist/[station]/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/runtime/restart-playlist/[station]/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/runtime/source-password-updated/[station]/POST/Output.schema.json b/defs/api/runtime/source-password-updated/[station]/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/runtime/source-password-updated/[station]/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/runtime/station-deleted/[station]/POST/Output.schema.json b/defs/api/runtime/station-deleted/[station]/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/runtime/station-deleted/[station]/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/station-pictures/POST/Output.schema.json b/defs/api/station-pictures/POST/Output.schema.json new file mode 100644 index 00000000..652579ac --- /dev/null +++ b/defs/api/station-pictures/POST/Output.schema.json @@ -0,0 +1,68 @@ +{ + "type": "object", + "required": [ + "_id", + "account_id", + "created_at", + "png_sizes", + "src_content_type", + "src_filename", + "src_sha256", + "src_size", + "src_size_bytes", + "updated_at", + "version", + "webp_sizes" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "version": { + "type": "number", + "format": "double" + }, + "src_filename": { + "type": "string" + }, + "src_content_type": { + "type": "string" + }, + "src_size": { + "type": "number", + "format": "double" + }, + "src_size_bytes": { + "type": "number", + "format": "double" + }, + "src_sha256": { + "type": "string" + }, + "webp_sizes": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + }, + "png_sizes": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } +} \ No newline at end of file diff --git a/defs/api/station-pictures/POST/Query.schema.json b/defs/api/station-pictures/POST/Query.schema.json new file mode 100644 index 00000000..42958031 --- /dev/null +++ b/defs/api/station-pictures/POST/Query.schema.json @@ -0,0 +1,19 @@ +{ + "type": "object", + "required": [ + "account_id", + "content_type", + "filename" + ], + "properties": { + "account_id": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "content_type": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/GET/Output.schema.json b/defs/api/stations/GET/Output.schema.json new file mode 100644 index 00000000..638eb327 --- /dev/null +++ b/defs/api/stations/GET/Output.schema.json @@ -0,0 +1,1326 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/defs/api/stations/GET/Query.schema.json b/defs/api/stations/GET/Query.schema.json new file mode 100644 index 00000000..20146c01 --- /dev/null +++ b/defs/api/stations/GET/Query.schema.json @@ -0,0 +1,29 @@ +{ + "type": "object", + "properties": { + "account_id": { + "type": "string", + "nullable": true + }, + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/stations/POST/Output.schema.json b/defs/api/stations/POST/Output.schema.json new file mode 100644 index 00000000..2cbc016f --- /dev/null +++ b/defs/api/stations/POST/Output.schema.json @@ -0,0 +1,1306 @@ +{ + "type": "object", + "required": [ + "station" + ], + "properties": { + "station": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/stations/POST/Payload.schema.json b/defs/api/stations/POST/Payload.schema.json new file mode 100644 index 00000000..de8eca61 --- /dev/null +++ b/defs/api/stations/POST/Payload.schema.json @@ -0,0 +1,620 @@ +{ + "type": "object", + "required": [ + "account_id", + "country_code", + "lang_code", + "name", + "picture_id", + "type_of_content" + ], + "properties": { + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "title": "[serde(skip_serializing_if = \"Option::is_none\")]", + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "external_relay_url": { + "type": "string", + "maxLength": 200, + "pattern": "^https?://.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/stations/POST/PayloadLimits.schema.json b/defs/api/stations/POST/PayloadLimits.schema.json new file mode 100644 index 00000000..112b1f81 --- /dev/null +++ b/defs/api/stations/POST/PayloadLimits.schema.json @@ -0,0 +1,24 @@ +{ + "type": "object", + "properties": { + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/stations/[station]/DELETE/Output.schema.json b/defs/api/stations/[station]/DELETE/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/stations/[station]/DELETE/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/stations/[station]/GET/Output.schema.json b/defs/api/stations/[station]/GET/Output.schema.json new file mode 100644 index 00000000..2cbc016f --- /dev/null +++ b/defs/api/stations/[station]/GET/Output.schema.json @@ -0,0 +1,1306 @@ +{ + "type": "object", + "required": [ + "station" + ], + "properties": { + "station": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/PATCH/Output.schema.json b/defs/api/stations/[station]/PATCH/Output.schema.json new file mode 100644 index 00000000..f08ca2db --- /dev/null +++ b/defs/api/stations/[station]/PATCH/Output.schema.json @@ -0,0 +1,1298 @@ +{ + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/stations/[station]/PATCH/Payload.schema.json b/defs/api/stations/[station]/PATCH/Payload.schema.json new file mode 100644 index 00000000..ae91a89f --- /dev/null +++ b/defs/api/stations/[station]/PATCH/Payload.schema.json @@ -0,0 +1,618 @@ +{ + "type": "object", + "properties": { + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1, + "nullable": true + }, + "picture_id": { + "type": "string", + "nullable": true + }, + "slogan": { + "default": null, + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ], + "nullable": true + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ], + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "external_relay_url": { + "type": "string", + "maxLength": 200, + "pattern": "^https?://.+", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/GET/Output.schema.json b/defs/api/stations/[station]/files/GET/Output.schema.json new file mode 100644 index 00000000..1184c050 --- /dev/null +++ b/defs/api/stations/[station]/files/GET/Output.schema.json @@ -0,0 +1,148 @@ +{ + "type": "object", + "required": [ + "files", + "playlist_is_randomly_shuffled" + ], + "properties": { + "files": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0.0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/GET/Query.schema.json b/defs/api/stations/[station]/files/GET/Query.schema.json new file mode 100644 index 00000000..9c76aecb --- /dev/null +++ b/defs/api/stations/[station]/files/GET/Query.schema.json @@ -0,0 +1,16 @@ +{ + "type": "object", + "properties": { + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/POST/Output.schema.json b/defs/api/stations/[station]/files/POST/Output.schema.json new file mode 100644 index 00000000..7fa5efcb --- /dev/null +++ b/defs/api/stations/[station]/files/POST/Output.schema.json @@ -0,0 +1,116 @@ +{ + "type": "object", + "required": [ + "file" + ], + "properties": { + "file": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0.0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/POST/Query.schema.json b/defs/api/stations/[station]/files/POST/Query.schema.json new file mode 100644 index 00000000..c29ecd44 --- /dev/null +++ b/defs/api/stations/[station]/files/POST/Query.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "filename" + ], + "properties": { + "filename": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/DELETE/Output.schema.json b/defs/api/stations/[station]/files/[file]/DELETE/Output.schema.json new file mode 100644 index 00000000..f66d8354 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/DELETE/Output.schema.json @@ -0,0 +1,108 @@ +{ + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0.0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/GET/Output.schema.json b/defs/api/stations/[station]/files/[file]/GET/Output.schema.json new file mode 100644 index 00000000..ca456cf2 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/GET/Output.schema.json @@ -0,0 +1,116 @@ +{ + "type": "object", + "required": [ + "item" + ], + "properties": { + "item": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0.0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/metadata/PUT/Output.schema.json b/defs/api/stations/[station]/files/[file]/metadata/PUT/Output.schema.json new file mode 100644 index 00000000..ca456cf2 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/metadata/PUT/Output.schema.json @@ -0,0 +1,116 @@ +{ + "type": "object", + "required": [ + "item" + ], + "properties": { + "item": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0.0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/metadata/PUT/Payload.schema.json b/defs/api/stations/[station]/files/[file]/metadata/PUT/Payload.schema.json new file mode 100644 index 00000000..935c63ed --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/metadata/PUT/Payload.schema.json @@ -0,0 +1,40 @@ +{ + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0.0, + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/move-after/POST/Output.schema.json b/defs/api/stations/[station]/files/[file]/order/move-after/POST/Output.schema.json new file mode 100644 index 00000000..8730ffc1 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/move-after/POST/Output.schema.json @@ -0,0 +1,12 @@ +{ + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/move-after/POST/Payload.schema.json b/defs/api/stations/[station]/files/[file]/order/move-after/POST/Payload.schema.json new file mode 100644 index 00000000..24cd55c3 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/move-after/POST/Payload.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "anchor_file_id" + ], + "properties": { + "anchor_file_id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/move-before/POST/Output.schema.json b/defs/api/stations/[station]/files/[file]/order/move-before/POST/Output.schema.json new file mode 100644 index 00000000..8730ffc1 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/move-before/POST/Output.schema.json @@ -0,0 +1,12 @@ +{ + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/move-before/POST/Payload.schema.json b/defs/api/stations/[station]/files/[file]/order/move-before/POST/Payload.schema.json new file mode 100644 index 00000000..24cd55c3 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/move-before/POST/Payload.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "anchor_file_id" + ], + "properties": { + "anchor_file_id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/move-to-first/POST/Output.schema.json b/defs/api/stations/[station]/files/[file]/order/move-to-first/POST/Output.schema.json new file mode 100644 index 00000000..8730ffc1 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/move-to-first/POST/Output.schema.json @@ -0,0 +1,12 @@ +{ + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/move-to-last/POST/Output.schema.json b/defs/api/stations/[station]/files/[file]/order/move-to-last/POST/Output.schema.json new file mode 100644 index 00000000..8730ffc1 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/move-to-last/POST/Output.schema.json @@ -0,0 +1,12 @@ +{ + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/swap/POST/Output.schema.json b/defs/api/stations/[station]/files/[file]/order/swap/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/swap/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/[file]/order/swap/POST/Payload.schema.json b/defs/api/stations/[station]/files/[file]/order/swap/POST/Payload.schema.json new file mode 100644 index 00000000..24cd55c3 --- /dev/null +++ b/defs/api/stations/[station]/files/[file]/order/swap/POST/Payload.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "anchor_file_id" + ], + "properties": { + "anchor_file_id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/suffle/POST/Output.schema.json b/defs/api/stations/[station]/files/suffle/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/stations/[station]/files/suffle/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/stations/[station]/files/unsuffle/POST/Output.schema.json b/defs/api/stations/[station]/files/unsuffle/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/stations/[station]/files/unsuffle/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/stations/[station]/now-playing/GET/Output.schema.json b/defs/api/stations/[station]/now-playing/GET/Output.schema.json new file mode 100644 index 00000000..fafa6b22 --- /dev/null +++ b/defs/api/stations/[station]/now-playing/GET/Output.schema.json @@ -0,0 +1,100 @@ +{ + "oneOf": [ + { + "type": "object", + "required": [ + "kind", + "start_on_connect" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "none" + ] + }, + "start_on_connect": { + "type": "boolean" + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_error": { + "type": "string", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "live" + ] + }, + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "kind", + "url" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "external-relay" + ] + }, + "url": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "file_id", + "filename", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "playlist" + ] + }, + "file_id": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + } + } + } + ] +} \ No newline at end of file diff --git a/defs/api/stations/[station]/reset-source-password/POST/Output.schema.json b/defs/api/stations/[station]/reset-source-password/POST/Output.schema.json new file mode 100644 index 00000000..1576c77c --- /dev/null +++ b/defs/api/stations/[station]/reset-source-password/POST/Output.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "new_password" + ], + "properties": { + "new_password": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/restart-playlist/POST/Output.schema.json b/defs/api/stations/[station]/restart-playlist/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/stations/[station]/restart-playlist/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/stations/[station]/stream-stats/GET/Output.schema.json b/defs/api/stations/[station]/stream-stats/GET/Output.schema.json new file mode 100644 index 00000000..4ea31a68 --- /dev/null +++ b/defs/api/stations/[station]/stream-stats/GET/Output.schema.json @@ -0,0 +1,99 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "last_24h", + "last_30d", + "last_7d", + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_24h": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_7d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_30d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/stream-stats/last-[num][unit]/GET/Output.schema.json b/defs/api/stations/[station]/stream-stats/last-[num][unit]/GET/Output.schema.json new file mode 100644 index 00000000..c74bc97d --- /dev/null +++ b/defs/api/stations/[station]/stream-stats/last-[num][unit]/GET/Output.schema.json @@ -0,0 +1,28 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/stream-stats/last-[num][unit]/count/GET/Output.schema.json b/defs/api/stations/[station]/stream-stats/last-[num][unit]/count/GET/Output.schema.json new file mode 100644 index 00000000..ca4bb8c1 --- /dev/null +++ b/defs/api/stations/[station]/stream-stats/last-[num][unit]/count/GET/Output.schema.json @@ -0,0 +1,13 @@ +{ + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/stream-stats/now/GET/Output.schema.json b/defs/api/stations/[station]/stream-stats/now/GET/Output.schema.json new file mode 100644 index 00000000..c74bc97d --- /dev/null +++ b/defs/api/stations/[station]/stream-stats/now/GET/Output.schema.json @@ -0,0 +1,28 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/stream-stats/now/count/GET/Output.schema.json b/defs/api/stations/[station]/stream-stats/now/count/GET/Output.schema.json new file mode 100644 index 00000000..ca4bb8c1 --- /dev/null +++ b/defs/api/stations/[station]/stream-stats/now/count/GET/Output.schema.json @@ -0,0 +1,13 @@ +{ + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/transfer/POST/Output.schema.json b/defs/api/stations/[station]/transfer/POST/Output.schema.json new file mode 100644 index 00000000..2cbc016f --- /dev/null +++ b/defs/api/stations/[station]/transfer/POST/Output.schema.json @@ -0,0 +1,1306 @@ +{ + "type": "object", + "required": [ + "station" + ], + "properties": { + "station": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000.0, + "minimum": 0.0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/stations/[station]/transfer/POST/Payload.schema.json b/defs/api/stations/[station]/transfer/POST/Payload.schema.json new file mode 100644 index 00000000..3d13b79f --- /dev/null +++ b/defs/api/stations/[station]/transfer/POST/Payload.schema.json @@ -0,0 +1,11 @@ +{ + "type": "object", + "required": [ + "target_account_id" + ], + "properties": { + "target_account_id": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/api/stream-connections/GET/Output.schema.json b/defs/api/stream-connections/GET/Output.schema.json new file mode 100644 index 00000000..8e886e47 --- /dev/null +++ b/defs/api/stream-connections/GET/Output.schema.json @@ -0,0 +1,773 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "deployment_id", + "ip", + "is_open", + "last_transfer_at", + "request", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + }, + "transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0.0, + "nullable": true + }, + "is_open": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "ip": { + "type": "string", + "format": "ip" + }, + "is_external_relay_redirect": { + "default": false, + "type": "boolean" + }, + "request": { + "type": "object", + "required": [ + "headers", + "local_addr", + "method", + "real_ip", + "remote_addr", + "uri", + "user_agent", + "version" + ], + "properties": { + "real_ip": { + "type": "string", + "format": "ip" + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "local_addr": { + "type": "object", + "required": [ + "ip", + "port" + ], + "properties": { + "ip": { + "type": "string", + "format": "ip" + }, + "port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "remote_addr": { + "type": "object", + "required": [ + "ip", + "port" + ], + "properties": { + "ip": { + "type": "string", + "format": "ip" + }, + "port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0 + } + } + }, + "version": { + "type": "string", + "enum": [ + "0.9", + "1.0", + "1.1", + "2", + "3", + "other" + ] + }, + "method": { + "oneOf": [ + { + "type": "string", + "enum": [ + "HEAD", + "GET", + "PUT", + "PATCH", + "POST", + "DELETE", + "OPTIONS", + "CONNECT", + "SOURCE" + ] + }, + { + "type": "object", + "required": [ + "Other" + ], + "properties": { + "Other": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "uri": { + "type": "object", + "required": [ + "path", + "uri" + ], + "properties": { + "uri": { + "type": "string" + }, + "scheme": { + "type": "string", + "nullable": true + }, + "host": { + "type": "string", + "nullable": true + }, + "port": { + "type": "integer", + "format": "uint16", + "minimum": 0.0, + "nullable": true + }, + "path": { + "type": "string" + }, + "query": { + "type": "string", + "nullable": true + } + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "user_agent": { + "description": "UserAgent is an owned value it does allocate in favor of simplicity", + "type": "object", + "properties": { + "ua": { + "type": "string", + "nullable": true + }, + "category": { + "type": "string", + "nullable": true + }, + "browser_type": { + "type": "string", + "nullable": true + }, + "vendor": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "version": { + "type": "string", + "nullable": true + }, + "os": { + "type": "string", + "nullable": true + }, + "os_version": { + "type": "string", + "nullable": true + } + } + } + } + }, + "last_transfer_at": { + "type": "string", + "format": "date-time" + }, + "closed_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stream-connections/GET/Query.schema.json b/defs/api/stream-connections/GET/Query.schema.json new file mode 100644 index 00000000..0b760bc3 --- /dev/null +++ b/defs/api/stream-connections/GET/Query.schema.json @@ -0,0 +1,40 @@ +{ + "type": "object", + "properties": { + "show": { + "type": "string", + "enum": [ + "all", + "open", + "closed" + ], + "nullable": true + }, + "sort": { + "type": "string", + "enum": [ + "creation-asc", + "creation-desc" + ], + "nullable": true + }, + "stations": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + }, + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + } + } +} \ No newline at end of file diff --git a/defs/api/stream-connections/GET/ShowQuery.schema.json b/defs/api/stream-connections/GET/ShowQuery.schema.json new file mode 100644 index 00000000..ef6ec30a --- /dev/null +++ b/defs/api/stream-connections/GET/ShowQuery.schema.json @@ -0,0 +1,8 @@ +{ + "type": "string", + "enum": [ + "all", + "open", + "closed" + ] +} \ No newline at end of file diff --git a/defs/api/stream-connections/GET/SortQuery.schema.json b/defs/api/stream-connections/GET/SortQuery.schema.json new file mode 100644 index 00000000..7ada3fcc --- /dev/null +++ b/defs/api/stream-connections/GET/SortQuery.schema.json @@ -0,0 +1,7 @@ +{ + "type": "string", + "enum": [ + "creation-asc", + "creation-desc" + ] +} \ No newline at end of file diff --git a/defs/api/stream-stats/GET/Output.schema.json b/defs/api/stream-stats/GET/Output.schema.json new file mode 100644 index 00000000..4ea31a68 --- /dev/null +++ b/defs/api/stream-stats/GET/Output.schema.json @@ -0,0 +1,99 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "last_24h", + "last_30d", + "last_7d", + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_24h": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_7d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_30d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stream-stats/last-[num][unit]/GET/Output.schema.json b/defs/api/stream-stats/last-[num][unit]/GET/Output.schema.json new file mode 100644 index 00000000..c74bc97d --- /dev/null +++ b/defs/api/stream-stats/last-[num][unit]/GET/Output.schema.json @@ -0,0 +1,28 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stream-stats/last-[num][unit]/count/GET/Output.schema.json b/defs/api/stream-stats/last-[num][unit]/count/GET/Output.schema.json new file mode 100644 index 00000000..ca4bb8c1 --- /dev/null +++ b/defs/api/stream-stats/last-[num][unit]/count/GET/Output.schema.json @@ -0,0 +1,13 @@ +{ + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } +} \ No newline at end of file diff --git a/defs/api/stream-stats/now/GET/Output.schema.json b/defs/api/stream-stats/now/GET/Output.schema.json new file mode 100644 index 00000000..c74bc97d --- /dev/null +++ b/defs/api/stream-stats/now/GET/Output.schema.json @@ -0,0 +1,28 @@ +{ + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/stream-stats/now/count-by-station/GET/Output.schema.json b/defs/api/stream-stats/now/count-by-station/GET/Output.schema.json new file mode 100644 index 00000000..b36cc451 --- /dev/null +++ b/defs/api/stream-stats/now/count-by-station/GET/Output.schema.json @@ -0,0 +1,16 @@ +{ + "type": "object", + "required": [ + "by_station" + ], + "properties": { + "by_station": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "uint32", + "minimum": 0.0 + } + } + } +} \ No newline at end of file diff --git a/defs/api/stream-stats/now/count/GET/Output.schema.json b/defs/api/stream-stats/now/count/GET/Output.schema.json new file mode 100644 index 00000000..ca4bb8c1 --- /dev/null +++ b/defs/api/stream-stats/now/count/GET/Output.schema.json @@ -0,0 +1,13 @@ +{ + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0.0 + } + } +} \ No newline at end of file diff --git a/defs/api/users/GET/Output.schema.json b/defs/api/users/GET/Output.schema.json new file mode 100644 index 00000000..94b3eb69 --- /dev/null +++ b/defs/api/users/GET/Output.schema.json @@ -0,0 +1,139 @@ +{ + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } +} \ No newline at end of file diff --git a/defs/api/users/GET/Query.schema.json b/defs/api/users/GET/Query.schema.json new file mode 100644 index 00000000..705cf495 --- /dev/null +++ b/defs/api/users/GET/Query.schema.json @@ -0,0 +1,25 @@ +{ + "type": "object", + "properties": { + "skip": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0.0 + }, + "limit": { + "default": 60, + "type": "integer", + "format": "int64" + }, + "show": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } +} \ No newline at end of file diff --git a/defs/api/users/POST/Output.schema.json b/defs/api/users/POST/Output.schema.json new file mode 100644 index 00000000..bc9ceb82 --- /dev/null +++ b/defs/api/users/POST/Output.schema.json @@ -0,0 +1,119 @@ +{ + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/users/POST/Payload.schema.json b/defs/api/users/POST/Payload.schema.json new file mode 100644 index 00000000..434125cd --- /dev/null +++ b/defs/api/users/POST/Payload.schema.json @@ -0,0 +1,42 @@ +{ + "type": "object", + "required": [ + "email", + "first_name", + "last_name", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "password": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false +} \ No newline at end of file diff --git a/defs/api/users/[user]/DELETE/Output.schema.json b/defs/api/users/[user]/DELETE/Output.schema.json new file mode 100644 index 00000000..f1361af7 --- /dev/null +++ b/defs/api/users/[user]/DELETE/Output.schema.json @@ -0,0 +1,64 @@ +{ + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } +} \ No newline at end of file diff --git a/defs/api/users/[user]/GET/Output.schema.json b/defs/api/users/[user]/GET/Output.schema.json new file mode 100644 index 00000000..bc9ceb82 --- /dev/null +++ b/defs/api/users/[user]/GET/Output.schema.json @@ -0,0 +1,119 @@ +{ + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/users/[user]/PATCH/Output.schema.json b/defs/api/users/[user]/PATCH/Output.schema.json new file mode 100644 index 00000000..bc9ceb82 --- /dev/null +++ b/defs/api/users/[user]/PATCH/Output.schema.json @@ -0,0 +1,119 @@ +{ + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } +} \ No newline at end of file diff --git a/defs/api/users/[user]/PATCH/Payload.schema.json b/defs/api/users/[user]/PATCH/Payload.schema.json new file mode 100644 index 00000000..e9f57e10 --- /dev/null +++ b/defs/api/users/[user]/PATCH/Payload.schema.json @@ -0,0 +1,21 @@ +{ + "type": "object", + "properties": { + "first_name": { + "type": "string", + "nullable": true + }, + "last_name": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + } + } +} \ No newline at end of file diff --git a/defs/api/users/[user]/change-password/POST/Output.schema.json b/defs/api/users/[user]/change-password/POST/Output.schema.json new file mode 100644 index 00000000..e498ac42 --- /dev/null +++ b/defs/api/users/[user]/change-password/POST/Output.schema.json @@ -0,0 +1,3 @@ +{ + "type": "object" +} \ No newline at end of file diff --git a/defs/api/users/[user]/change-password/POST/Payload.schema.json b/defs/api/users/[user]/change-password/POST/Payload.schema.json new file mode 100644 index 00000000..93ea319a --- /dev/null +++ b/defs/api/users/[user]/change-password/POST/Payload.schema.json @@ -0,0 +1,15 @@ +{ + "type": "object", + "required": [ + "current_password", + "new_password" + ], + "properties": { + "current_password": { + "type": "string" + }, + "new_password": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/defs/app-analytics/Analytics.ts b/defs/app-analytics/Analytics.ts index 803063c1..8648b2de 100644 --- a/defs/app-analytics/Analytics.ts +++ b/defs/app-analytics/Analytics.ts @@ -5,6 +5,7 @@ import type { AnalyticsStation } from "./AnalyticsStation"; import type { AppKindVersion } from "./AppKindVersion"; import type { CountryCode } from "../CountryCode"; import type { DateTime } from "../DateTime"; +import type { TimezoneDateTime } from "../TimezoneDateTime"; import type { YearMonthDay } from "./YearMonthDay"; import type { YearMonthDayHour } from "./YearMonthDayHour"; @@ -12,8 +13,8 @@ export type Analytics = { is_now: boolean; kind: AnalyticsQueryKind; stations: Array; - since: /** time::DateTime */ string; - until: /** time::DateTime */ string; + since: TimezoneDateTime; + until: TimezoneDateTime; utc_offset_minutes: number; sessions: number; ips: number; diff --git a/defs/app-analytics/AnalyticsQueryKind.ts b/defs/app-analytics/AnalyticsQueryKind.ts index b93aeb78..b3492474 100644 --- a/defs/app-analytics/AnalyticsQueryKind.ts +++ b/defs/app-analytics/AnalyticsQueryKind.ts @@ -1,10 +1,6 @@ // This file was generated by [ts-rs](https://github.com/Aleph-Alpha/ts-rs). Do not edit this file manually. +import type { TimezoneDateTime } from "../TimezoneDateTime"; -export type AnalyticsQueryKind = { - now: { offset_date: /** time::DateTime */ string }; -} | { - time_range: { - since: /** time::DateTime */ string; - until: /** time::DateTime */ string; - }; +export type AnalyticsQueryKind = { now: { offset_date: TimezoneDateTime } } | { + time_range: { since: TimezoneDateTime; until: TimezoneDateTime }; }; diff --git a/git/hooks/pre-commit b/git/hooks/pre-commit index 45eeb861..06ee8ff4 100755 --- a/git/hooks/pre-commit +++ b/git/hooks/pre-commit @@ -43,6 +43,10 @@ await within(async () => { await $`git add defs` check(); + write("Creating openapi.json file..."); + await $`node openapi-generator.js` + check(); + await within(async () => { write(`Running front npm ci...`); cd("front"); diff --git a/openapi-generator.js b/openapi-generator.js new file mode 100644 index 00000000..29e9b9c7 --- /dev/null +++ b/openapi-generator.js @@ -0,0 +1,177 @@ +import { fileURLToPath } from "url"; +import path from "path"; +import fs from "fs"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); + +const basedir = `${__dirname}/defs/api`; + +const methods = ["GET", "POST", "PUT", "PATCH", "DELETE"]; + +const map_path = (dir) => { + return `/${dir.replaceAll("[", "{").replaceAll("]", "}")}`; +}; + +const get_path_params = (dir) => { + return [...dir.matchAll(/\{(.+?)\}/g)]; +} + +const securitySchemes = { + "API Key": { + type: "apiKey", + in: "header", + name: "x-access-token", + } +} + +const security = [ + { "API Key": [] } +] + +const paths = {}; + +const process_dir = (target) => { + const full_target = `${basedir}${target == null ? "" : `/${target}`}`; + const filenames = fs.readdirSync(full_target).sort(); + + for (const name of filenames) { + if (methods.includes(name)) { + const method = name; + const path = map_path(target); + + const output_path = `${full_target}/${name}/Output.schema.json`; + const output = JSON.parse(fs.readFileSync(output_path)); + + const payload_path = `${full_target}/${name}/Payload.schema.json`; + let payload = null; + if (fs.existsSync(payload_path)) payload = JSON.parse(fs.readFileSync(payload_path)); + + const query_path = `${full_target}/${name}/Query.schema.json`; + const query_params = []; + if(fs.existsSync(query_path)) { + const schema = JSON.parse(fs.readFileSync(query_path)); + for(const key in schema.properties) { + query_params.push({ + name: key, + in: "query", + required: !!schema.required?.includes(key), + style: "deepObject", + explode: true, + allowReserved: true, + schema: schema.properties[key], + }) + } + } + + const path_params = get_path_params(path).map(name => { + return { + name: name[1], + in: "path", + required: true, + schema: { + type: "string", + } + } + }); + + paths[path] ??= {}; + + paths[path][method.toLowerCase()] = { + + parameters: [ + ...path_params, + ...query_params, + ], + + requestBody: + payload == null + ? undefined + : { + required: true, + content: { + "application/json": { + schema: payload, + }, + }, + }, + + responses: { + 200: { + content: { + "application/json": { + schema: output, + }, + }, + }, + }, + }; + } + + for (const name of filenames) { + if (methods.includes(name)) continue; + if (fs.statSync(`${full_target}/${name}`).isDirectory()) { + process_dir(`${target == null ? "" : `${target}/`}${name}`); + } + } + } +}; + +process_dir(null) + + // TODO: don't hardcode this + paths["/station-pictures"].post.requestBody = { + required: true, + content: { + "image/png": { + schema: { + type: "string", + format: "binary", + } + }, + "image/jpeg": { + schema: { + type: "string", + format: "binary", + } + }, + "image/webp": { + schema: { + type: "string", + format: "binary", + } + } + } + }; + +const document = { + + openapi: "3.0.0", + + info: { + title: "Openstream Media Server API", + + termsOfService: "https://openstream.fm/api-terms/", + + license: { + name: "Apache 2.0", + url: "https://www.apache.org/licenses/LICENSE-2.0.html" + }, + + version: "0.1.0", + }, + + servers: [{ + url: "https://api.openstream.fm", + description: "Openstream production servers", + }], + + security, + + paths, + + components: { + securitySchemes, + } +} + +fs.writeFileSync(`${__dirname}/openapi.json`, JSON.stringify(document, null, 2)); \ No newline at end of file diff --git a/openapi.json b/openapi.json new file mode 100644 index 00000000..dd8a2265 --- /dev/null +++ b/openapi.json @@ -0,0 +1,21168 @@ +{ + "openapi": "3.0.0", + "info": { + "title": "Openstream Media Server API", + "termsOfService": "https://openstream.fm/api-terms/", + "license": { + "name": "Apache 2.0", + "url": "https://www.apache.org/licenses/LICENSE-2.0.html" + }, + "version": "0.1.0" + }, + "servers": [ + { + "url": "https://api.openstream.fm", + "description": "Openstream production servers" + } + ], + "security": [ + { + "API Key": [] + } + ], + "paths": { + "/accounts": { + "get": { + "parameters": [ + { + "name": "user_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "name", + "payment_method_id", + "plan_id" + ], + "properties": { + "name": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "user_id": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "payment_method_id": { + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "account" + ], + "properties": { + "account": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "/accounts/{account}": { + "delete": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "account", + "is_owner" + ], + "properties": { + "is_owner": { + "type": "boolean" + }, + "account": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1, + "nullable": true + }, + "plan_id": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + }, + "/accounts/{account}/members": { + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "members" + ], + "properties": { + "members": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name", + "relation" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "relation": { + "type": "string", + "enum": [ + "owner", + "staff" + ] + } + } + } + } + } + } + } + } + } + } + } + }, + "/accounts/{account}/members/{member}": { + "delete": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "member", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/accounts/{account}/members/{member}/set-role": { + "post": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "member", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "role" + ], + "properties": { + "role": { + "type": "string", + "enum": [ + "owner", + "staff" + ] + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/accounts/{account}/stream-stats": { + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "last_24h", + "last_30d", + "last_7d", + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_24h": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_7d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_30d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/accounts/{account}/stream-stats/last-{num}{unit}": { + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "num", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "unit", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + }, + "/accounts/{account}/stream-stats/last-{num}{unit}/count": { + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "num", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "unit", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + } + } + } + } + } + } + }, + "/accounts/{account}/stream-stats/now": { + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + }, + "/accounts/{account}/stream-stats/now/count": { + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + } + } + } + } + } + } + }, + "/accounts/{account}/stream-stats/now/count-by-station": { + "get": { + "parameters": [ + { + "name": "account", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "by_station" + ], + "properties": { + "by_station": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + } + } + } + } + } + } + } + } + }, + "/admins": { + "get": { + "parameters": [ + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "first_name", + "last_name", + "password" + ], + "properties": { + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "admin" + ], + "properties": { + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "/admins/{admin}": { + "get": { + "parameters": [ + { + "name": "admin", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "admin" + ], + "properties": { + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "admin", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "first_name": { + "type": "string", + "nullable": true + }, + "last_name": { + "type": "string", + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + }, + "/admins/{admin}/change-password": { + "post": { + "parameters": [ + { + "name": "admin", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "current_password", + "new_password" + ], + "properties": { + "current_password": { + "type": "string" + }, + "new_password": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/analytics": { + "get": { + "parameters": [ + { + "name": "kind", + "in": "query", + "required": true, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + } + }, + { + "name": "stations", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "description": "ommiting this value means all available stations for the current access scope (this is valid only for admin and global access token scopes)", + "default": [], + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "browser", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": null, + "type": "string", + "nullable": true + } + }, + { + "name": "os", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": null, + "type": "string", + "nullable": true + } + }, + { + "name": "domain", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": null, + "type": "string", + "nullable": true + } + }, + { + "name": "country_code", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": null, + "anyOf": [ + { + "type": "string", + "enum": [ + "ZZ" + ] + }, + { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + } + ], + "nullable": true + } + }, + { + "name": "min_duration_ms", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "analytics" + ], + "properties": { + "analytics": { + "type": "object", + "required": [ + "by_browser", + "by_country", + "by_day", + "by_domain", + "by_os", + "by_station", + "ips", + "is_now", + "kind", + "max_concurrent_listeners", + "sessions", + "since", + "stations", + "total_duration_ms", + "total_transfer_bytes", + "until", + "utc_offset_minutes" + ], + "properties": { + "is_now": { + "type": "boolean" + }, + "kind": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "stations": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + }, + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + }, + "utc_offset_minutes": { + "type": "integer", + "format": "int16" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "by_day": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_hour": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "hour", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0 + }, + "hour": { + "type": "integer", + "format": "uint8", + "minimum": 0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "nullable": true + }, + "by_browser": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_os": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_country": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_station": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_domain": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/app-analytics": { + "get": { + "parameters": [ + { + "name": "kind", + "in": "query", + "required": true, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + } + }, + { + "name": "stations", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "description": "ommiting this value means all available stations for the current access scope (this is valid only for admin and global access token scopes)", + "default": [], + "type": "array", + "items": { + "type": "string" + } + } + }, + { + "name": "app_kind", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": null, + "type": "string", + "nullable": true + } + }, + { + "name": "app_version", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": null, + "type": "string", + "nullable": true + } + }, + { + "name": "country_code", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": null, + "anyOf": [ + { + "type": "string", + "enum": [ + "ZZ" + ] + }, + { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + } + ], + "nullable": true + } + }, + { + "name": "min_duration_ms", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "analytics" + ], + "properties": { + "analytics": { + "type": "object", + "required": [ + "by_app_kind", + "by_app_version", + "by_country", + "by_day", + "by_station", + "ips", + "is_now", + "kind", + "max_concurrent_listeners", + "sessions", + "since", + "stations", + "total_duration_ms", + "until", + "utc_offset_minutes" + ], + "properties": { + "is_now": { + "type": "boolean" + }, + "kind": { + "oneOf": [ + { + "type": "object", + "required": [ + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "offset_date" + ], + "properties": { + "offset_date": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + }, + { + "type": "object", + "required": [ + "time_range" + ], + "properties": { + "time_range": { + "type": "object", + "required": [ + "since", + "until" + ], + "properties": { + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + } + } + } + }, + "additionalProperties": false + } + ] + }, + "stations": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + }, + "since": { + "type": "string", + "format": "date-time" + }, + "until": { + "type": "string", + "format": "date-time" + }, + "utc_offset_minutes": { + "type": "integer", + "format": "int16" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "by_day": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_hour": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "required": [ + "day", + "hour", + "month", + "year" + ], + "properties": { + "year": { + "type": "integer", + "format": "uint16", + "minimum": 0 + }, + "month": { + "type": "integer", + "format": "uint8", + "minimum": 0 + }, + "day": { + "type": "integer", + "format": "uint8", + "minimum": 0 + }, + "hour": { + "type": "integer", + "format": "uint8", + "minimum": 0 + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "nullable": true + }, + "by_country": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_station": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string" + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_app_kind": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "string", + "nullable": true + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + }, + "by_app_version": { + "type": "array", + "items": { + "type": "object", + "required": [ + "ips", + "key", + "max_concurrent_listeners", + "sessions", + "total_duration_ms", + "total_transfer_bytes" + ], + "properties": { + "key": { + "type": "object", + "properties": { + "kind": { + "type": "string", + "nullable": true + }, + "version": { + "type": "integer", + "format": "uint32", + "minimum": 0, + "nullable": true + } + } + }, + "sessions": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "ips": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total_transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "max_concurrent_listeners_date": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/auth/admin/delegate/{user}": { + "post": { + "parameters": [ + { + "name": "user", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "title" + ], + "properties": { + "title": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "media_key", + "token", + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/auth/admin/login": { + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "device_id", + "email", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "device_id": { + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "admin", + "media_key", + "token" + ], + "properties": { + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/auth/admin/logout": { + "post": { + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/auth/email-verification/send-code": { + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "email": { + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/auth/user/email-exists/{email}": { + "get": { + "parameters": [ + { + "name": "email", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "exists" + ], + "properties": { + "exists": { + "type": "boolean" + } + } + } + } + } + } + } + } + }, + "/auth/user/login": { + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "device_id", + "email", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "device_id": { + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "media_key", + "token", + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/auth/user/logout": { + "post": { + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/auth/user/recover": { + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email" + ], + "properties": { + "email": { + "type": "string" + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/auth/user/recovery-token/{token}": { + "get": { + "parameters": [ + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "already_used", + "expired", + "kind", + "user_email", + "user_first_name", + "user_id", + "user_last_name" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "found" + ] + }, + "user_id": { + "type": "string" + }, + "user_first_name": { + "type": "string" + }, + "user_last_name": { + "type": "string" + }, + "user_email": { + "type": "string" + }, + "already_used": { + "type": "boolean" + }, + "expired": { + "type": "boolean" + } + } + }, + { + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "not_found" + ] + } + } + } + ] + } + } + } + } + } + } + }, + "/auth/user/recovery-token/{token}/set-password": { + "post": { + "parameters": [ + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "new_password" + ], + "properties": { + "new_password": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "user_email", + "user_id" + ], + "properties": { + "user_id": { + "type": "string" + }, + "user_email": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/auth/user/register": { + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "account_name", + "device_id", + "email", + "email_verification_code", + "first_name", + "last_name", + "password", + "payment_method_nonce", + "plan_id" + ], + "properties": { + "plan_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "password": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "account_name": { + "type": "string" + }, + "user_user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "user_system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "account_user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "account_system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "email_verification_code": { + "type": "string" + }, + "device_id": { + "type": "string" + }, + "payment_method_nonce": { + "type": "string" + }, + "payment_device_data": { + "type": "string", + "nullable": true + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "account", + "media_key", + "token", + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + }, + "account": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "limits", + "name", + "plan_id", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "plan_id": { + "type": "string" + }, + "payment_method_id": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "listeners": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "transfer": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "storage": { + "type": "object", + "required": [ + "total", + "used" + ], + "properties": { + "used": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/invitations": { + "get": { + "parameters": [ + { + "name": "user_sender_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "admin_sender_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "receiver_email", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "account_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "account_id", + "email" + ], + "properties": { + "account_id": { + "type": "string" + }, + "email": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "invitation" + ], + "properties": { + "invitation": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "/invitations/{invitation}": { + "delete": { + "parameters": [ + { + "name": "invitation", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "invitation", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "invitation" + ], + "properties": { + "invitation": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "/invitations/accept": { + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "first_name", + "last_name", + "password", + "token" + ], + "properties": { + "token": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "password": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "invitation_id" + ], + "properties": { + "invitation_id": { + "type": "string" + } + } + } + ] + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "ok" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "not-found" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "expired" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-accepted" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-rejected" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-in-account" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "account-deleted" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "account-not-found" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "email-exists" + ] + } + } + } + ] + } + } + } + } + } + } + }, + "/invitations/get-by-token/{token}": { + "get": { + "parameters": [ + { + "name": "token", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "invitation", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "ok" + ] + }, + "invitation": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "state" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "pending" + ] + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "accepted" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + }, + { + "type": "object", + "required": [ + "state", + "used_at" + ], + "properties": { + "state": { + "type": "string", + "enum": [ + "rejected" + ] + }, + "used_at": { + "type": "string", + "format": "date-time" + } + } + } + ], + "required": [ + "account_id", + "created_at", + "expires_at", + "id", + "is_expired", + "receiver_email" + ], + "properties": { + "id": { + "type": "string" + }, + "user_sender_id": { + "type": "string", + "nullable": true + }, + "admin_sender_id": { + "type": "string", + "nullable": true + }, + "account_id": { + "type": "string" + }, + "receiver_email": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "is_expired": { + "type": "boolean" + }, + "expires_at": { + "type": "string", + "format": "date-time" + }, + "account": { + "type": "object", + "required": [ + "_id", + "name" + ], + "properties": { + "_id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "nullable": true + }, + "user_sender": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "nullable": true + }, + "admin_sender": { + "type": "object", + "required": [ + "_id", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + }, + "receiver": { + "type": "object", + "required": [ + "_id", + "email", + "first_name", + "last_name" + ], + "properties": { + "_id": { + "type": "string" + }, + "email": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + } + }, + "nullable": true + } + } + } + } + }, + { + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "not-found" + ] + } + } + } + ] + } + } + } + } + } + } + }, + "/invitations/reject": { + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "token" + ], + "properties": { + "token": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "invitation_id" + ], + "properties": { + "invitation_id": { + "type": "string" + } + } + } + ] + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "ok" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "not-found" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "expired" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-accepted" + ] + } + } + }, + { + "type": "object", + "required": [ + "result" + ], + "properties": { + "result": { + "type": "string", + "enum": [ + "already-rejected" + ] + } + } + } + ] + } + } + } + } + } + } + }, + "/me": { + "get": { + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "global" + ] + } + } + }, + { + "type": "object", + "required": [ + "admin", + "scope" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "admin" + ] + }, + "admin": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + }, + { + "type": "object", + "required": [ + "scope", + "user" + ], + "properties": { + "scope": { + "type": "string", + "enum": [ + "user" + ] + }, + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + ] + } + } + } + } + } + } + }, + "/me/api-keys": { + "get": { + "parameters": [ + { + "name": "user_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "admin_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "is_current", + "title" + ], + "properties": { + "_id": { + "type": "string" + }, + "is_current": { + "type": "boolean" + }, + "title": { + "type": "string" + }, + "user_id": { + "type": "string", + "nullable": true + }, + "admin_id": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "last_used_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "password", + "title" + ], + "properties": { + "title": { + "type": "string" + }, + "password": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "api_key", + "media_key", + "token" + ], + "properties": { + "api_key": { + "type": "object", + "required": [ + "_id", + "created_at", + "is_current", + "title" + ], + "properties": { + "_id": { + "type": "string" + }, + "is_current": { + "type": "boolean" + }, + "title": { + "type": "string" + }, + "user_id": { + "type": "string", + "nullable": true + }, + "admin_id": { + "type": "string", + "nullable": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "last_used_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + "token": { + "type": "string" + }, + "media_key": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/me/api-keys/{id}": { + "delete": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "id", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/me/devices": { + "get": { + "parameters": [ + { + "name": "user_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "admin_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "ip", + "is_current", + "ua" + ], + "properties": { + "_id": { + "type": "string" + }, + "is_current": { + "type": "boolean" + }, + "ip": { + "type": "string", + "format": "ip" + }, + "ua": { + "description": "UserAgent is an owned value it does allocate in favor of simplicity", + "type": "object", + "properties": { + "ua": { + "type": "string", + "nullable": true + }, + "category": { + "type": "string", + "nullable": true + }, + "browser_type": { + "type": "string", + "nullable": true + }, + "vendor": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "version": { + "type": "string", + "nullable": true + }, + "os": { + "type": "string", + "nullable": true + }, + "os_version": { + "type": "string", + "nullable": true + } + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "last_used_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "user_id": { + "type": "string", + "nullable": true + }, + "admin_id": { + "type": "string", + "nullable": true + } + } + } + } + } + } + } + } + } + } + } + }, + "/me/devices/{device}": { + "delete": { + "parameters": [ + { + "name": "device", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/payment-methods": { + "get": { + "parameters": [ + { + "name": "user_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "card_type", + "kind", + "last_4" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "card" + ] + }, + "card_type": { + "type": "string" + }, + "last_4": { + "type": "string" + }, + "expiration_year": { + "type": "string", + "nullable": true + }, + "expiration_month": { + "type": "string", + "nullable": true + } + } + } + ], + "required": [ + "_id", + "created_at", + "updated_at", + "user_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "device_data", + "nonce" + ], + "properties": { + "user_id": { + "type": "string", + "nullable": true + }, + "nonce": { + "type": "string" + }, + "device_data": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "payment_method" + ], + "properties": { + "payment_method": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "card_type", + "kind", + "last_4" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "card" + ] + }, + "card_type": { + "type": "string" + }, + "last_4": { + "type": "string" + }, + "expiration_year": { + "type": "string", + "nullable": true + }, + "expiration_month": { + "type": "string", + "nullable": true + } + } + } + ], + "required": [ + "_id", + "created_at", + "updated_at", + "user_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "/payment-methods/{payment-method}": { + "get": { + "parameters": [ + { + "name": "payment-method", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "payment_method" + ], + "properties": { + "payment_method": { + "type": "object", + "oneOf": [ + { + "type": "object", + "required": [ + "card_type", + "kind", + "last_4" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "card" + ] + }, + "card_type": { + "type": "string" + }, + "last_4": { + "type": "string" + }, + "expiration_year": { + "type": "string", + "nullable": true + }, + "expiration_month": { + "type": "string", + "nullable": true + } + } + } + ], + "required": [ + "_id", + "created_at", + "updated_at", + "user_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "user_id": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "/plans": { + "get": { + "parameters": [ + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "color", + "display_name", + "identifier", + "is_user_selectable", + "listeners", + "price", + "slug", + "stations", + "storage", + "transfer" + ], + "properties": { + "identifier": { + "type": "string", + "minLength": 1 + }, + "slug": { + "type": "string", + "minLength": 1 + }, + "display_name": { + "type": "string", + "minLength": 1 + }, + "is_user_selectable": { + "type": "boolean" + }, + "price": { + "type": "number", + "format": "double", + "minimum": 0 + }, + "color": { + "type": "string", + "minLength": 1 + }, + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + }, + "/plans/{plan}": { + "delete": { + "parameters": [ + { + "name": "plan", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "plan" + ], + "properties": { + "plan": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "plan", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "plan" + ], + "properties": { + "plan": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "plan", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "price": { + "type": "number", + "format": "double", + "minimum": 0, + "nullable": true + }, + "identifier": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "slug": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "display_name": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "color": { + "type": "string", + "minLength": 1, + "nullable": true + }, + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "is_user_selectable": { + "type": "boolean", + "nullable": true + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + }, + "/plans/by-slug/{slug}": { + "get": { + "parameters": [ + { + "name": "slug", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "plan" + ], + "properties": { + "plan": { + "type": "object", + "required": [ + "_id", + "color", + "created_at", + "display_name", + "identifier", + "is_user_selectable", + "limits", + "order", + "price", + "slug", + "updated_at" + ], + "properties": { + "_id": { + "type": "string" + }, + "identifier": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "display_name": { + "type": "string" + }, + "price": { + "type": "number", + "format": "double" + }, + "limits": { + "type": "object", + "required": [ + "listeners", + "stations", + "storage", + "transfer" + ], + "properties": { + "stations": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "listeners": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "transfer": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "storage": { + "type": "integer", + "format": "uint64", + "minimum": 0 + } + } + }, + "color": { + "type": "string" + }, + "order": { + "type": "number", + "format": "double" + }, + "is_user_selectable": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + }, + "/runtime/external-relay-updated/{station}": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/runtime/restart-playlist/{station}": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/runtime/source-password-updated/{station}": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/runtime/station-deleted/{station}": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/station-pictures": { + "post": { + "parameters": [ + { + "name": "account_id", + "in": "query", + "required": true, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string" + } + }, + { + "name": "filename", + "in": "query", + "required": true, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string" + } + }, + { + "name": "content_type", + "in": "query", + "required": true, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "image/png": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "image/jpeg": { + "schema": { + "type": "string", + "format": "binary" + } + }, + "image/webp": { + "schema": { + "type": "string", + "format": "binary" + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "_id", + "account_id", + "created_at", + "png_sizes", + "src_content_type", + "src_filename", + "src_sha256", + "src_size", + "src_size_bytes", + "updated_at", + "version", + "webp_sizes" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "version": { + "type": "number", + "format": "double" + }, + "src_filename": { + "type": "string" + }, + "src_content_type": { + "type": "string" + }, + "src_size": { + "type": "number", + "format": "double" + }, + "src_size_bytes": { + "type": "number", + "format": "double" + }, + "src_sha256": { + "type": "string" + }, + "webp_sizes": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + }, + "png_sizes": { + "type": "array", + "items": { + "type": "number", + "format": "double" + } + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + } + } + } + }, + "/stations": { + "get": { + "parameters": [ + { + "name": "account_id", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "nullable": true + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "account_id", + "country_code", + "lang_code", + "name", + "picture_id", + "type_of_content" + ], + "properties": { + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "title": "[serde(skip_serializing_if = \"Option::is_none\")]", + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "external_relay_url": { + "type": "string", + "maxLength": 200, + "pattern": "^https?://.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "station" + ], + "properties": { + "station": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "/stations/{station}": { + "delete": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "station" + ], + "properties": { + "station": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1, + "nullable": true + }, + "picture_id": { + "type": "string", + "nullable": true + }, + "slogan": { + "default": null, + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ], + "nullable": true + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ], + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "external_relay_url": { + "type": "string", + "maxLength": 200, + "pattern": "^https?://.+", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + }, + "/stations/{station}/files": { + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "files", + "playlist_is_randomly_shuffled" + ], + "properties": { + "files": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + } + } + } + } + } + } + } + }, + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "filename", + "in": "query", + "required": true, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "file" + ], + "properties": { + "file": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + } + } + } + } + } + }, + "/stations/{station}/files/{file}": { + "delete": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "item" + ], + "properties": { + "item": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + } + } + } + } + } + }, + "/stations/{station}/files/{file}/metadata": { + "put": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0, + "nullable": true + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "item" + ], + "properties": { + "item": { + "type": "object", + "required": [ + "_id", + "bytes_sec", + "chunk_count", + "chunk_duration_ms", + "chunk_len", + "created_at", + "duration_ms", + "filename", + "len", + "metadata", + "order", + "sha256", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "sha256": { + "type": "string" + }, + "len": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "duration_ms": { + "type": "number", + "format": "double" + }, + "bytes_sec": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_count": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_len": { + "type": "integer", + "format": "uint", + "minimum": 0 + }, + "chunk_duration_ms": { + "type": "number", + "format": "double" + }, + "filename": { + "type": "string" + }, + "metadata": { + "type": "object", + "properties": { + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + }, + "album": { + "type": "string", + "nullable": true + }, + "album_artist": { + "type": "string", + "nullable": true + }, + "genre": { + "type": "string", + "nullable": true + }, + "year": { + "type": "integer", + "format": "int32", + "nullable": true + }, + "comment": { + "type": "string", + "nullable": true + }, + "track": { + "type": "integer", + "format": "uint16", + "minimum": 0, + "nullable": true + } + } + }, + "order": { + "type": "number", + "format": "double" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + } + } + } + } + } + } + } + } + } + }, + "/stations/{station}/files/{file}/order/move-after": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "anchor_file_id" + ], + "properties": { + "anchor_file_id": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + }, + "/stations/{station}/files/{file}/order/move-before": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "anchor_file_id" + ], + "properties": { + "anchor_file_id": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + }, + "/stations/{station}/files/{file}/order/move-to-first": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + }, + "/stations/{station}/files/{file}/order/move-to-last": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "order" + ], + "properties": { + "order": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + }, + "/stations/{station}/files/{file}/order/swap": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "file", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "anchor_file_id" + ], + "properties": { + "anchor_file_id": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/stations/{station}/files/suffle": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/stations/{station}/files/unsuffle": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/stations/{station}/now-playing": { + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "type": "object", + "required": [ + "kind", + "start_on_connect" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "none" + ] + }, + "start_on_connect": { + "type": "boolean" + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_error": { + "type": "string", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "live" + ] + }, + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "kind", + "url" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "external-relay" + ] + }, + "url": { + "type": "string" + } + } + }, + { + "type": "object", + "required": [ + "file_id", + "filename", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "playlist" + ] + }, + "file_id": { + "type": "string" + }, + "filename": { + "type": "string" + }, + "title": { + "type": "string", + "nullable": true + }, + "artist": { + "type": "string", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + }, + "/stations/{station}/reset-source-password": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "new_password" + ], + "properties": { + "new_password": { + "type": "string" + } + } + } + } + } + } + } + } + }, + "/stations/{station}/restart-playlist": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + }, + "/stations/{station}/stream-stats": { + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "last_24h", + "last_30d", + "last_7d", + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_24h": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_7d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_30d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/stations/{station}/stream-stats/last-{num}{unit}": { + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "num", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "unit", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + }, + "/stations/{station}/stream-stats/last-{num}{unit}/count": { + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "num", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "unit", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + } + } + } + } + } + } + }, + "/stations/{station}/stream-stats/now": { + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + }, + "/stations/{station}/stream-stats/now/count": { + "get": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + } + } + } + } + } + } + }, + "/stations/{station}/transfer": { + "post": { + "parameters": [ + { + "name": "station", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "target_account_id" + ], + "properties": { + "target_account_id": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "station" + ], + "properties": { + "station": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "system_metadata", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string", + "maxLength": 60, + "minLength": 1 + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "maxLength": 100, + "minLength": 1, + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "description": { + "type": "string", + "maxLength": 4000, + "minLength": 1, + "nullable": true + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "maxLength": 100, + "nullable": true + }, + "phone": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "whatsapp": { + "type": "string", + "maxLength": 60, + "nullable": true + }, + "website_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https?://.+", + "nullable": true + }, + "twitter_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://twitter\\.com/.+", + "nullable": true + }, + "facebook_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.facebook\\.com/.+", + "nullable": true + }, + "instagram_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.instagram\\.com/.+", + "nullable": true + }, + "threads_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.threads\\.net/.+", + "nullable": true + }, + "youtube_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.youtube\\.com/.+", + "nullable": true + }, + "twitch_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.twitch\\.tv/.+", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://www\\.tiktok\\.com/.+", + "nullable": true + }, + "spotify_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://open\\.spotify\\.com/.+", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://radiocut\\.fm/.+", + "nullable": true + }, + "google_play_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://play\\.google\\.com/.+", + "nullable": true + }, + "app_store_url": { + "type": "string", + "maxLength": 150, + "pattern": "^https://apps\\.apple\\.com/.+", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "owner_deployment_info": { + "type": "object", + "required": [ + "content_type", + "deployment_id", + "task_id" + ], + "properties": { + "deployment_id": { + "type": "string" + }, + "task_id": { + "type": "string" + }, + "content_type": { + "type": "string" + }, + "health_checked_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + }, + "nullable": true + }, + "last_external_relay_probe_started_at": { + "type": "string", + "format": "date-time", + "nullable": true + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "account_id", + "country_code", + "created_at", + "external_relay_redirect", + "lang_code", + "name", + "picture_id", + "playlist_is_randomly_shuffled", + "slug", + "source_password", + "type_of_content", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "account_id": { + "type": "string" + }, + "picture_id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "slug": { + "type": "string" + }, + "slogan": { + "type": "string", + "nullable": true + }, + "description": { + "type": "string", + "nullable": true + }, + "type_of_content": { + "type": "string", + "enum": [ + "comedy", + "educational", + "general", + "music", + "news", + "religious", + "sports", + "talk" + ] + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ] + }, + "lang_code": { + "type": "string", + "enum": [ + "aa", + "ab", + "ae", + "af", + "ak", + "am", + "an", + "ar", + "as", + "av", + "ay", + "az", + "ba", + "be", + "bg", + "bi", + "bm", + "bn", + "bo", + "br", + "bs", + "ca", + "ce", + "ch", + "co", + "cr", + "cs", + "cu", + "cv", + "cy", + "da", + "de", + "dv", + "dz", + "ee", + "el", + "en", + "eo", + "es", + "et", + "eu", + "fa", + "ff", + "fi", + "fj", + "fo", + "fr", + "fy", + "ga", + "gd", + "gl", + "gn", + "gu", + "gv", + "ha", + "he", + "hi", + "ho", + "hr", + "ht", + "hu", + "hy", + "hz", + "ia", + "id", + "ie", + "ig", + "ii", + "ik", + "io", + "is", + "it", + "iu", + "ja", + "jv", + "ka", + "kg", + "ki", + "kj", + "kk", + "kl", + "km", + "kn", + "ko", + "kr", + "ks", + "ku", + "kv", + "kw", + "ky", + "la", + "lb", + "lg", + "li", + "ln", + "lo", + "lt", + "lu", + "lv", + "mg", + "mh", + "mi", + "mk", + "ml", + "mn", + "mr", + "ms", + "mt", + "my", + "na", + "nb", + "nd", + "ne", + "ng", + "nl", + "nn", + "no", + "nr", + "nv", + "ny", + "oc", + "oj", + "om", + "or", + "os", + "pa", + "pi", + "pl", + "ps", + "pt", + "qu", + "rm", + "rn", + "ro", + "ru", + "rw", + "sa", + "sc", + "sd", + "se", + "sg", + "si", + "sk", + "sl", + "sm", + "sn", + "so", + "sq", + "sr", + "ss", + "st", + "su", + "sv", + "sw", + "ta", + "te", + "tg", + "th", + "ti", + "tk", + "tl", + "tn", + "to", + "tr", + "ts", + "tt", + "tw", + "ty", + "ug", + "uk", + "ur", + "uz", + "ve", + "vi", + "vo", + "wa", + "wo", + "xh", + "yi", + "yo", + "za", + "zh", + "zu" + ] + }, + "frequency": { + "type": "object", + "required": [ + "freq", + "kind" + ], + "properties": { + "kind": { + "type": "string", + "enum": [ + "am", + "fm" + ] + }, + "freq": { + "type": "number", + "format": "double", + "maximum": 100000, + "minimum": 0 + } + }, + "nullable": true + }, + "email": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "whatsapp": { + "type": "string", + "nullable": true + }, + "website_url": { + "type": "string", + "nullable": true + }, + "twitter_url": { + "type": "string", + "nullable": true + }, + "facebook_url": { + "type": "string", + "nullable": true + }, + "instagram_url": { + "type": "string", + "nullable": true + }, + "threads_url": { + "type": "string", + "nullable": true + }, + "twitch_url": { + "type": "string", + "nullable": true + }, + "tiktok_url": { + "type": "string", + "nullable": true + }, + "youtube_url": { + "type": "string", + "nullable": true + }, + "spotify_url": { + "type": "string", + "nullable": true + }, + "radiocut_url": { + "type": "string", + "nullable": true + }, + "app_store_url": { + "type": "string", + "nullable": true + }, + "google_play_url": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "external_relay_url": { + "type": "string", + "nullable": true + }, + "external_relay_redirect": { + "type": "boolean" + }, + "playlist_is_randomly_shuffled": { + "type": "boolean" + }, + "source_password": { + "type": "string" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "/stream-connections": { + "get": { + "parameters": [ + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "enum": [ + "all", + "open", + "closed" + ], + "nullable": true + } + }, + { + "name": "sort", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "string", + "enum": [ + "creation-asc", + "creation-desc" + ], + "nullable": true + } + }, + { + "name": "stations", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "type": "array", + "items": { + "type": "string" + }, + "nullable": true + } + }, + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "type": "object", + "required": [ + "_id", + "created_at", + "deployment_id", + "ip", + "is_open", + "last_transfer_at", + "request", + "station_id" + ], + "properties": { + "_id": { + "type": "string" + }, + "station_id": { + "type": "string" + }, + "deployment_id": { + "type": "string" + }, + "transfer_bytes": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "duration_ms": { + "type": "integer", + "format": "uint64", + "minimum": 0, + "nullable": true + }, + "is_open": { + "type": "boolean" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "ip": { + "type": "string", + "format": "ip" + }, + "is_external_relay_redirect": { + "default": false, + "type": "boolean" + }, + "request": { + "type": "object", + "required": [ + "headers", + "local_addr", + "method", + "real_ip", + "remote_addr", + "uri", + "user_agent", + "version" + ], + "properties": { + "real_ip": { + "type": "string", + "format": "ip" + }, + "country_code": { + "type": "string", + "enum": [ + "AF", + "AX", + "AL", + "DZ", + "AS", + "AD", + "AO", + "AI", + "AQ", + "AG", + "AR", + "AM", + "AW", + "AU", + "AT", + "AZ", + "BS", + "BH", + "BD", + "BB", + "BY", + "BE", + "BZ", + "BJ", + "BM", + "BT", + "BO", + "BQ", + "BA", + "BW", + "BV", + "BR", + "IO", + "BN", + "BG", + "BF", + "BI", + "CV", + "KH", + "CM", + "CA", + "KY", + "CF", + "TD", + "CL", + "CN", + "CX", + "CC", + "CO", + "KM", + "CG", + "CD", + "CK", + "CR", + "CI", + "HR", + "CU", + "CW", + "CY", + "CZ", + "DK", + "DJ", + "DM", + "DO", + "EC", + "EG", + "EU", + "SV", + "GQ", + "ER", + "EE", + "SZ", + "ET", + "FK", + "FO", + "FJ", + "FI", + "FR", + "GF", + "PF", + "TF", + "GA", + "GM", + "GE", + "DE", + "GH", + "GI", + "GR", + "GL", + "GD", + "GP", + "GU", + "GT", + "GG", + "GN", + "GW", + "GY", + "HT", + "HM", + "VA", + "HN", + "HK", + "HU", + "IS", + "IN", + "ID", + "IR", + "IQ", + "IE", + "IM", + "IL", + "IT", + "JM", + "JP", + "JE", + "JO", + "KZ", + "KE", + "KI", + "KP", + "KR", + "KW", + "KG", + "LA", + "LV", + "LB", + "LS", + "LR", + "LY", + "LI", + "LT", + "LU", + "MO", + "MG", + "MW", + "MY", + "MV", + "ML", + "MT", + "MH", + "MQ", + "MR", + "MU", + "YT", + "MX", + "FM", + "MD", + "MC", + "MN", + "ME", + "MS", + "MA", + "MZ", + "MM", + "NA", + "NR", + "NP", + "NL", + "NC", + "NZ", + "NI", + "NE", + "NG", + "NU", + "NF", + "MK", + "MP", + "NO", + "OM", + "PK", + "PW", + "PS", + "PA", + "PG", + "PY", + "PE", + "PH", + "PN", + "PL", + "PT", + "PR", + "QA", + "RE", + "RO", + "RU", + "RW", + "BL", + "SH", + "KN", + "LC", + "MF", + "PM", + "VC", + "WS", + "SM", + "ST", + "SA", + "SN", + "RS", + "SC", + "SL", + "SG", + "SX", + "SK", + "SI", + "SB", + "SO", + "ZA", + "GS", + "SS", + "ES", + "LK", + "SD", + "SR", + "SJ", + "SE", + "CH", + "SY", + "TW", + "TJ", + "TZ", + "TH", + "TL", + "TG", + "TK", + "TO", + "TT", + "TN", + "TR", + "TM", + "TC", + "TV", + "UG", + "UA", + "AE", + "GB", + "US", + "UM", + "UY", + "UZ", + "VU", + "VE", + "VN", + "VG", + "VI", + "WF", + "EH", + "YE", + "ZM", + "ZW" + ], + "nullable": true + }, + "local_addr": { + "type": "object", + "required": [ + "ip", + "port" + ], + "properties": { + "ip": { + "type": "string", + "format": "ip" + }, + "port": { + "type": "integer", + "format": "uint16", + "minimum": 0 + } + } + }, + "remote_addr": { + "type": "object", + "required": [ + "ip", + "port" + ], + "properties": { + "ip": { + "type": "string", + "format": "ip" + }, + "port": { + "type": "integer", + "format": "uint16", + "minimum": 0 + } + } + }, + "version": { + "type": "string", + "enum": [ + "0.9", + "1.0", + "1.1", + "2", + "3", + "other" + ] + }, + "method": { + "oneOf": [ + { + "type": "string", + "enum": [ + "HEAD", + "GET", + "PUT", + "PATCH", + "POST", + "DELETE", + "OPTIONS", + "CONNECT", + "SOURCE" + ] + }, + { + "type": "object", + "required": [ + "Other" + ], + "properties": { + "Other": { + "type": "string" + } + }, + "additionalProperties": false + } + ] + }, + "uri": { + "type": "object", + "required": [ + "path", + "uri" + ], + "properties": { + "uri": { + "type": "string" + }, + "scheme": { + "type": "string", + "nullable": true + }, + "host": { + "type": "string", + "nullable": true + }, + "port": { + "type": "integer", + "format": "uint16", + "minimum": 0, + "nullable": true + }, + "path": { + "type": "string" + }, + "query": { + "type": "string", + "nullable": true + } + } + }, + "headers": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "user_agent": { + "description": "UserAgent is an owned value it does allocate in favor of simplicity", + "type": "object", + "properties": { + "ua": { + "type": "string", + "nullable": true + }, + "category": { + "type": "string", + "nullable": true + }, + "browser_type": { + "type": "string", + "nullable": true + }, + "vendor": { + "type": "string", + "nullable": true + }, + "name": { + "type": "string", + "nullable": true + }, + "version": { + "type": "string", + "nullable": true + }, + "os": { + "type": "string", + "nullable": true + }, + "os_version": { + "type": "string", + "nullable": true + } + } + } + } + }, + "last_transfer_at": { + "type": "string", + "format": "date-time" + }, + "closed_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + } + } + }, + "/stream-stats": { + "get": { + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "last_24h", + "last_30d", + "last_7d", + "now" + ], + "properties": { + "now": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_24h": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_7d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + }, + "last_30d": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + } + } + }, + "/stream-stats/last-{num}{unit}": { + "get": { + "parameters": [ + { + "name": "num", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "unit", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + }, + "/stream-stats/last-{num}{unit}/count": { + "get": { + "parameters": [ + { + "name": "num", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "unit", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + } + } + } + } + } + } + }, + "/stream-stats/now": { + "get": { + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "stats" + ], + "properties": { + "stats": { + "type": "object", + "required": [ + "country_sessions", + "sessions" + ], + "properties": { + "sessions": { + "type": "number", + "format": "double" + }, + "country_sessions": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + } + } + } + } + } + } + } + } + } + }, + "/stream-stats/now/count": { + "get": { + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint", + "minimum": 0 + } + } + } + } + } + } + } + } + }, + "/stream-stats/now/count-by-station": { + "get": { + "parameters": [], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "by_station" + ], + "properties": { + "by_station": { + "type": "object", + "additionalProperties": { + "type": "integer", + "format": "uint32", + "minimum": 0 + } + } + } + } + } + } + } + } + } + }, + "/users": { + "get": { + "parameters": [ + { + "name": "skip", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 0, + "type": "integer", + "format": "uint64", + "minimum": 0 + } + }, + { + "name": "limit", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": 60, + "type": "integer", + "format": "int64" + } + }, + { + "name": "show", + "in": "query", + "required": false, + "style": "deepObject", + "explode": true, + "allowReserved": true, + "schema": { + "default": "active", + "type": "string", + "enum": [ + "all", + "active", + "deleted" + ] + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "items", + "limit", + "skip", + "total" + ], + "properties": { + "total": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "skip": { + "type": "integer", + "format": "uint64", + "minimum": 0 + }, + "limit": { + "type": "integer", + "format": "int64" + }, + "items": { + "type": "array", + "items": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "post": { + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "email", + "first_name", + "last_name", + "password" + ], + "properties": { + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "password": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true, + "nullable": true + } + }, + "additionalProperties": false + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "/users/{user}": { + "delete": { + "parameters": [ + { + "name": "user", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + } + } + } + } + } + } + }, + "get": { + "parameters": [ + { + "name": "user", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + }, + "patch": { + "parameters": [ + { + "name": "user", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "first_name": { + "type": "string", + "nullable": true + }, + "last_name": { + "type": "string", + "nullable": true + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "user" + ], + "properties": { + "user": { + "anyOf": [ + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "system_metadata", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "system_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + }, + { + "type": "object", + "required": [ + "_id", + "created_at", + "email", + "first_name", + "last_name", + "updated_at", + "user_metadata" + ], + "properties": { + "_id": { + "type": "string" + }, + "first_name": { + "type": "string" + }, + "last_name": { + "type": "string" + }, + "email": { + "type": "string" + }, + "phone": { + "type": "string", + "nullable": true + }, + "language": { + "type": "string", + "nullable": true + }, + "user_metadata": { + "type": "object", + "additionalProperties": true + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + }, + "deleted_at": { + "type": "string", + "format": "date-time", + "nullable": true + } + } + } + ] + } + } + } + } + } + } + } + } + }, + "/users/{user}/change-password": { + "post": { + "parameters": [ + { + "name": "user", + "in": "path", + "required": true, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "type": "object", + "required": [ + "current_password", + "new_password" + ], + "properties": { + "current_password": { + "type": "string" + }, + "new_password": { + "type": "string" + } + } + } + } + } + }, + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "type": "object" + } + } + } + } + } + } + } + }, + "components": { + "securitySchemes": { + "API Key": { + "type": "apiKey", + "in": "header", + "name": "x-access-token" + } + } + } +} \ No newline at end of file diff --git a/openapi/redoc.html b/openapi/redoc.html new file mode 100644 index 00000000..b41d7eec --- /dev/null +++ b/openapi/redoc.html @@ -0,0 +1,12 @@ + + + + + + Openstream API docs + + + + + + \ No newline at end of file diff --git a/rs/packages/api/Cargo.toml b/rs/packages/api/Cargo.toml index 160632c0..e7513326 100644 --- a/rs/packages/api/Cargo.toml +++ b/rs/packages/api/Cargo.toml @@ -27,9 +27,11 @@ hyper = { version = "0.14.27", features = ["full"] } lang = { version = "0.1.0", path = "../lang" } lazy-regex = "2.5.0" log = "0.4.17" +macros = { version = "0.1.0", path = "../macros" } mailer = { version = "0.1.0", path = "../mailer" } media = { version = "0.1.0", path = "../media" } mongodb = "2.7.0" +openapi = { version = "0.1.0", path = "../openapi" } owo-colors = { version = "3.5.0", path = "../owo-colors" } parking_lot = "0.12.1" paste = "1.0.14" diff --git a/rs/packages/api/src/lib.rs b/rs/packages/api/src/lib.rs index 18ba52e6..d2fa9563 100644 --- a/rs/packages/api/src/lib.rs +++ b/rs/packages/api/src/lib.rs @@ -2,15 +2,12 @@ pub mod error; pub mod ip_limit; pub mod json; pub mod me; -pub mod openapi; pub mod qs; pub mod request_ext; pub mod routes; pub mod storage; pub mod ws_stats; -pub use export_schema_macro as export_schema; - use payments::client::PaymentsClient; use db::stream_connection::index::MemIndex; diff --git a/rs/packages/api/src/me/mod.rs b/rs/packages/api/src/me/mod.rs index 199be930..7221c3a9 100644 --- a/rs/packages/api/src/me/mod.rs +++ b/rs/packages/api/src/me/mod.rs @@ -1,8 +1,9 @@ use db::{admin::PublicAdmin, user::PublicUser}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/")] #[serde(rename_all = "snake_case", tag = "scope")] pub enum Me { diff --git a/rs/packages/api/src/qs/mod.rs b/rs/packages/api/src/qs/mod.rs index ddf59485..5d09f596 100644 --- a/rs/packages/api/src/qs/mod.rs +++ b/rs/packages/api/src/qs/mod.rs @@ -32,23 +32,7 @@ struct PaginationQsSchema { pub limit: i64, } -impl JsonSchema for PaginationQs { - fn is_referenceable() -> bool { - PaginationQsSchema::is_referenceable() - } - - fn schema_id() -> std::borrow::Cow<'static, str> { - PaginationQsSchema::schema_id() - } - - fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - PaginationQsSchema::json_schema(gen) - } - - fn schema_name() -> String { - PaginationQsSchema::schema_name() - } -} +openapi::impl_schema_from!(PaginationQs, PaginationQsSchema); impl Default for PaginationQs { fn default() -> Self { diff --git a/rs/packages/api/src/routes/accounts/id.rs b/rs/packages/api/src/routes/accounts/id.rs index 36f94172..ffd7724f 100644 --- a/rs/packages/api/src/routes/accounts/id.rs +++ b/rs/packages/api/src/routes/accounts/id.rs @@ -15,6 +15,7 @@ pub mod get { user_account_relation::{UserAccountRelation, UserAccountRelationKind}, Model, }; + use schemars::JsonSchema; use super::*; @@ -27,9 +28,9 @@ pub mod get { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/accounts/[account]/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/accounts/[account]/GET/")] + #[macros::schema_ts_export] // #[serde(rename_all = "camelCase")] pub struct Output { pub is_owner: bool, @@ -93,13 +94,15 @@ pub mod patch { run_transaction, Model, }; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use validify::{ValidationErrors, Validify}; #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/accounts/[account]/PATCH/")] + #[macros::schema_ts_export] pub struct Payload(pub AccountPatch); #[derive(Debug, Clone)] @@ -109,8 +112,9 @@ pub mod patch { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/accounts/[account]/PATCH/")] + #[macros::schema_ts_export] pub struct Output(pub PublicAccount); #[derive(Debug, thiserror::Error)] @@ -290,6 +294,7 @@ pub mod delete { station::Station, Model, }; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint {} @@ -300,8 +305,9 @@ pub mod delete { account_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/accounts/[account]/DELETE/")] + #[macros::schema_ts_export] pub struct Output(pub PublicAccount); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/accounts/members/id.rs b/rs/packages/api/src/routes/accounts/members/id.rs index 32ccd2d0..4d7ebe77 100644 --- a/rs/packages/api/src/routes/accounts/members/id.rs +++ b/rs/packages/api/src/routes/accounts/members/id.rs @@ -6,6 +6,7 @@ pub mod delete { use super::*; use db::models::user_account_relation::UserAccountRelation; + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; #[derive(Debug, Clone)] @@ -17,9 +18,10 @@ pub mod delete { account_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export)] #[ts(export_to = "../../../defs/api/accounts/[account]/members/[member]/DELETE/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] @@ -90,6 +92,7 @@ pub mod set_role { user_account_relation::UserAccountRelationKind, }; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; #[derive(Debug, Clone)] @@ -102,16 +105,18 @@ pub mod set_role { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export)] #[ts(export_to = "../../../defs/api/accounts/[account]/members/[member]/set-role/POST/")] + #[macros::schema_ts_export] pub struct Payload { role: AccessKind, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export)] #[ts(export_to = "../../../defs/api/accounts/[account]/members/[member]/set-role/POST/")] + #[macros::schema_ts_export] pub enum AccessKind { #[serde(rename = "owner")] Owner, @@ -119,9 +124,12 @@ pub mod set_role { Staff, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/accounts/[account]/members/[member]/set-role/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/accounts/[account]/members/[member]/set-role/POST/" + )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/accounts/members/mod.rs b/rs/packages/api/src/routes/accounts/members/mod.rs index 9730df7d..1bbbfc00 100644 --- a/rs/packages/api/src/routes/accounts/members/mod.rs +++ b/rs/packages/api/src/routes/accounts/members/mod.rs @@ -18,6 +18,7 @@ pub mod get { }; use futures_util::TryStreamExt; use mongodb::options::FindOptions; + use schemars::JsonSchema; use super::*; @@ -29,9 +30,12 @@ pub mod get { account_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/accounts/[account]/members/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/accounts/[account]/members/GET/" + )] + #[macros::schema_ts_export] pub struct Member { #[serde(rename = "_id")] id: String, @@ -41,9 +45,10 @@ pub mod get { relation: UserAccountRelationKind, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export)] #[ts(export_to = "../../../defs/api/accounts/[account]/members/GET/")] + #[macros::schema_ts_export] // #[serde(rename_all = "camelCase")] pub struct Output { pub members: Vec, diff --git a/rs/packages/api/src/routes/accounts/mod.rs b/rs/packages/api/src/routes/accounts/mod.rs index b8345874..7efb2c7f 100644 --- a/rs/packages/api/src/routes/accounts/mod.rs +++ b/rs/packages/api/src/routes/accounts/mod.rs @@ -21,13 +21,16 @@ use ts_rs::TS; pub mod get { + use schemars::JsonSchema; + use super::*; #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS, Default)] + #[derive(Debug, Clone, Serialize, Deserialize, Default, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/accounts/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] page: PaginationQs, @@ -45,8 +48,9 @@ pub mod get { query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/accounts/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, thiserror::Error)] @@ -159,15 +163,16 @@ pub mod post { use db::plan::Plan; use db::user::User; use db::{current_filter_doc, run_transaction}; + use schemars::JsonSchema; use serde_util::DateTime; use ts_rs::TS; use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/accounts/POST/")] - #[serde(rename_all = "snake_case")] - #[serde(deny_unknown_fields)] + #[macros::schema_ts_export] + #[serde(rename_all = "snake_case", deny_unknown_fields)] pub struct Payload { pub name: String, pub plan_id: String, @@ -186,8 +191,9 @@ pub mod post { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/accounts/POST/")] + #[macros::schema_ts_export] pub struct Output { account: PublicAccount, } diff --git a/rs/packages/api/src/routes/accounts/stream_stats.rs b/rs/packages/api/src/routes/accounts/stream_stats.rs index 2a369d2a..f6cb3f7e 100644 --- a/rs/packages/api/src/routes/accounts/stream_stats.rs +++ b/rs/packages/api/src/routes/accounts/stream_stats.rs @@ -14,6 +14,7 @@ use ts_rs::TS; pub mod get { use db::stream_connection::index::{AllFilter, MemIndex, StationQuery}; + use schemars::JsonSchema; use super::*; @@ -27,9 +28,12 @@ pub mod get { pub account_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/accounts/[account]/stream-stats/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/accounts/[account]/stream-stats/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub stats: Stats, } @@ -104,6 +108,7 @@ pub mod now { index::{IsOpenFilter, MemIndex, StationQuery}, stats::StatsItem, }; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint { @@ -115,9 +120,12 @@ pub mod now { account_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/accounts/[account]/stream-stats/now/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/accounts/[account]/stream-stats/now/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub stats: StatsItem, } @@ -190,6 +198,7 @@ pub mod now { use super::*; use db::stream_connection::index::{IsOpenFilter, MemIndex, StationQuery}; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint { @@ -201,9 +210,12 @@ pub mod now { account_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/accounts/[account]/stream-stats/now/count/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/accounts/[account]/stream-stats/now/count/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub total: usize, } @@ -277,6 +289,7 @@ pub mod now { use super::*; use db::stream_connection::index::{IsOpenFilter, MemIndex}; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint { @@ -288,11 +301,12 @@ pub mod now { account_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( + export, export_to = "../../../defs/api/accounts/[account]/stream-stats/now/count-by-station/GET/" )] + #[macros::schema_ts_export] pub struct Output { pub by_station: HashMap, } @@ -352,6 +366,7 @@ pub mod since { index::{MemIndex, SinceFilter, StationQuery}, stats::StatsItem, }; + use schemars::JsonSchema; use crate::error::ApiError; @@ -368,9 +383,12 @@ pub mod since { duration: time::Duration, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/accounts/[account]/stream-stats/last-[num][unit]/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/accounts/[account]/stream-stats/last-[num][unit]/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub stats: StatsItem, } @@ -484,6 +502,7 @@ pub mod since { use super::*; pub mod get { use db::stream_connection::index::{MemIndex, SinceFilter, StationQuery}; + use schemars::JsonSchema; use crate::error::ApiError; @@ -500,11 +519,12 @@ pub mod since { duration: time::Duration, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( + export, export_to = "../../../defs/api/accounts/[account]/stream-stats/last-[num][unit]/count/GET/" )] + #[macros::schema_ts_export] pub struct Output { pub total: usize, } diff --git a/rs/packages/api/src/routes/admins/change_password.rs b/rs/packages/api/src/routes/admins/change_password.rs index 8280e793..38241a53 100644 --- a/rs/packages/api/src/routes/admins/change_password.rs +++ b/rs/packages/api/src/routes/admins/change_password.rs @@ -9,6 +9,7 @@ pub mod post { use db::{admin::Admin, Model}; use mongodb::bson::doc; use prex::{request::ReadBodyJsonError, Request}; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::empty_struct::EmptyStruct; use std::net::IpAddr; @@ -17,11 +18,12 @@ pub mod post { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/admins/[admin]/change-password/POST/" )] + #[macros::schema_ts_export] pub struct Payload { pub current_password: String, pub new_password: String, @@ -34,11 +36,12 @@ pub mod post { ip: IpAddr, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/admins/[admin]/change-password/POST/" )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/admins/id.rs b/rs/packages/api/src/routes/admins/id.rs index fd68414a..1a65543a 100644 --- a/rs/packages/api/src/routes/admins/id.rs +++ b/rs/packages/api/src/routes/admins/id.rs @@ -9,6 +9,7 @@ use ts_rs::TS; pub mod get { use db::admin::{Admin, PublicAdmin}; + use schemars::JsonSchema; use std::convert::Infallible; use super::*; @@ -21,9 +22,9 @@ pub mod get { admin: Admin, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/admins/[admin]/GET/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { admin: PublicAdmin, } @@ -66,12 +67,14 @@ pub mod patch { fetch_and_patch, run_transaction, Model, }; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/admins/[admin]/PATCH/")] + #[macros::schema_ts_export] pub struct Payload(pub AdminPatch); #[derive(Debug, Clone)] @@ -80,8 +83,9 @@ pub mod patch { admin: Admin, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/admins/[admin]/PATCH/")] + #[macros::schema_ts_export] pub struct Output(pub PublicAdmin); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/admins/mod.rs b/rs/packages/api/src/routes/admins/mod.rs index 51c5eb94..480b007f 100644 --- a/rs/packages/api/src/routes/admins/mod.rs +++ b/rs/packages/api/src/routes/admins/mod.rs @@ -14,6 +14,7 @@ use serde::{Deserialize, Serialize}; pub mod get { use db::admin::{Admin, PublicAdmin}; + use schemars::JsonSchema; use ts_rs::TS; use crate::qs::{PaginationQs, VisibilityQs}; @@ -23,8 +24,9 @@ pub mod get { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS, Default)] + #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/admins/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] pub page: PaginationQs, @@ -37,8 +39,9 @@ pub mod get { query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/admins/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, thiserror::Error)] @@ -105,16 +108,17 @@ pub mod post { use db::metadata::Metadata; use db::run_transaction; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use serde_util::DateTime; use ts_rs::TS; use validate::email::is_valid_email; use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/admins/POST/")] - #[serde(rename_all = "snake_case")] - #[serde(deny_unknown_fields)] + #[macros::schema_ts_export] + #[serde(rename_all = "snake_case", deny_unknown_fields)] pub struct Payload { pub first_name: String, pub last_name: String, @@ -129,8 +133,9 @@ pub mod post { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/admins/POST/")] + #[macros::schema_ts_export] pub struct Output { admin: PublicAdmin, } diff --git a/rs/packages/api/src/routes/analytics/mod.rs b/rs/packages/api/src/routes/analytics/mod.rs index f2918289..9692101d 100644 --- a/rs/packages/api/src/routes/analytics/mod.rs +++ b/rs/packages/api/src/routes/analytics/mod.rs @@ -15,6 +15,7 @@ pub mod get { use db::{station::Station, stream_connection::analytics::Analytics}; use geoip::CountryCode; use mongodb::bson::Bson; + use schemars::JsonSchema; use super::*; @@ -27,32 +28,32 @@ pub mod get { pub query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/analytics/GET/")] + #[macros::schema_ts_export] pub struct Output { pub analytics: Analytics, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/analytics/GET/")] + #[macros::schema_ts_export] #[serde(untagged)] pub enum CountryCodeOrZZ { ZZ(ZZ), CC(CountryCode), } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/analytics/GET/")] + #[macros::schema_ts_export] pub enum ZZ { ZZ, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/analytics/GET/")] + #[macros::schema_ts_export] pub struct Query { pub kind: analytics::AnalyticsQueryKind, diff --git a/rs/packages/api/src/routes/app_analytics/mod.rs b/rs/packages/api/src/routes/app_analytics/mod.rs index 04252492..664c76a0 100644 --- a/rs/packages/api/src/routes/app_analytics/mod.rs +++ b/rs/packages/api/src/routes/app_analytics/mod.rs @@ -15,6 +15,7 @@ pub mod get { use db::{station::Station, stream_connection::app_analytics::Analytics}; use geoip::CountryCode; use mongodb::bson::Bson; + use schemars::JsonSchema; use super::*; @@ -27,32 +28,32 @@ pub mod get { pub query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/app-analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/app-analytics/GET/")] + #[macros::schema_ts_export] pub struct Output { pub analytics: Analytics, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/app-analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/app-analytics/GET/")] + #[macros::schema_ts_export] #[serde(untagged)] pub enum CountryCodeOrZZ { ZZ(ZZ), CC(CountryCode), } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/app-analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/app-analytics/GET/")] + #[macros::schema_ts_export] pub enum ZZ { ZZ, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/app-analytics/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/app-analytics/GET/")] + #[macros::schema_ts_export] pub struct Query { pub kind: app_analytics::AnalyticsQueryKind, diff --git a/rs/packages/api/src/routes/auth/admin/delegate/user.rs b/rs/packages/api/src/routes/auth/admin/delegate/user.rs index 7fd90fcf..fd6e4650 100644 --- a/rs/packages/api/src/routes/auth/admin/delegate/user.rs +++ b/rs/packages/api/src/routes/auth/admin/delegate/user.rs @@ -7,6 +7,7 @@ pub mod post { use mongodb::bson::doc; use prex::request::ReadBodyJsonError; use prex::Request; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -22,20 +23,22 @@ pub mod post { access_token: AccessToken, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/admin/delegate/[user]/POST/" )] + #[macros::schema_ts_export] pub struct Payload { title: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/admin/delegate/[user]/POST/" )] + #[macros::schema_ts_export] pub struct Output { user: AdminPublicUser, token: String, diff --git a/rs/packages/api/src/routes/auth/admin/login.rs b/rs/packages/api/src/routes/auth/admin/login.rs index ba3bec13..4f6d3f6e 100644 --- a/rs/packages/api/src/routes/auth/admin/login.rs +++ b/rs/packages/api/src/routes/auth/admin/login.rs @@ -5,6 +5,7 @@ pub mod post { use db::{current_filter_doc, Model}; use mongodb::bson::doc; use prex::{request::ReadBodyJsonError, Request}; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use std::net::IpAddr; @@ -15,10 +16,10 @@ pub mod post { use crate::ip_limit::{hit, should_reject}; use crate::json::JsonHandler; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/admin/login/POST/")] - #[serde(rename_all = "snake_case")] - #[serde(deny_unknown_fields)] + #[macros::schema_ts_export] + #[serde(rename_all = "snake_case", deny_unknown_fields)] pub struct Payload { email: String, password: String, @@ -32,8 +33,9 @@ pub mod post { user_agent: UserAgent, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/admin/login/POST/")] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { admin: PublicAdmin, diff --git a/rs/packages/api/src/routes/auth/admin/logout.rs b/rs/packages/api/src/routes/auth/admin/logout.rs index 8871ad19..78521084 100644 --- a/rs/packages/api/src/routes/auth/admin/logout.rs +++ b/rs/packages/api/src/routes/auth/admin/logout.rs @@ -5,6 +5,7 @@ pub mod post { use db::Model; use mongodb::bson::doc; use prex::Request; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::empty_struct::EmptyStruct; use ts_rs::TS; @@ -18,8 +19,9 @@ pub mod post { access_token: AccessToken, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/admin/logout/POST/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, Clone)] diff --git a/rs/packages/api/src/routes/auth/email_verification/send_code.rs b/rs/packages/api/src/routes/auth/email_verification/send_code.rs index c4a31ad0..08c99cd2 100644 --- a/rs/packages/api/src/routes/auth/email_verification/send_code.rs +++ b/rs/packages/api/src/routes/auth/email_verification/send_code.rs @@ -8,6 +8,7 @@ pub mod post { use mailer::send::{Address, Email, Mailer, SendError}; use mongodb::bson::doc; use prex::{request::ReadBodyJsonError, Request}; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::empty_struct::EmptyStruct; use serde_util::DateTime; @@ -19,12 +20,12 @@ pub mod post { use crate::ip_limit::{hit, should_reject}; use crate::json::JsonHandler; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/email-verification/send-code/POST/" )] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] #[serde(deny_unknown_fields)] pub struct Payload { email: String, @@ -36,11 +37,12 @@ pub mod post { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/email-verification/send-code/POST/" )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, Clone)] diff --git a/rs/packages/api/src/routes/auth/user/email_exists.rs b/rs/packages/api/src/routes/auth/user/email_exists.rs index 6887dd91..bd06eba2 100644 --- a/rs/packages/api/src/routes/auth/user/email_exists.rs +++ b/rs/packages/api/src/routes/auth/user/email_exists.rs @@ -3,6 +3,7 @@ pub mod get { use db::user::User; use mongodb::bson::doc; use prex::Request; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::convert::Infallible; use std::net::IpAddr; @@ -18,11 +19,12 @@ pub mod get { ip: IpAddr, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/user/email-exists/[email]/GET/" )] + #[macros::schema_ts_export] pub struct Output { exists: bool, } diff --git a/rs/packages/api/src/routes/auth/user/login.rs b/rs/packages/api/src/routes/auth/user/login.rs index 6a9b8b3b..39b296ff 100644 --- a/rs/packages/api/src/routes/auth/user/login.rs +++ b/rs/packages/api/src/routes/auth/user/login.rs @@ -5,6 +5,7 @@ pub mod post { use db::{current_filter_doc, run_transaction, Model}; use mongodb::bson::doc; use prex::{request::ReadBodyJsonError, Request}; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use std::net::IpAddr; @@ -15,9 +16,9 @@ pub mod post { use crate::ip_limit::{hit, should_reject}; use crate::json::JsonHandler; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/user/login/POST/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] #[serde(deny_unknown_fields)] pub struct Payload { email: String, @@ -32,9 +33,9 @@ pub mod post { user_agent: UserAgent, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/user/login/POST/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { user: UserPublicUser, token: String, diff --git a/rs/packages/api/src/routes/auth/user/logout.rs b/rs/packages/api/src/routes/auth/user/logout.rs index 47b87ab2..3645b649 100644 --- a/rs/packages/api/src/routes/auth/user/logout.rs +++ b/rs/packages/api/src/routes/auth/user/logout.rs @@ -6,6 +6,7 @@ pub mod post { use log::warn; use mongodb::bson::doc; use prex::Request; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::empty_struct::EmptyStruct; use ts_rs::TS; @@ -19,8 +20,9 @@ pub mod post { access_token: AccessToken, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/user/logout/POST/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, Clone)] diff --git a/rs/packages/api/src/routes/auth/user/recover.rs b/rs/packages/api/src/routes/auth/user/recover.rs index 62175df3..13645f2f 100644 --- a/rs/packages/api/src/routes/auth/user/recover.rs +++ b/rs/packages/api/src/routes/auth/user/recover.rs @@ -9,6 +9,7 @@ pub mod post { use mailer::send::{Address, Email, Mailer, SendError}; use mongodb::bson::doc; use prex::{request::ReadBodyJsonError, Request}; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::empty_struct::EmptyStruct; use serde_util::DateTime; @@ -20,9 +21,9 @@ pub mod post { use crate::ip_limit::{hit, should_reject}; use crate::json::JsonHandler; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/user/recover/POST/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] #[serde(deny_unknown_fields)] pub struct Payload { email: String, @@ -34,8 +35,9 @@ pub mod post { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/user/recover/POST/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, Clone)] diff --git a/rs/packages/api/src/routes/auth/user/recovery_token/token/mod.rs b/rs/packages/api/src/routes/auth/user/recovery_token/token/mod.rs index 5585e7af..da8aa623 100644 --- a/rs/packages/api/src/routes/auth/user/recovery_token/token/mod.rs +++ b/rs/packages/api/src/routes/auth/user/recovery_token/token/mod.rs @@ -15,6 +15,8 @@ pub mod get { use std::net::IpAddr; + use schemars::JsonSchema; + use crate::ip_limit; use super::*; @@ -28,11 +30,12 @@ pub mod get { token: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/user/recovery-token/[token]/GET/" )] + #[macros::schema_ts_export] #[serde(tag = "kind", rename_all = "snake_case")] pub enum Output { Found { diff --git a/rs/packages/api/src/routes/auth/user/recovery_token/token/set_password.rs b/rs/packages/api/src/routes/auth/user/recovery_token/token/set_password.rs index 5b612d34..7a9ee35a 100644 --- a/rs/packages/api/src/routes/auth/user/recovery_token/token/set_password.rs +++ b/rs/packages/api/src/routes/auth/user/recovery_token/token/set_password.rs @@ -16,17 +16,19 @@ pub mod post { use async_trait::async_trait; use db::token_user_recovery::TokenUserRecovery; use prex::Request; + use schemars::JsonSchema; use super::*; #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/user/recovery-token/[token]/set-password/POST/" )] + #[macros::schema_ts_export] pub struct Payload { new_password: String, } @@ -38,11 +40,12 @@ pub mod post { ip: IpAddr, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/auth/user/recovery-token/[token]/set-password/POST/" )] + #[macros::schema_ts_export] pub struct Output { user_id: String, user_email: String, diff --git a/rs/packages/api/src/routes/auth/user/register.rs b/rs/packages/api/src/routes/auth/user/register.rs index 7daf5cbb..202bd05b 100644 --- a/rs/packages/api/src/routes/auth/user/register.rs +++ b/rs/packages/api/src/routes/auth/user/register.rs @@ -14,6 +14,7 @@ pub mod post { use mongodb::bson::doc; use payments::query::save_payment_method::SavePaymentMethodResponse; use prex::{request::ReadBodyJsonError, Request}; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -153,9 +154,9 @@ pub mod post { } } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/user/register/POST/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] #[serde(deny_unknown_fields)] pub struct Payload { plan_id: String, @@ -199,9 +200,9 @@ pub mod post { pub payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/auth/user/register/POST/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { pub user: PublicUser, pub account: PublicAccount, diff --git a/rs/packages/api/src/routes/invitations/accept.rs b/rs/packages/api/src/routes/invitations/accept.rs index d3f8594c..573ed236 100644 --- a/rs/packages/api/src/routes/invitations/accept.rs +++ b/rs/packages/api/src/routes/invitations/accept.rs @@ -27,19 +27,22 @@ use crate::request_ext::get_optional_access_token_scope; pub mod post { use db::account::Account; + use schemars::JsonSchema; use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/accept/POST/")] + #[macros::schema_ts_export] #[serde(untagged)] pub enum Payload { Unauthenticated(UnauthenticatedAcceptPayloadData), Authenticated { invitation_id: String }, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/accept/POST/")] + #[macros::schema_ts_export] pub struct UnauthenticatedAcceptPayloadData { pub token: String, pub first_name: String, @@ -54,8 +57,9 @@ pub mod post { pub payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/accept/POST/")] + #[macros::schema_ts_export] #[serde(tag = "result", rename_all = "kebab-case")] pub enum Output { Ok, diff --git a/rs/packages/api/src/routes/invitations/get_by_token.rs b/rs/packages/api/src/routes/invitations/get_by_token.rs index bd23d97a..9a02d823 100644 --- a/rs/packages/api/src/routes/invitations/get_by_token.rs +++ b/rs/packages/api/src/routes/invitations/get_by_token.rs @@ -4,6 +4,8 @@ use super::*; /// if we decide to save the requests to a mongodb collection pub mod get { + use schemars::JsonSchema; + use super::*; #[derive(Debug)] @@ -11,11 +13,12 @@ pub mod get { token: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/invitations/get-by-token/[token]/GET/" )] + #[macros::schema_ts_export] #[serde(tag = "kind")] #[allow(clippy::large_enum_variant)] pub enum Output { diff --git a/rs/packages/api/src/routes/invitations/id.rs b/rs/packages/api/src/routes/invitations/id.rs index 0a3609c3..2fef8a89 100644 --- a/rs/packages/api/src/routes/invitations/id.rs +++ b/rs/packages/api/src/routes/invitations/id.rs @@ -10,8 +10,9 @@ pub mod get { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/[invitation]/GET/")] + #[macros::schema_ts_export] pub struct Output { pub invitation: PublicInvitation, } @@ -155,11 +156,12 @@ pub mod delete { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/invitations/[invitation]/DELETE/" )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, Clone)] diff --git a/rs/packages/api/src/routes/invitations/mod.rs b/rs/packages/api/src/routes/invitations/mod.rs index 385e5c97..0756f66c 100644 --- a/rs/packages/api/src/routes/invitations/mod.rs +++ b/rs/packages/api/src/routes/invitations/mod.rs @@ -13,6 +13,7 @@ use db::{Model, Paged}; use mongodb::bson::doc; use prex::request::ReadBodyJsonError; use prex::Request; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -22,7 +23,7 @@ pub mod get_by_token; pub mod id; pub mod reject; -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/")] pub struct PublicInvitation { pub id: String, @@ -43,7 +44,7 @@ pub struct PublicInvitation { pub receiver: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/")] pub struct InvitationAccount { #[serde(rename = "_id")] @@ -60,7 +61,7 @@ impl From for InvitationAccount { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/")] pub struct InvitationUserSender { #[serde(rename = "_id")] @@ -81,7 +82,7 @@ impl From for InvitationUserSender { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/")] pub struct InvitationAdminSender { #[serde(rename = "_id")] @@ -100,7 +101,7 @@ impl From for InvitationAdminSender { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/")] pub struct InvitationReceiver { #[serde(rename = "_id")] @@ -135,8 +136,9 @@ pub mod get { pub access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] pub page: PaginationQs, @@ -153,8 +155,9 @@ pub mod get { pub account_id: Option, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, Clone)] @@ -331,8 +334,9 @@ pub mod post { use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/POST/")] + #[macros::schema_ts_export] pub struct Payload { pub account_id: String, pub email: String, @@ -344,8 +348,9 @@ pub mod post { pub payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/POST/")] + #[macros::schema_ts_export] pub struct Output { pub invitation: PublicInvitation, } diff --git a/rs/packages/api/src/routes/invitations/reject.rs b/rs/packages/api/src/routes/invitations/reject.rs index b247533e..5725e93e 100644 --- a/rs/packages/api/src/routes/invitations/reject.rs +++ b/rs/packages/api/src/routes/invitations/reject.rs @@ -19,10 +19,13 @@ use crate::request_ext::get_optional_access_token_scope; pub mod post { + use schemars::JsonSchema; + use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/reject/POST/")] + #[macros::schema_ts_export] #[serde(untagged)] pub enum Payload { Unauthenticated { token: String }, @@ -35,8 +38,9 @@ pub mod post { pub payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/invitations/reject/POST/")] + #[macros::schema_ts_export] #[serde(tag = "result", rename_all = "kebab-case")] pub enum Output { Ok, diff --git a/rs/packages/api/src/routes/me/api_keys/id.rs b/rs/packages/api/src/routes/me/api_keys/id.rs index e628f78e..43b05fe7 100644 --- a/rs/packages/api/src/routes/me/api_keys/id.rs +++ b/rs/packages/api/src/routes/me/api_keys/id.rs @@ -12,6 +12,7 @@ use ts_rs::TS; pub mod delete { + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; use super::*; @@ -25,8 +26,9 @@ pub mod delete { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/api-keys/[id]/DELETE/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] @@ -134,6 +136,7 @@ pub mod delete { pub mod patch { use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; use super::*; @@ -141,8 +144,9 @@ pub mod patch { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/api-keys/[id]/PATCH/")] + #[macros::schema_ts_export] pub struct Payload { title: Option, } @@ -154,8 +158,9 @@ pub mod patch { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/api-keys/[id]/PATCH/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/me/api_keys/mod.rs b/rs/packages/api/src/routes/me/api_keys/mod.rs index 2fe21874..e6a84a5a 100644 --- a/rs/packages/api/src/routes/me/api_keys/mod.rs +++ b/rs/packages/api/src/routes/me/api_keys/mod.rs @@ -9,11 +9,12 @@ use db::access_token::{AccessToken, GeneratedBy, Scope}; use db::{Model, Paged}; use mongodb::bson::doc; use prex::Request; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/")] pub struct ApiKey { #[serde(rename = "_id")] @@ -35,8 +36,9 @@ pub mod get { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS, Default)] + #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/api-keys/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] page: PaginationQs, @@ -58,8 +60,9 @@ pub mod get { query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/api-keys/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, thiserror::Error)] @@ -197,6 +200,7 @@ pub mod post { use std::net::IpAddr; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use crate::ip_limit; @@ -212,15 +216,17 @@ pub mod post { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/api-keys/POST/")] + #[macros::schema_ts_export] pub struct Payload { title: String, password: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/api-keys/POST/")] + #[macros::schema_ts_export] pub struct Output { pub api_key: ApiKey, pub token: String, diff --git a/rs/packages/api/src/routes/me/devices/id.rs b/rs/packages/api/src/routes/me/devices/id.rs index 3db11667..c18fd3ed 100644 --- a/rs/packages/api/src/routes/me/devices/id.rs +++ b/rs/packages/api/src/routes/me/devices/id.rs @@ -28,10 +28,9 @@ pub mod delete { #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/devices/[device]/DELETE/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); - crate::export_schema!(Output); - #[derive(Debug, thiserror::Error)] pub enum ParseError { #[error("access: {0}")] diff --git a/rs/packages/api/src/routes/me/devices/mod.rs b/rs/packages/api/src/routes/me/devices/mod.rs index da8a0a0e..460addf2 100644 --- a/rs/packages/api/src/routes/me/devices/mod.rs +++ b/rs/packages/api/src/routes/me/devices/mod.rs @@ -16,7 +16,6 @@ use std::net::IpAddr; use ts_rs::TS; use user_agent::UserAgent; -crate::export_schema!(Device); #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] pub struct Device { @@ -42,9 +41,9 @@ pub mod get { #[derive(Debug, Clone)] pub struct Endpoint {} - crate::export_schema!(Query); #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/devices/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] page: PaginationQs, @@ -66,17 +65,11 @@ pub mod get { query: Query, } - crate::export_schema!(Output); #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/devices/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); - #[cfg(test)] - #[test] - fn export_output_schema() { - crate::openapi::export_schema_from_ts::().unwrap(); - } - #[derive(Debug, thiserror::Error)] pub enum ParseError { #[error("access: {0}")] diff --git a/rs/packages/api/src/routes/me/mod.rs b/rs/packages/api/src/routes/me/mod.rs index e72b6e97..032de07b 100644 --- a/rs/packages/api/src/routes/me/mod.rs +++ b/rs/packages/api/src/routes/me/mod.rs @@ -13,6 +13,8 @@ use std::convert::Infallible; use ts_rs::TS; pub mod get { + use schemars::JsonSchema; + use super::*; #[derive(Debug)] @@ -20,8 +22,9 @@ pub mod get { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/me/GET/")] + #[macros::schema_ts_export] pub struct Output(pub Me); #[derive(Debug, Clone)] diff --git a/rs/packages/api/src/routes/mod.rs b/rs/packages/api/src/routes/mod.rs index ed6c5b26..7b5c8e64 100644 --- a/rs/packages/api/src/routes/mod.rs +++ b/rs/packages/api/src/routes/mod.rs @@ -19,10 +19,12 @@ pub mod stream_stats; use db::station_picture::StationPicture; use db::stream_connection::index::MemIndex; use drop_tracer::DropTracer; +use hyper::header::{HeaderValue, CONTENT_TYPE}; +use hyper::{Body, StatusCode}; use mailer::send::Mailer; use media::MediaSessionMap; use prex::router::builder::Builder; -use prex::Request; +use prex::{Request, Response}; use shutdown::Shutdown; use crate::error::ApiError; @@ -43,6 +45,28 @@ pub fn router( ) -> Builder { let mut app = prex::prex(); + app.at("/openapi.json").get(|_, _| async move { + let html = include_str!("../../../../../openapi.json"); + let mut res = Response::new(StatusCode::OK); + res.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_static("application/json;charset=utf-8"), + ); + *res.body_mut() = Body::from(html); + res + }); + + app.at("/docs").get(|_, _| async move { + let html = include_str!("../../../../../openapi/redoc.html"); + let mut res = Response::new(StatusCode::OK); + res.headers_mut().insert( + CONTENT_TYPE, + HeaderValue::from_static("text/html;charset=utf-8"), + ); + *res.body_mut() = Body::from(html); + res + }); + app.at("/me").get(me::get::Endpoint {}.into_handler()); app diff --git a/rs/packages/api/src/routes/payment_methods/id.rs b/rs/packages/api/src/routes/payment_methods/id.rs index b8314099..7fbf751e 100644 --- a/rs/packages/api/src/routes/payment_methods/id.rs +++ b/rs/packages/api/src/routes/payment_methods/id.rs @@ -12,6 +12,8 @@ use ts_rs::TS; pub mod get { + use schemars::JsonSchema; + use super::*; pub struct Input { @@ -50,11 +52,12 @@ pub mod get { } } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/payment-methods/[payment-method]/GET/" )] + #[macros::schema_ts_export] pub struct Output { pub payment_method: PublicPaymentMethod, } diff --git a/rs/packages/api/src/routes/payment_methods/mod.rs b/rs/packages/api/src/routes/payment_methods/mod.rs index dee04d59..c674f815 100644 --- a/rs/packages/api/src/routes/payment_methods/mod.rs +++ b/rs/packages/api/src/routes/payment_methods/mod.rs @@ -19,13 +19,15 @@ pub mod id; pub mod get { use db::Paged; + use schemars::JsonSchema; use crate::qs::{PaginationQs, VisibilityQs}; use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, ts_rs::TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/payment-methods/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] pub page: PaginationQs, @@ -72,8 +74,9 @@ pub mod get { } } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/payment-methods/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, Clone)] @@ -133,10 +136,13 @@ pub mod get { } pub mod post { + use schemars::JsonSchema; + use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, ts_rs::TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/payment-methods/POST/")] + #[macros::schema_ts_export] pub struct Payload { #[ts(optional)] #[serde(skip_serializing_if = "Option::is_none")] @@ -197,8 +203,9 @@ pub mod post { } } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/payment-methods/POST/")] + #[macros::schema_ts_export] pub struct Output { pub payment_method: PublicPaymentMethod, } diff --git a/rs/packages/api/src/routes/plans/by_slug/slug/mod.rs b/rs/packages/api/src/routes/plans/by_slug/slug/mod.rs index 27d46256..120fcab9 100644 --- a/rs/packages/api/src/routes/plans/by_slug/slug/mod.rs +++ b/rs/packages/api/src/routes/plans/by_slug/slug/mod.rs @@ -13,6 +13,7 @@ pub mod get { use crate::{error::ApiError, request_ext::AccessTokenScope}; use db::plan::Plan; + use schemars::JsonSchema; use super::*; @@ -25,9 +26,9 @@ pub mod get { optional_access_token_scope: Option, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/by-slug/[slug]/GET/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { plan: Plan, } diff --git a/rs/packages/api/src/routes/plans/id.rs b/rs/packages/api/src/routes/plans/id.rs index 2177bff7..6101213d 100644 --- a/rs/packages/api/src/routes/plans/id.rs +++ b/rs/packages/api/src/routes/plans/id.rs @@ -12,6 +12,7 @@ pub mod get { use crate::{error::ApiError, request_ext::AccessTokenScope}; use db::plan::Plan; + use schemars::JsonSchema; use super::*; @@ -24,9 +25,9 @@ pub mod get { optional_access_token_scope: Option, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/[plan]/GET/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { plan: Plan, } @@ -98,6 +99,7 @@ pub mod delete { use crate::error::ApiError; use db::plan::Plan; + use schemars::JsonSchema; use super::*; @@ -109,9 +111,9 @@ pub mod delete { plan_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/[plan]/DELETE/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { plan: Plan, } @@ -178,15 +180,17 @@ pub mod patch { run_transaction, Model, }; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use serde_util::DateTime; use validify::{validify, ValidationErrors, Validify}; #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[validify] #[ts(export, export_to = "../../../defs/api/plans/[plan]/PATCH/")] + #[macros::schema_ts_export] pub struct Payload { #[ts(optional)] #[validate(range(min = 0.0))] @@ -234,8 +238,9 @@ pub mod patch { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/[plan]/PATCH/")] + #[macros::schema_ts_export] pub struct Output(Plan); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/plans/mod.rs b/rs/packages/api/src/routes/plans/mod.rs index cb867084..915fb140 100644 --- a/rs/packages/api/src/routes/plans/mod.rs +++ b/rs/packages/api/src/routes/plans/mod.rs @@ -9,6 +9,7 @@ pub mod get { use db::Paged; use mongodb::bson::doc; use prex::Request; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; @@ -20,8 +21,9 @@ pub mod get { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS, Default)] + #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/GET/")] + #[macros::schema_ts_export] /// TODO: add pagination pub struct Query { #[serde(flatten)] @@ -36,8 +38,9 @@ pub mod get { query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, thiserror::Error)] @@ -121,6 +124,7 @@ pub mod post { use mongodb::bson::doc; use mongodb::options::FindOneOptions; use prex::{request::ReadBodyJsonError, Request}; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -132,8 +136,9 @@ pub mod post { request_ext::{self, GetAccessTokenScopeError}, }; - #[derive(Debug, Clone, Serialize, Deserialize, ts_rs::TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/POST/")] + #[macros::schema_ts_export] #[validify] #[serde(rename_all = "snake_case")] #[serde(deny_unknown_fields)] @@ -170,8 +175,9 @@ pub mod post { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/plans/POST/")] + #[macros::schema_ts_export] pub struct Output(pub Plan); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/runtime/external_relay_updated/station_id.rs b/rs/packages/api/src/routes/runtime/external_relay_updated/station_id.rs index 1892ad06..131c0514 100644 --- a/rs/packages/api/src/routes/runtime/external_relay_updated/station_id.rs +++ b/rs/packages/api/src/routes/runtime/external_relay_updated/station_id.rs @@ -13,6 +13,8 @@ use ts_rs::TS; pub mod post { + use schemars::JsonSchema; + use super::*; #[derive(Debug, Clone)] @@ -25,9 +27,12 @@ pub mod post { station: Station, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/runtime/external-relay-updated/[station]/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/runtime/external-relay-updated/[station]/POST/" + )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[async_trait] diff --git a/rs/packages/api/src/routes/runtime/restart_playlist/station_id.rs b/rs/packages/api/src/routes/runtime/restart_playlist/station_id.rs index c6bc08e8..1c974ba2 100644 --- a/rs/packages/api/src/routes/runtime/restart_playlist/station_id.rs +++ b/rs/packages/api/src/routes/runtime/restart_playlist/station_id.rs @@ -13,6 +13,7 @@ pub mod post { use drop_tracer::DropTracer; use media::MediaSessionMap; + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; use shutdown::Shutdown; @@ -33,9 +34,12 @@ pub mod post { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/runtime/restart-playlist/[station]/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/runtime/restart-playlist/[station]/POST/" + )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/runtime/source_password_updated/station_id.rs b/rs/packages/api/src/routes/runtime/source_password_updated/station_id.rs index de7cfc10..c2053811 100644 --- a/rs/packages/api/src/routes/runtime/source_password_updated/station_id.rs +++ b/rs/packages/api/src/routes/runtime/source_password_updated/station_id.rs @@ -13,6 +13,7 @@ pub mod post { use std::convert::Infallible; use media::MediaSessionMap; + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; use super::*; @@ -27,9 +28,12 @@ pub mod post { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/runtime/source-password-updated/[station]/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/runtime/source-password-updated/[station]/POST/" + )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[async_trait] diff --git a/rs/packages/api/src/routes/runtime/station_deleted/station_id.rs b/rs/packages/api/src/routes/runtime/station_deleted/station_id.rs index 0649df92..949087ef 100644 --- a/rs/packages/api/src/routes/runtime/station_deleted/station_id.rs +++ b/rs/packages/api/src/routes/runtime/station_deleted/station_id.rs @@ -12,6 +12,8 @@ use ts_rs::TS; pub mod post { + use schemars::JsonSchema; + use super::*; #[derive(Debug, Clone)] @@ -24,9 +26,12 @@ pub mod post { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/runtime/station-deleted/[station]/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/runtime/station-deleted/[station]/POST/" + )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[async_trait] diff --git a/rs/packages/api/src/routes/station_pictures/mod.rs b/rs/packages/api/src/routes/station_pictures/mod.rs index 199b6455..745cbed8 100644 --- a/rs/packages/api/src/routes/station_pictures/mod.rs +++ b/rs/packages/api/src/routes/station_pictures/mod.rs @@ -126,11 +126,13 @@ pub mod post { use bytes::Bytes; use db::station_picture::{CreateStationPictureError, StationPicture}; use prex::request::ReadBodyBytesError; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/station-pictures/POST/")] + #[macros::schema_ts_export] pub struct Query { pub account_id: String, pub filename: String, @@ -146,8 +148,9 @@ pub mod post { data: Bytes, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/station-pictures/POST/")] + #[macros::schema_ts_export] pub struct Output(StationPicture); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/stations/files/id.rs b/rs/packages/api/src/routes/stations/files/id.rs index 4569defd..5d8cda0f 100644 --- a/rs/packages/api/src/routes/stations/files/id.rs +++ b/rs/packages/api/src/routes/stations/files/id.rs @@ -26,6 +26,7 @@ const CONTENT_TYPE_AUDIO_MPEG: HeaderValue = HeaderValue::from_static("audio/mpe pub mod get { + use schemars::JsonSchema; use ts_rs::TS; use crate::error::ApiError; @@ -43,11 +44,12 @@ pub mod get { file_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/GET/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { item: AudioFile, @@ -278,6 +280,7 @@ pub mod stream { } pub mod delete { + use schemars::JsonSchema; use ts_rs::TS; use crate::error::ApiError; @@ -309,11 +312,12 @@ pub mod delete { } } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/DELETE/" )] + #[macros::schema_ts_export] pub struct Output(AudioFile); #[async_trait] diff --git a/rs/packages/api/src/routes/stations/files/metadata.rs b/rs/packages/api/src/routes/stations/files/metadata.rs index 6f725ee4..7508c03a 100644 --- a/rs/packages/api/src/routes/stations/files/metadata.rs +++ b/rs/packages/api/src/routes/stations/files/metadata.rs @@ -13,6 +13,7 @@ pub mod put { use db::run_transaction; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use ts_rs::TS; use crate::error::ApiError; @@ -20,11 +21,12 @@ pub mod put { use super::*; - #[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, TS)] + #[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/metadata/PUT/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Payload { #[ts(optional)] @@ -104,11 +106,12 @@ pub mod put { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/metadata/PUT/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { item: AudioFile, diff --git a/rs/packages/api/src/routes/stations/files/mod.rs b/rs/packages/api/src/routes/stations/files/mod.rs index a3db6877..7b922dd1 100644 --- a/rs/packages/api/src/routes/stations/files/mod.rs +++ b/rs/packages/api/src/routes/stations/files/mod.rs @@ -20,6 +20,8 @@ use ts_rs::TS; pub mod get { + use schemars::JsonSchema; + use crate::qs::PaginationQs; use super::*; @@ -27,15 +29,17 @@ pub mod get { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Serialize, Deserialize, Clone, TS)] + #[derive(Debug, Serialize, Deserialize, Clone, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/[station]/files/GET/")] + #[macros::schema_ts_export] pub struct Output { files: Paged, playlist_is_randomly_shuffled: bool, } - #[derive(Debug, Clone, Serialize, Deserialize, Default, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, Default, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/[station]/files/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] pub page: PaginationQs, @@ -115,6 +119,7 @@ pub mod post { use bytes::Bytes; use futures::Stream; use hyper::header::CONTENT_LENGTH; + use schemars::JsonSchema; use serde::de::Error; use upload::UploadError; @@ -127,8 +132,9 @@ pub mod post { pub deployment_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/[station]/files/POST/")] + #[macros::schema_ts_export] pub struct Query { pub filename: String, } @@ -141,8 +147,9 @@ pub mod post { pub size_hint: Option, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/[station]/files/POST/")] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { file: AudioFile, diff --git a/rs/packages/api/src/routes/stations/files/order.rs b/rs/packages/api/src/routes/stations/files/order.rs index 5ffb442d..b6d0acc1 100644 --- a/rs/packages/api/src/routes/stations/files/order.rs +++ b/rs/packages/api/src/routes/stations/files/order.rs @@ -45,15 +45,17 @@ pub mod swap { pub mod post { + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/swap/POST/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Payload { anchor_file_id: String, @@ -69,11 +71,12 @@ pub mod swap { other_file_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/swap/POST/" )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); impl From for ApiError { @@ -165,6 +168,8 @@ pub mod move_to_first { pub mod post { + use schemars::JsonSchema; + use super::*; #[derive(Debug, Clone)] @@ -176,11 +181,12 @@ pub mod move_to_first { file_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/move-to-first/POST/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { order: f64, @@ -225,6 +231,8 @@ pub mod move_to_last { pub mod post { + use schemars::JsonSchema; + use super::*; #[derive(Debug, Clone)] @@ -236,11 +244,12 @@ pub mod move_to_last { file_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/move-to-last/POST/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { order: f64, @@ -285,6 +294,7 @@ pub mod move_before { pub mod post { use db::audio_file::OrderDocument; + use schemars::JsonSchema; use super::*; #[derive(Debug, Clone)] @@ -297,22 +307,24 @@ pub mod move_before { anchor_file_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/move-before/POST/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { order: f64, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/move-before/POST/" )] #[serde(rename_all = "snake_case")] + #[macros::schema_ts_export] pub struct Payload { anchor_file_id: String, } @@ -389,6 +401,8 @@ pub mod move_after { use super::*; pub mod post { + use schemars::JsonSchema; + use super::*; #[derive(Debug, Clone)] pub struct Endpoint {} @@ -400,21 +414,23 @@ pub mod move_after { anchor_file_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/move-after/POST/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Output { order: f64, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/[file]/order/move-after/POST/" )] + #[macros::schema_ts_export] #[serde(rename_all = "snake_case")] pub struct Payload { anchor_file_id: String, diff --git a/rs/packages/api/src/routes/stations/files/shuffle.rs b/rs/packages/api/src/routes/stations/files/shuffle.rs index dba15118..56e1774f 100644 --- a/rs/packages/api/src/routes/stations/files/shuffle.rs +++ b/rs/packages/api/src/routes/stations/files/shuffle.rs @@ -7,6 +7,7 @@ pub mod post { use mongodb::options::{FindOneAndReplaceOptions, FindOptions}; use prex::Request; use rand::seq::SliceRandom; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::empty_struct::EmptyStruct; use serde_util::DateTime; @@ -23,11 +24,12 @@ pub mod post { station_id: String, } - #[derive(Debug, Clone, Copy, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Copy, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/suffle/POST/" )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/stations/files/unshuffle.rs b/rs/packages/api/src/routes/stations/files/unshuffle.rs index 92cbcfa4..85f24988 100644 --- a/rs/packages/api/src/routes/stations/files/unshuffle.rs +++ b/rs/packages/api/src/routes/stations/files/unshuffle.rs @@ -6,6 +6,7 @@ pub mod post { use mongodb::bson::doc; use mongodb::options::FindOptions; use prex::Request; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::empty_struct::EmptyStruct; use ts_rs::TS; @@ -38,11 +39,12 @@ pub mod post { station_id: String, } - #[derive(Debug, Clone, Copy, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Copy, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/files/unsuffle/POST/" )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/stations/id.rs b/rs/packages/api/src/routes/stations/id.rs index 6e569d6a..5b1c648d 100644 --- a/rs/packages/api/src/routes/stations/id.rs +++ b/rs/packages/api/src/routes/stations/id.rs @@ -14,6 +14,8 @@ pub mod get { use std::convert::Infallible; + use schemars::JsonSchema; + use super::*; #[derive(Debug, Clone)] @@ -25,10 +27,10 @@ pub mod get { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export)] #[ts(export_to = "../../../defs/api/stations/[station]/GET/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { pub station: PublicStation, } @@ -77,6 +79,7 @@ pub mod delete { use hyper::http::HeaderValue; use hyper::Body; use media::MediaSessionMap; + use schemars::JsonSchema; use serde_util::DateTime; // use futures_util::TryStreamExt; use serde_util::empty_struct::EmptyStruct; @@ -97,10 +100,9 @@ pub mod delete { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/DELETE/")] - // #[serde(rename_all = "camelCase")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/stations/[station]/DELETE/")] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] @@ -265,6 +267,7 @@ pub mod patch { use hyper::{http::HeaderValue, Body}; use media::MediaSessionMap; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use validify::{ValidationErrors, Validify}; #[derive(Debug, Clone)] @@ -273,8 +276,9 @@ pub mod patch { pub media_sessions: MediaSessionMap, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/[station]/PATCH/")] + #[macros::schema_ts_export] pub struct Payload(pub StationPatch); #[derive(Debug, Clone)] @@ -285,8 +289,9 @@ pub mod patch { station: Station, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/[station]/PATCH/")] + #[macros::schema_ts_export] pub struct Output(pub PublicStation); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/stations/mod.rs b/rs/packages/api/src/routes/stations/mod.rs index f545e2c5..154deacf 100644 --- a/rs/packages/api/src/routes/stations/mod.rs +++ b/rs/packages/api/src/routes/stations/mod.rs @@ -26,6 +26,8 @@ use ts_rs::TS; pub mod get { + use schemars::JsonSchema; + use crate::qs::{PaginationQs, VisibilityQs}; use super::*; @@ -33,8 +35,9 @@ pub mod get { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS, Default)] + #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/GET/")] + #[macros::schema_ts_export] struct Query { #[serde(flatten)] pub page: PaginationQs, @@ -52,8 +55,9 @@ pub mod get { query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, thiserror::Error)] @@ -158,6 +162,7 @@ pub mod post { use db::station_picture::StationPicture; use geoip::CountryCode; use lang::LangCode; + use schemars::JsonSchema; use serde_util::DateTime; use ts_rs::TS; use validate::url::patterns::*; @@ -165,10 +170,10 @@ pub mod post { use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/POST/")] - #[serde(rename_all = "snake_case")] - #[serde(deny_unknown_fields)] + #[macros::schema_ts_export] + #[serde(rename_all = "snake_case", deny_unknown_fields)] #[validify] pub struct Payload { pub account_id: String, @@ -419,10 +424,10 @@ pub mod post { pub system_metadata: Option, } - #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/POST/")] - #[serde(rename_all = "snake_case")] - #[serde(deny_unknown_fields)] + #[macros::schema_ts_export] + #[serde(rename_all = "snake_case", deny_unknown_fields)] pub struct PayloadLimits { #[serde(skip_serializing_if = "Option::is_none")] listeners: Option, @@ -440,8 +445,9 @@ pub mod post { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stations/POST/")] + #[macros::schema_ts_export] pub struct Output { station: PublicStation, } diff --git a/rs/packages/api/src/routes/stations/now_playing.rs b/rs/packages/api/src/routes/stations/now_playing.rs index 4b017268..aed14a88 100644 --- a/rs/packages/api/src/routes/stations/now_playing.rs +++ b/rs/packages/api/src/routes/stations/now_playing.rs @@ -16,6 +16,7 @@ pub mod get { probe::Probe, Model, }; + use schemars::JsonSchema; use super::*; @@ -28,9 +29,12 @@ pub mod get { } #[allow(clippy::large_enum_variant)] - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/now-playing/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/now-playing/GET/" + )] + #[macros::schema_ts_export] #[serde(tag = "kind")] pub enum Output { #[serde(rename = "none")] diff --git a/rs/packages/api/src/routes/stations/reset_source_password.rs b/rs/packages/api/src/routes/stations/reset_source_password.rs index 4300f571..45df3f47 100644 --- a/rs/packages/api/src/routes/stations/reset_source_password.rs +++ b/rs/packages/api/src/routes/stations/reset_source_password.rs @@ -13,6 +13,7 @@ pub mod post { use db::{deployment::Deployment, Model}; use hyper::{http::HeaderValue, Body}; use media::MediaSessionMap; + use schemars::JsonSchema; use crate::request_ext::X_ACCESS_TOKEN; @@ -30,9 +31,12 @@ pub mod post { station: Station, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/reset-source-password/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/reset-source-password/POST/" + )] + #[macros::schema_ts_export] pub struct Output { new_password: String, } diff --git a/rs/packages/api/src/routes/stations/restart_playlist.rs b/rs/packages/api/src/routes/stations/restart_playlist.rs index dc5ae4d2..8a22ad58 100644 --- a/rs/packages/api/src/routes/stations/restart_playlist.rs +++ b/rs/packages/api/src/routes/stations/restart_playlist.rs @@ -13,6 +13,7 @@ pub mod post { use db::{deployment::Deployment, Model}; use drop_tracer::DropTracer; use hyper::http::HeaderValue; + use schemars::JsonSchema; use serde_util::empty_struct::EmptyStruct; use shutdown::Shutdown; @@ -34,9 +35,12 @@ pub mod post { station: Station, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/restart-playlist/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/restart-playlist/POST/" + )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/stations/stream_stats.rs b/rs/packages/api/src/routes/stations/stream_stats.rs index f10b287f..f234ec45 100644 --- a/rs/packages/api/src/routes/stations/stream_stats.rs +++ b/rs/packages/api/src/routes/stations/stream_stats.rs @@ -13,6 +13,7 @@ use ts_rs::TS; pub mod get { use db::stream_connection::index::{AllFilter, StationQuery}; + use schemars::JsonSchema; use super::*; @@ -26,9 +27,12 @@ pub mod get { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/stream-stats/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/stream-stats/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub stats: Stats, } @@ -73,6 +77,7 @@ pub mod now { index::{IsOpenFilter, StationQuery}, stats::StatsItem, }; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint { @@ -84,9 +89,12 @@ pub mod now { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/stream-stats/now/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/stream-stats/now/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub stats: StatsItem, } @@ -125,6 +133,7 @@ pub mod now { use super::*; use db::stream_connection::index::{IsOpenFilter, StationQuery}; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint { @@ -136,9 +145,12 @@ pub mod now { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/stream-stats/now/count/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/stream-stats/now/count/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub total: usize, } @@ -184,6 +196,7 @@ pub mod since { index::{SinceFilter, StationQuery}, stats::StatsItem, }; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint { @@ -196,9 +209,12 @@ pub mod since { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/stream-stats/last-[num][unit]/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/stream-stats/last-[num][unit]/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub stats: StatsItem, } @@ -281,6 +297,7 @@ pub mod since { use super::*; use crate::error::ApiError; use db::stream_connection::index::{SinceFilter, StationQuery}; + use schemars::JsonSchema; #[derive(Debug, Clone)] pub struct Endpoint { @@ -293,11 +310,12 @@ pub mod since { station_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( + export, export_to = "../../../defs/api/stations/[station]/stream-stats/last-[num][unit]/count/GET/" )] + #[macros::schema_ts_export] pub struct Output { pub total: usize, } diff --git a/rs/packages/api/src/routes/stations/transfer.rs b/rs/packages/api/src/routes/stations/transfer.rs index efa2e120..d84eb385 100644 --- a/rs/packages/api/src/routes/stations/transfer.rs +++ b/rs/packages/api/src/routes/stations/transfer.rs @@ -16,17 +16,19 @@ use ts_rs::TS; pub mod post { use db::station::PublicStation; + use schemars::JsonSchema; use super::*; #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, ts_rs::TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/stations/[station]/transfer/POST/" )] + #[macros::schema_ts_export] pub struct Payload { target_account_id: String, } @@ -38,9 +40,12 @@ pub mod post { payload: Payload, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stations/[station]/transfer/POST/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stations/[station]/transfer/POST/" + )] + #[macros::schema_ts_export] pub struct Output { station: PublicStation, } diff --git a/rs/packages/api/src/routes/stream_connections/mod.rs b/rs/packages/api/src/routes/stream_connections/mod.rs index 7037d7f2..9acff6f1 100644 --- a/rs/packages/api/src/routes/stream_connections/mod.rs +++ b/rs/packages/api/src/routes/stream_connections/mod.rs @@ -8,6 +8,7 @@ pub mod get { use db::Paged; use mongodb::bson::doc; use prex::Request; + use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; @@ -18,8 +19,9 @@ pub mod get { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stream-connections/GET/")] + #[macros::schema_ts_export] #[serde(rename_all = "kebab-case")] pub enum ShowQuery { All, @@ -27,16 +29,18 @@ pub mod get { Closed, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stream-connections/GET/")] + #[macros::schema_ts_export] #[serde(rename_all = "kebab-case")] pub enum SortQuery { CreationAsc, CreationDesc, } - #[derive(Debug, Clone, Serialize, Deserialize, TS, Default)] + #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stream-connections/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] pub page: PaginationQs, @@ -54,8 +58,9 @@ pub mod get { pub query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/stream-connections/GET/")] + #[macros::schema_ts_export] pub struct Output(Paged); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/stream_stats/mod.rs b/rs/packages/api/src/routes/stream_stats/mod.rs index 861b0c5c..27f26bdf 100644 --- a/rs/packages/api/src/routes/stream_stats/mod.rs +++ b/rs/packages/api/src/routes/stream_stats/mod.rs @@ -12,6 +12,7 @@ use ts_rs::TS; pub mod get { use db::stream_connection::index::StationQuery; + use schemars::JsonSchema; use super::*; @@ -23,9 +24,9 @@ pub mod get { #[derive(Debug, Clone)] pub struct Input {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stream-stats/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/stream-stats/GET/")] + #[macros::schema_ts_export] pub struct Output { pub stats: Stats, } @@ -61,6 +62,7 @@ pub mod now { index::{IsOpenFilter, StationQuery}, stats::StatsItem, }; + use schemars::JsonSchema; use super::*; @@ -72,9 +74,9 @@ pub mod now { #[derive(Debug, Clone)] pub struct Input {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stream-stats/now/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/stream-stats/now/GET/")] + #[macros::schema_ts_export] pub struct Output { pub stats: StatsItem, } @@ -109,6 +111,7 @@ pub mod now { pub mod get { use db::stream_connection::index::{IsOpenFilter, StationQuery}; + use schemars::JsonSchema; use super::*; #[derive(Debug, Clone)] @@ -119,9 +122,9 @@ pub mod now { #[derive(Debug, Clone)] pub struct Input {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stream-stats/now/count/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts(export, export_to = "../../../defs/api/stream-stats/now/count/GET/")] + #[macros::schema_ts_export] pub struct Output { pub total: usize, } @@ -159,6 +162,7 @@ pub mod now { use std::collections::{HashMap, HashSet}; use db::{station::Station, stream_connection::index::IsOpenFilter, Model}; + use schemars::JsonSchema; use super::*; #[derive(Debug, Clone)] @@ -169,9 +173,12 @@ pub mod now { #[derive(Debug, Clone)] pub struct Input {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stream-stats/now/count-by-station/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stream-stats/now/count-by-station/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub by_station: HashMap, } @@ -218,6 +225,7 @@ pub mod since { index::{SinceFilter, StationQuery}, stats::StatsItem, }; + use schemars::JsonSchema; use crate::error::ApiError; @@ -233,9 +241,12 @@ pub mod since { duration: time::Duration, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stream-stats/last-[num][unit]/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stream-stats/last-[num][unit]/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub stats: StatsItem, } @@ -308,6 +319,7 @@ pub mod since { use super::*; pub mod get { use db::stream_connection::index::{SinceFilter, StationQuery}; + use schemars::JsonSchema; use crate::error::ApiError; @@ -323,9 +335,12 @@ pub mod since { duration: time::Duration, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] - #[ts(export)] - #[ts(export_to = "../../../defs/api/stream-stats/last-[num][unit]/count/GET/")] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] + #[ts( + export, + export_to = "../../../defs/api/stream-stats/last-[num][unit]/count/GET/" + )] + #[macros::schema_ts_export] pub struct Output { pub total: usize, } diff --git a/rs/packages/api/src/routes/users/change_password.rs b/rs/packages/api/src/routes/users/change_password.rs index 68e88b0c..278f301b 100644 --- a/rs/packages/api/src/routes/users/change_password.rs +++ b/rs/packages/api/src/routes/users/change_password.rs @@ -1,6 +1,7 @@ pub mod post { use mongodb::bson::doc; + use schemars::JsonSchema; use std::net::IpAddr; use crate::{ @@ -20,11 +21,12 @@ pub mod post { #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/users/[user]/change-password/POST/" )] + #[macros::schema_ts_export] pub struct Payload { pub current_password: String, pub new_password: String, @@ -37,11 +39,12 @@ pub mod post { ip: IpAddr, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts( export, export_to = "../../../defs/api/users/[user]/change-password/POST/" )] + #[macros::schema_ts_export] pub struct Output(EmptyStruct); #[derive(Debug, thiserror::Error)] diff --git a/rs/packages/api/src/routes/users/id.rs b/rs/packages/api/src/routes/users/id.rs index 776c28da..7843e323 100644 --- a/rs/packages/api/src/routes/users/id.rs +++ b/rs/packages/api/src/routes/users/id.rs @@ -12,6 +12,7 @@ use serde::{Deserialize, Serialize}; pub mod get { use super::*; + use schemars::JsonSchema; use std::convert::Infallible; use ts_rs::TS; @@ -24,9 +25,9 @@ pub mod get { public_scope: PublicScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/[user]/GET/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { user: PublicUser, } @@ -62,15 +63,16 @@ pub mod patch { use super::*; use db::{fetch_and_patch, run_transaction}; use prex::request::ReadBodyJsonError; + use schemars::JsonSchema; use serde_util::DateTime; use ts_rs::TS; #[derive(Debug, Clone)] pub struct Endpoint {} - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/[user]/PATCH/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Payload { first_name: Option, last_name: Option, @@ -95,9 +97,9 @@ pub mod patch { public_scope: PublicScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/[user]/PATCH/")] - // #[serde(rename_all = "camelCase")] + #[macros::schema_ts_export] pub struct Output { user: PublicUser, } @@ -249,6 +251,7 @@ pub mod delete { use super::*; use db::{run_transaction, user::AdminPublicUser, user_account_relation::UserAccountRelation}; + use schemars::JsonSchema; use ts_rs::TS; #[derive(Debug, Clone)] @@ -259,8 +262,9 @@ pub mod delete { user_id: String, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/[user]/DELETE/")] + #[macros::schema_ts_export] pub struct Output { user: AdminPublicUser, } diff --git a/rs/packages/api/src/routes/users/mod.rs b/rs/packages/api/src/routes/users/mod.rs index 253aab02..33b7d6cf 100644 --- a/rs/packages/api/src/routes/users/mod.rs +++ b/rs/packages/api/src/routes/users/mod.rs @@ -19,6 +19,7 @@ use validate::email::is_valid_email; pub mod get { + use schemars::JsonSchema; use ts_rs::TS; use crate::qs::{PaginationQs, VisibilityQs}; @@ -34,12 +35,14 @@ pub mod get { query: Query, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/GET/")] + #[macros::schema_ts_export] pub struct Output(pub Paged); - #[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/GET/")] + #[macros::schema_ts_export] pub struct Query { #[serde(flatten)] pub page: PaginationQs, @@ -116,13 +119,14 @@ pub mod get { pub mod post { use db::run_transaction; + use schemars::JsonSchema; use ts_rs::TS; use super::*; - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/POST/")] - #[serde(rename_all = "snake_case")] + #[macros::schema_ts_export] #[serde(deny_unknown_fields)] pub struct Payload { email: String, @@ -147,8 +151,9 @@ pub mod post { access_token_scope: AccessTokenScope, } - #[derive(Debug, Clone, Serialize, Deserialize, TS)] + #[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/api/users/POST/")] + #[macros::schema_ts_export] pub struct Output { user: PublicUser, } diff --git a/rs/packages/db/Cargo.toml b/rs/packages/db/Cargo.toml index c8a1b723..17b99b03 100644 --- a/rs/packages/db/Cargo.toml +++ b/rs/packages/db/Cargo.toml @@ -66,6 +66,8 @@ image = { version = "0.24.6", features = ["webp-encoder", "webp", "rgb", "dcv-co lang = { version = "0.1.0", path = "../lang" } ffmpeg = { version = "0.1.0", path = "../ffmpeg" } schemars = "0.8.16" +serde_json = "1.0" +openapi = { version = "0.1.0", path = "../openapi" } [dev-dependencies] serde_json = { version = "1.0", features = ["preserve_order"] } diff --git a/rs/packages/db/src/http/headers/mod.rs b/rs/packages/db/src/http/headers/mod.rs index 527cbf71..854fc57d 100644 --- a/rs/packages/db/src/http/headers/mod.rs +++ b/rs/packages/db/src/http/headers/mod.rs @@ -3,10 +3,11 @@ use indexmap::{ map::{IntoIter, Iter, Keys, Values}, IndexMap, }; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; -#[derive(Debug, Default, Clone, Serialize, Deserialize, TS, Eq, PartialEq)] +#[derive(Debug, Default, Clone, Serialize, Deserialize, TS, Eq, PartialEq, JsonSchema)] #[ts(export, export_to = "../../../defs/db/http/")] pub struct Headers(IndexMap); diff --git a/rs/packages/db/src/http/method/mod.rs b/rs/packages/db/src/http/method/mod.rs index f29ea89e..fdacc9e7 100644 --- a/rs/packages/db/src/http/method/mod.rs +++ b/rs/packages/db/src/http/method/mod.rs @@ -1,7 +1,8 @@ use hyper::http::method::InvalidMethod; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -#[derive(Debug, Clone, Eq, PartialEq, Hash)] +#[derive(Debug, Clone, Eq, PartialEq, Hash, JsonSchema)] pub enum Method { HEAD, GET, diff --git a/rs/packages/db/src/http/request/mod.rs b/rs/packages/db/src/http/request/mod.rs index 4c7a2659..6c2b46ce 100644 --- a/rs/packages/db/src/http/request/mod.rs +++ b/rs/packages/db/src/http/request/mod.rs @@ -1,15 +1,17 @@ use super::{Headers, Method, SocketAddr, Uri, Version}; use geoip::CountryCode; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::net::IpAddr; use ts_rs::TS; use user_agent::{UserAgent, UserAgentExt}; -#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/http/")] #[macros::keys] pub struct Request { - #[serde(with = "serde_util::ip")] + #[serde(serialize_with = "serde_util::ip::serialize")] + #[serde(deserialize_with = "serde_util::ip::deserialize")] pub real_ip: IpAddr, pub country_code: Option, pub local_addr: SocketAddr, diff --git a/rs/packages/db/src/http/socket_addr/mod.rs b/rs/packages/db/src/http/socket_addr/mod.rs index 53782a27..4a4101aa 100644 --- a/rs/packages/db/src/http/socket_addr/mod.rs +++ b/rs/packages/db/src/http/socket_addr/mod.rs @@ -1,12 +1,14 @@ +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::net::IpAddr; use ts_rs::TS; -#[derive(Debug, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, TS)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, Eq, PartialEq, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/http/")] // #[serde(rename_all = "camelCase")] pub struct SocketAddr { - #[serde(with = "serde_util::ip")] + #[serde(serialize_with = "serde_util::ip::serialize")] + #[serde(deserialize_with = "serde_util::ip::deserialize")] pub ip: IpAddr, pub port: u16, } diff --git a/rs/packages/db/src/http/uri/mod.rs b/rs/packages/db/src/http/uri/mod.rs index af0b22ca..609fc0cd 100644 --- a/rs/packages/db/src/http/uri/mod.rs +++ b/rs/packages/db/src/http/uri/mod.rs @@ -1,7 +1,8 @@ +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; -#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/http/")] pub struct Uri { pub uri: String, diff --git a/rs/packages/db/src/http/version/mod.rs b/rs/packages/db/src/http/version/mod.rs index 76465922..f542dcb1 100644 --- a/rs/packages/db/src/http/version/mod.rs +++ b/rs/packages/db/src/http/version/mod.rs @@ -1,8 +1,11 @@ +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; #[allow(non_camel_case_types)] -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Serialize, Deserialize, TS, PartialOrd, Ord)] +#[derive( + Debug, Clone, Copy, Eq, PartialEq, Hash, Ord, PartialOrd, Serialize, Deserialize, TS, JsonSchema, +)] #[ts(export, export_to = "../../../defs/db/http/")] pub enum Version { #[serde(rename = "0.9")] diff --git a/rs/packages/db/src/metadata/mod.rs b/rs/packages/db/src/metadata/mod.rs index ebc5feb1..fd49c83c 100644 --- a/rs/packages/db/src/metadata/mod.rs +++ b/rs/packages/db/src/metadata/mod.rs @@ -1,12 +1,13 @@ use std::collections::BTreeMap; use std::ops::{Deref, DerefMut}; +use schemars::JsonSchema; //use serde::de::Visitor; //use serde::ser::SerializeMap; use serde::{Deserialize, Serialize}; use ts_rs::TS; -#[derive(Debug, Clone, Default, Eq, PartialEq, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Default, Eq, PartialEq, Serialize, Deserialize, TS, JsonSchema)] #[ts(export)] #[ts(export_to = "../../../defs/db/")] pub struct Metadata(Document); @@ -14,12 +15,12 @@ pub struct Metadata(Document); #[derive(Debug, Clone, Default, Eq, PartialEq, Serialize, Deserialize, TS)] #[ts(export)] #[ts(export_to = "../../../defs/db/")] -// Record cannot reference itself in typescript pub struct Document(BTreeMap); -#[derive(Debug, Clone, TS, Serialize, Deserialize)] -#[ts(export)] -#[ts(export_to = "../../../defs/db/")] +openapi::impl_schema_from!(Document, DocumentSchema); + +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] +#[ts(export, export_to = "../../../defs/db/")] #[serde(untagged)] pub enum Value { Null, @@ -89,3 +90,7 @@ impl Metadata { self } } + +#[derive(JsonSchema)] +#[schemars(rename = "JsonDocument")] +pub struct DocumentSchema(BTreeMap); diff --git a/rs/packages/db/src/models/_token_user_email_confirmation.bak/mod.rs b/rs/packages/db/src/models/_token_user_email_confirmation.bak/mod.rs deleted file mode 100644 index cb2d0477..00000000 --- a/rs/packages/db/src/models/_token_user_email_confirmation.bak/mod.rs +++ /dev/null @@ -1,73 +0,0 @@ -use crate::Model; -use mongodb::bson::doc; -use mongodb::IndexModel; -use serde::{Deserialize, Serialize}; -use serde_util::DateTime; -use time::Duration; -use ts_rs::TS; - -crate::register!(TokenUserEmailConfirmation); - -#[derive(Debug, Clone, Serialize, Deserialize, TS)] -#[ts(export, export_to = "../../../defs/db/")] -#[serde(rename_all = "snake_case")] -#[macros::keys] -pub struct TokenUserEmailConfirmation { - #[serde(rename = "_id")] - pub id: String, - /// sha256 of a Self::random_key() - pub hash: String, - pub user_id: String, - pub email: String, - pub accepted_at: Option, - pub created_at: DateTime, -} - -#[derive(Debug, Clone, Serialize, Deserialize, TS)] -pub enum TokenUserEmailConfirmationState {} - -impl TokenUserEmailConfirmation { - pub const RANDOM_KEY_LEN: usize = 24; - pub const VALIDITY_SECONDS: u32 = 60 * 60 * 3; // 3 hr - - pub fn random_key() -> String { - uid::uid(Self::RANDOM_KEY_LEN) - } - - pub fn is_valid_now(&self) -> bool { - let now = DateTime::now().inner(); - - let until = self - .created_at - .saturating_add(Duration::SECOND * Self::VALIDITY_SECONDS); - - now < until - } -} - -impl Model for TokenUserEmailConfirmation { - const UID_LEN: usize = 12; - const CL_NAME: &'static str = "token_user_email_confirmation"; - - fn indexes() -> Vec { - let user_id = IndexModel::builder() - .keys(doc! { Self::KEY_USER_ID: 1 }) - .build(); - - let created_at = IndexModel::builder() - .keys(doc! { Self::KEY_CREATED_AT: 1 }) - .build(); - - vec![user_id, created_at] - } -} - -#[cfg(test)] -mod test { - use super::*; - - #[test] - fn keys_match() { - assert_eq!(crate::KEY_ID, TokenUserEmailConfirmation::KEY_ID); - } -} diff --git a/rs/packages/db/src/models/account/mod.rs b/rs/packages/db/src/models/account/mod.rs index 985675ee..d90c1fd3 100644 --- a/rs/packages/db/src/models/account/mod.rs +++ b/rs/packages/db/src/models/account/mod.rs @@ -5,6 +5,7 @@ use crate::{metadata::Metadata, PublicScope}; use constants::validate::*; use mongodb::bson::{doc, Bson}; use mongodb::ClientSession; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use std::collections::HashMap; @@ -12,7 +13,7 @@ use ts_rs::TS; crate::register!(Account); -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] #[macros::keys] @@ -30,7 +31,7 @@ pub struct Account { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(rename_all = "snake_case")] pub struct UserPublicAccount { @@ -46,11 +47,11 @@ pub struct UserPublicAccount { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] pub struct AdminPublicAccount(pub Account); -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(untagged)] pub enum PublicAccount { @@ -58,7 +59,7 @@ pub enum PublicAccount { User(UserPublicAccount), } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/ops/")] #[serde(rename_all = "snake_case")] #[serde(deny_unknown_fields)] @@ -145,7 +146,7 @@ impl Model for Account { const CL_NAME: &'static str = "accounts"; } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/", rename = "AccountLimits")] #[serde(rename_all = "snake_case")] #[macros::keys] @@ -156,14 +157,16 @@ pub struct Limits { pub storage: Limit, } -#[derive(Debug, Clone, Deserialize, Serialize, TS)] +#[derive(Debug, Clone, Deserialize, Serialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/", rename = "AccountLimit")] #[serde(rename_all = "snake_case")] #[macros::keys] pub struct Limit { - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub used: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total: u64, } diff --git a/rs/packages/db/src/models/account_invitations/mod.rs b/rs/packages/db/src/models/account_invitations/mod.rs index f8dd53a8..8efb4e32 100644 --- a/rs/packages/db/src/models/account_invitations/mod.rs +++ b/rs/packages/db/src/models/account_invitations/mod.rs @@ -1,6 +1,7 @@ use crate::Model; use mongodb::IndexModel; use mongodb::{bson::doc, ClientSession}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -38,7 +39,7 @@ pub struct AccountInvitation { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(tag = "state")] #[macros::keys] diff --git a/rs/packages/db/src/models/admin/mod.rs b/rs/packages/db/src/models/admin/mod.rs index 073ffb1e..7be99b2e 100644 --- a/rs/packages/db/src/models/admin/mod.rs +++ b/rs/packages/db/src/models/admin/mod.rs @@ -1,6 +1,7 @@ use crate::Model; use crate::{error::ApplyPatchError, metadata::Metadata}; use mongodb::{bson::doc, options::IndexOptions, IndexModel}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -24,7 +25,7 @@ pub struct Admin { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(rename_all = "snake_case")] pub struct PublicAdmin { @@ -54,10 +55,9 @@ impl Admin { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/ops/")] -#[serde(rename_all = "snake_case")] -#[serde(deny_unknown_fields)] +#[serde(rename_all = "snake_case", deny_unknown_fields)] pub struct AdminPatch { #[serde(skip_serializing_if = "Option::is_none")] pub first_name: Option, diff --git a/rs/packages/db/src/models/audio_file/mod.rs b/rs/packages/db/src/models/audio_file/mod.rs index 02a13a2c..cbd622a8 100644 --- a/rs/packages/db/src/models/audio_file/mod.rs +++ b/rs/packages/db/src/models/audio_file/mod.rs @@ -8,13 +8,14 @@ use mongodb::{ options::FindOneOptions, ClientSession, IndexModel, }; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use serde_util::{as_f64, DateTime}; +use serde_util::DateTime; use ts_rs::TS; crate::register!(AudioFile); -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] #[macros::keys] @@ -24,18 +25,22 @@ pub struct AudioFile { pub station_id: String, pub sha256: String, - #[serde(with = "as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub len: u64, pub duration_ms: f64, - #[serde(with = "as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub bytes_sec: usize, - #[serde(with = "as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub chunk_count: usize, - #[serde(with = "as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub chunk_len: usize, pub chunk_duration_ms: f64, @@ -230,7 +235,7 @@ impl Model for AudioFile { } } -#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, TS)] +#[derive(Debug, Default, Serialize, Deserialize, PartialEq, Eq, Clone, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/", rename = "AudioMetadata")] #[serde(rename_all = "snake_case")] #[macros::keys] @@ -242,7 +247,8 @@ pub struct Metadata { pub genre: Option, pub year: Option, pub comment: Option, - #[serde(with = "as_f64::option")] + #[serde(serialize_with = "serde_util::as_f64::option::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::option::deserialize")] pub track: Option, } diff --git a/rs/packages/db/src/models/payment_method/mod.rs b/rs/packages/db/src/models/payment_method/mod.rs index a303782a..e755e258 100644 --- a/rs/packages/db/src/models/payment_method/mod.rs +++ b/rs/packages/db/src/models/payment_method/mod.rs @@ -1,5 +1,6 @@ use crate::Model; use mongodb::IndexModel; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -39,7 +40,7 @@ pub enum PaymentMethodKind { }, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] pub struct PublicPaymentMethod { #[serde(rename = "_id")] @@ -76,7 +77,7 @@ impl From for PublicPaymentMethod { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(tag = "kind")] pub enum PublicPaymentMethodKind { diff --git a/rs/packages/db/src/models/plan/mod.rs b/rs/packages/db/src/models/plan/mod.rs index b625a733..168420c8 100644 --- a/rs/packages/db/src/models/plan/mod.rs +++ b/rs/packages/db/src/models/plan/mod.rs @@ -5,6 +5,7 @@ use mongodb::{ options::{FindOptions, IndexOptions}, IndexModel, }; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -13,7 +14,7 @@ use crate::current_filter_doc; crate::register!(Plan); -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] #[macros::keys] @@ -75,16 +76,20 @@ impl Plan { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] pub struct PlanLimits { - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub stations: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub listeners: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub transfer: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub storage: u64, } diff --git a/rs/packages/db/src/models/station/mod.rs b/rs/packages/db/src/models/station/mod.rs index 7ca6098d..b7153026 100644 --- a/rs/packages/db/src/models/station/mod.rs +++ b/rs/packages/db/src/models/station/mod.rs @@ -9,6 +9,7 @@ use lang::LangCode; use mongodb::bson::{doc, Bson, SerializerOptions}; use mongodb::options::{FindOneAndUpdateOptions, ReturnDocument}; use mongodb::{ClientSession, IndexModel}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::map_some; use serde_util::DateTime; @@ -18,7 +19,7 @@ use validify::validify; crate::register!(Station); -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] #[validify] @@ -277,12 +278,13 @@ pub struct Station { Copy, Serialize, Deserialize, - ts_rs::TS, strum::AsRefStr, strum::Display, strum::EnumCount, strum::EnumIter, strum::EnumVariantNames, + TS, + JsonSchema, )] #[serde(rename_all = "lowercase")] #[strum(serialize_all = "lowercase")] @@ -315,7 +317,7 @@ impl StationTypeOfContent { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] #[macros::keys] @@ -339,7 +341,7 @@ impl From for Bson { } } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(rename_all = "snake_case")] pub struct UserPublicStation { @@ -401,7 +403,7 @@ pub struct UserPublicStation { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(rename_all = "snake_case")] #[validify] @@ -416,7 +418,7 @@ pub struct StationFrequency { freq: f64, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(rename_all = "kebab-case")] pub enum StationFrequencyKind { @@ -424,11 +426,11 @@ pub enum StationFrequencyKind { Fm, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] pub struct AdminPublicStation(pub Station); -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/")] #[serde(untagged)] pub enum PublicStation { @@ -436,7 +438,7 @@ pub enum PublicStation { User(UserPublicStation), } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/ops/")] #[serde(rename_all = "snake_case")] #[serde(deny_unknown_fields)] diff --git a/rs/packages/db/src/models/station_picture/mod.rs b/rs/packages/db/src/models/station_picture/mod.rs index 4c44a82f..298f50e9 100644 --- a/rs/packages/db/src/models/station_picture/mod.rs +++ b/rs/packages/db/src/models/station_picture/mod.rs @@ -8,13 +8,14 @@ use image::{ImageBuffer, EncodableLayout}; use mongodb::bson::doc; use mongodb::{ClientSession, IndexModel}; use ril::{Encoder, Paste, Rgba}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; crate::register!(StationPicture); -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] #[macros::keys] diff --git a/rs/packages/db/src/models/stream_connection/analytics/mod.rs b/rs/packages/db/src/models/stream_connection/analytics/mod.rs index a4c320ed..4c2aa72e 100644 --- a/rs/packages/db/src/models/stream_connection/analytics/mod.rs +++ b/rs/packages/db/src/models/stream_connection/analytics/mod.rs @@ -8,14 +8,15 @@ use std::{ use futures_util::{StreamExt, TryStreamExt}; use geoip::CountryCode; use mongodb::bson::doc; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; -use serde_util::DateTime; +use serde_util::{timezone_datetime::TimezoneDateTime, DateTime}; use time::{OffsetDateTime, UtcOffset}; use ts_rs::TS; use crate::{station::Station, stream_connection::lite::StreamConnectionLite, Model}; -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/analytics/")] pub struct Analytics { pub is_now: bool, @@ -24,30 +25,31 @@ pub struct Analytics { pub stations: Vec, - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - pub since: time::OffsetDateTime, + pub since: TimezoneDateTime, - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - pub until: time::OffsetDateTime, + pub until: TimezoneDateTime, pub utc_offset_minutes: i16, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub sessions: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub ips: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total_duration_ms: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total_transfer_bytes: u64, #[cfg(feature = "analytics-max-concurrent")] - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] #[ts(optional)] pub max_concurrent_listeners: u64, @@ -64,21 +66,26 @@ pub struct Analytics { pub by_domain: Vec>>, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/analytics/")] pub struct AnalyticsItem { pub key: K, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub sessions: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub ips: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total_duration_ms: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total_transfer_bytes: u64, #[cfg(feature = "analytics-max-concurrent")] - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] #[ts(optional)] pub max_concurrent_listeners: u64, @@ -94,7 +101,9 @@ pub struct AnalyticsItem { // pub month: u8, // } -#[derive(Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS)] +#[derive( + Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS, JsonSchema, +)] #[ts(export, export_to = "../../../defs/analytics/")] pub struct YearMonthDay { pub year: u16, @@ -102,7 +111,9 @@ pub struct YearMonthDay { pub day: u8, } -#[derive(Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS)] +#[derive( + Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS, JsonSchema, +)] #[ts(export, export_to = "../../../defs/analytics/")] pub struct YearMonthDayHour { pub year: u16, @@ -111,7 +122,7 @@ pub struct YearMonthDayHour { pub hour: u8, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/analytics/")] #[macros::keys] pub struct AnalyticsStation { @@ -132,25 +143,16 @@ pub struct AnalyticsQuery { pub min_duration_ms: Option, } -#[derive(Debug, Clone, Copy, Serialize, Deserialize, ts_rs::TS)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, ts_rs::TS, JsonSchema)] #[ts(export, export_to = "../../../defs/analytics/")] pub enum AnalyticsQueryKind { #[serde(rename = "now")] - Now { - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - offset_date: time::OffsetDateTime, - }, + Now { offset_date: TimezoneDateTime }, #[serde(rename = "time_range")] TimeRange { - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - since: time::OffsetDateTime, - - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - until: time::OffsetDateTime, + since: TimezoneDateTime, + until: TimezoneDateTime, }, } @@ -429,7 +431,7 @@ pub async fn get_analytics(query: AnalyticsQuery) -> Result { is_now = false; - let mut start_date = since; + let mut start_date = *since; let mut end_date = (until).to_offset(since.offset()); let now = OffsetDateTime::now_utc(); @@ -547,8 +549,8 @@ pub async fn get_analytics(query: AnalyticsQuery) -> Result Result, - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - pub since: time::OffsetDateTime, + pub since: TimezoneDateTime, - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - pub until: time::OffsetDateTime, + pub until: TimezoneDateTime, pub utc_offset_minutes: i16, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub sessions: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub ips: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total_duration_ms: u64, // #[serde(with = "serde_util::as_f64")] // pub total_transfer_bytes: u64, #[cfg(feature = "analytics-max-concurrent")] - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] #[ts(optional)] pub max_concurrent_listeners: u64, @@ -65,21 +66,26 @@ pub struct Analytics { pub by_app_version: Vec>, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/app-analytics/")] pub struct AnalyticsItem { pub key: K, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub sessions: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub ips: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total_duration_ms: u64, - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] pub total_transfer_bytes: u64, #[cfg(feature = "analytics-max-concurrent")] - #[serde(with = "serde_util::as_f64")] + #[serde(serialize_with = "serde_util::as_f64::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::deserialize")] #[ts(optional)] pub max_concurrent_listeners: u64, @@ -95,7 +101,9 @@ pub struct AnalyticsItem { // pub month: u8, // } -#[derive(Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS)] +#[derive( + Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS, JsonSchema, +)] #[ts(export, export_to = "../../../defs/app-analytics/")] pub struct YearMonthDay { pub year: u16, @@ -103,7 +111,9 @@ pub struct YearMonthDay { pub day: u8, } -#[derive(Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS)] +#[derive( + Debug, Clone, Copy, Serialize, Eq, PartialEq, Hash, Ord, PartialOrd, Deserialize, TS, JsonSchema, +)] #[ts(export, export_to = "../../../defs/app-analytics/")] pub struct YearMonthDayHour { pub year: u16, @@ -112,14 +122,16 @@ pub struct YearMonthDayHour { pub hour: u8, } -#[derive(Debug, Clone, Serialize, Ord, PartialOrd, Eq, PartialEq, Hash, Deserialize, TS)] +#[derive( + Debug, Clone, Serialize, Ord, PartialOrd, Eq, PartialEq, Hash, Deserialize, TS, JsonSchema, +)] #[ts(export, export_to = "../../../defs/app-analytics/")] pub struct AppKindVersion { pub kind: Option, pub version: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/app-analytics/")] #[macros::keys] pub struct AnalyticsStation { @@ -142,25 +154,16 @@ pub struct AnalyticsQuery { pub min_duration_ms: Option, } -#[derive(Debug, Clone, Copy, Serialize, Deserialize, ts_rs::TS)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/app-analytics/")] pub enum AnalyticsQueryKind { #[serde(rename = "now")] - Now { - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - offset_date: time::OffsetDateTime, - }, + Now { offset_date: TimezoneDateTime }, #[serde(rename = "time_range")] TimeRange { - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - since: time::OffsetDateTime, - - #[ts(type = "/** time::DateTime */ string")] - #[serde(with = "time::serde::iso8601")] - until: time::OffsetDateTime, + since: TimezoneDateTime, + until: TimezoneDateTime, }, } @@ -451,7 +454,7 @@ pub async fn get_analytics(query: AnalyticsQuery) -> Result { is_now = false; - let mut start_date = since; + let mut start_date = *since; let mut end_date = (until).to_offset(since.offset()); let now = OffsetDateTime::now_utc(); @@ -577,8 +580,8 @@ pub async fn get_analytics(query: AnalyticsQuery) -> Result Result, - #[serde(with = "serde_util::as_f64::option")] + #[serde(serialize_with = "serde_util::as_f64::option::serialize")] + #[serde(deserialize_with = "serde_util::as_f64::option::deserialize")] pub duration_ms: Option, pub is_open: bool, pub created_at: DateTime, pub country_code: Option, - #[serde(with = "serde_util::ip")] + #[serde(serialize_with = "serde_util::ip::serialize")] + #[serde(deserialize_with = "serde_util::ip::deserialize")] pub ip: IpAddr, #[serde(default)] diff --git a/rs/packages/db/src/models/stream_connection/stats/mod.rs b/rs/packages/db/src/models/stream_connection/stats/mod.rs index 33c64443..91607359 100644 --- a/rs/packages/db/src/models/stream_connection/stats/mod.rs +++ b/rs/packages/db/src/models/stream_connection/stats/mod.rs @@ -1,10 +1,11 @@ use std::collections::BTreeMap; use geoip::CountryCode; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use ts_rs::TS; -#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/stream-connection-stats/")] pub struct Stats { pub now: StatsItem, @@ -13,7 +14,7 @@ pub struct Stats { pub last_30d: StatsItem, } -#[derive(Debug, Clone, Default, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Default, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/stream-connection-stats/")] pub struct StatsItem { pub sessions: f64, diff --git a/rs/packages/db/src/models/user/mod.rs b/rs/packages/db/src/models/user/mod.rs index f87eceb1..d3c9bafb 100644 --- a/rs/packages/db/src/models/user/mod.rs +++ b/rs/packages/db/src/models/user/mod.rs @@ -3,6 +3,7 @@ use crate::{current_filter_doc, deleted_filter_doc, Model, PublicScope}; use mongodb::error::Result as MongoResult; use mongodb::ClientSession; use mongodb::{bson::doc, options::IndexOptions, IndexModel}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -44,7 +45,7 @@ pub struct User { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] pub struct UserPublicUser { @@ -61,7 +62,7 @@ pub struct UserPublicUser { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "snake_case")] pub struct AdminPublicUser { @@ -79,7 +80,7 @@ pub struct AdminPublicUser { pub deleted_at: Option, } -#[derive(Debug, Clone, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(untagged)] pub enum PublicUser { diff --git a/rs/packages/db/src/models/user_account_relation/mod.rs b/rs/packages/db/src/models/user_account_relation/mod.rs index 6e61d4ab..c76f1b06 100644 --- a/rs/packages/db/src/models/user_account_relation/mod.rs +++ b/rs/packages/db/src/models/user_account_relation/mod.rs @@ -1,5 +1,6 @@ use mongodb::IndexModel; use mongodb::{bson::doc, options::IndexOptions}; +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use serde_util::DateTime; use ts_rs::TS; @@ -20,7 +21,7 @@ pub struct UserAccountRelation { pub created_at: DateTime, } -#[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize, TS)] +#[derive(Debug, Clone, Copy, Eq, PartialEq, Serialize, Deserialize, TS, JsonSchema)] #[ts(export, export_to = "../../../defs/db/")] #[serde(rename_all = "lowercase")] #[macros::keys] diff --git a/rs/packages/geoip/Cargo.toml b/rs/packages/geoip/Cargo.toml index ded1e20e..25439147 100644 --- a/rs/packages/geoip/Cargo.toml +++ b/rs/packages/geoip/Cargo.toml @@ -11,6 +11,7 @@ deepsize = "0.2.0" ip2geo = "0.1.0" log = "0.4.17" macros = { version = "0.1.0", path = "../macros" } +schemars = "0.8.16" serde = { version = "1.0.160", features = ["derive"] } strum = { version = "0.24.1", features = ["phf", "derive", "strum_macros"] } ts-rs = "6.2.0" diff --git a/rs/packages/geoip/src/lib.rs b/rs/packages/geoip/src/lib.rs index 7febcf6e..2ff902ab 100644 --- a/rs/packages/geoip/src/lib.rs +++ b/rs/packages/geoip/src/lib.rs @@ -1,3 +1,4 @@ +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::net::IpAddr; use std::str::FromStr; @@ -38,7 +39,6 @@ fn it_works() { PartialOrd, Serialize, Deserialize, - TS, strum::Display, AsRefStr, EnumCount, @@ -46,6 +46,8 @@ fn it_works() { FromRepr, EnumString, IntoStaticStr, + TS, + JsonSchema, deepsize::DeepSizeOf, )] #[ts(export, export_to = "../../../defs/")] diff --git a/rs/packages/lang/Cargo.toml b/rs/packages/lang/Cargo.toml index c8c4da1b..b2d0950a 100644 --- a/rs/packages/lang/Cargo.toml +++ b/rs/packages/lang/Cargo.toml @@ -6,5 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +schemars = "0.8.16" serde = { version = "1.0.177", features = ["derive"] } ts-rs = { version = "6.2.0" } diff --git a/rs/packages/lang/src/lib.rs b/rs/packages/lang/src/lib.rs index efa9e9e9..4c463a69 100644 --- a/rs/packages/lang/src/lib.rs +++ b/rs/packages/lang/src/lib.rs @@ -1,6 +1,8 @@ +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; +use ts_rs::TS; -#[derive(Debug, Clone, Copy, Serialize, Deserialize, ts_rs::TS)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, TS, JsonSchema)] #[serde(rename_all = "lowercase")] #[ts(export, export_to = "../../../defs/")] pub enum LangCode { diff --git a/rs/packages/macros-build/src/impls/mod.rs b/rs/packages/macros-build/src/impls/mod.rs index 176e05a2..dd4fdf5e 100644 --- a/rs/packages/macros-build/src/impls/mod.rs +++ b/rs/packages/macros-build/src/impls/mod.rs @@ -3,4 +3,5 @@ pub mod pick_from; pub mod singleton; // pub mod validate; pub mod const_register; +pub mod schema_ts_export; pub mod status; diff --git a/rs/packages/macros-build/src/impls/schema_ts_export.rs b/rs/packages/macros-build/src/impls/schema_ts_export.rs new file mode 100644 index 00000000..f40caf6d --- /dev/null +++ b/rs/packages/macros-build/src/impls/schema_ts_export.rs @@ -0,0 +1,21 @@ +use proc_macro::TokenStream; +use quote::quote; +use syn::{parse_macro_input, Item}; + +pub fn schema_ts_export(_args: TokenStream, tokens: TokenStream) -> TokenStream { + let item: Item = parse_macro_input!(tokens); + + let name = match &item { + Item::Struct(item) => item.ident.clone(), + Item::Enum(item) => item.ident.clone(), + other => panic!("item of type {other:?} is not supported, only structs are supported"), + }; + + let out = quote! { + #item + + ::openapi::export_schema_ts!(#name); + }; + + out.into() +} diff --git a/rs/packages/macros-build/src/lib.rs b/rs/packages/macros-build/src/lib.rs index 884d8221..66fa3fc1 100644 --- a/rs/packages/macros-build/src/lib.rs +++ b/rs/packages/macros-build/src/lib.rs @@ -28,6 +28,11 @@ pub fn status(tokens: TokenStream) -> TokenStream { impls::status::status(tokens) } +#[proc_macro_attribute] +pub fn schema_ts_export(args: TokenStream, tokens: TokenStream) -> TokenStream { + impls::schema_ts_export::schema_ts_export(args, tokens) +} + // #[proc_macro_attribute] // pub fn validate(args: TokenStream, tokens: TokenStream) -> TokenStream { // todo!(); diff --git a/rs/packages/openapi/Cargo.toml b/rs/packages/openapi/Cargo.toml new file mode 100644 index 00000000..d9dddbbe --- /dev/null +++ b/rs/packages/openapi/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "openapi" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +schemars = "0.8.16" +serde = "1.0.195" +serde_json = "1.0.111" +thiserror = "1.0.56" +ts-rs = "6.2.0" diff --git a/rs/packages/api/src/openapi.rs b/rs/packages/openapi/src/lib.rs similarity index 76% rename from rs/packages/api/src/openapi.rs rename to rs/packages/openapi/src/lib.rs index abfaca88..dc6e20d0 100644 --- a/rs/packages/api/src/openapi.rs +++ b/rs/packages/openapi/src/lib.rs @@ -69,14 +69,37 @@ pub fn export_schema_from_ts() -> Result<(), ExportError> { } #[macro_export] -macro_rules! export_schema_macro { +macro_rules! export_schema_ts { ($ident:ident) => { paste::paste! { #[cfg(test)] #[test] #[allow(non_snake_case)] fn []() { - $crate::openapi::export_schema_from_ts::<$ident>().unwrap(); + $crate::export_schema_from_ts::<$ident>().unwrap(); + } + } + }; +} + +#[macro_export] +macro_rules! impl_schema_from { + ($target:ident, $source:ident) => { + impl ::schemars::JsonSchema for $target { + fn is_referenceable() -> bool { + $source::is_referenceable() + } + + fn schema_id() -> ::std::borrow::Cow<'static, str> { + $source::schema_id() + } + + fn json_schema(gen: &mut ::schemars::gen::SchemaGenerator) -> ::schemars::schema::Schema { + $source::json_schema(gen) + } + + fn schema_name() -> String { + $source::schema_name() } } }; diff --git a/rs/packages/serde-util/Cargo.toml b/rs/packages/serde-util/Cargo.toml index 1761a15a..93476306 100644 --- a/rs/packages/serde-util/Cargo.toml +++ b/rs/packages/serde-util/Cargo.toml @@ -13,6 +13,7 @@ hyper = "0.14.27" iso8601-timestamp = "0.2.7" log = "0.4.17" mongodb = "2.7.0" +openapi = { version = "0.1.0", path = "../openapi" } schemars = { version = "0.8.16", features = ["preserve_order", "chrono"] } serde = "1" serde_json = { version = "1.0", features = ["preserve_order"] } diff --git a/rs/packages/serde-util/src/datetime.rs b/rs/packages/serde-util/src/datetime.rs index 8475e3aa..8e6fa710 100644 --- a/rs/packages/serde-util/src/datetime.rs +++ b/rs/packages/serde-util/src/datetime.rs @@ -29,29 +29,13 @@ pub fn local_offset() -> UtcOffset { #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, TS)] #[ts(export)] #[ts(export_to = "../../../defs/")] -pub struct DateTime(#[ts(type = "string")] OffsetDateTime); +pub struct DateTime(#[ts(type = "/* DateTime */ string")] OffsetDateTime); + +openapi::impl_schema_from!(DateTime, DateTimeSchema); #[derive(JsonSchema)] #[schemars(rename = "DateTime")] -struct DateTimeSchemars(chrono::DateTime); - -impl JsonSchema for DateTime { - fn is_referenceable() -> bool { - DateTimeSchemars::is_referenceable() - } - - fn schema_id() -> std::borrow::Cow<'static, str> { - DateTimeSchemars::schema_id() - } - - fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - DateTimeSchemars::json_schema(gen) - } - - fn schema_name() -> String { - DateTimeSchemars::schema_name() - } -} +struct DateTimeSchema(chrono::DateTime); impl Display for DateTime { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/rs/packages/serde-util/src/empty_struct.rs b/rs/packages/serde-util/src/empty_struct.rs index b52a1afd..d99a5630 100644 --- a/rs/packages/serde-util/src/empty_struct.rs +++ b/rs/packages/serde-util/src/empty_struct.rs @@ -6,23 +6,7 @@ use ts_rs::TS; #[ts(export, export_to = "../../../defs/")] pub struct EmptyStruct(#[ts(type = "Record")] pub ()); -impl JsonSchema for EmptyStruct { - fn schema_id() -> std::borrow::Cow<'static, str> { - EmptyStructSchema::schema_id() - } - - fn json_schema(gen: &mut schemars::gen::SchemaGenerator) -> schemars::schema::Schema { - EmptyStructSchema::json_schema(gen) - } - - fn is_referenceable() -> bool { - EmptyStructSchema::is_referenceable() - } - - fn schema_name() -> String { - EmptyStructSchema::schema_name() - } -} +openapi::impl_schema_from!(EmptyStruct, EmptyStructSchema); #[derive(JsonSchema)] #[schemars(rename = "EmptyObjectw")] diff --git a/rs/packages/serde-util/src/lib.rs b/rs/packages/serde-util/src/lib.rs index 9abf8993..2f63a1da 100644 --- a/rs/packages/serde-util/src/lib.rs +++ b/rs/packages/serde-util/src/lib.rs @@ -7,6 +7,7 @@ pub mod ip; pub mod password; pub mod port; pub mod status_code; +pub mod timezone_datetime; pub mod voidable; pub use datetime::DateTime; pub use mongodb::bson; diff --git a/rs/packages/serde-util/src/timezone_datetime.rs b/rs/packages/serde-util/src/timezone_datetime.rs new file mode 100644 index 00000000..6339e636 --- /dev/null +++ b/rs/packages/serde-util/src/timezone_datetime.rs @@ -0,0 +1,45 @@ +use chrono::Utc; +use schemars::JsonSchema; +use serde::{Deserialize, Serialize}; +use std::{fmt::Display, ops::Deref}; +use time::OffsetDateTime; +use ts_rs::TS; + +#[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, TS)] +#[ts(export, export_to = "../../../defs/")] +pub struct TimezoneDateTime( + #[ts(type = "/* TimezoneDateTime */ string")] + #[serde(with = "time::serde::iso8601")] + pub OffsetDateTime, +); + +openapi::impl_schema_from!(TimezoneDateTime, DateTimeSchema); + +#[derive(JsonSchema)] +#[schemars(rename = "TimezoneDateTime")] +struct DateTimeSchema(chrono::DateTime); + +impl Display for TimezoneDateTime { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.0.fmt(f) + } +} + +impl Deref for TimezoneDateTime { + type Target = OffsetDateTime; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl From for TimezoneDateTime { + fn from(time: time::OffsetDateTime) -> Self { + Self(time) + } +} + +impl From for time::OffsetDateTime { + fn from(date: TimezoneDateTime) -> Self { + date.0 + } +}