OCaml bindings to the Peertube ActivityPub video sharing API
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 15141 lines 669 kB view raw
1(** {1 PeerTube} 2 3 The PeerTube API is built on HTTP(S) and is RESTful. You can use your favorite 4HTTP/REST library for your programming language to use PeerTube. 5 6See the [REST API quick start](https://docs.joinpeertube.org/api/rest-getting-started) for a few 7examples of using the PeerTube API. 8 9# Authentication 10 11When you sign up for an account on a PeerTube instance, you are given the possibility 12to generate sessions on it, and authenticate there using an access token. Only __one 13access token can currently be used at a time__. 14 15## Roles 16 17Accounts are given permissions based on their role. There are three roles on 18PeerTube: Administrator, Moderator, and User. See the [roles guide](https://docs.joinpeertube.org/admin/managing-users#roles) for a detail of their permissions. 19 20# Errors 21 22The API uses standard HTTP status codes to indicate the success or failure 23of the API call, completed by a [RFC7807-compliant](https://tools.ietf.org/html/rfc7807) response body. 24 25``` 26HTTP 1.1 404 Not Found 27Content-Type: application/problem+json; charset=utf-8 28 29\{ 30 "detail": "Video not found", 31 "docs": "https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo", 32 "status": 404, 33 "title": "Not Found", 34 "type": "about:blank" 35\} 36``` 37 38We provide error `type` (following RFC7807) and `code` (internal PeerTube code) values for [a growing number of cases](https://github.com/Chocobozzz/PeerTube/blob/develop/packages/models/src/server/server-error-code.enum.ts), 39but it is still optional. Types are used to disambiguate errors that bear the same status code 40and are non-obvious: 41 42``` 43HTTP 1.1 403 Forbidden 44Content-Type: application/problem+json; charset=utf-8 45 46\{ 47 "detail": "Cannot get this video regarding follow constraints", 48 "docs": "https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo", 49 "status": 403, 50 "title": "Forbidden", 51 "type": "https://docs.joinpeertube.org/api-rest-reference.html#section/Errors/does_not_respect_follow_constraints" 52\} 53``` 54 55Here a 403 error could otherwise mean that the video is private or blocklisted. 56 57### Validation errors 58 59Each parameter is evaluated on its own against a set of rules before the route validator 60proceeds with potential testing involving parameter combinations. Errors coming from validation 61errors appear earlier and benefit from a more detailed error description: 62 63``` 64HTTP 1.1 400 Bad Request 65Content-Type: application/problem+json; charset=utf-8 66 67\{ 68 "detail": "Incorrect request parameters: id", 69 "docs": "https://docs.joinpeertube.org/api-rest-reference.html#operation/getVideo", 70 "instance": "/api/v1/videos/9c9de5e8-0a1e-484a-b099-e80766180", 71 "invalid-params": \{ 72 "id": \{ 73 "location": "params", 74 "msg": "Invalid value", 75 "param": "id", 76 "value": "9c9de5e8-0a1e-484a-b099-e80766180" 77 \} 78 \}, 79 "status": 400, 80 "title": "Bad Request", 81 "type": "about:blank" 82\} 83``` 84 85Where `id` is the name of the field concerned by the error, within the route definition. 86`invalid-params.<field>.location` can be either 'params', 'body', 'header', 'query' or 'cookies', and 87`invalid-params.<field>.value` reports the value that didn't pass validation whose `invalid-params.<field>.msg` 88is about. 89 90### Deprecated error fields 91 92Some fields could be included with previous versions. They are still included but their use is deprecated: 93- `error`: superseded by `detail` 94 95# Rate limits 96 97We are rate-limiting all endpoints of PeerTube's API. Custom values can be set by administrators: 98 99| Endpoint (prefix: `/api/v1`) | Calls | Time frame | 100|------------------------------|---------------|--------------| 101| `/*` | 50 | 10 seconds | 102| `POST /users/token` | 15 | 5 minutes | 103| `POST /users/register` | 2<sup>*</sup> | 5 minutes | 104| `POST /users/ask-send-verify-email` | 3 | 5 minutes | 105 106Depending on the endpoint, <sup>*</sup>failed requests are not taken into account. A service 107limit is announced by a `429 Too Many Requests` status code. 108 109You can get details about the current state of your rate limit by reading the 110following headers: 111 112| Header | Description | 113|-------------------------|------------------------------------------------------------| 114| `X-RateLimit-Limit` | Number of max requests allowed in the current time period | 115| `X-RateLimit-Remaining` | Number of remaining requests in the current time period | 116| `X-RateLimit-Reset` | Timestamp of end of current time period as UNIX timestamp | 117| `Retry-After` | Seconds to delay after the first `429` is received | 118 119# CORS 120 121This API features [Cross-Origin Resource Sharing (CORS)](https://fetch.spec.whatwg.org/), 122allowing cross-domain communication from the browser for some routes: 123 124| Endpoint | 125|------------------------- ---| 126| `/api/*` | 127| `/download/*` | 128| `/lazy-static/*` | 129| `/.well-known/webfinger` | 130 131In addition, all routes serving ActivityPub are CORS-enabled for all origins. 132 133 134 @version 8.0.0 *) 135 136type t = { 137 session : Requests.t; 138 base_url : string; 139} 140 141let create ?session ~sw env ~base_url = 142 let session = match session with 143 | Some s -> s 144 | None -> Requests.v ~sw env 145 in 146 { session; base_url } 147 148let base_url t = t.base_url 149let session t = t.session 150 151module VideosForXml = struct 152 module Types = struct 153 module T = struct 154 type t = Json.t 155 end 156 end 157 158 module T = struct 159 include Types.T 160 let jsont = Json.Codec.Value.t 161 let v () = Json.Null ((), Json.Meta.none) 162 end 163end 164 165module VideoUpload = struct 166 module Types = struct 167 module Response = struct 168 type t = { 169 video : Json.t option; 170 } 171 end 172 end 173 174 module Response = struct 175 include Types.Response 176 177 let v ?video () = { video } 178 179 let video t = t.video 180 181 let jsont : t Json.codec = 182 Json.Codec.Object.map ~kind:"VideoUploadResponse" 183 (fun video -> { video }) 184 |> Json.Codec.Object.opt_member "video" Json.Codec.Value.t ~enc:(fun r -> r.video) 185 |> Json.Codec.Object.skip_unknown 186 |> Json.Codec.Object.seal 187 end 188 189 (** Import a video 190 191 Import a torrent or magnetURI or HTTP resource (if enabled by the instance administrator) *) 192 let import_video client () = 193 let op_name = "import_video" in 194 let url_path = "/api/v1/videos/imports" in 195 let query = "" in 196 let url = client.base_url ^ url_path ^ query in 197 let response = 198 try Requests.post client.session url 199 with Eio.Io _ as ex -> 200 let bt = Printexc.get_raw_backtrace () in 201 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 202 in 203 if Requests.Response.ok response then 204 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 205 else 206 let body = Requests.Response.text response in 207 let parsed_body = 208 match Json.of_string Json.Codec.Value.t body with 209 | Ok json -> Some (Openapi.Runtime.Json json) 210 | Error _ -> Some (Openapi.Runtime.Raw body) 211 in 212 raise (Openapi.Runtime.Api_error { 213 operation = op_name; 214 method_ = "POST"; 215 url; 216 status = Requests.Response.status_code response; 217 body; 218 parsed_body; 219 }) 220 221 (** Create a live *) 222 let add_live client () = 223 let op_name = "add_live" in 224 let url_path = "/api/v1/videos/live" in 225 let query = "" in 226 let url = client.base_url ^ url_path ^ query in 227 let response = 228 try Requests.post client.session url 229 with Eio.Io _ as ex -> 230 let bt = Printexc.get_raw_backtrace () in 231 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 232 in 233 if Requests.Response.ok response then 234 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 235 else 236 let body = Requests.Response.text response in 237 let parsed_body = 238 match Json.of_string Json.Codec.Value.t body with 239 | Ok json -> Some (Openapi.Runtime.Json json) 240 | Error _ -> Some (Openapi.Runtime.Raw body) 241 in 242 raise (Openapi.Runtime.Api_error { 243 operation = op_name; 244 method_ = "POST"; 245 url; 246 status = Requests.Response.status_code response; 247 body; 248 parsed_body; 249 }) 250 251 (** Upload a video 252 253 Uses a single request to upload a video. *) 254 let upload_legacy client () = 255 let op_name = "upload_legacy" in 256 let url_path = "/api/v1/videos/upload" in 257 let query = "" in 258 let url = client.base_url ^ url_path ^ query in 259 let response = 260 try Requests.post client.session url 261 with Eio.Io _ as ex -> 262 let bt = Printexc.get_raw_backtrace () in 263 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 264 in 265 if Requests.Response.ok response then 266 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 267 else 268 let body = Requests.Response.text response in 269 let parsed_body = 270 match Json.of_string Json.Codec.Value.t body with 271 | Ok json -> Some (Openapi.Runtime.Json json) 272 | Error _ -> Some (Openapi.Runtime.Raw body) 273 in 274 raise (Openapi.Runtime.Api_error { 275 operation = op_name; 276 method_ = "POST"; 277 url; 278 status = Requests.Response.status_code response; 279 body; 280 parsed_body; 281 }) 282 283 (** Send chunk for the resumable upload of a video 284 285 Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the upload of a video 286 @param upload_id Created session id to proceed with. If you didn't send chunks in the last hour, it is 287 not valid anymore and you need to initialize a new upload. 288 289 *) 290 let upload_resumable ~upload_id client () = 291 let op_name = "upload_resumable" in 292 let url_path = "/api/v1/videos/upload-resumable" in 293 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"upload_id" ~value:upload_id]) in 294 let url = client.base_url ^ url_path ^ query in 295 let response = 296 try Requests.put client.session url 297 with Eio.Io _ as ex -> 298 let bt = Printexc.get_raw_backtrace () in 299 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 300 in 301 if Requests.Response.ok response then 302 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 303 else 304 let body = Requests.Response.text response in 305 let parsed_body = 306 match Json.of_string Json.Codec.Value.t body with 307 | Ok json -> Some (Openapi.Runtime.Json json) 308 | Error _ -> Some (Openapi.Runtime.Raw body) 309 in 310 raise (Openapi.Runtime.Api_error { 311 operation = op_name; 312 method_ = "PUT"; 313 url; 314 status = Requests.Response.status_code response; 315 body; 316 parsed_body; 317 }) 318end 319 320module VideoToken = struct 321 module Types = struct 322 module Response = struct 323 type t = { 324 files : Json.t option; 325 } 326 end 327 end 328 329 module Response = struct 330 include Types.Response 331 332 let v ?files () = { files } 333 334 let files t = t.files 335 336 let jsont : t Json.codec = 337 Json.Codec.Object.map ~kind:"VideoTokenResponse" 338 (fun files -> { files }) 339 |> Json.Codec.Object.opt_member "files" Json.Codec.Value.t ~enc:(fun r -> r.files) 340 |> Json.Codec.Object.skip_unknown 341 |> Json.Codec.Object.seal 342 end 343 344 (** Request video token 345 346 Request special tokens that expire quickly to use them in some context (like accessing private static files) 347 @param id The object id, uuid or short uuid 348 *) 349 let request_video_token ~id client () = 350 let op_name = "request_video_token" in 351 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/token" in 352 let query = "" in 353 let url = client.base_url ^ url_path ^ query in 354 let response = 355 try Requests.post client.session url 356 with Eio.Io _ as ex -> 357 let bt = Printexc.get_raw_backtrace () in 358 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 359 in 360 if Requests.Response.ok response then 361 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 362 else 363 let body = Requests.Response.text response in 364 let parsed_body = 365 match Json.of_string Json.Codec.Value.t body with 366 | Ok json -> Some (Openapi.Runtime.Json json) 367 | Error _ -> Some (Openapi.Runtime.Raw body) 368 in 369 raise (Openapi.Runtime.Api_error { 370 operation = op_name; 371 method_ = "POST"; 372 url; 373 status = Requests.Response.status_code response; 374 body; 375 parsed_body; 376 }) 377end 378 379module VideoStudioCreateTask = struct 380 module Types = struct 381 module T = struct 382 type t = Json.t 383 end 384 end 385 386 module T = struct 387 include Types.T 388 let jsont = Json.Codec.Value.t 389 let v () = Json.Null ((), Json.Meta.none) 390 end 391end 392 393module VideoStatsUserAgentDevice = struct 394 module Types = struct 395 module T = struct 396 type t = [ 397 | `Console 398 | `Embedded 399 | `Mobile 400 | `Smarttv 401 | `Tablet 402 | `Wearable 403 | `Xr 404 | `Desktop 405 ] 406 end 407 end 408 409 module T = struct 410 include Types.T 411 412 let jsont : t Json.codec = 413 Json.Codec.map Json.Codec.string ~kind:"VideoStatsUserAgentDevice" 414 ~dec:(function 415 | "console" -> `Console 416 | "embedded" -> `Embedded 417 | "mobile" -> `Mobile 418 | "smarttv" -> `Smarttv 419 | "tablet" -> `Tablet 420 | "wearable" -> `Wearable 421 | "xr" -> `Xr 422 | "desktop" -> `Desktop 423 | s -> Json.Error.failf Json.Meta.none "Unknown value: %s" s) 424 ~enc:(function 425 | `Console -> "console" 426 | `Embedded -> "embedded" 427 | `Mobile -> "mobile" 428 | `Smarttv -> "smarttv" 429 | `Tablet -> "tablet" 430 | `Wearable -> "wearable" 431 | `Xr -> "xr" 432 | `Desktop -> "desktop") 433 end 434end 435 436module UserViewingVideo = struct 437 module Types = struct 438 module T = struct 439 type t = { 440 client : string option; (** Client software used to watch the video. For example "Firefox", "PeerTube Approval Android", etc. 441 *) 442 current_time : int; (** timestamp within the video, in seconds *) 443 device : VideoStatsUserAgentDevice.T.t option; (** Device used to watch the video. For example "desktop", "mobile", "smarttv", etc. 444 *) 445 operating_system : string option; (** Operating system used to watch the video. For example "Windows", "Ubuntu", etc. 446 *) 447 session_id : string option; (** Optional param to represent the current viewer session. Used by the backend to properly count one view per session per video. PeerTube admin can configure the server to not trust this `sessionId` parameter but use the request IP address instead to identify a viewer. 448 *) 449 view_event : string option; (** Event since last viewing call: 450 * `seek` - If the user seeked the video 451 *) 452 } 453 end 454 end 455 456 module T = struct 457 include Types.T 458 459 let v ~current_time ?client ?device ?operating_system ?session_id ?view_event () = { client; current_time; device; operating_system; session_id; view_event } 460 461 let client t = t.client 462 let current_time t = t.current_time 463 let device t = t.device 464 let operating_system t = t.operating_system 465 let session_id t = t.session_id 466 let view_event t = t.view_event 467 468 let jsont : t Json.codec = 469 Json.Codec.Object.map ~kind:"UserViewingVideo" 470 (fun client current_time device operating_system session_id view_event -> { client; current_time; device; operating_system; session_id; view_event }) 471 |> Json.Codec.Object.opt_member "client" Json.Codec.string ~enc:(fun r -> r.client) 472 |> Json.Codec.Object.member "currentTime" Json.Codec.int ~enc:(fun r -> r.current_time) 473 |> Json.Codec.Object.opt_member "device" VideoStatsUserAgentDevice.T.jsont ~enc:(fun r -> r.device) 474 |> Json.Codec.Object.opt_member "operatingSystem" Json.Codec.string ~enc:(fun r -> r.operating_system) 475 |> Json.Codec.Object.opt_member "sessionId" Json.Codec.string ~enc:(fun r -> r.session_id) 476 |> Json.Codec.Object.opt_member "viewEvent" Json.Codec.string ~enc:(fun r -> r.view_event) 477 |> Json.Codec.Object.skip_unknown 478 |> Json.Codec.Object.seal 479 end 480end 481 482module VideoStatsUserAgent = struct 483 module Types = struct 484 module T = struct 485 type t = { 486 clients : Json.t list option; 487 devices : Json.t list option; 488 operating_system : Json.t list option; 489 } 490 end 491 end 492 493 module T = struct 494 include Types.T 495 496 let v ?clients ?devices ?operating_system () = { clients; devices; operating_system } 497 498 let clients t = t.clients 499 let devices t = t.devices 500 let operating_system t = t.operating_system 501 502 let jsont : t Json.codec = 503 Json.Codec.Object.map ~kind:"VideoStatsUserAgent" 504 (fun clients devices operating_system -> { clients; devices; operating_system }) 505 |> Json.Codec.Object.opt_member "clients" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.clients) 506 |> Json.Codec.Object.opt_member "devices" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.devices) 507 |> Json.Codec.Object.opt_member "operatingSystem" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.operating_system) 508 |> Json.Codec.Object.skip_unknown 509 |> Json.Codec.Object.seal 510 end 511 512 (** Get user agent stats of a video 513 @param id The object id, uuid or short uuid 514 @param start_date Filter stats by start date 515 @param end_date Filter stats by end date 516 *) 517 let get_api_v1_videos_stats_user_agent ~id ?start_date ?end_date client () = 518 let op_name = "get_api_v1_videos_stats_user_agent" in 519 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/stats/user-agent" in 520 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"startDate" ~value:start_date; Openapi.Runtime.Query.optional ~key:"endDate" ~value:end_date]) in 521 let url = client.base_url ^ url_path ^ query in 522 let response = 523 try Requests.get client.session url 524 with Eio.Io _ as ex -> 525 let bt = Printexc.get_raw_backtrace () in 526 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 527 in 528 if Requests.Response.ok response then 529 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 530 else 531 let body = Requests.Response.text response in 532 let parsed_body = 533 match Json.of_string Json.Codec.Value.t body with 534 | Ok json -> Some (Openapi.Runtime.Json json) 535 | Error _ -> Some (Openapi.Runtime.Raw body) 536 in 537 raise (Openapi.Runtime.Api_error { 538 operation = op_name; 539 method_ = "GET"; 540 url; 541 status = Requests.Response.status_code response; 542 body; 543 parsed_body; 544 }) 545end 546 547module VideoStatsTimeserie = struct 548 module Types = struct 549 module T = struct 550 type t = { 551 data : Json.t list option; 552 } 553 end 554 end 555 556 module T = struct 557 include Types.T 558 559 let v ?data () = { data } 560 561 let data t = t.data 562 563 let jsont : t Json.codec = 564 Json.Codec.Object.map ~kind:"VideoStatsTimeserie" 565 (fun data -> { data }) 566 |> Json.Codec.Object.opt_member "data" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.data) 567 |> Json.Codec.Object.skip_unknown 568 |> Json.Codec.Object.seal 569 end 570 571 (** Get timeserie stats of a video 572 @param id The object id, uuid or short uuid 573 @param metric The metric to get 574 @param start_date Filter stats by start date 575 @param end_date Filter stats by end date 576 *) 577 let get_api_v1_videos_stats_timeseries ~id ~metric ?start_date ?end_date client () = 578 let op_name = "get_api_v1_videos_stats_timeseries" in 579 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("metric", metric)] "/api/v1/videos/{id}/stats/timeseries/{metric}" in 580 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"startDate" ~value:start_date; Openapi.Runtime.Query.optional ~key:"endDate" ~value:end_date]) in 581 let url = client.base_url ^ url_path ^ query in 582 let response = 583 try Requests.get client.session url 584 with Eio.Io _ as ex -> 585 let bt = Printexc.get_raw_backtrace () in 586 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 587 in 588 if Requests.Response.ok response then 589 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 590 else 591 let body = Requests.Response.text response in 592 let parsed_body = 593 match Json.of_string Json.Codec.Value.t body with 594 | Ok json -> Some (Openapi.Runtime.Json json) 595 | Error _ -> Some (Openapi.Runtime.Raw body) 596 in 597 raise (Openapi.Runtime.Api_error { 598 operation = op_name; 599 method_ = "GET"; 600 url; 601 status = Requests.Response.status_code response; 602 body; 603 parsed_body; 604 }) 605end 606 607module VideoStatsRetention = struct 608 module Types = struct 609 module T = struct 610 type t = { 611 data : Json.t list option; 612 } 613 end 614 end 615 616 module T = struct 617 include Types.T 618 619 let v ?data () = { data } 620 621 let data t = t.data 622 623 let jsont : t Json.codec = 624 Json.Codec.Object.map ~kind:"VideoStatsRetention" 625 (fun data -> { data }) 626 |> Json.Codec.Object.opt_member "data" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.data) 627 |> Json.Codec.Object.skip_unknown 628 |> Json.Codec.Object.seal 629 end 630 631 (** Get retention stats of a video 632 @param id The object id, uuid or short uuid 633 *) 634 let get_api_v1_videos_stats_retention ~id client () = 635 let op_name = "get_api_v1_videos_stats_retention" in 636 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/stats/retention" in 637 let query = "" in 638 let url = client.base_url ^ url_path ^ query in 639 let response = 640 try Requests.get client.session url 641 with Eio.Io _ as ex -> 642 let bt = Printexc.get_raw_backtrace () in 643 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 644 in 645 if Requests.Response.ok response then 646 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 647 else 648 let body = Requests.Response.text response in 649 let parsed_body = 650 match Json.of_string Json.Codec.Value.t body with 651 | Ok json -> Some (Openapi.Runtime.Json json) 652 | Error _ -> Some (Openapi.Runtime.Raw body) 653 in 654 raise (Openapi.Runtime.Api_error { 655 operation = op_name; 656 method_ = "GET"; 657 url; 658 status = Requests.Response.status_code response; 659 body; 660 parsed_body; 661 }) 662end 663 664module VideoStatsOverall = struct 665 module Types = struct 666 module T = struct 667 type t = { 668 average_watch_time : float option; 669 countries : Json.t list option; 670 subdivisions : Json.t list option; 671 total_viewers : float option; 672 total_watch_time : float option; 673 viewers_peak : float option; 674 viewers_peak_date : Ptime.t option; 675 } 676 end 677 end 678 679 module T = struct 680 include Types.T 681 682 let v ?average_watch_time ?countries ?subdivisions ?total_viewers ?total_watch_time ?viewers_peak ?viewers_peak_date () = { average_watch_time; countries; subdivisions; total_viewers; total_watch_time; viewers_peak; viewers_peak_date } 683 684 let average_watch_time t = t.average_watch_time 685 let countries t = t.countries 686 let subdivisions t = t.subdivisions 687 let total_viewers t = t.total_viewers 688 let total_watch_time t = t.total_watch_time 689 let viewers_peak t = t.viewers_peak 690 let viewers_peak_date t = t.viewers_peak_date 691 692 let jsont : t Json.codec = 693 Json.Codec.Object.map ~kind:"VideoStatsOverall" 694 (fun average_watch_time countries subdivisions total_viewers total_watch_time viewers_peak viewers_peak_date -> { average_watch_time; countries; subdivisions; total_viewers; total_watch_time; viewers_peak; viewers_peak_date }) 695 |> Json.Codec.Object.opt_member "averageWatchTime" Json.Codec.number ~enc:(fun r -> r.average_watch_time) 696 |> Json.Codec.Object.opt_member "countries" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.countries) 697 |> Json.Codec.Object.opt_member "subdivisions" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.subdivisions) 698 |> Json.Codec.Object.opt_member "totalViewers" Json.Codec.number ~enc:(fun r -> r.total_viewers) 699 |> Json.Codec.Object.opt_member "totalWatchTime" Json.Codec.number ~enc:(fun r -> r.total_watch_time) 700 |> Json.Codec.Object.opt_member "viewersPeak" Json.Codec.number ~enc:(fun r -> r.viewers_peak) 701 |> Json.Codec.Object.opt_member "viewersPeakDate" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.viewers_peak_date) 702 |> Json.Codec.Object.skip_unknown 703 |> Json.Codec.Object.seal 704 end 705 706 (** Get overall stats of a video 707 @param id The object id, uuid or short uuid 708 @param start_date Filter stats by start date 709 @param end_date Filter stats by end date 710 *) 711 let get_api_v1_videos_stats_overall ~id ?start_date ?end_date client () = 712 let op_name = "get_api_v1_videos_stats_overall" in 713 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/stats/overall" in 714 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"startDate" ~value:start_date; Openapi.Runtime.Query.optional ~key:"endDate" ~value:end_date]) in 715 let url = client.base_url ^ url_path ^ query in 716 let response = 717 try Requests.get client.session url 718 with Eio.Io _ as ex -> 719 let bt = Printexc.get_raw_backtrace () in 720 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 721 in 722 if Requests.Response.ok response then 723 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 724 else 725 let body = Requests.Response.text response in 726 let parsed_body = 727 match Json.of_string Json.Codec.Value.t body with 728 | Ok json -> Some (Openapi.Runtime.Json json) 729 | Error _ -> Some (Openapi.Runtime.Raw body) 730 in 731 raise (Openapi.Runtime.Api_error { 732 operation = op_name; 733 method_ = "GET"; 734 url; 735 status = Requests.Response.status_code response; 736 body; 737 parsed_body; 738 }) 739end 740 741module VideoStateConstant = struct 742 module Types = struct 743 module T = struct 744 type t = { 745 id : int option; (** The video state: 746 - `1`: Published 747 - `2`: To transcode 748 - `3`: To import 749 - `4`: Waiting for live stream 750 - `5`: Live ended 751 - `6`: To move to an external storage (object storage...) 752 - `7`: Transcoding failed 753 - `8`: Moving to an external storage failed 754 - `9`: To edit using studio edition feature 755 *) 756 label : string option; 757 } 758 end 759 end 760 761 module T = struct 762 include Types.T 763 764 let v ?id ?label () = { id; label } 765 766 let id t = t.id 767 let label t = t.label 768 769 let jsont : t Json.codec = 770 Json.Codec.Object.map ~kind:"VideoStateConstant" 771 (fun id label -> { id; label }) 772 |> Json.Codec.Object.opt_member "id" Json.Codec.int ~enc:(fun r -> r.id) 773 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 774 |> Json.Codec.Object.skip_unknown 775 |> Json.Codec.Object.seal 776 end 777end 778 779module VideoResolutionSet = struct 780 module Types = struct 781 module T = struct 782 (** Video resolution (`0`, `240`, `360`, `720`, `1080`, `1440` or `2160`) 783 784 `0` is used as a special value for stillimage videos dedicated to audio, a.k.a. audio-only videos. 785 *) 786 type t = Json.t 787 end 788 end 789 790 module T = struct 791 include Types.T 792 let jsont = Json.Codec.Value.t 793 let v () = Json.Null ((), Json.Meta.none) 794 end 795end 796 797module VideoResolutionConstant = struct 798 module Types = struct 799 module T = struct 800 (** resolutions and their labels for the video *) 801 type t = { 802 id : VideoResolutionSet.T.t option; 803 label : string option; 804 } 805 end 806 end 807 808 module T = struct 809 include Types.T 810 811 let v ?id ?label () = { id; label } 812 813 let id t = t.id 814 let label t = t.label 815 816 let jsont : t Json.codec = 817 Json.Codec.Object.map ~kind:"VideoResolutionConstant" 818 (fun id label -> { id; label }) 819 |> Json.Codec.Object.opt_member "id" VideoResolutionSet.T.jsont ~enc:(fun r -> r.id) 820 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 821 |> Json.Codec.Object.skip_unknown 822 |> Json.Codec.Object.seal 823 end 824end 825 826module VideoSource = struct 827 module Types = struct 828 module T = struct 829 type t = { 830 created_at : Ptime.t option; 831 file_download_url : string option; (** **PeerTube >= 6.1** If enabled by the admin, the video source file is kept on the server and can be downloaded by the owner *) 832 fps : float option; (** **PeerTube >= 6.1** Frames per second of the video file *) 833 height : int option; (** **PeerTube >= 6.1** Video stream height *) 834 input_filename : string option; (** Uploaded/imported filename *) 835 resolution : VideoResolutionConstant.T.t option; (** **PeerTube >= 6.1** *) 836 size : int option; (** **PeerTube >= 6.1** Video file size in bytes *) 837 width : int option; (** **PeerTube >= 6.1** Video stream width *) 838 } 839 end 840 end 841 842 module T = struct 843 include Types.T 844 845 let v ?created_at ?file_download_url ?fps ?height ?input_filename ?resolution ?size ?width () = { created_at; file_download_url; fps; height; input_filename; resolution; size; width } 846 847 let created_at t = t.created_at 848 let file_download_url t = t.file_download_url 849 let fps t = t.fps 850 let height t = t.height 851 let input_filename t = t.input_filename 852 let resolution t = t.resolution 853 let size t = t.size 854 let width t = t.width 855 856 let jsont : t Json.codec = 857 Json.Codec.Object.map ~kind:"VideoSource" 858 (fun created_at file_download_url fps height input_filename resolution size width -> { created_at; file_download_url; fps; height; input_filename; resolution; size; width }) 859 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 860 |> Json.Codec.Object.opt_member "fileDownloadUrl" Json.Codec.string ~enc:(fun r -> r.file_download_url) 861 |> Json.Codec.Object.opt_member "fps" Json.Codec.number ~enc:(fun r -> r.fps) 862 |> Json.Codec.Object.opt_member "height" Json.Codec.int ~enc:(fun r -> r.height) 863 |> Json.Codec.Object.opt_member "inputFilename" Json.Codec.string ~enc:(fun r -> r.input_filename) 864 |> Json.Codec.Object.opt_member "resolution" VideoResolutionConstant.T.jsont ~enc:(fun r -> r.resolution) 865 |> Json.Codec.Object.opt_member "size" Json.Codec.int ~enc:(fun r -> r.size) 866 |> Json.Codec.Object.opt_member "width" Json.Codec.int ~enc:(fun r -> r.width) 867 |> Json.Codec.Object.skip_unknown 868 |> Json.Codec.Object.seal 869 end 870 871 (** Get video source file metadata 872 873 Get metadata and download link of original video file 874 @param id The object id, uuid or short uuid 875 *) 876 let get_video_source ~id client () = 877 let op_name = "get_video_source" in 878 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/source" in 879 let query = "" in 880 let url = client.base_url ^ url_path ^ query in 881 let response = 882 try Requests.get client.session url 883 with Eio.Io _ as ex -> 884 let bt = Printexc.get_raw_backtrace () in 885 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 886 in 887 if Requests.Response.ok response then 888 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 889 else 890 let body = Requests.Response.text response in 891 let parsed_body = 892 match Json.of_string Json.Codec.Value.t body with 893 | Ok json -> Some (Openapi.Runtime.Json json) 894 | Error _ -> Some (Openapi.Runtime.Raw body) 895 in 896 raise (Openapi.Runtime.Api_error { 897 operation = op_name; 898 method_ = "GET"; 899 url; 900 status = Requests.Response.status_code response; 901 body; 902 parsed_body; 903 }) 904end 905 906module VideoReplaceSourceRequestResumable = struct 907 module Types = struct 908 module T = struct 909 type t = { 910 filename : string option; (** Video filename including extension *) 911 } 912 end 913 end 914 915 module T = struct 916 include Types.T 917 918 let v ?filename () = { filename } 919 920 let filename t = t.filename 921 922 let jsont : t Json.codec = 923 Json.Codec.Object.map ~kind:"VideoReplaceSourceRequestResumable" 924 (fun filename -> { filename }) 925 |> Json.Codec.Object.opt_member "filename" Json.Codec.string ~enc:(fun r -> r.filename) 926 |> Json.Codec.Object.skip_unknown 927 |> Json.Codec.Object.seal 928 end 929end 930 931module VideoPrivacySet = struct 932 module Types = struct 933 module T = struct 934 (** privacy id of the video (see [/videos/privacies](#operation/getVideoPrivacyPolicies)) *) 935 type t = string 936 end 937 end 938 939 module T = struct 940 include Types.T 941 let jsont = Json.Codec.string 942 end 943end 944 945module VideoScheduled = struct 946 module Types = struct 947 module Update = struct 948 type t = { 949 privacy : VideoPrivacySet.T.t option; 950 update_at : Ptime.t; (** When to update the video *) 951 } 952 end 953 end 954 955 module Update = struct 956 include Types.Update 957 958 let v ~update_at ?privacy () = { privacy; update_at } 959 960 let privacy t = t.privacy 961 let update_at t = t.update_at 962 963 let jsont : t Json.codec = 964 Json.Codec.Object.map ~kind:"VideoScheduledUpdate" 965 (fun privacy update_at -> { privacy; update_at }) 966 |> Json.Codec.Object.opt_member "privacy" VideoPrivacySet.T.jsont ~enc:(fun r -> r.privacy) 967 |> Json.Codec.Object.member "updateAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.update_at) 968 |> Json.Codec.Object.skip_unknown 969 |> Json.Codec.Object.seal 970 end 971end 972 973module VideoPrivacyConstant = struct 974 module Types = struct 975 module T = struct 976 type t = { 977 id : VideoPrivacySet.T.t option; 978 label : string option; 979 } 980 end 981 end 982 983 module T = struct 984 include Types.T 985 986 let v ?id ?label () = { id; label } 987 988 let id t = t.id 989 let label t = t.label 990 991 let jsont : t Json.codec = 992 Json.Codec.Object.map ~kind:"VideoPrivacyConstant" 993 (fun id label -> { id; label }) 994 |> Json.Codec.Object.opt_member "id" VideoPrivacySet.T.jsont ~enc:(fun r -> r.id) 995 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 996 |> Json.Codec.Object.skip_unknown 997 |> Json.Codec.Object.seal 998 end 999end 1000 1001module LiveVideoReplaySettings = struct 1002 module Types = struct 1003 module T = struct 1004 type t = { 1005 privacy : VideoPrivacySet.T.t option; 1006 } 1007 end 1008 end 1009 1010 module T = struct 1011 include Types.T 1012 1013 let v ?privacy () = { privacy } 1014 1015 let privacy t = t.privacy 1016 1017 let jsont : t Json.codec = 1018 Json.Codec.Object.map ~kind:"LiveVideoReplaySettings" 1019 (fun privacy -> { privacy }) 1020 |> Json.Codec.Object.opt_member "privacy" VideoPrivacySet.T.jsont ~enc:(fun r -> r.privacy) 1021 |> Json.Codec.Object.skip_unknown 1022 |> Json.Codec.Object.seal 1023 end 1024end 1025 1026module VideoPlaylistTypeSet = struct 1027 module Types = struct 1028 module T = struct 1029 (** The video playlist type (Regular = `1`, Watch Later = `2`) *) 1030 type t = string 1031 end 1032 end 1033 1034 module T = struct 1035 include Types.T 1036 let jsont = Json.Codec.string 1037 end 1038end 1039 1040module VideoPlaylistTypeConstant = struct 1041 module Types = struct 1042 module T = struct 1043 type t = { 1044 id : VideoPlaylistTypeSet.T.t option; 1045 label : string option; 1046 } 1047 end 1048 end 1049 1050 module T = struct 1051 include Types.T 1052 1053 let v ?id ?label () = { id; label } 1054 1055 let id t = t.id 1056 let label t = t.label 1057 1058 let jsont : t Json.codec = 1059 Json.Codec.Object.map ~kind:"VideoPlaylistTypeConstant" 1060 (fun id label -> { id; label }) 1061 |> Json.Codec.Object.opt_member "id" VideoPlaylistTypeSet.T.jsont ~enc:(fun r -> r.id) 1062 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 1063 |> Json.Codec.Object.skip_unknown 1064 |> Json.Codec.Object.seal 1065 end 1066end 1067 1068module VideoPlaylistPrivacySet = struct 1069 module Types = struct 1070 module T = struct 1071 (** Video playlist privacy policy (see [/video-playlists/privacies](#operation/getPlaylistPrivacyPolicies)) *) 1072 type t = string 1073 end 1074 end 1075 1076 module T = struct 1077 include Types.T 1078 let jsont = Json.Codec.string 1079 end 1080end 1081 1082module VideoPlaylistPrivacyConstant = struct 1083 module Types = struct 1084 module T = struct 1085 type t = { 1086 id : VideoPlaylistPrivacySet.T.t option; 1087 label : string option; 1088 } 1089 end 1090 end 1091 1092 module T = struct 1093 include Types.T 1094 1095 let v ?id ?label () = { id; label } 1096 1097 let id t = t.id 1098 let label t = t.label 1099 1100 let jsont : t Json.codec = 1101 Json.Codec.Object.map ~kind:"VideoPlaylistPrivacyConstant" 1102 (fun id label -> { id; label }) 1103 |> Json.Codec.Object.opt_member "id" VideoPlaylistPrivacySet.T.jsont ~enc:(fun r -> r.id) 1104 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 1105 |> Json.Codec.Object.skip_unknown 1106 |> Json.Codec.Object.seal 1107 end 1108end 1109 1110module VideoLicenceSet = struct 1111 module Types = struct 1112 module T = struct 1113 (** licence id of the video (see [/videos/licences](#operation/getLicences)) *) 1114 type t = Json.t 1115 end 1116 end 1117 1118 module T = struct 1119 include Types.T 1120 let jsont = Json.Codec.Value.t 1121 let v () = Json.Null ((), Json.Meta.none) 1122 end 1123end 1124 1125module VideoConstantNumberLicence = struct 1126 module Types = struct 1127 module T = struct 1128 type t = { 1129 id : VideoLicenceSet.T.t option; 1130 label : string option; 1131 } 1132 end 1133 end 1134 1135 module T = struct 1136 include Types.T 1137 1138 let v ?id ?label () = { id; label } 1139 1140 let id t = t.id 1141 let label t = t.label 1142 1143 let jsont : t Json.codec = 1144 Json.Codec.Object.map ~kind:"VideoConstantNumber-Licence" 1145 (fun id label -> { id; label }) 1146 |> Json.Codec.Object.opt_member "id" VideoLicenceSet.T.jsont ~enc:(fun r -> r.id) 1147 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 1148 |> Json.Codec.Object.skip_unknown 1149 |> Json.Codec.Object.seal 1150 end 1151end 1152 1153module VideoLanguageSet = struct 1154 module Types = struct 1155 module T = struct 1156 (** language id of the video (see [/videos/languages](#operation/getLanguages)) *) 1157 type t = Json.t 1158 end 1159 end 1160 1161 module T = struct 1162 include Types.T 1163 let jsont = Json.Codec.Value.t 1164 let v () = Json.Null ((), Json.Meta.none) 1165 end 1166end 1167 1168module VideoConstantStringLanguage = struct 1169 module Types = struct 1170 module T = struct 1171 type t = { 1172 id : VideoLanguageSet.T.t option; 1173 label : string option; 1174 } 1175 end 1176 end 1177 1178 module T = struct 1179 include Types.T 1180 1181 let v ?id ?label () = { id; label } 1182 1183 let id t = t.id 1184 let label t = t.label 1185 1186 let jsont : t Json.codec = 1187 Json.Codec.Object.map ~kind:"VideoConstantString-Language" 1188 (fun id label -> { id; label }) 1189 |> Json.Codec.Object.opt_member "id" VideoLanguageSet.T.jsont ~enc:(fun r -> r.id) 1190 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 1191 |> Json.Codec.Object.skip_unknown 1192 |> Json.Codec.Object.seal 1193 end 1194end 1195 1196module VideoCaption = struct 1197 module Types = struct 1198 module T = struct 1199 type t = { 1200 automatically_generated : bool option; 1201 caption_path : string option; (** Deprecated in PeerTube v8.0, use fileUrl instead *) 1202 file_url : string option; (** **PeerTube >= 7.1** *) 1203 language : VideoConstantStringLanguage.T.t option; 1204 m3u8_url : string option; 1205 updated_at : Ptime.t option; 1206 } 1207 end 1208 end 1209 1210 module T = struct 1211 include Types.T 1212 1213 let v ?automatically_generated ?caption_path ?file_url ?language ?m3u8_url ?updated_at () = { automatically_generated; caption_path; file_url; language; m3u8_url; updated_at } 1214 1215 let automatically_generated t = t.automatically_generated 1216 let caption_path t = t.caption_path 1217 let file_url t = t.file_url 1218 let language t = t.language 1219 let m3u8_url t = t.m3u8_url 1220 let updated_at t = t.updated_at 1221 1222 let jsont : t Json.codec = 1223 Json.Codec.Object.map ~kind:"VideoCaption" 1224 (fun automatically_generated caption_path file_url language m3u8_url updated_at -> { automatically_generated; caption_path; file_url; language; m3u8_url; updated_at }) 1225 |> Json.Codec.Object.opt_member "automaticallyGenerated" Json.Codec.bool ~enc:(fun r -> r.automatically_generated) 1226 |> Json.Codec.Object.opt_member "captionPath" Json.Codec.string ~enc:(fun r -> r.caption_path) 1227 |> Json.Codec.Object.opt_member "fileUrl" Json.Codec.string ~enc:(fun r -> r.file_url) 1228 |> Json.Codec.Object.opt_member "language" VideoConstantStringLanguage.T.jsont ~enc:(fun r -> r.language) 1229 |> Json.Codec.Object.opt_member "m3u8Url" Json.Codec.string ~enc:(fun r -> r.m3u8_url) 1230 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 1231 |> Json.Codec.Object.skip_unknown 1232 |> Json.Codec.Object.seal 1233 end 1234end 1235 1236module VideoImportStateConstant = struct 1237 module Types = struct 1238 module T = struct 1239 type t = { 1240 id : int option; (** The video import state (Pending = `1`, Success = `2`, Failed = `3`) *) 1241 label : string option; 1242 } 1243 end 1244 end 1245 1246 module T = struct 1247 include Types.T 1248 1249 let v ?id ?label () = { id; label } 1250 1251 let id t = t.id 1252 let label t = t.label 1253 1254 let jsont : t Json.codec = 1255 Json.Codec.Object.map ~kind:"VideoImportStateConstant" 1256 (fun id label -> { id; label }) 1257 |> Json.Codec.Object.opt_member "id" Json.Codec.int ~enc:(fun r -> r.id) 1258 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 1259 |> Json.Codec.Object.skip_unknown 1260 |> Json.Codec.Object.seal 1261 end 1262end 1263 1264module VideoCommentsPolicySet = struct 1265 module Types = struct 1266 module T = struct 1267 (** Comments policy of the video (Enabled = `1`, Disabled = `2`, Requires Approval = `3`) *) 1268 type t = string 1269 end 1270 end 1271 1272 module T = struct 1273 include Types.T 1274 let jsont = Json.Codec.string 1275 end 1276end 1277 1278module VideoCommentsPolicyConstant = struct 1279 module Types = struct 1280 module T = struct 1281 type t = { 1282 id : VideoCommentsPolicySet.T.t option; 1283 label : string option; 1284 } 1285 end 1286 end 1287 1288 module T = struct 1289 include Types.T 1290 1291 let v ?id ?label () = { id; label } 1292 1293 let id t = t.id 1294 let label t = t.label 1295 1296 let jsont : t Json.codec = 1297 Json.Codec.Object.map ~kind:"VideoCommentsPolicyConstant" 1298 (fun id label -> { id; label }) 1299 |> Json.Codec.Object.opt_member "id" VideoCommentsPolicySet.T.jsont ~enc:(fun r -> r.id) 1300 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 1301 |> Json.Codec.Object.skip_unknown 1302 |> Json.Codec.Object.seal 1303 end 1304end 1305 1306module VideoCommentsForXml = struct 1307 module Types = struct 1308 module T = struct 1309 type t = Json.t 1310 end 1311 end 1312 1313 module T = struct 1314 include Types.T 1315 let jsont = Json.Codec.Value.t 1316 let v () = Json.Null ((), Json.Meta.none) 1317 end 1318end 1319 1320module VideoChapters = struct 1321 module Types = struct 1322 module T = struct 1323 type t = { 1324 chapters : Json.t option; 1325 } 1326 end 1327 end 1328 1329 module T = struct 1330 include Types.T 1331 1332 let v ?chapters () = { chapters } 1333 1334 let chapters t = t.chapters 1335 1336 let jsont : t Json.codec = 1337 Json.Codec.Object.map ~kind:"VideoChapters" 1338 (fun chapters -> { chapters }) 1339 |> Json.Codec.Object.opt_member "chapters" Json.Codec.Value.t ~enc:(fun r -> r.chapters) 1340 |> Json.Codec.Object.skip_unknown 1341 |> Json.Codec.Object.seal 1342 end 1343 1344 (** Get chapters of a video 1345 1346 **PeerTube >= 6.0** 1347 @param id The object id, uuid or short uuid 1348 *) 1349 let get_video_chapters ~id client () = 1350 let op_name = "get_video_chapters" in 1351 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/chapters" in 1352 let query = "" in 1353 let url = client.base_url ^ url_path ^ query in 1354 let response = 1355 try Requests.get client.session url 1356 with Eio.Io _ as ex -> 1357 let bt = Printexc.get_raw_backtrace () in 1358 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 1359 in 1360 if Requests.Response.ok response then 1361 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 1362 else 1363 let body = Requests.Response.text response in 1364 let parsed_body = 1365 match Json.of_string Json.Codec.Value.t body with 1366 | Ok json -> Some (Openapi.Runtime.Json json) 1367 | Error _ -> Some (Openapi.Runtime.Raw body) 1368 in 1369 raise (Openapi.Runtime.Api_error { 1370 operation = op_name; 1371 method_ = "GET"; 1372 url; 1373 status = Requests.Response.status_code response; 1374 body; 1375 parsed_body; 1376 }) 1377end 1378 1379module VideoChannelEdit = struct 1380 module Types = struct 1381 module T = struct 1382 type t = { 1383 description : Json.t option; (** Channel description *) 1384 display_name : Json.t option; (** Channel display name *) 1385 support : Json.t option; (** How to support/fund the channel *) 1386 } 1387 end 1388 end 1389 1390 module T = struct 1391 include Types.T 1392 1393 let v ?description ?display_name ?support () = { description; display_name; support } 1394 1395 let description t = t.description 1396 let display_name t = t.display_name 1397 let support t = t.support 1398 1399 let jsont : t Json.codec = 1400 Json.Codec.Object.map ~kind:"VideoChannelEdit" 1401 (fun description display_name support -> { description; display_name; support }) 1402 |> Json.Codec.Object.opt_member "description" Json.Codec.Value.t ~enc:(fun r -> r.description) 1403 |> Json.Codec.Object.opt_member "displayName" Json.Codec.Value.t ~enc:(fun r -> r.display_name) 1404 |> Json.Codec.Object.opt_member "support" Json.Codec.Value.t ~enc:(fun r -> r.support) 1405 |> Json.Codec.Object.skip_unknown 1406 |> Json.Codec.Object.seal 1407 end 1408end 1409 1410module VideoChannelCollaboratorState = struct 1411 module Types = struct 1412 module T = struct 1413 (** The user import state: 1414 - `1`: Pending 1415 - `2`: Accepted 1416 *) 1417 type t = string 1418 end 1419 end 1420 1421 module T = struct 1422 include Types.T 1423 let jsont = Json.Codec.string 1424 end 1425end 1426 1427module VideoChannelActivityTarget = struct 1428 module Types = struct 1429 module T = struct 1430 (** The activity target: 1431 - VIDEO: 1, 1432 - PLAYLIST: 2, 1433 - CHANNEL: 3, 1434 - CHANNEL_SYNC: 4, 1435 - VIDEO_IMPORT: 5 1436 *) 1437 type t = string 1438 end 1439 end 1440 1441 module T = struct 1442 include Types.T 1443 let jsont = Json.Codec.string 1444 end 1445end 1446 1447module VideoChannelActivityAction = struct 1448 module Types = struct 1449 module T = struct 1450 (** The activity action: 1451 - CREATE: 1 1452 - UPDATE: 2 1453 - DELETE: 3 1454 - UPDATE_CAPTIONS: 4 1455 - UPDATE_CHAPTERS: 5 1456 - UPDATE_PASSWORDS: 6 1457 - CREATE_STUDIO_TASKS: 7 1458 - UPDATE_SOURCE_FILE: 8 1459 - UPDATE_ELEMENTS: 9 1460 - REMOVE_CHANNEL_OWNERSHIP: 10 1461 - CREATE_CHANNEL_OWNERSHIP: 11 1462 *) 1463 type t = string 1464 end 1465 end 1466 1467 module T = struct 1468 include Types.T 1469 let jsont = Json.Codec.string 1470 end 1471end 1472 1473module VideoCategorySet = struct 1474 module Types = struct 1475 module T = struct 1476 (** category id of the video (see [/videos/categories](#operation/getCategories)) *) 1477 type t = Json.t 1478 end 1479 end 1480 1481 module T = struct 1482 include Types.T 1483 let jsont = Json.Codec.Value.t 1484 let v () = Json.Null ((), Json.Meta.none) 1485 end 1486end 1487 1488module VideoConstantNumberCategory = struct 1489 module Types = struct 1490 module T = struct 1491 type t = { 1492 id : VideoCategorySet.T.t option; 1493 label : string option; 1494 } 1495 end 1496 end 1497 1498 module T = struct 1499 include Types.T 1500 1501 let v ?id ?label () = { id; label } 1502 1503 let id t = t.id 1504 let label t = t.label 1505 1506 let jsont : t Json.codec = 1507 Json.Codec.Object.map ~kind:"VideoConstantNumber-Category" 1508 (fun id label -> { id; label }) 1509 |> Json.Codec.Object.opt_member "id" VideoCategorySet.T.jsont ~enc:(fun r -> r.id) 1510 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 1511 |> Json.Codec.Object.skip_unknown 1512 |> Json.Codec.Object.seal 1513 end 1514end 1515 1516module Uuidv4 = struct 1517 module Types = struct 1518 module T = struct 1519 type t = Json.t 1520 end 1521 end 1522 1523 module T = struct 1524 include Types.T 1525 let jsont = Json.Codec.Value.t 1526 let v () = Json.Null ((), Json.Meta.none) 1527 end 1528end 1529 1530module UsernameChannel = struct 1531 module Types = struct 1532 module T = struct 1533 (** immutable name of the channel, used to interact with its actor *) 1534 type t = Json.t 1535 end 1536 end 1537 1538 module T = struct 1539 include Types.T 1540 let jsont = Json.Codec.Value.t 1541 let v () = Json.Null ((), Json.Meta.none) 1542 end 1543end 1544 1545module Username = struct 1546 module Types = struct 1547 module T = struct 1548 (** immutable name of the user, used to find or mention its actor *) 1549 type t = Json.t 1550 end 1551 end 1552 1553 module T = struct 1554 include Types.T 1555 let jsont = Json.Codec.Value.t 1556 let v () = Json.Null ((), Json.Meta.none) 1557 end 1558end 1559 1560module UserRole = struct 1561 module Types = struct 1562 module T = struct 1563 (** The user role (Admin = `0`, Moderator = `1`, User = `2`) *) 1564 type t = string 1565 end 1566 end 1567 1568 module T = struct 1569 include Types.T 1570 let jsont = Json.Codec.string 1571 end 1572end 1573 1574module UserRegistrationAcceptOrReject = struct 1575 module Types = struct 1576 module T = struct 1577 type t = { 1578 moderation_response : string; (** Moderation response to send to the user *) 1579 prevent_email_delivery : bool option; (** Set it to true if you don't want PeerTube to send an email to the user *) 1580 } 1581 end 1582 end 1583 1584 module T = struct 1585 include Types.T 1586 1587 let v ~moderation_response ?prevent_email_delivery () = { moderation_response; prevent_email_delivery } 1588 1589 let moderation_response t = t.moderation_response 1590 let prevent_email_delivery t = t.prevent_email_delivery 1591 1592 let jsont : t Json.codec = 1593 Json.Codec.Object.map ~kind:"UserRegistrationAcceptOrReject" 1594 (fun moderation_response prevent_email_delivery -> { moderation_response; prevent_email_delivery }) 1595 |> Json.Codec.Object.member "moderationResponse" Json.Codec.string ~enc:(fun r -> r.moderation_response) 1596 |> Json.Codec.Object.opt_member "preventEmailDelivery" Json.Codec.bool ~enc:(fun r -> r.prevent_email_delivery) 1597 |> Json.Codec.Object.skip_unknown 1598 |> Json.Codec.Object.seal 1599 end 1600end 1601 1602module UserImportState = struct 1603 module Types = struct 1604 module T = struct 1605 (** The user import state: 1606 - `1`: Pending 1607 - `2`: Processing 1608 - `3`: Completed 1609 - `4`: Errored 1610 *) 1611 type t = string 1612 end 1613 end 1614 1615 module T = struct 1616 include Types.T 1617 let jsont = Json.Codec.string 1618 end 1619end 1620 1621module UserImportResumable = struct 1622 module Types = struct 1623 module T = struct 1624 type t = { 1625 filename : string option; (** Archive filename including extension *) 1626 } 1627 end 1628 end 1629 1630 module T = struct 1631 include Types.T 1632 1633 let v ?filename () = { filename } 1634 1635 let filename t = t.filename 1636 1637 let jsont : t Json.codec = 1638 Json.Codec.Object.map ~kind:"UserImportResumable" 1639 (fun filename -> { filename }) 1640 |> Json.Codec.Object.opt_member "filename" Json.Codec.string ~enc:(fun r -> r.filename) 1641 |> Json.Codec.Object.skip_unknown 1642 |> Json.Codec.Object.seal 1643 end 1644end 1645 1646module UserExportState = struct 1647 module Types = struct 1648 module T = struct 1649 (** The user export state: 1650 - `1`: Pending 1651 - `2`: Processing 1652 - `3`: Completed 1653 - `4`: Errored 1654 *) 1655 type t = string 1656 end 1657 end 1658 1659 module T = struct 1660 include Types.T 1661 let jsont = Json.Codec.string 1662 end 1663end 1664 1665module UserAdminFlags = struct 1666 module Types = struct 1667 module T = struct 1668 (** Admin flags for the user (None = `0`, Bypass video blocklist = `1`) *) 1669 type t = string 1670 end 1671 end 1672 1673 module T = struct 1674 include Types.T 1675 let jsont = Json.Codec.string 1676 end 1677end 1678 1679module TokenSession = struct 1680 module Types = struct 1681 module T = struct 1682 type t = { 1683 created_at : Ptime.t option; 1684 current_session : bool option; (** Is this session the current one? *) 1685 id : int option; 1686 last_activity_date : Ptime.t option; 1687 last_activity_device : string option; 1688 last_activity_ip : string option; 1689 login_date : Ptime.t option; (** Date of the login *) 1690 login_device : string option; (** Device used to login *) 1691 login_ip : string option; (** IP address used to login *) 1692 } 1693 end 1694 end 1695 1696 module T = struct 1697 include Types.T 1698 1699 let v ?created_at ?current_session ?id ?last_activity_date ?last_activity_device ?last_activity_ip ?login_date ?login_device ?login_ip () = { created_at; current_session; id; last_activity_date; last_activity_device; last_activity_ip; login_date; login_device; login_ip } 1700 1701 let created_at t = t.created_at 1702 let current_session t = t.current_session 1703 let id t = t.id 1704 let last_activity_date t = t.last_activity_date 1705 let last_activity_device t = t.last_activity_device 1706 let last_activity_ip t = t.last_activity_ip 1707 let login_date t = t.login_date 1708 let login_device t = t.login_device 1709 let login_ip t = t.login_ip 1710 1711 let jsont : t Json.codec = 1712 Json.Codec.Object.map ~kind:"TokenSession" 1713 (fun created_at current_session id last_activity_date last_activity_device last_activity_ip login_date login_device login_ip -> { created_at; current_session; id; last_activity_date; last_activity_device; last_activity_ip; login_date; login_device; login_ip }) 1714 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 1715 |> Json.Codec.Object.opt_member "currentSession" Json.Codec.bool ~enc:(fun r -> r.current_session) 1716 |> Json.Codec.Object.opt_member "id" Json.Codec.int ~enc:(fun r -> r.id) 1717 |> Json.Codec.Object.opt_member "lastActivityDate" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.last_activity_date) 1718 |> Json.Codec.Object.opt_member "lastActivityDevice" Json.Codec.string ~enc:(fun r -> r.last_activity_device) 1719 |> Json.Codec.Object.opt_member "lastActivityIP" Json.Codec.string ~enc:(fun r -> r.last_activity_ip) 1720 |> Json.Codec.Object.opt_member "loginDate" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.login_date) 1721 |> Json.Codec.Object.opt_member "loginDevice" Json.Codec.string ~enc:(fun r -> r.login_device) 1722 |> Json.Codec.Object.opt_member "loginIP" Json.Codec.string ~enc:(fun r -> r.login_ip) 1723 |> Json.Codec.Object.skip_unknown 1724 |> Json.Codec.Object.seal 1725 end 1726end 1727 1728module Storyboard = struct 1729 module Types = struct 1730 module T = struct 1731 type t = { 1732 file_url : string option; (** **PeerTube >= 7.1** *) 1733 sprite_duration : int option; 1734 sprite_height : int option; 1735 sprite_width : int option; 1736 storyboard_path : string option; (** Deprecated in PeerTube v8.0, use fileUrl instead *) 1737 total_height : int option; 1738 total_width : int option; 1739 } 1740 end 1741 end 1742 1743 module T = struct 1744 include Types.T 1745 1746 let v ?file_url ?sprite_duration ?sprite_height ?sprite_width ?storyboard_path ?total_height ?total_width () = { file_url; sprite_duration; sprite_height; sprite_width; storyboard_path; total_height; total_width } 1747 1748 let file_url t = t.file_url 1749 let sprite_duration t = t.sprite_duration 1750 let sprite_height t = t.sprite_height 1751 let sprite_width t = t.sprite_width 1752 let storyboard_path t = t.storyboard_path 1753 let total_height t = t.total_height 1754 let total_width t = t.total_width 1755 1756 let jsont : t Json.codec = 1757 Json.Codec.Object.map ~kind:"Storyboard" 1758 (fun file_url sprite_duration sprite_height sprite_width storyboard_path total_height total_width -> { file_url; sprite_duration; sprite_height; sprite_width; storyboard_path; total_height; total_width }) 1759 |> Json.Codec.Object.opt_member "fileUrl" Json.Codec.string ~enc:(fun r -> r.file_url) 1760 |> Json.Codec.Object.opt_member "spriteDuration" Json.Codec.int ~enc:(fun r -> r.sprite_duration) 1761 |> Json.Codec.Object.opt_member "spriteHeight" Json.Codec.int ~enc:(fun r -> r.sprite_height) 1762 |> Json.Codec.Object.opt_member "spriteWidth" Json.Codec.int ~enc:(fun r -> r.sprite_width) 1763 |> Json.Codec.Object.opt_member "storyboardPath" Json.Codec.string ~enc:(fun r -> r.storyboard_path) 1764 |> Json.Codec.Object.opt_member "totalHeight" Json.Codec.int ~enc:(fun r -> r.total_height) 1765 |> Json.Codec.Object.opt_member "totalWidth" Json.Codec.int ~enc:(fun r -> r.total_width) 1766 |> Json.Codec.Object.skip_unknown 1767 |> Json.Codec.Object.seal 1768 end 1769end 1770 1771module ShortUuid = struct 1772 module Types = struct 1773 module T = struct 1774 (** translation of a uuid v4 with a bigger alphabet to have a shorter uuid *) 1775 type t = Json.t 1776 end 1777 end 1778 1779 module T = struct 1780 include Types.T 1781 let jsont = Json.Codec.Value.t 1782 let v () = Json.Null ((), Json.Meta.none) 1783 end 1784end 1785 1786module ServerStats = struct 1787 module Types = struct 1788 module T = struct 1789 type t = { 1790 activity_pub_messages_processed_per_second : float option; 1791 average_abuse_response_time_ms : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled abuses stats *) 1792 average_registration_request_response_time_ms : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled registration requests stats *) 1793 total_abuses : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled abuses stats *) 1794 total_abuses_processed : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled abuses stats *) 1795 total_activity_pub_messages_errors : float option; 1796 total_activity_pub_messages_processed : float option; 1797 total_activity_pub_messages_successes : float option; 1798 total_activity_pub_messages_waiting : float option; 1799 total_admins : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled total admins stats *) 1800 total_daily_active_users : float option; 1801 total_instance_followers : float option; 1802 total_instance_following : float option; 1803 total_local_daily_active_video_channels : float option; 1804 total_local_monthly_active_video_channels : float option; 1805 total_local_playlists : float option; 1806 total_local_video_channels : float option; 1807 total_local_video_comments : float option; (** Total comments made by local users *) 1808 total_local_video_files_size : float option; 1809 total_local_video_views : float option; (** Total video views made on the instance *) 1810 total_local_videos : float option; 1811 total_local_weekly_active_video_channels : float option; 1812 total_moderators : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled total moderators stats *) 1813 total_monthly_active_users : float option; 1814 total_registration_requests : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled registration requests stats *) 1815 total_registration_requests_processed : float option; (** **PeerTube >= 6.1** Value is null if the admin disabled registration requests stats *) 1816 total_users : float option; 1817 total_video_comments : float option; 1818 total_videos : float option; 1819 total_weekly_active_users : float option; 1820 videos_redundancy : Json.t list option; 1821 } 1822 end 1823 end 1824 1825 module T = struct 1826 include Types.T 1827 1828 let v ?activity_pub_messages_processed_per_second ?average_abuse_response_time_ms ?average_registration_request_response_time_ms ?total_abuses ?total_abuses_processed ?total_activity_pub_messages_errors ?total_activity_pub_messages_processed ?total_activity_pub_messages_successes ?total_activity_pub_messages_waiting ?total_admins ?total_daily_active_users ?total_instance_followers ?total_instance_following ?total_local_daily_active_video_channels ?total_local_monthly_active_video_channels ?total_local_playlists ?total_local_video_channels ?total_local_video_comments ?total_local_video_files_size ?total_local_video_views ?total_local_videos ?total_local_weekly_active_video_channels ?total_moderators ?total_monthly_active_users ?total_registration_requests ?total_registration_requests_processed ?total_users ?total_video_comments ?total_videos ?total_weekly_active_users ?videos_redundancy () = { activity_pub_messages_processed_per_second; average_abuse_response_time_ms; average_registration_request_response_time_ms; total_abuses; total_abuses_processed; total_activity_pub_messages_errors; total_activity_pub_messages_processed; total_activity_pub_messages_successes; total_activity_pub_messages_waiting; total_admins; total_daily_active_users; total_instance_followers; total_instance_following; total_local_daily_active_video_channels; total_local_monthly_active_video_channels; total_local_playlists; total_local_video_channels; total_local_video_comments; total_local_video_files_size; total_local_video_views; total_local_videos; total_local_weekly_active_video_channels; total_moderators; total_monthly_active_users; total_registration_requests; total_registration_requests_processed; total_users; total_video_comments; total_videos; total_weekly_active_users; videos_redundancy } 1829 1830 let activity_pub_messages_processed_per_second t = t.activity_pub_messages_processed_per_second 1831 let average_abuse_response_time_ms t = t.average_abuse_response_time_ms 1832 let average_registration_request_response_time_ms t = t.average_registration_request_response_time_ms 1833 let total_abuses t = t.total_abuses 1834 let total_abuses_processed t = t.total_abuses_processed 1835 let total_activity_pub_messages_errors t = t.total_activity_pub_messages_errors 1836 let total_activity_pub_messages_processed t = t.total_activity_pub_messages_processed 1837 let total_activity_pub_messages_successes t = t.total_activity_pub_messages_successes 1838 let total_activity_pub_messages_waiting t = t.total_activity_pub_messages_waiting 1839 let total_admins t = t.total_admins 1840 let total_daily_active_users t = t.total_daily_active_users 1841 let total_instance_followers t = t.total_instance_followers 1842 let total_instance_following t = t.total_instance_following 1843 let total_local_daily_active_video_channels t = t.total_local_daily_active_video_channels 1844 let total_local_monthly_active_video_channels t = t.total_local_monthly_active_video_channels 1845 let total_local_playlists t = t.total_local_playlists 1846 let total_local_video_channels t = t.total_local_video_channels 1847 let total_local_video_comments t = t.total_local_video_comments 1848 let total_local_video_files_size t = t.total_local_video_files_size 1849 let total_local_video_views t = t.total_local_video_views 1850 let total_local_videos t = t.total_local_videos 1851 let total_local_weekly_active_video_channels t = t.total_local_weekly_active_video_channels 1852 let total_moderators t = t.total_moderators 1853 let total_monthly_active_users t = t.total_monthly_active_users 1854 let total_registration_requests t = t.total_registration_requests 1855 let total_registration_requests_processed t = t.total_registration_requests_processed 1856 let total_users t = t.total_users 1857 let total_video_comments t = t.total_video_comments 1858 let total_videos t = t.total_videos 1859 let total_weekly_active_users t = t.total_weekly_active_users 1860 let videos_redundancy t = t.videos_redundancy 1861 1862 let jsont : t Json.codec = 1863 Json.Codec.Object.map ~kind:"ServerStats" 1864 (fun activity_pub_messages_processed_per_second average_abuse_response_time_ms average_registration_request_response_time_ms total_abuses total_abuses_processed total_activity_pub_messages_errors total_activity_pub_messages_processed total_activity_pub_messages_successes total_activity_pub_messages_waiting total_admins total_daily_active_users total_instance_followers total_instance_following total_local_daily_active_video_channels total_local_monthly_active_video_channels total_local_playlists total_local_video_channels total_local_video_comments total_local_video_files_size total_local_video_views total_local_videos total_local_weekly_active_video_channels total_moderators total_monthly_active_users total_registration_requests total_registration_requests_processed total_users total_video_comments total_videos total_weekly_active_users videos_redundancy -> { activity_pub_messages_processed_per_second; average_abuse_response_time_ms; average_registration_request_response_time_ms; total_abuses; total_abuses_processed; total_activity_pub_messages_errors; total_activity_pub_messages_processed; total_activity_pub_messages_successes; total_activity_pub_messages_waiting; total_admins; total_daily_active_users; total_instance_followers; total_instance_following; total_local_daily_active_video_channels; total_local_monthly_active_video_channels; total_local_playlists; total_local_video_channels; total_local_video_comments; total_local_video_files_size; total_local_video_views; total_local_videos; total_local_weekly_active_video_channels; total_moderators; total_monthly_active_users; total_registration_requests; total_registration_requests_processed; total_users; total_video_comments; total_videos; total_weekly_active_users; videos_redundancy }) 1865 |> Json.Codec.Object.opt_member "activityPubMessagesProcessedPerSecond" Json.Codec.number ~enc:(fun r -> r.activity_pub_messages_processed_per_second) 1866 |> Json.Codec.Object.opt_member "averageAbuseResponseTimeMs" Json.Codec.number ~enc:(fun r -> r.average_abuse_response_time_ms) 1867 |> Json.Codec.Object.opt_member "averageRegistrationRequestResponseTimeMs" Json.Codec.number ~enc:(fun r -> r.average_registration_request_response_time_ms) 1868 |> Json.Codec.Object.opt_member "totalAbuses" Json.Codec.number ~enc:(fun r -> r.total_abuses) 1869 |> Json.Codec.Object.opt_member "totalAbusesProcessed" Json.Codec.number ~enc:(fun r -> r.total_abuses_processed) 1870 |> Json.Codec.Object.opt_member "totalActivityPubMessagesErrors" Json.Codec.number ~enc:(fun r -> r.total_activity_pub_messages_errors) 1871 |> Json.Codec.Object.opt_member "totalActivityPubMessagesProcessed" Json.Codec.number ~enc:(fun r -> r.total_activity_pub_messages_processed) 1872 |> Json.Codec.Object.opt_member "totalActivityPubMessagesSuccesses" Json.Codec.number ~enc:(fun r -> r.total_activity_pub_messages_successes) 1873 |> Json.Codec.Object.opt_member "totalActivityPubMessagesWaiting" Json.Codec.number ~enc:(fun r -> r.total_activity_pub_messages_waiting) 1874 |> Json.Codec.Object.opt_member "totalAdmins" Json.Codec.number ~enc:(fun r -> r.total_admins) 1875 |> Json.Codec.Object.opt_member "totalDailyActiveUsers" Json.Codec.number ~enc:(fun r -> r.total_daily_active_users) 1876 |> Json.Codec.Object.opt_member "totalInstanceFollowers" Json.Codec.number ~enc:(fun r -> r.total_instance_followers) 1877 |> Json.Codec.Object.opt_member "totalInstanceFollowing" Json.Codec.number ~enc:(fun r -> r.total_instance_following) 1878 |> Json.Codec.Object.opt_member "totalLocalDailyActiveVideoChannels" Json.Codec.number ~enc:(fun r -> r.total_local_daily_active_video_channels) 1879 |> Json.Codec.Object.opt_member "totalLocalMonthlyActiveVideoChannels" Json.Codec.number ~enc:(fun r -> r.total_local_monthly_active_video_channels) 1880 |> Json.Codec.Object.opt_member "totalLocalPlaylists" Json.Codec.number ~enc:(fun r -> r.total_local_playlists) 1881 |> Json.Codec.Object.opt_member "totalLocalVideoChannels" Json.Codec.number ~enc:(fun r -> r.total_local_video_channels) 1882 |> Json.Codec.Object.opt_member "totalLocalVideoComments" Json.Codec.number ~enc:(fun r -> r.total_local_video_comments) 1883 |> Json.Codec.Object.opt_member "totalLocalVideoFilesSize" Json.Codec.number ~enc:(fun r -> r.total_local_video_files_size) 1884 |> Json.Codec.Object.opt_member "totalLocalVideoViews" Json.Codec.number ~enc:(fun r -> r.total_local_video_views) 1885 |> Json.Codec.Object.opt_member "totalLocalVideos" Json.Codec.number ~enc:(fun r -> r.total_local_videos) 1886 |> Json.Codec.Object.opt_member "totalLocalWeeklyActiveVideoChannels" Json.Codec.number ~enc:(fun r -> r.total_local_weekly_active_video_channels) 1887 |> Json.Codec.Object.opt_member "totalModerators" Json.Codec.number ~enc:(fun r -> r.total_moderators) 1888 |> Json.Codec.Object.opt_member "totalMonthlyActiveUsers" Json.Codec.number ~enc:(fun r -> r.total_monthly_active_users) 1889 |> Json.Codec.Object.opt_member "totalRegistrationRequests" Json.Codec.number ~enc:(fun r -> r.total_registration_requests) 1890 |> Json.Codec.Object.opt_member "totalRegistrationRequestsProcessed" Json.Codec.number ~enc:(fun r -> r.total_registration_requests_processed) 1891 |> Json.Codec.Object.opt_member "totalUsers" Json.Codec.number ~enc:(fun r -> r.total_users) 1892 |> Json.Codec.Object.opt_member "totalVideoComments" Json.Codec.number ~enc:(fun r -> r.total_video_comments) 1893 |> Json.Codec.Object.opt_member "totalVideos" Json.Codec.number ~enc:(fun r -> r.total_videos) 1894 |> Json.Codec.Object.opt_member "totalWeeklyActiveUsers" Json.Codec.number ~enc:(fun r -> r.total_weekly_active_users) 1895 |> Json.Codec.Object.opt_member "videosRedundancy" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.videos_redundancy) 1896 |> Json.Codec.Object.skip_unknown 1897 |> Json.Codec.Object.seal 1898 end 1899 1900 (** Get instance stats 1901 1902 Get instance public statistics. This endpoint is cached. *) 1903 let get_instance_stats client () = 1904 let op_name = "get_instance_stats" in 1905 let url_path = "/api/v1/server/stats" in 1906 let query = "" in 1907 let url = client.base_url ^ url_path ^ query in 1908 let response = 1909 try Requests.get client.session url 1910 with Eio.Io _ as ex -> 1911 let bt = Printexc.get_raw_backtrace () in 1912 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 1913 in 1914 if Requests.Response.ok response then 1915 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 1916 else 1917 let body = Requests.Response.text response in 1918 let parsed_body = 1919 match Json.of_string Json.Codec.Value.t body with 1920 | Ok json -> Some (Openapi.Runtime.Json json) 1921 | Error _ -> Some (Openapi.Runtime.Raw body) 1922 in 1923 raise (Openapi.Runtime.Api_error { 1924 operation = op_name; 1925 method_ = "GET"; 1926 url; 1927 status = Requests.Response.status_code response; 1928 body; 1929 parsed_body; 1930 }) 1931end 1932 1933module ServerError = struct 1934 module Types = struct 1935 module T = struct 1936 type t = { 1937 code : string option; 1938 detail : string option; 1939 status : int option; 1940 type_ : string option; 1941 } 1942 end 1943 end 1944 1945 module T = struct 1946 include Types.T 1947 1948 let v ?code ?detail ?status ?type_ () = { code; detail; status; type_ } 1949 1950 let code t = t.code 1951 let detail t = t.detail 1952 let status t = t.status 1953 let type_ t = t.type_ 1954 1955 let jsont : t Json.codec = 1956 Json.Codec.Object.map ~kind:"ServerError" 1957 (fun code detail status type_ -> { code; detail; status; type_ }) 1958 |> Json.Codec.Object.opt_member "code" Json.Codec.string ~enc:(fun r -> r.code) 1959 |> Json.Codec.Object.opt_member "detail" Json.Codec.string ~enc:(fun r -> r.detail) 1960 |> Json.Codec.Object.opt_member "status" Json.Codec.int ~enc:(fun r -> r.status) 1961 |> Json.Codec.Object.opt_member "type" Json.Codec.string ~enc:(fun r -> r.type_) 1962 |> Json.Codec.Object.skip_unknown 1963 |> Json.Codec.Object.seal 1964 end 1965end 1966 1967module ServerConfigCustom = struct 1968 module Types = struct 1969 module T = struct 1970 type t = { 1971 admin : Json.t option; 1972 auto_blacklist : Json.t option; 1973 cache : Json.t option; 1974 contact_form : Json.t option; 1975 defaults : Json.t option; 1976 followers : Json.t option; 1977 import : Json.t option; 1978 instance : Json.t option; 1979 services : Json.t option; 1980 signup : Json.t option; 1981 storyboard : Json.t option; 1982 theme : Json.t option; 1983 transcoding : Json.t option; (** Settings pertaining to transcoding jobs *) 1984 user : Json.t option; (** Settings that apply to new users, if registration is enabled *) 1985 } 1986 end 1987 end 1988 1989 module T = struct 1990 include Types.T 1991 1992 let v ?admin ?auto_blacklist ?cache ?contact_form ?defaults ?followers ?import ?instance ?services ?signup ?storyboard ?theme ?transcoding ?user () = { admin; auto_blacklist; cache; contact_form; defaults; followers; import; instance; services; signup; storyboard; theme; transcoding; user } 1993 1994 let admin t = t.admin 1995 let auto_blacklist t = t.auto_blacklist 1996 let cache t = t.cache 1997 let contact_form t = t.contact_form 1998 let defaults t = t.defaults 1999 let followers t = t.followers 2000 let import t = t.import 2001 let instance t = t.instance 2002 let services t = t.services 2003 let signup t = t.signup 2004 let storyboard t = t.storyboard 2005 let theme t = t.theme 2006 let transcoding t = t.transcoding 2007 let user t = t.user 2008 2009 let jsont : t Json.codec = 2010 Json.Codec.Object.map ~kind:"ServerConfigCustom" 2011 (fun admin auto_blacklist cache contact_form defaults followers import instance services signup storyboard theme transcoding user -> { admin; auto_blacklist; cache; contact_form; defaults; followers; import; instance; services; signup; storyboard; theme; transcoding; user }) 2012 |> Json.Codec.Object.opt_member "admin" Json.Codec.Value.t ~enc:(fun r -> r.admin) 2013 |> Json.Codec.Object.opt_member "autoBlacklist" Json.Codec.Value.t ~enc:(fun r -> r.auto_blacklist) 2014 |> Json.Codec.Object.opt_member "cache" Json.Codec.Value.t ~enc:(fun r -> r.cache) 2015 |> Json.Codec.Object.opt_member "contactForm" Json.Codec.Value.t ~enc:(fun r -> r.contact_form) 2016 |> Json.Codec.Object.opt_member "defaults" Json.Codec.Value.t ~enc:(fun r -> r.defaults) 2017 |> Json.Codec.Object.opt_member "followers" Json.Codec.Value.t ~enc:(fun r -> r.followers) 2018 |> Json.Codec.Object.opt_member "import" Json.Codec.Value.t ~enc:(fun r -> r.import) 2019 |> Json.Codec.Object.opt_member "instance" Json.Codec.Value.t ~enc:(fun r -> r.instance) 2020 |> Json.Codec.Object.opt_member "services" Json.Codec.Value.t ~enc:(fun r -> r.services) 2021 |> Json.Codec.Object.opt_member "signup" Json.Codec.Value.t ~enc:(fun r -> r.signup) 2022 |> Json.Codec.Object.opt_member "storyboard" Json.Codec.Value.t ~enc:(fun r -> r.storyboard) 2023 |> Json.Codec.Object.opt_member "theme" Json.Codec.Value.t ~enc:(fun r -> r.theme) 2024 |> Json.Codec.Object.opt_member "transcoding" Json.Codec.Value.t ~enc:(fun r -> r.transcoding) 2025 |> Json.Codec.Object.opt_member "user" Json.Codec.Value.t ~enc:(fun r -> r.user) 2026 |> Json.Codec.Object.skip_unknown 2027 |> Json.Codec.Object.seal 2028 end 2029 2030 (** Get instance runtime configuration *) 2031 let get_custom_config client () = 2032 let op_name = "get_custom_config" in 2033 let url_path = "/api/v1/config/custom" in 2034 let query = "" in 2035 let url = client.base_url ^ url_path ^ query in 2036 let response = 2037 try Requests.get client.session url 2038 with Eio.Io _ as ex -> 2039 let bt = Printexc.get_raw_backtrace () in 2040 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 2041 in 2042 if Requests.Response.ok response then 2043 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 2044 else 2045 let body = Requests.Response.text response in 2046 let parsed_body = 2047 match Json.of_string Json.Codec.Value.t body with 2048 | Ok json -> Some (Openapi.Runtime.Json json) 2049 | Error _ -> Some (Openapi.Runtime.Raw body) 2050 in 2051 raise (Openapi.Runtime.Api_error { 2052 operation = op_name; 2053 method_ = "GET"; 2054 url; 2055 status = Requests.Response.status_code response; 2056 body; 2057 parsed_body; 2058 }) 2059end 2060 2061module ServerConfigAbout = struct 2062 module Types = struct 2063 module T = struct 2064 type t = { 2065 instance : Json.t option; 2066 } 2067 end 2068 end 2069 2070 module T = struct 2071 include Types.T 2072 2073 let v ?instance () = { instance } 2074 2075 let instance t = t.instance 2076 2077 let jsont : t Json.codec = 2078 Json.Codec.Object.map ~kind:"ServerConfigAbout" 2079 (fun instance -> { instance }) 2080 |> Json.Codec.Object.opt_member "instance" Json.Codec.Value.t ~enc:(fun r -> r.instance) 2081 |> Json.Codec.Object.skip_unknown 2082 |> Json.Codec.Object.seal 2083 end 2084 2085 (** Get instance "About" information *) 2086 let get_about client () = 2087 let op_name = "get_about" in 2088 let url_path = "/api/v1/config/about" in 2089 let query = "" in 2090 let url = client.base_url ^ url_path ^ query in 2091 let response = 2092 try Requests.get client.session url 2093 with Eio.Io _ as ex -> 2094 let bt = Printexc.get_raw_backtrace () in 2095 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 2096 in 2097 if Requests.Response.ok response then 2098 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 2099 else 2100 let body = Requests.Response.text response in 2101 let parsed_body = 2102 match Json.of_string Json.Codec.Value.t body with 2103 | Ok json -> Some (Openapi.Runtime.Json json) 2104 | Error _ -> Some (Openapi.Runtime.Raw body) 2105 in 2106 raise (Openapi.Runtime.Api_error { 2107 operation = op_name; 2108 method_ = "GET"; 2109 url; 2110 status = Requests.Response.status_code response; 2111 body; 2112 parsed_body; 2113 }) 2114end 2115 2116module Server = struct 2117 module Types = struct 2118 module Config = struct 2119 type t = { 2120 auto_blacklist : Json.t option; 2121 avatar : Json.t option; 2122 contact_form : Json.t option; 2123 email : Json.t option; 2124 export : Json.t option; 2125 federation : Json.t option; 2126 followings : Json.t option; 2127 homepage : Json.t option; 2128 import : Json.t option; 2129 instance : Json.t option; 2130 open_telemetry : Json.t option; (** PeerTube >= 6.1 *) 2131 plugin : Json.t option; 2132 search : Json.t option; 2133 server_commit : string option; 2134 server_version : string option; 2135 signup : Json.t option; 2136 theme : Json.t option; 2137 tracker : Json.t option; 2138 transcoding : Json.t option; 2139 trending : Json.t option; 2140 user : Json.t option; 2141 video : Json.t option; 2142 video_caption : Json.t option; 2143 views : Json.t option; (** PeerTube >= 6.1 *) 2144 } 2145 end 2146 end 2147 2148 module Config = struct 2149 include Types.Config 2150 2151 let v ?auto_blacklist ?avatar ?contact_form ?email ?export ?federation ?followings ?homepage ?import ?instance ?open_telemetry ?plugin ?search ?server_commit ?server_version ?signup ?theme ?tracker ?transcoding ?trending ?user ?video ?video_caption ?views () = { auto_blacklist; avatar; contact_form; email; export; federation; followings; homepage; import; instance; open_telemetry; plugin; search; server_commit; server_version; signup; theme; tracker; transcoding; trending; user; video; video_caption; views } 2152 2153 let auto_blacklist t = t.auto_blacklist 2154 let avatar t = t.avatar 2155 let contact_form t = t.contact_form 2156 let email t = t.email 2157 let export t = t.export 2158 let federation t = t.federation 2159 let followings t = t.followings 2160 let homepage t = t.homepage 2161 let import t = t.import 2162 let instance t = t.instance 2163 let open_telemetry t = t.open_telemetry 2164 let plugin t = t.plugin 2165 let search t = t.search 2166 let server_commit t = t.server_commit 2167 let server_version t = t.server_version 2168 let signup t = t.signup 2169 let theme t = t.theme 2170 let tracker t = t.tracker 2171 let transcoding t = t.transcoding 2172 let trending t = t.trending 2173 let user t = t.user 2174 let video t = t.video 2175 let video_caption t = t.video_caption 2176 let views t = t.views 2177 2178 let jsont : t Json.codec = 2179 Json.Codec.Object.map ~kind:"ServerConfig" 2180 (fun auto_blacklist avatar contact_form email export federation followings homepage import instance open_telemetry plugin search server_commit server_version signup theme tracker transcoding trending user video video_caption views -> { auto_blacklist; avatar; contact_form; email; export; federation; followings; homepage; import; instance; open_telemetry; plugin; search; server_commit; server_version; signup; theme; tracker; transcoding; trending; user; video; video_caption; views }) 2181 |> Json.Codec.Object.opt_member "autoBlacklist" Json.Codec.Value.t ~enc:(fun r -> r.auto_blacklist) 2182 |> Json.Codec.Object.opt_member "avatar" Json.Codec.Value.t ~enc:(fun r -> r.avatar) 2183 |> Json.Codec.Object.opt_member "contactForm" Json.Codec.Value.t ~enc:(fun r -> r.contact_form) 2184 |> Json.Codec.Object.opt_member "email" Json.Codec.Value.t ~enc:(fun r -> r.email) 2185 |> Json.Codec.Object.opt_member "export" Json.Codec.Value.t ~enc:(fun r -> r.export) 2186 |> Json.Codec.Object.opt_member "federation" Json.Codec.Value.t ~enc:(fun r -> r.federation) 2187 |> Json.Codec.Object.opt_member "followings" Json.Codec.Value.t ~enc:(fun r -> r.followings) 2188 |> Json.Codec.Object.opt_member "homepage" Json.Codec.Value.t ~enc:(fun r -> r.homepage) 2189 |> Json.Codec.Object.opt_member "import" Json.Codec.Value.t ~enc:(fun r -> r.import) 2190 |> Json.Codec.Object.opt_member "instance" Json.Codec.Value.t ~enc:(fun r -> r.instance) 2191 |> Json.Codec.Object.opt_member "openTelemetry" Json.Codec.Value.t ~enc:(fun r -> r.open_telemetry) 2192 |> Json.Codec.Object.opt_member "plugin" Json.Codec.Value.t ~enc:(fun r -> r.plugin) 2193 |> Json.Codec.Object.opt_member "search" Json.Codec.Value.t ~enc:(fun r -> r.search) 2194 |> Json.Codec.Object.opt_member "serverCommit" Json.Codec.string ~enc:(fun r -> r.server_commit) 2195 |> Json.Codec.Object.opt_member "serverVersion" Json.Codec.string ~enc:(fun r -> r.server_version) 2196 |> Json.Codec.Object.opt_member "signup" Json.Codec.Value.t ~enc:(fun r -> r.signup) 2197 |> Json.Codec.Object.opt_member "theme" Json.Codec.Value.t ~enc:(fun r -> r.theme) 2198 |> Json.Codec.Object.opt_member "tracker" Json.Codec.Value.t ~enc:(fun r -> r.tracker) 2199 |> Json.Codec.Object.opt_member "transcoding" Json.Codec.Value.t ~enc:(fun r -> r.transcoding) 2200 |> Json.Codec.Object.opt_member "trending" Json.Codec.Value.t ~enc:(fun r -> r.trending) 2201 |> Json.Codec.Object.opt_member "user" Json.Codec.Value.t ~enc:(fun r -> r.user) 2202 |> Json.Codec.Object.opt_member "video" Json.Codec.Value.t ~enc:(fun r -> r.video) 2203 |> Json.Codec.Object.opt_member "videoCaption" Json.Codec.Value.t ~enc:(fun r -> r.video_caption) 2204 |> Json.Codec.Object.opt_member "views" Json.Codec.Value.t ~enc:(fun r -> r.views) 2205 |> Json.Codec.Object.skip_unknown 2206 |> Json.Codec.Object.seal 2207 end 2208 2209 (** Get instance public configuration *) 2210 let get_config client () = 2211 let op_name = "get_config" in 2212 let url_path = "/api/v1/config" in 2213 let query = "" in 2214 let url = client.base_url ^ url_path ^ query in 2215 let response = 2216 try Requests.get client.session url 2217 with Eio.Io _ as ex -> 2218 let bt = Printexc.get_raw_backtrace () in 2219 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 2220 in 2221 if Requests.Response.ok response then 2222 Openapi.Runtime.Json.decode_json_exn Config.jsont (Requests.Response.text response) 2223 else 2224 let body = Requests.Response.text response in 2225 let parsed_body = 2226 match Json.of_string Json.Codec.Value.t body with 2227 | Ok json -> Some (Openapi.Runtime.Json json) 2228 | Error _ -> Some (Openapi.Runtime.Raw body) 2229 in 2230 raise (Openapi.Runtime.Api_error { 2231 operation = op_name; 2232 method_ = "GET"; 2233 url; 2234 status = Requests.Response.status_code response; 2235 body; 2236 parsed_body; 2237 }) 2238end 2239 2240module SendClientLog = struct 2241 module Types = struct 2242 module T = struct 2243 type t = { 2244 level : Json.t; 2245 message : string; 2246 meta : string option; (** Additional information regarding this log *) 2247 stack_trace : string option; (** Stack trace of the error if there is one *) 2248 url : string; (** URL of the current user page *) 2249 user_agent : string option; (** User agent of the web browser that sends the message *) 2250 } 2251 end 2252 end 2253 2254 module T = struct 2255 include Types.T 2256 2257 let v ~level ~message ~url ?meta ?stack_trace ?user_agent () = { level; message; meta; stack_trace; url; user_agent } 2258 2259 let level t = t.level 2260 let message t = t.message 2261 let meta t = t.meta 2262 let stack_trace t = t.stack_trace 2263 let url t = t.url 2264 let user_agent t = t.user_agent 2265 2266 let jsont : t Json.codec = 2267 Json.Codec.Object.map ~kind:"SendClientLog" 2268 (fun level message meta stack_trace url user_agent -> { level; message; meta; stack_trace; url; user_agent }) 2269 |> Json.Codec.Object.member "level" Json.Codec.Value.t ~enc:(fun r -> r.level) 2270 |> Json.Codec.Object.member "message" Json.Codec.string ~enc:(fun r -> r.message) 2271 |> Json.Codec.Object.opt_member "meta" Json.Codec.string ~enc:(fun r -> r.meta) 2272 |> Json.Codec.Object.opt_member "stackTrace" Json.Codec.string ~enc:(fun r -> r.stack_trace) 2273 |> Json.Codec.Object.member "url" Json.Codec.string ~enc:(fun r -> r.url) 2274 |> Json.Codec.Object.opt_member "userAgent" Json.Codec.string ~enc:(fun r -> r.user_agent) 2275 |> Json.Codec.Object.skip_unknown 2276 |> Json.Codec.Object.seal 2277 end 2278end 2279 2280module RunnerRegistrationToken = struct 2281 module Types = struct 2282 module T = struct 2283 type t = { 2284 created_at : Ptime.t option; 2285 id : int option; 2286 registered_runners_count : int option; 2287 registration_token : string option; 2288 updated_at : Ptime.t option; 2289 } 2290 end 2291 end 2292 2293 module T = struct 2294 include Types.T 2295 2296 let v ?created_at ?id ?registered_runners_count ?registration_token ?updated_at () = { created_at; id; registered_runners_count; registration_token; updated_at } 2297 2298 let created_at t = t.created_at 2299 let id t = t.id 2300 let registered_runners_count t = t.registered_runners_count 2301 let registration_token t = t.registration_token 2302 let updated_at t = t.updated_at 2303 2304 let jsont : t Json.codec = 2305 Json.Codec.Object.map ~kind:"RunnerRegistrationToken" 2306 (fun created_at id registered_runners_count registration_token updated_at -> { created_at; id; registered_runners_count; registration_token; updated_at }) 2307 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 2308 |> Json.Codec.Object.opt_member "id" Json.Codec.int ~enc:(fun r -> r.id) 2309 |> Json.Codec.Object.opt_member "registeredRunnersCount" Json.Codec.int ~enc:(fun r -> r.registered_runners_count) 2310 |> Json.Codec.Object.opt_member "registrationToken" Json.Codec.string ~enc:(fun r -> r.registration_token) 2311 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 2312 |> Json.Codec.Object.skip_unknown 2313 |> Json.Codec.Object.seal 2314 end 2315end 2316 2317module RunnerJobState = struct 2318 module Types = struct 2319 module T = struct 2320 (** The runner job state: 2321 - `1` Pending 2322 - `2` Processing 2323 - `3` Completed 2324 - `4` Errored 2325 - `5` Waiting for a parent job 2326 - `6` Cancelled 2327 - `7` Parent had an error 2328 - `8` Parent has been cancelled 2329 *) 2330 type t = string 2331 end 2332 end 2333 2334 module T = struct 2335 include Types.T 2336 let jsont = Json.Codec.string 2337 end 2338end 2339 2340module RunnerJobStateConstant = struct 2341 module Types = struct 2342 module T = struct 2343 type t = { 2344 id : RunnerJobState.T.t option; 2345 label : string option; 2346 } 2347 end 2348 end 2349 2350 module T = struct 2351 include Types.T 2352 2353 let v ?id ?label () = { id; label } 2354 2355 let id t = t.id 2356 let label t = t.label 2357 2358 let jsont : t Json.codec = 2359 Json.Codec.Object.map ~kind:"RunnerJobStateConstant" 2360 (fun id label -> { id; label }) 2361 |> Json.Codec.Object.opt_member "id" RunnerJobState.T.jsont ~enc:(fun r -> r.id) 2362 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 2363 |> Json.Codec.Object.skip_unknown 2364 |> Json.Codec.Object.seal 2365 end 2366end 2367 2368module RunnerJobPayload = struct 2369 module Types = struct 2370 module T = struct 2371 type t = Json.t 2372 end 2373 end 2374 2375 module T = struct 2376 include Types.T 2377 let jsont = Json.Codec.Value.t 2378 let v () = Json.Null ((), Json.Meta.none) 2379 end 2380end 2381 2382module RunnerJob = struct 2383 module Types = struct 2384 module Type = struct 2385 type t = [ 2386 | `Vod_web_video_transcoding 2387 | `Vod_hls_transcoding 2388 | `Vod_audio_merge_transcoding 2389 | `Live_rtmp_hls_transcoding 2390 ] 2391 end 2392 2393 module T = struct 2394 type t = { 2395 created_at : Ptime.t option; 2396 error : string option; (** Error message if the job is errored *) 2397 failures : int option; (** Number of times a remote runner failed to process this job. After too many failures, the job in "error" state *) 2398 finished_at : Ptime.t option; 2399 parent : Json.t option; (** If job has a parent job *) 2400 payload : RunnerJobPayload.T.t option; 2401 priority : int option; (** Job priority (less has more priority) *) 2402 progress : int option; (** Percentage progress *) 2403 runner : Json.t option; (** If job is associated to a runner *) 2404 started_at : Ptime.t option; 2405 state : RunnerJobStateConstant.T.t option; 2406 type_ : Type.t option; 2407 updated_at : Ptime.t option; 2408 uuid : Uuidv4.T.t option; 2409 } 2410 end 2411 end 2412 2413 module Type = struct 2414 include Types.Type 2415 2416 let jsont : t Json.codec = 2417 Json.Codec.map Json.Codec.string ~kind:"RunnerJobType" 2418 ~dec:(function 2419 | "vod-web-video-transcoding" -> `Vod_web_video_transcoding 2420 | "vod-hls-transcoding" -> `Vod_hls_transcoding 2421 | "vod-audio-merge-transcoding" -> `Vod_audio_merge_transcoding 2422 | "live-rtmp-hls-transcoding" -> `Live_rtmp_hls_transcoding 2423 | s -> Json.Error.failf Json.Meta.none "Unknown value: %s" s) 2424 ~enc:(function 2425 | `Vod_web_video_transcoding -> "vod-web-video-transcoding" 2426 | `Vod_hls_transcoding -> "vod-hls-transcoding" 2427 | `Vod_audio_merge_transcoding -> "vod-audio-merge-transcoding" 2428 | `Live_rtmp_hls_transcoding -> "live-rtmp-hls-transcoding") 2429 end 2430 2431 module T = struct 2432 include Types.T 2433 2434 let v ?created_at ?error ?failures ?finished_at ?parent ?payload ?priority ?progress ?runner ?started_at ?state ?type_ ?updated_at ?uuid () = { created_at; error; failures; finished_at; parent; payload; priority; progress; runner; started_at; state; type_; updated_at; uuid } 2435 2436 let created_at t = t.created_at 2437 let error t = t.error 2438 let failures t = t.failures 2439 let finished_at t = t.finished_at 2440 let parent t = t.parent 2441 let payload t = t.payload 2442 let priority t = t.priority 2443 let progress t = t.progress 2444 let runner t = t.runner 2445 let started_at t = t.started_at 2446 let state t = t.state 2447 let type_ t = t.type_ 2448 let updated_at t = t.updated_at 2449 let uuid t = t.uuid 2450 2451 let jsont : t Json.codec = 2452 Json.Codec.Object.map ~kind:"RunnerJob" 2453 (fun created_at error failures finished_at parent payload priority progress runner started_at state type_ updated_at uuid -> { created_at; error; failures; finished_at; parent; payload; priority; progress; runner; started_at; state; type_; updated_at; uuid }) 2454 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 2455 |> Json.Codec.Object.member "error" Openapi.Runtime.nullable_string 2456 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.error) 2457 |> Json.Codec.Object.opt_member "failures" Json.Codec.int ~enc:(fun r -> r.failures) 2458 |> Json.Codec.Object.opt_member "finishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.finished_at) 2459 |> Json.Codec.Object.member "parent" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 2460 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.parent) 2461 |> Json.Codec.Object.opt_member "payload" RunnerJobPayload.T.jsont ~enc:(fun r -> r.payload) 2462 |> Json.Codec.Object.opt_member "priority" Json.Codec.int ~enc:(fun r -> r.priority) 2463 |> Json.Codec.Object.opt_member "progress" Json.Codec.int ~enc:(fun r -> r.progress) 2464 |> Json.Codec.Object.member "runner" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 2465 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.runner) 2466 |> Json.Codec.Object.opt_member "startedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.started_at) 2467 |> Json.Codec.Object.opt_member "state" RunnerJobStateConstant.T.jsont ~enc:(fun r -> r.state) 2468 |> Json.Codec.Object.opt_member "type" Type.jsont ~enc:(fun r -> r.type_) 2469 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 2470 |> Json.Codec.Object.opt_member "uuid" Uuidv4.T.jsont ~enc:(fun r -> r.uuid) 2471 |> Json.Codec.Object.skip_unknown 2472 |> Json.Codec.Object.seal 2473 end 2474end 2475 2476module RunnerJobAdmin = struct 2477 module Types = struct 2478 module T = struct 2479 type t = { 2480 created_at : Ptime.t option; 2481 error : string option; (** Error message if the job is errored *) 2482 failures : int option; (** Number of times a remote runner failed to process this job. After too many failures, the job in "error" state *) 2483 finished_at : Ptime.t option; 2484 parent : Json.t option; (** If job has a parent job *) 2485 payload : RunnerJobPayload.T.t option; 2486 priority : int option; (** Job priority (less has more priority) *) 2487 progress : int option; (** Percentage progress *) 2488 runner : Json.t option; (** If job is associated to a runner *) 2489 started_at : Ptime.t option; 2490 state : RunnerJobStateConstant.T.t option; 2491 type_ : RunnerJob.Type.t option; 2492 updated_at : Ptime.t option; 2493 uuid : Uuidv4.T.t option; 2494 private_payload : Json.t option; 2495 } 2496 end 2497 end 2498 2499 module T = struct 2500 include Types.T 2501 2502 let v ?created_at ?error ?failures ?finished_at ?parent ?payload ?priority ?progress ?runner ?started_at ?state ?type_ ?updated_at ?uuid ?private_payload () = { created_at; error; failures; finished_at; parent; payload; priority; progress; runner; started_at; state; type_; updated_at; uuid; private_payload } 2503 2504 let created_at t = t.created_at 2505 let error t = t.error 2506 let failures t = t.failures 2507 let finished_at t = t.finished_at 2508 let parent t = t.parent 2509 let payload t = t.payload 2510 let priority t = t.priority 2511 let progress t = t.progress 2512 let runner t = t.runner 2513 let started_at t = t.started_at 2514 let state t = t.state 2515 let type_ t = t.type_ 2516 let updated_at t = t.updated_at 2517 let uuid t = t.uuid 2518 let private_payload t = t.private_payload 2519 2520 let jsont : t Json.codec = 2521 Json.Codec.Object.map ~kind:"RunnerJobAdmin" 2522 (fun created_at error failures finished_at parent payload priority progress runner started_at state type_ updated_at uuid private_payload -> { created_at; error; failures; finished_at; parent; payload; priority; progress; runner; started_at; state; type_; updated_at; uuid; private_payload }) 2523 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 2524 |> Json.Codec.Object.member "error" Openapi.Runtime.nullable_string 2525 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.error) 2526 |> Json.Codec.Object.opt_member "failures" Json.Codec.int ~enc:(fun r -> r.failures) 2527 |> Json.Codec.Object.opt_member "finishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.finished_at) 2528 |> Json.Codec.Object.member "parent" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 2529 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.parent) 2530 |> Json.Codec.Object.opt_member "payload" RunnerJobPayload.T.jsont ~enc:(fun r -> r.payload) 2531 |> Json.Codec.Object.opt_member "priority" Json.Codec.int ~enc:(fun r -> r.priority) 2532 |> Json.Codec.Object.opt_member "progress" Json.Codec.int ~enc:(fun r -> r.progress) 2533 |> Json.Codec.Object.member "runner" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 2534 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.runner) 2535 |> Json.Codec.Object.opt_member "startedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.started_at) 2536 |> Json.Codec.Object.opt_member "state" RunnerJobStateConstant.T.jsont ~enc:(fun r -> r.state) 2537 |> Json.Codec.Object.opt_member "type" RunnerJob.Type.jsont ~enc:(fun r -> r.type_) 2538 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 2539 |> Json.Codec.Object.opt_member "uuid" Uuidv4.T.jsont ~enc:(fun r -> r.uuid) 2540 |> Json.Codec.Object.opt_member "privatePayload" Json.Codec.Value.t ~enc:(fun r -> r.private_payload) 2541 |> Json.Codec.Object.skip_unknown 2542 |> Json.Codec.Object.seal 2543 end 2544end 2545 2546module Runner = struct 2547 module Types = struct 2548 module T = struct 2549 type t = { 2550 created_at : Ptime.t option; 2551 description : string option; 2552 id : int option; 2553 ip : string option; 2554 last_contact : Ptime.t option; 2555 name : string option; 2556 updated_at : Ptime.t option; 2557 } 2558 end 2559 end 2560 2561 module T = struct 2562 include Types.T 2563 2564 let v ?created_at ?description ?id ?ip ?last_contact ?name ?updated_at () = { created_at; description; id; ip; last_contact; name; updated_at } 2565 2566 let created_at t = t.created_at 2567 let description t = t.description 2568 let id t = t.id 2569 let ip t = t.ip 2570 let last_contact t = t.last_contact 2571 let name t = t.name 2572 let updated_at t = t.updated_at 2573 2574 let jsont : t Json.codec = 2575 Json.Codec.Object.map ~kind:"Runner" 2576 (fun created_at description id ip last_contact name updated_at -> { created_at; description; id; ip; last_contact; name; updated_at }) 2577 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 2578 |> Json.Codec.Object.opt_member "description" Json.Codec.string ~enc:(fun r -> r.description) 2579 |> Json.Codec.Object.opt_member "id" Json.Codec.int ~enc:(fun r -> r.id) 2580 |> Json.Codec.Object.opt_member "ip" Json.Codec.string ~enc:(fun r -> r.ip) 2581 |> Json.Codec.Object.opt_member "lastContact" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.last_contact) 2582 |> Json.Codec.Object.opt_member "name" Json.Codec.string ~enc:(fun r -> r.name) 2583 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 2584 |> Json.Codec.Object.skip_unknown 2585 |> Json.Codec.Object.seal 2586 end 2587end 2588 2589module RequestTwoFactor = struct 2590 module Types = struct 2591 module Response = struct 2592 type t = { 2593 otp_request : Json.t option; 2594 } 2595 end 2596 end 2597 2598 module Response = struct 2599 include Types.Response 2600 2601 let v ?otp_request () = { otp_request } 2602 2603 let otp_request t = t.otp_request 2604 2605 let jsont : t Json.codec = 2606 Json.Codec.Object.map ~kind:"RequestTwoFactorResponse" 2607 (fun otp_request -> { otp_request }) 2608 |> Json.Codec.Object.opt_member "otpRequest" Json.Codec.Value.t ~enc:(fun r -> r.otp_request) 2609 |> Json.Codec.Object.skip_unknown 2610 |> Json.Codec.Object.seal 2611 end 2612 2613 (** Request two factor auth 2614 2615 Request two factor authentication for a user 2616 @param id Entity id 2617 *) 2618 let request_two_factor ~id client () = 2619 let op_name = "request_two_factor" in 2620 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}/two-factor/request" in 2621 let query = "" in 2622 let url = client.base_url ^ url_path ^ query in 2623 let response = 2624 try Requests.post client.session url 2625 with Eio.Io _ as ex -> 2626 let bt = Printexc.get_raw_backtrace () in 2627 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 2628 in 2629 if Requests.Response.ok response then 2630 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 2631 else 2632 let body = Requests.Response.text response in 2633 let parsed_body = 2634 match Json.of_string Json.Codec.Value.t body with 2635 | Ok json -> Some (Openapi.Runtime.Json json) 2636 | Error _ -> Some (Openapi.Runtime.Raw body) 2637 in 2638 raise (Openapi.Runtime.Api_error { 2639 operation = op_name; 2640 method_ = "POST"; 2641 url; 2642 status = Requests.Response.status_code response; 2643 body; 2644 parsed_body; 2645 }) 2646end 2647 2648module PredefinedAbuseReasons = struct 2649 module Types = struct 2650 module T = struct 2651 (** Reason categories that help triage reports *) 2652 type t = Json.t 2653 end 2654 end 2655 2656 module T = struct 2657 include Types.T 2658 let jsont = Json.Codec.Value.t 2659 let v () = Json.Null ((), Json.Meta.none) 2660 end 2661end 2662 2663module Plugin = struct 2664 module Types = struct 2665 module T = struct 2666 type t = { 2667 created_at : Ptime.t option; 2668 description : string option; 2669 enabled : bool option; 2670 homepage : string option; 2671 latest_version : string option; 2672 name : string option; 2673 peertube_engine : string option; 2674 settings : Json.t option; 2675 type_ : int option; (** - `1`: PLUGIN 2676 - `2`: THEME 2677 *) 2678 uninstalled : bool option; 2679 updated_at : Ptime.t option; 2680 version : string option; 2681 } 2682 end 2683 2684 module Response = struct 2685 type t = { 2686 data : T.t list option; 2687 total : int option; 2688 } 2689 end 2690 end 2691 2692 module T = struct 2693 include Types.T 2694 2695 let v ?created_at ?description ?enabled ?homepage ?latest_version ?name ?peertube_engine ?settings ?type_ ?uninstalled ?updated_at ?version () = { created_at; description; enabled; homepage; latest_version; name; peertube_engine; settings; type_; uninstalled; updated_at; version } 2696 2697 let created_at t = t.created_at 2698 let description t = t.description 2699 let enabled t = t.enabled 2700 let homepage t = t.homepage 2701 let latest_version t = t.latest_version 2702 let name t = t.name 2703 let peertube_engine t = t.peertube_engine 2704 let settings t = t.settings 2705 let type_ t = t.type_ 2706 let uninstalled t = t.uninstalled 2707 let updated_at t = t.updated_at 2708 let version t = t.version 2709 2710 let jsont : t Json.codec = 2711 Json.Codec.Object.map ~kind:"Plugin" 2712 (fun created_at description enabled homepage latest_version name peertube_engine settings type_ uninstalled updated_at version -> { created_at; description; enabled; homepage; latest_version; name; peertube_engine; settings; type_; uninstalled; updated_at; version }) 2713 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 2714 |> Json.Codec.Object.opt_member "description" Json.Codec.string ~enc:(fun r -> r.description) 2715 |> Json.Codec.Object.opt_member "enabled" Json.Codec.bool ~enc:(fun r -> r.enabled) 2716 |> Json.Codec.Object.opt_member "homepage" Json.Codec.string ~enc:(fun r -> r.homepage) 2717 |> Json.Codec.Object.opt_member "latestVersion" Json.Codec.string ~enc:(fun r -> r.latest_version) 2718 |> Json.Codec.Object.opt_member "name" Json.Codec.string ~enc:(fun r -> r.name) 2719 |> Json.Codec.Object.opt_member "peertubeEngine" Json.Codec.string ~enc:(fun r -> r.peertube_engine) 2720 |> Json.Codec.Object.opt_member "settings" Json.Codec.Value.t ~enc:(fun r -> r.settings) 2721 |> Json.Codec.Object.opt_member "type" Json.Codec.int ~enc:(fun r -> r.type_) 2722 |> Json.Codec.Object.opt_member "uninstalled" Json.Codec.bool ~enc:(fun r -> r.uninstalled) 2723 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 2724 |> Json.Codec.Object.opt_member "version" Json.Codec.string ~enc:(fun r -> r.version) 2725 |> Json.Codec.Object.skip_unknown 2726 |> Json.Codec.Object.seal 2727 end 2728 2729 module Response = struct 2730 include Types.Response 2731 2732 let v ?data ?total () = { data; total } 2733 2734 let data t = t.data 2735 let total t = t.total 2736 2737 let jsont : t Json.codec = 2738 Json.Codec.Object.map ~kind:"PluginResponse" 2739 (fun data total -> { data; total }) 2740 |> Json.Codec.Object.opt_member "data" (Openapi.Runtime.validated_list ~max_items:100 T.jsont) ~enc:(fun r -> r.data) 2741 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 2742 |> Json.Codec.Object.skip_unknown 2743 |> Json.Codec.Object.seal 2744 end 2745 2746 (** List plugins 2747 @param start Offset used to paginate results 2748 @param count Number of items to return 2749 @param sort Sort column 2750 *) 2751 let get_plugins ?plugin_type ?uninstalled ?start ?count ?sort client () = 2752 let op_name = "get_plugins" in 2753 let url_path = "/api/v1/plugins" in 2754 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"pluginType" ~value:plugin_type; Openapi.Runtime.Query.optional ~key:"uninstalled" ~value:uninstalled; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 2755 let url = client.base_url ^ url_path ^ query in 2756 let response = 2757 try Requests.get client.session url 2758 with Eio.Io _ as ex -> 2759 let bt = Printexc.get_raw_backtrace () in 2760 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 2761 in 2762 if Requests.Response.ok response then 2763 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 2764 else 2765 let body = Requests.Response.text response in 2766 let parsed_body = 2767 match Json.of_string Json.Codec.Value.t body with 2768 | Ok json -> Some (Openapi.Runtime.Json json) 2769 | Error _ -> Some (Openapi.Runtime.Raw body) 2770 in 2771 raise (Openapi.Runtime.Api_error { 2772 operation = op_name; 2773 method_ = "GET"; 2774 url; 2775 status = Requests.Response.status_code response; 2776 body; 2777 parsed_body; 2778 }) 2779 2780 (** List available plugins 2781 @param start Offset used to paginate results 2782 @param count Number of items to return 2783 @param sort Sort column 2784 *) 2785 let get_available_plugins ?search ?plugin_type ?current_peer_tube_engine ?start ?count ?sort client () = 2786 let op_name = "get_available_plugins" in 2787 let url_path = "/api/v1/plugins/available" in 2788 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"pluginType" ~value:plugin_type; Openapi.Runtime.Query.optional ~key:"currentPeerTubeEngine" ~value:current_peer_tube_engine; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 2789 let url = client.base_url ^ url_path ^ query in 2790 let response = 2791 try Requests.get client.session url 2792 with Eio.Io _ as ex -> 2793 let bt = Printexc.get_raw_backtrace () in 2794 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 2795 in 2796 if Requests.Response.ok response then 2797 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 2798 else 2799 let body = Requests.Response.text response in 2800 let parsed_body = 2801 match Json.of_string Json.Codec.Value.t body with 2802 | Ok json -> Some (Openapi.Runtime.Json json) 2803 | Error _ -> Some (Openapi.Runtime.Raw body) 2804 in 2805 raise (Openapi.Runtime.Api_error { 2806 operation = op_name; 2807 method_ = "GET"; 2808 url; 2809 status = Requests.Response.status_code response; 2810 body; 2811 parsed_body; 2812 }) 2813 2814 (** Get a plugin 2815 @param npm_name name of the plugin/theme on npmjs.com or in its package.json 2816 *) 2817 let get_plugin ~npm_name client () = 2818 let op_name = "get_plugin" in 2819 let url_path = Openapi.Runtime.Path.render ~params:[("npmName", npm_name)] "/api/v1/plugins/{npmName}" in 2820 let query = "" in 2821 let url = client.base_url ^ url_path ^ query in 2822 let response = 2823 try Requests.get client.session url 2824 with Eio.Io _ as ex -> 2825 let bt = Printexc.get_raw_backtrace () in 2826 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 2827 in 2828 if Requests.Response.ok response then 2829 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 2830 else 2831 let body = Requests.Response.text response in 2832 let parsed_body = 2833 match Json.of_string Json.Codec.Value.t body with 2834 | Ok json -> Some (Openapi.Runtime.Json json) 2835 | Error _ -> Some (Openapi.Runtime.Raw body) 2836 in 2837 raise (Openapi.Runtime.Api_error { 2838 operation = op_name; 2839 method_ = "GET"; 2840 url; 2841 status = Requests.Response.status_code response; 2842 body; 2843 parsed_body; 2844 }) 2845end 2846 2847module PlayerThemeVideoSetting = struct 2848 module Types = struct 2849 module T = struct 2850 (** Player theme setting for a video: 2851 - `channel-default` Use the channel default theme 2852 - `instance-default` Use the instance default theme 2853 - `galaxy` Use the galaxy theme 2854 - `lucide` Use the lucide theme 2855 *) 2856 type t = [ 2857 | `Channel_default 2858 | `Instance_default 2859 | `Galaxy 2860 | `Lucide 2861 ] 2862 end 2863 end 2864 2865 module T = struct 2866 include Types.T 2867 2868 let jsont : t Json.codec = 2869 Json.Codec.map Json.Codec.string ~kind:"PlayerThemeVideoSetting" 2870 ~dec:(function 2871 | "channel-default" -> `Channel_default 2872 | "instance-default" -> `Instance_default 2873 | "galaxy" -> `Galaxy 2874 | "lucide" -> `Lucide 2875 | s -> Json.Error.failf Json.Meta.none "Unknown value: %s" s) 2876 ~enc:(function 2877 | `Channel_default -> "channel-default" 2878 | `Instance_default -> "instance-default" 2879 | `Galaxy -> "galaxy" 2880 | `Lucide -> "lucide") 2881 end 2882end 2883 2884module PlayerVideoSettings = struct 2885 module Types = struct 2886 module Update = struct 2887 (** Player settings update for a video *) 2888 type t = { 2889 theme : PlayerThemeVideoSetting.T.t; 2890 } 2891 end 2892 2893 module T = struct 2894 (** Player settings for a video *) 2895 type t = { 2896 theme : PlayerThemeVideoSetting.T.t option; 2897 } 2898 end 2899 end 2900 2901 module Update = struct 2902 include Types.Update 2903 2904 let v ~theme () = { theme } 2905 2906 let theme t = t.theme 2907 2908 let jsont : t Json.codec = 2909 Json.Codec.Object.map ~kind:"PlayerVideoSettingsUpdate" 2910 (fun theme -> { theme }) 2911 |> Json.Codec.Object.member "theme" PlayerThemeVideoSetting.T.jsont ~enc:(fun r -> r.theme) 2912 |> Json.Codec.Object.skip_unknown 2913 |> Json.Codec.Object.seal 2914 end 2915 2916 module T = struct 2917 include Types.T 2918 2919 let v ?theme () = { theme } 2920 2921 let theme t = t.theme 2922 2923 let jsont : t Json.codec = 2924 Json.Codec.Object.map ~kind:"PlayerVideoSettings" 2925 (fun theme -> { theme }) 2926 |> Json.Codec.Object.opt_member "theme" PlayerThemeVideoSetting.T.jsont ~enc:(fun r -> r.theme) 2927 |> Json.Codec.Object.skip_unknown 2928 |> Json.Codec.Object.seal 2929 end 2930 2931 (** Get video player settings 2932 2933 Get player settings for a specific video. Returns video-specific settings merged with channel player settings. 2934 @param id The object id, uuid or short uuid 2935 @param raw Return raw settings without merging channel defaults 2936 *) 2937 let get_video_player_settings ~id ?raw client () = 2938 let op_name = "get_video_player_settings" in 2939 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/player-settings/videos/{id}" in 2940 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"raw" ~value:raw]) in 2941 let url = client.base_url ^ url_path ^ query in 2942 let response = 2943 try Requests.get client.session url 2944 with Eio.Io _ as ex -> 2945 let bt = Printexc.get_raw_backtrace () in 2946 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 2947 in 2948 if Requests.Response.ok response then 2949 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 2950 else 2951 let body = Requests.Response.text response in 2952 let parsed_body = 2953 match Json.of_string Json.Codec.Value.t body with 2954 | Ok json -> Some (Openapi.Runtime.Json json) 2955 | Error _ -> Some (Openapi.Runtime.Raw body) 2956 in 2957 raise (Openapi.Runtime.Api_error { 2958 operation = op_name; 2959 method_ = "GET"; 2960 url; 2961 status = Requests.Response.status_code response; 2962 body; 2963 parsed_body; 2964 }) 2965 2966 (** Update video player settings 2967 2968 Update player settings for a specific video 2969 @param id The object id, uuid or short uuid 2970 *) 2971 let update_video_player_settings ~id ~body client () = 2972 let op_name = "update_video_player_settings" in 2973 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/player-settings/videos/{id}" in 2974 let query = "" in 2975 let url = client.base_url ^ url_path ^ query in 2976 let response = 2977 try Requests.put client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string Update.jsont body)) url 2978 with Eio.Io _ as ex -> 2979 let bt = Printexc.get_raw_backtrace () in 2980 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 2981 in 2982 if Requests.Response.ok response then 2983 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 2984 else 2985 let body = Requests.Response.text response in 2986 let parsed_body = 2987 match Json.of_string Json.Codec.Value.t body with 2988 | Ok json -> Some (Openapi.Runtime.Json json) 2989 | Error _ -> Some (Openapi.Runtime.Raw body) 2990 in 2991 raise (Openapi.Runtime.Api_error { 2992 operation = op_name; 2993 method_ = "PUT"; 2994 url; 2995 status = Requests.Response.status_code response; 2996 body; 2997 parsed_body; 2998 }) 2999end 3000 3001module PlayerThemeChannelSetting = struct 3002 module Types = struct 3003 module T = struct 3004 (** Player theme setting for a channel: 3005 - `instance-default` Use the instance default theme 3006 - `galaxy` Use the galaxy theme 3007 - `lucide` Use the lucide theme 3008 *) 3009 type t = [ 3010 | `Instance_default 3011 | `Galaxy 3012 | `Lucide 3013 ] 3014 end 3015 end 3016 3017 module T = struct 3018 include Types.T 3019 3020 let jsont : t Json.codec = 3021 Json.Codec.map Json.Codec.string ~kind:"PlayerThemeChannelSetting" 3022 ~dec:(function 3023 | "instance-default" -> `Instance_default 3024 | "galaxy" -> `Galaxy 3025 | "lucide" -> `Lucide 3026 | s -> Json.Error.failf Json.Meta.none "Unknown value: %s" s) 3027 ~enc:(function 3028 | `Instance_default -> "instance-default" 3029 | `Galaxy -> "galaxy" 3030 | `Lucide -> "lucide") 3031 end 3032end 3033 3034module PlayerChannelSettings = struct 3035 module Types = struct 3036 module Update = struct 3037 (** Player settings update for a channel *) 3038 type t = { 3039 theme : PlayerThemeChannelSetting.T.t; 3040 } 3041 end 3042 3043 module T = struct 3044 (** Player settings for a channel *) 3045 type t = { 3046 theme : PlayerThemeChannelSetting.T.t option; 3047 } 3048 end 3049 end 3050 3051 module Update = struct 3052 include Types.Update 3053 3054 let v ~theme () = { theme } 3055 3056 let theme t = t.theme 3057 3058 let jsont : t Json.codec = 3059 Json.Codec.Object.map ~kind:"PlayerChannelSettingsUpdate" 3060 (fun theme -> { theme }) 3061 |> Json.Codec.Object.member "theme" PlayerThemeChannelSetting.T.jsont ~enc:(fun r -> r.theme) 3062 |> Json.Codec.Object.skip_unknown 3063 |> Json.Codec.Object.seal 3064 end 3065 3066 module T = struct 3067 include Types.T 3068 3069 let v ?theme () = { theme } 3070 3071 let theme t = t.theme 3072 3073 let jsont : t Json.codec = 3074 Json.Codec.Object.map ~kind:"PlayerChannelSettings" 3075 (fun theme -> { theme }) 3076 |> Json.Codec.Object.opt_member "theme" PlayerThemeChannelSetting.T.jsont ~enc:(fun r -> r.theme) 3077 |> Json.Codec.Object.skip_unknown 3078 |> Json.Codec.Object.seal 3079 end 3080 3081 (** Get channel player settings 3082 3083 Get player settings for a video channel. 3084 @param channel_handle The video channel handle 3085 @param raw Return raw settings without applying instance defaults 3086 *) 3087 let get_channel_player_settings ~channel_handle ?raw client () = 3088 let op_name = "get_channel_player_settings" in 3089 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/player-settings/video-channels/{channelHandle}" in 3090 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"raw" ~value:raw]) in 3091 let url = client.base_url ^ url_path ^ query in 3092 let response = 3093 try Requests.get client.session url 3094 with Eio.Io _ as ex -> 3095 let bt = Printexc.get_raw_backtrace () in 3096 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 3097 in 3098 if Requests.Response.ok response then 3099 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 3100 else 3101 let body = Requests.Response.text response in 3102 let parsed_body = 3103 match Json.of_string Json.Codec.Value.t body with 3104 | Ok json -> Some (Openapi.Runtime.Json json) 3105 | Error _ -> Some (Openapi.Runtime.Raw body) 3106 in 3107 raise (Openapi.Runtime.Api_error { 3108 operation = op_name; 3109 method_ = "GET"; 3110 url; 3111 status = Requests.Response.status_code response; 3112 body; 3113 parsed_body; 3114 }) 3115 3116 (** Update channel player settings 3117 3118 Update default player settings for a video channel. 3119 @param channel_handle The video channel handle 3120 *) 3121 let update_channel_player_settings ~channel_handle ~body client () = 3122 let op_name = "update_channel_player_settings" in 3123 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/player-settings/video-channels/{channelHandle}" in 3124 let query = "" in 3125 let url = client.base_url ^ url_path ^ query in 3126 let response = 3127 try Requests.put client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string Update.jsont body)) url 3128 with Eio.Io _ as ex -> 3129 let bt = Printexc.get_raw_backtrace () in 3130 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 3131 in 3132 if Requests.Response.ok response then 3133 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 3134 else 3135 let body = Requests.Response.text response in 3136 let parsed_body = 3137 match Json.of_string Json.Codec.Value.t body with 3138 | Ok json -> Some (Openapi.Runtime.Json json) 3139 | Error _ -> Some (Openapi.Runtime.Raw body) 3140 in 3141 raise (Openapi.Runtime.Api_error { 3142 operation = op_name; 3143 method_ = "PUT"; 3144 url; 3145 status = Requests.Response.status_code response; 3146 body; 3147 parsed_body; 3148 }) 3149end 3150 3151module PlayerTheme = struct 3152 module Types = struct 3153 module T = struct 3154 (** The player theme to use *) 3155 type t = [ 3156 | `Galaxy 3157 | `Lucide 3158 ] 3159 end 3160 end 3161 3162 module T = struct 3163 include Types.T 3164 3165 let jsont : t Json.codec = 3166 Json.Codec.map Json.Codec.string ~kind:"PlayerTheme" 3167 ~dec:(function 3168 | "galaxy" -> `Galaxy 3169 | "lucide" -> `Lucide 3170 | s -> Json.Error.failf Json.Meta.none "Unknown value: %s" s) 3171 ~enc:(function 3172 | `Galaxy -> "galaxy" 3173 | `Lucide -> "lucide") 3174 end 3175end 3176 3177module PlaybackMetric = struct 3178 module Types = struct 3179 module Create = struct 3180 type t = { 3181 buffer_stalled : float option; (** How many times buffer has been stalled since the last metric creation *) 3182 downloaded_bytes_http : float; (** How many bytes were downloaded with HTTP since the last metric creation *) 3183 downloaded_bytes_p2_p : float; (** How many bytes were downloaded with P2P since the last metric creation *) 3184 errors : float; (** How many errors occurred since the last metric creation *) 3185 fps : float option; (** Current player video fps *) 3186 p2p_enabled : bool; 3187 p2p_peers : float option; (** P2P peers connected (doesn't include WebSeed peers) *) 3188 player_mode : string; 3189 resolution : float option; (** Current player video resolution *) 3190 resolution_changes : float; (** How many resolution changes occurred since the last metric creation *) 3191 uploaded_bytes_p2_p : float; (** How many bytes were uploaded with P2P since the last metric creation *) 3192 video_id : Json.t; 3193 } 3194 end 3195 end 3196 3197 module Create = struct 3198 include Types.Create 3199 3200 let v ~downloaded_bytes_http ~downloaded_bytes_p2_p ~errors ~p2p_enabled ~player_mode ~resolution_changes ~uploaded_bytes_p2_p ~video_id ?buffer_stalled ?fps ?p2p_peers ?resolution () = { buffer_stalled; downloaded_bytes_http; downloaded_bytes_p2_p; errors; fps; p2p_enabled; p2p_peers; player_mode; resolution; resolution_changes; uploaded_bytes_p2_p; video_id } 3201 3202 let buffer_stalled t = t.buffer_stalled 3203 let downloaded_bytes_http t = t.downloaded_bytes_http 3204 let downloaded_bytes_p2_p t = t.downloaded_bytes_p2_p 3205 let errors t = t.errors 3206 let fps t = t.fps 3207 let p2p_enabled t = t.p2p_enabled 3208 let p2p_peers t = t.p2p_peers 3209 let player_mode t = t.player_mode 3210 let resolution t = t.resolution 3211 let resolution_changes t = t.resolution_changes 3212 let uploaded_bytes_p2_p t = t.uploaded_bytes_p2_p 3213 let video_id t = t.video_id 3214 3215 let jsont : t Json.codec = 3216 Json.Codec.Object.map ~kind:"PlaybackMetricCreate" 3217 (fun buffer_stalled downloaded_bytes_http downloaded_bytes_p2_p errors fps p2p_enabled p2p_peers player_mode resolution resolution_changes uploaded_bytes_p2_p video_id -> { buffer_stalled; downloaded_bytes_http; downloaded_bytes_p2_p; errors; fps; p2p_enabled; p2p_peers; player_mode; resolution; resolution_changes; uploaded_bytes_p2_p; video_id }) 3218 |> Json.Codec.Object.opt_member "bufferStalled" Json.Codec.number ~enc:(fun r -> r.buffer_stalled) 3219 |> Json.Codec.Object.member "downloadedBytesHTTP" Json.Codec.number ~enc:(fun r -> r.downloaded_bytes_http) 3220 |> Json.Codec.Object.member "downloadedBytesP2P" Json.Codec.number ~enc:(fun r -> r.downloaded_bytes_p2_p) 3221 |> Json.Codec.Object.member "errors" Json.Codec.number ~enc:(fun r -> r.errors) 3222 |> Json.Codec.Object.opt_member "fps" Json.Codec.number ~enc:(fun r -> r.fps) 3223 |> Json.Codec.Object.member "p2pEnabled" Json.Codec.bool ~enc:(fun r -> r.p2p_enabled) 3224 |> Json.Codec.Object.opt_member "p2pPeers" Json.Codec.number ~enc:(fun r -> r.p2p_peers) 3225 |> Json.Codec.Object.member "playerMode" Json.Codec.string ~enc:(fun r -> r.player_mode) 3226 |> Json.Codec.Object.opt_member "resolution" Json.Codec.number ~enc:(fun r -> r.resolution) 3227 |> Json.Codec.Object.member "resolutionChanges" Json.Codec.number ~enc:(fun r -> r.resolution_changes) 3228 |> Json.Codec.Object.member "uploadedBytesP2P" Json.Codec.number ~enc:(fun r -> r.uploaded_bytes_p2_p) 3229 |> Json.Codec.Object.member "videoId" Json.Codec.Value.t ~enc:(fun r -> r.video_id) 3230 |> Json.Codec.Object.skip_unknown 3231 |> Json.Codec.Object.seal 3232 end 3233end 3234 3235module Password = struct 3236 module Types = struct 3237 module T = struct 3238 type t = Json.t 3239 end 3240 end 3241 3242 module T = struct 3243 include Types.T 3244 let jsont = Json.Codec.Value.t 3245 let v () = Json.Null ((), Json.Meta.none) 3246 end 3247end 3248 3249module UpdateUser = struct 3250 module Types = struct 3251 module T = struct 3252 type t = { 3253 admin_flags : UserAdminFlags.T.t option; 3254 email : Json.t option; (** The updated email of the user *) 3255 email_verified : bool option; (** Set the email as verified *) 3256 password : Password.T.t option; 3257 plugin_auth : string option; (** The auth plugin to use to authenticate the user *) 3258 role : UserRole.T.t option; 3259 video_quota : int option; (** The updated video quota of the user in bytes *) 3260 video_quota_daily : int option; (** The updated daily video quota of the user in bytes *) 3261 } 3262 end 3263 end 3264 3265 module T = struct 3266 include Types.T 3267 3268 let v ?admin_flags ?email ?email_verified ?password ?plugin_auth ?role ?video_quota ?video_quota_daily () = { admin_flags; email; email_verified; password; plugin_auth; role; video_quota; video_quota_daily } 3269 3270 let admin_flags t = t.admin_flags 3271 let email t = t.email 3272 let email_verified t = t.email_verified 3273 let password t = t.password 3274 let plugin_auth t = t.plugin_auth 3275 let role t = t.role 3276 let video_quota t = t.video_quota 3277 let video_quota_daily t = t.video_quota_daily 3278 3279 let jsont : t Json.codec = 3280 Json.Codec.Object.map ~kind:"UpdateUser" 3281 (fun admin_flags email email_verified password plugin_auth role video_quota video_quota_daily -> { admin_flags; email; email_verified; password; plugin_auth; role; video_quota; video_quota_daily }) 3282 |> Json.Codec.Object.opt_member "adminFlags" UserAdminFlags.T.jsont ~enc:(fun r -> r.admin_flags) 3283 |> Json.Codec.Object.opt_member "email" Json.Codec.Value.t ~enc:(fun r -> r.email) 3284 |> Json.Codec.Object.opt_member "emailVerified" Json.Codec.bool ~enc:(fun r -> r.email_verified) 3285 |> Json.Codec.Object.opt_member "password" Password.T.jsont ~enc:(fun r -> r.password) 3286 |> Json.Codec.Object.member "pluginAuth" Openapi.Runtime.nullable_string 3287 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.plugin_auth) 3288 |> Json.Codec.Object.opt_member "role" UserRole.T.jsont ~enc:(fun r -> r.role) 3289 |> Json.Codec.Object.opt_member "videoQuota" Json.Codec.int ~enc:(fun r -> r.video_quota) 3290 |> Json.Codec.Object.opt_member "videoQuotaDaily" Json.Codec.int ~enc:(fun r -> r.video_quota_daily) 3291 |> Json.Codec.Object.skip_unknown 3292 |> Json.Codec.Object.seal 3293 end 3294end 3295 3296module RegisterUser = struct 3297 module Types = struct 3298 module T = struct 3299 type t = { 3300 channel : Json.t option; (** channel base information used to create the first channel of the user *) 3301 display_name : string option; (** editable name of the user, displayed in its representations *) 3302 email : string; (** email of the user, used for login or service communications *) 3303 password : Password.T.t; 3304 username : Username.T.t; (** immutable name of the user, used to find or mention its actor *) 3305 } 3306 end 3307 end 3308 3309 module T = struct 3310 include Types.T 3311 3312 let v ~email ~password ~username ?channel ?display_name () = { channel; display_name; email; password; username } 3313 3314 let channel t = t.channel 3315 let display_name t = t.display_name 3316 let email t = t.email 3317 let password t = t.password 3318 let username t = t.username 3319 3320 let jsont : t Json.codec = 3321 Json.Codec.Object.map ~kind:"RegisterUser" 3322 (fun channel display_name email password username -> { channel; display_name; email; password; username }) 3323 |> Json.Codec.Object.opt_member "channel" Json.Codec.Value.t ~enc:(fun r -> r.channel) 3324 |> Json.Codec.Object.opt_member "displayName" (Openapi.Runtime.validated_string ~min_length:1 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.display_name) 3325 |> Json.Codec.Object.member "email" Json.Codec.string ~enc:(fun r -> r.email) 3326 |> Json.Codec.Object.member "password" Password.T.jsont ~enc:(fun r -> r.password) 3327 |> Json.Codec.Object.member "username" Username.T.jsont ~enc:(fun r -> r.username) 3328 |> Json.Codec.Object.skip_unknown 3329 |> Json.Codec.Object.seal 3330 end 3331end 3332 3333module OauthTokenPassword = struct 3334 module Types = struct 3335 module T = struct 3336 type t = { 3337 client_id : string; 3338 client_secret : string; 3339 grant_type : string; 3340 username : Json.t; 3341 password : Password.T.t option; 3342 external_auth_token : string option; (** If you want to authenticate using an external authentication token you got from an auth plugin (like `peertube-plugin-auth-openid-connect` for example) instead of a password or a refresh token, provide it here. *) 3343 } 3344 end 3345 end 3346 3347 module T = struct 3348 include Types.T 3349 3350 let v ~client_id ~client_secret ~grant_type ~username ?password ?external_auth_token () = { client_id; client_secret; grant_type; username; password; external_auth_token } 3351 3352 let client_id t = t.client_id 3353 let client_secret t = t.client_secret 3354 let grant_type t = t.grant_type 3355 let username t = t.username 3356 let password t = t.password 3357 let external_auth_token t = t.external_auth_token 3358 3359 let jsont : t Json.codec = 3360 Json.Codec.Object.map ~kind:"OAuthToken-password" 3361 (fun client_id client_secret grant_type username password external_auth_token -> { client_id; client_secret; grant_type; username; password; external_auth_token }) 3362 |> Json.Codec.Object.member "client_id" (Openapi.Runtime.validated_string ~min_length:32 ~max_length:32 ~pattern:"/^[a-z0-9]$/" Json.Codec.string) ~enc:(fun r -> r.client_id) 3363 |> Json.Codec.Object.member "client_secret" (Openapi.Runtime.validated_string ~min_length:32 ~max_length:32 ~pattern:"/^[a-zA-Z0-9]$/" Json.Codec.string) ~enc:(fun r -> r.client_secret) 3364 |> Json.Codec.Object.member "grant_type" Json.Codec.string ~enc:(fun r -> r.grant_type) 3365 |> Json.Codec.Object.member "username" Json.Codec.Value.t ~enc:(fun r -> r.username) 3366 |> Json.Codec.Object.opt_member "password" Password.T.jsont ~enc:(fun r -> r.password) 3367 |> Json.Codec.Object.opt_member "externalAuthToken" Json.Codec.string ~enc:(fun r -> r.external_auth_token) 3368 |> Json.Codec.Object.skip_unknown 3369 |> Json.Codec.Object.seal 3370 end 3371end 3372 3373module AddUser = struct 3374 module Types = struct 3375 module Response = struct 3376 type t = { 3377 user : Json.t option; 3378 } 3379 end 3380 3381 module T = struct 3382 type t = { 3383 admin_flags : UserAdminFlags.T.t option; 3384 channel_name : UsernameChannel.T.t option; 3385 email : string; (** The user email *) 3386 password : Password.T.t; 3387 role : UserRole.T.t; 3388 username : Username.T.t; 3389 video_quota : int option; (** The user video quota in bytes *) 3390 video_quota_daily : int option; (** The user daily video quota in bytes *) 3391 } 3392 end 3393 end 3394 3395 module Response = struct 3396 include Types.Response 3397 3398 let v ?user () = { user } 3399 3400 let user t = t.user 3401 3402 let jsont : t Json.codec = 3403 Json.Codec.Object.map ~kind:"AddUserResponse" 3404 (fun user -> { user }) 3405 |> Json.Codec.Object.opt_member "user" Json.Codec.Value.t ~enc:(fun r -> r.user) 3406 |> Json.Codec.Object.skip_unknown 3407 |> Json.Codec.Object.seal 3408 end 3409 3410 module T = struct 3411 include Types.T 3412 3413 let v ~email ~password ~role ~username ?admin_flags ?channel_name ?video_quota ?video_quota_daily () = { admin_flags; channel_name; email; password; role; username; video_quota; video_quota_daily } 3414 3415 let admin_flags t = t.admin_flags 3416 let channel_name t = t.channel_name 3417 let email t = t.email 3418 let password t = t.password 3419 let role t = t.role 3420 let username t = t.username 3421 let video_quota t = t.video_quota 3422 let video_quota_daily t = t.video_quota_daily 3423 3424 let jsont : t Json.codec = 3425 Json.Codec.Object.map ~kind:"AddUser" 3426 (fun admin_flags channel_name email password role username video_quota video_quota_daily -> { admin_flags; channel_name; email; password; role; username; video_quota; video_quota_daily }) 3427 |> Json.Codec.Object.opt_member "adminFlags" UserAdminFlags.T.jsont ~enc:(fun r -> r.admin_flags) 3428 |> Json.Codec.Object.opt_member "channelName" UsernameChannel.T.jsont ~enc:(fun r -> r.channel_name) 3429 |> Json.Codec.Object.member "email" Json.Codec.string ~enc:(fun r -> r.email) 3430 |> Json.Codec.Object.member "password" Password.T.jsont ~enc:(fun r -> r.password) 3431 |> Json.Codec.Object.member "role" UserRole.T.jsont ~enc:(fun r -> r.role) 3432 |> Json.Codec.Object.member "username" Username.T.jsont ~enc:(fun r -> r.username) 3433 |> Json.Codec.Object.opt_member "videoQuota" Json.Codec.int ~enc:(fun r -> r.video_quota) 3434 |> Json.Codec.Object.opt_member "videoQuotaDaily" Json.Codec.int ~enc:(fun r -> r.video_quota_daily) 3435 |> Json.Codec.Object.skip_unknown 3436 |> Json.Codec.Object.seal 3437 end 3438 3439 (** Create a user *) 3440 let add_user ~body client () = 3441 let op_name = "add_user" in 3442 let url_path = "/api/v1/users" in 3443 let query = "" in 3444 let url = client.base_url ^ url_path ^ query in 3445 let response = 3446 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string T.jsont body)) url 3447 with Eio.Io _ as ex -> 3448 let bt = Printexc.get_raw_backtrace () in 3449 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 3450 in 3451 if Requests.Response.ok response then 3452 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 3453 else 3454 let body = Requests.Response.text response in 3455 let parsed_body = 3456 match Json.of_string Json.Codec.Value.t body with 3457 | Ok json -> Some (Openapi.Runtime.Json json) 3458 | Error _ -> Some (Openapi.Runtime.Raw body) 3459 in 3460 raise (Openapi.Runtime.Api_error { 3461 operation = op_name; 3462 method_ = "POST"; 3463 url; 3464 status = Requests.Response.status_code response; 3465 body; 3466 parsed_body; 3467 }) 3468end 3469 3470module OauthTokenRefreshToken = struct 3471 module Types = struct 3472 module T = struct 3473 type t = { 3474 client_id : string; 3475 client_secret : string; 3476 grant_type : string; 3477 refresh_token : string; 3478 } 3479 end 3480 end 3481 3482 module T = struct 3483 include Types.T 3484 3485 let v ~client_id ~client_secret ~grant_type ~refresh_token () = { client_id; client_secret; grant_type; refresh_token } 3486 3487 let client_id t = t.client_id 3488 let client_secret t = t.client_secret 3489 let grant_type t = t.grant_type 3490 let refresh_token t = t.refresh_token 3491 3492 let jsont : t Json.codec = 3493 Json.Codec.Object.map ~kind:"OAuthToken-refresh_token" 3494 (fun client_id client_secret grant_type refresh_token -> { client_id; client_secret; grant_type; refresh_token }) 3495 |> Json.Codec.Object.member "client_id" (Openapi.Runtime.validated_string ~min_length:32 ~max_length:32 ~pattern:"/^[a-z0-9]$/" Json.Codec.string) ~enc:(fun r -> r.client_id) 3496 |> Json.Codec.Object.member "client_secret" (Openapi.Runtime.validated_string ~min_length:32 ~max_length:32 ~pattern:"/^[a-zA-Z0-9]$/" Json.Codec.string) ~enc:(fun r -> r.client_secret) 3497 |> Json.Codec.Object.member "grant_type" Json.Codec.string ~enc:(fun r -> r.grant_type) 3498 |> Json.Codec.Object.member "refresh_token" Json.Codec.string ~enc:(fun r -> r.refresh_token) 3499 |> Json.Codec.Object.skip_unknown 3500 |> Json.Codec.Object.seal 3501 end 3502end 3503 3504module OauthClient = struct 3505 module Types = struct 3506 module T = struct 3507 type t = { 3508 client_id : string option; 3509 client_secret : string option; 3510 } 3511 end 3512 end 3513 3514 module T = struct 3515 include Types.T 3516 3517 let v ?client_id ?client_secret () = { client_id; client_secret } 3518 3519 let client_id t = t.client_id 3520 let client_secret t = t.client_secret 3521 3522 let jsont : t Json.codec = 3523 Json.Codec.Object.map ~kind:"OAuthClient" 3524 (fun client_id client_secret -> { client_id; client_secret }) 3525 |> Json.Codec.Object.opt_member "client_id" (Openapi.Runtime.validated_string ~min_length:32 ~max_length:32 ~pattern:"/^[a-z0-9]$/" Json.Codec.string) ~enc:(fun r -> r.client_id) 3526 |> Json.Codec.Object.opt_member "client_secret" (Openapi.Runtime.validated_string ~min_length:32 ~max_length:32 ~pattern:"/^[a-zA-Z0-9]$/" Json.Codec.string) ~enc:(fun r -> r.client_secret) 3527 |> Json.Codec.Object.skip_unknown 3528 |> Json.Codec.Object.seal 3529 end 3530 3531 (** Login prerequisite 3532 3533 You need to retrieve a client id and secret before [logging in](#operation/getOAuthToken). *) 3534 let get_oauth_client client () = 3535 let op_name = "get_oauth_client" in 3536 let url_path = "/api/v1/oauth-clients/local" in 3537 let query = "" in 3538 let url = client.base_url ^ url_path ^ query in 3539 let response = 3540 try Requests.get client.session url 3541 with Eio.Io _ as ex -> 3542 let bt = Printexc.get_raw_backtrace () in 3543 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 3544 in 3545 if Requests.Response.ok response then 3546 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 3547 else 3548 let body = Requests.Response.text response in 3549 let parsed_body = 3550 match Json.of_string Json.Codec.Value.t body with 3551 | Ok json -> Some (Openapi.Runtime.Json json) 3552 | Error _ -> Some (Openapi.Runtime.Raw body) 3553 in 3554 raise (Openapi.Runtime.Api_error { 3555 operation = op_name; 3556 method_ = "GET"; 3557 url; 3558 status = Requests.Response.status_code response; 3559 body; 3560 parsed_body; 3561 }) 3562end 3563 3564module Nsfwpolicy = struct 3565 module Types = struct 3566 module T = struct 3567 type t = [ 3568 | `Display 3569 | `Warn 3570 | `Do_not_list 3571 ] 3572 end 3573 end 3574 3575 module T = struct 3576 include Types.T 3577 3578 let jsont : t Json.codec = 3579 Json.Codec.map Json.Codec.string ~kind:"NSFWPolicy" 3580 ~dec:(function 3581 | "display" -> `Display 3582 | "warn" -> `Warn 3583 | "do_not_list" -> `Do_not_list 3584 | s -> Json.Error.failf Json.Meta.none "Unknown value: %s" s) 3585 ~enc:(function 3586 | `Display -> "display" 3587 | `Warn -> "warn" 3588 | `Do_not_list -> "do_not_list") 3589 end 3590end 3591 3592module Nsfwflag = struct 3593 module Types = struct 3594 module T = struct 3595 (** 3596 NSFW flags (can be combined using bitwise or operator) 3597 - `0` NONE 3598 - `1` VIOLENT 3599 - `2` EXPLICIT_SEX 3600 *) 3601 type t = string 3602 end 3603 end 3604 3605 module T = struct 3606 include Types.T 3607 let jsont = Json.Codec.string 3608 end 3609end 3610 3611module UpdateMe = struct 3612 module Types = struct 3613 module T = struct 3614 type t = { 3615 auto_play_next_video : bool option; (** new preference regarding playing following videos automatically *) 3616 auto_play_next_video_playlist : bool option; (** new preference regarding playing following playlist videos automatically *) 3617 auto_play_video : bool option; (** new preference regarding playing videos automatically *) 3618 current_password : Password.T.t option; 3619 display_name : string option; (** new name of the user in its representations *) 3620 email : Json.t option; (** new email used for login and service communications *) 3621 language : string option; (** default language for this user *) 3622 no_account_setup_warning_modal : bool option; 3623 no_instance_config_warning_modal : bool option; 3624 no_welcome_modal : bool option; 3625 nsfw_flags_blurred : Nsfwflag.T.t option; 3626 nsfw_flags_displayed : Nsfwflag.T.t option; 3627 nsfw_flags_hidden : Nsfwflag.T.t option; 3628 nsfw_flags_warned : Nsfwflag.T.t option; 3629 nsfw_policy : string option; (** new NSFW display policy *) 3630 p2p_enabled : bool option; (** whether to enable P2P in the player or not *) 3631 password : Password.T.t option; 3632 theme : string option; 3633 video_languages : string list option; (** list of languages to filter videos down to *) 3634 videos_history_enabled : bool option; (** whether to keep track of watched history or not *) 3635 } 3636 end 3637 end 3638 3639 module T = struct 3640 include Types.T 3641 3642 let v ?auto_play_next_video ?auto_play_next_video_playlist ?auto_play_video ?current_password ?display_name ?email ?language ?no_account_setup_warning_modal ?no_instance_config_warning_modal ?no_welcome_modal ?nsfw_flags_blurred ?nsfw_flags_displayed ?nsfw_flags_hidden ?nsfw_flags_warned ?nsfw_policy ?p2p_enabled ?password ?theme ?video_languages ?videos_history_enabled () = { auto_play_next_video; auto_play_next_video_playlist; auto_play_video; current_password; display_name; email; language; no_account_setup_warning_modal; no_instance_config_warning_modal; no_welcome_modal; nsfw_flags_blurred; nsfw_flags_displayed; nsfw_flags_hidden; nsfw_flags_warned; nsfw_policy; p2p_enabled; password; theme; video_languages; videos_history_enabled } 3643 3644 let auto_play_next_video t = t.auto_play_next_video 3645 let auto_play_next_video_playlist t = t.auto_play_next_video_playlist 3646 let auto_play_video t = t.auto_play_video 3647 let current_password t = t.current_password 3648 let display_name t = t.display_name 3649 let email t = t.email 3650 let language t = t.language 3651 let no_account_setup_warning_modal t = t.no_account_setup_warning_modal 3652 let no_instance_config_warning_modal t = t.no_instance_config_warning_modal 3653 let no_welcome_modal t = t.no_welcome_modal 3654 let nsfw_flags_blurred t = t.nsfw_flags_blurred 3655 let nsfw_flags_displayed t = t.nsfw_flags_displayed 3656 let nsfw_flags_hidden t = t.nsfw_flags_hidden 3657 let nsfw_flags_warned t = t.nsfw_flags_warned 3658 let nsfw_policy t = t.nsfw_policy 3659 let p2p_enabled t = t.p2p_enabled 3660 let password t = t.password 3661 let theme t = t.theme 3662 let video_languages t = t.video_languages 3663 let videos_history_enabled t = t.videos_history_enabled 3664 3665 let jsont : t Json.codec = 3666 Json.Codec.Object.map ~kind:"UpdateMe" 3667 (fun auto_play_next_video auto_play_next_video_playlist auto_play_video current_password display_name email language no_account_setup_warning_modal no_instance_config_warning_modal no_welcome_modal nsfw_flags_blurred nsfw_flags_displayed nsfw_flags_hidden nsfw_flags_warned nsfw_policy p2p_enabled password theme video_languages videos_history_enabled -> { auto_play_next_video; auto_play_next_video_playlist; auto_play_video; current_password; display_name; email; language; no_account_setup_warning_modal; no_instance_config_warning_modal; no_welcome_modal; nsfw_flags_blurred; nsfw_flags_displayed; nsfw_flags_hidden; nsfw_flags_warned; nsfw_policy; p2p_enabled; password; theme; video_languages; videos_history_enabled }) 3668 |> Json.Codec.Object.opt_member "autoPlayNextVideo" Json.Codec.bool ~enc:(fun r -> r.auto_play_next_video) 3669 |> Json.Codec.Object.opt_member "autoPlayNextVideoPlaylist" Json.Codec.bool ~enc:(fun r -> r.auto_play_next_video_playlist) 3670 |> Json.Codec.Object.opt_member "autoPlayVideo" Json.Codec.bool ~enc:(fun r -> r.auto_play_video) 3671 |> Json.Codec.Object.opt_member "currentPassword" Password.T.jsont ~enc:(fun r -> r.current_password) 3672 |> Json.Codec.Object.opt_member "displayName" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.display_name) 3673 |> Json.Codec.Object.opt_member "email" Json.Codec.Value.t ~enc:(fun r -> r.email) 3674 |> Json.Codec.Object.opt_member "language" Json.Codec.string ~enc:(fun r -> r.language) 3675 |> Json.Codec.Object.opt_member "noAccountSetupWarningModal" Json.Codec.bool ~enc:(fun r -> r.no_account_setup_warning_modal) 3676 |> Json.Codec.Object.opt_member "noInstanceConfigWarningModal" Json.Codec.bool ~enc:(fun r -> r.no_instance_config_warning_modal) 3677 |> Json.Codec.Object.opt_member "noWelcomeModal" Json.Codec.bool ~enc:(fun r -> r.no_welcome_modal) 3678 |> Json.Codec.Object.opt_member "nsfwFlagsBlurred" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_blurred) 3679 |> Json.Codec.Object.opt_member "nsfwFlagsDisplayed" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_displayed) 3680 |> Json.Codec.Object.opt_member "nsfwFlagsHidden" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_hidden) 3681 |> Json.Codec.Object.opt_member "nsfwFlagsWarned" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_warned) 3682 |> Json.Codec.Object.opt_member "nsfwPolicy" Json.Codec.string ~enc:(fun r -> r.nsfw_policy) 3683 |> Json.Codec.Object.opt_member "p2pEnabled" Json.Codec.bool ~enc:(fun r -> r.p2p_enabled) 3684 |> Json.Codec.Object.opt_member "password" Password.T.jsont ~enc:(fun r -> r.password) 3685 |> Json.Codec.Object.opt_member "theme" Json.Codec.string ~enc:(fun r -> r.theme) 3686 |> Json.Codec.Object.opt_member "videoLanguages" (Json.Codec.list Json.Codec.string) ~enc:(fun r -> r.video_languages) 3687 |> Json.Codec.Object.opt_member "videosHistoryEnabled" Json.Codec.bool ~enc:(fun r -> r.videos_history_enabled) 3688 |> Json.Codec.Object.skip_unknown 3689 |> Json.Codec.Object.seal 3690 end 3691end 3692 3693module NotificationSettingValue = struct 3694 module Types = struct 3695 module T = struct 3696 (** Notification type. One of the following values, or a sum of multiple values: 3697 - `0` NONE 3698 - `1` WEB 3699 - `2` EMAIL 3700 *) 3701 type t = Json.t 3702 end 3703 end 3704 3705 module T = struct 3706 include Types.T 3707 let jsont = Json.Codec.Value.t 3708 let v () = Json.Null ((), Json.Meta.none) 3709 end 3710end 3711 3712module UserNotificationSettings = struct 3713 module Types = struct 3714 module T = struct 3715 type t = { 3716 abuse_as_moderator : NotificationSettingValue.T.t option; 3717 abuse_new_message : NotificationSettingValue.T.t option; 3718 abuse_state_change : NotificationSettingValue.T.t option; 3719 auto_instance_following : NotificationSettingValue.T.t option; 3720 blacklist_on_my_video : NotificationSettingValue.T.t option; 3721 comment_mention : NotificationSettingValue.T.t option; 3722 my_video_import_finished : NotificationSettingValue.T.t option; 3723 my_video_published : NotificationSettingValue.T.t option; 3724 my_video_studio_edition_finished : NotificationSettingValue.T.t option; 3725 my_video_transcription_generated : NotificationSettingValue.T.t option; 3726 new_comment_on_my_video : NotificationSettingValue.T.t option; 3727 new_follow : NotificationSettingValue.T.t option; 3728 new_instance_follower : NotificationSettingValue.T.t option; 3729 new_peer_tube_version : NotificationSettingValue.T.t option; 3730 new_plugin_version : NotificationSettingValue.T.t option; 3731 new_user_registration : NotificationSettingValue.T.t option; 3732 new_video_from_subscription : NotificationSettingValue.T.t option; 3733 video_auto_blacklist_as_moderator : NotificationSettingValue.T.t option; 3734 } 3735 end 3736 end 3737 3738 module T = struct 3739 include Types.T 3740 3741 let v ?abuse_as_moderator ?abuse_new_message ?abuse_state_change ?auto_instance_following ?blacklist_on_my_video ?comment_mention ?my_video_import_finished ?my_video_published ?my_video_studio_edition_finished ?my_video_transcription_generated ?new_comment_on_my_video ?new_follow ?new_instance_follower ?new_peer_tube_version ?new_plugin_version ?new_user_registration ?new_video_from_subscription ?video_auto_blacklist_as_moderator () = { abuse_as_moderator; abuse_new_message; abuse_state_change; auto_instance_following; blacklist_on_my_video; comment_mention; my_video_import_finished; my_video_published; my_video_studio_edition_finished; my_video_transcription_generated; new_comment_on_my_video; new_follow; new_instance_follower; new_peer_tube_version; new_plugin_version; new_user_registration; new_video_from_subscription; video_auto_blacklist_as_moderator } 3742 3743 let abuse_as_moderator t = t.abuse_as_moderator 3744 let abuse_new_message t = t.abuse_new_message 3745 let abuse_state_change t = t.abuse_state_change 3746 let auto_instance_following t = t.auto_instance_following 3747 let blacklist_on_my_video t = t.blacklist_on_my_video 3748 let comment_mention t = t.comment_mention 3749 let my_video_import_finished t = t.my_video_import_finished 3750 let my_video_published t = t.my_video_published 3751 let my_video_studio_edition_finished t = t.my_video_studio_edition_finished 3752 let my_video_transcription_generated t = t.my_video_transcription_generated 3753 let new_comment_on_my_video t = t.new_comment_on_my_video 3754 let new_follow t = t.new_follow 3755 let new_instance_follower t = t.new_instance_follower 3756 let new_peer_tube_version t = t.new_peer_tube_version 3757 let new_plugin_version t = t.new_plugin_version 3758 let new_user_registration t = t.new_user_registration 3759 let new_video_from_subscription t = t.new_video_from_subscription 3760 let video_auto_blacklist_as_moderator t = t.video_auto_blacklist_as_moderator 3761 3762 let jsont : t Json.codec = 3763 Json.Codec.Object.map ~kind:"UserNotificationSettings" 3764 (fun abuse_as_moderator abuse_new_message abuse_state_change auto_instance_following blacklist_on_my_video comment_mention my_video_import_finished my_video_published my_video_studio_edition_finished my_video_transcription_generated new_comment_on_my_video new_follow new_instance_follower new_peer_tube_version new_plugin_version new_user_registration new_video_from_subscription video_auto_blacklist_as_moderator -> { abuse_as_moderator; abuse_new_message; abuse_state_change; auto_instance_following; blacklist_on_my_video; comment_mention; my_video_import_finished; my_video_published; my_video_studio_edition_finished; my_video_transcription_generated; new_comment_on_my_video; new_follow; new_instance_follower; new_peer_tube_version; new_plugin_version; new_user_registration; new_video_from_subscription; video_auto_blacklist_as_moderator }) 3765 |> Json.Codec.Object.opt_member "abuseAsModerator" NotificationSettingValue.T.jsont ~enc:(fun r -> r.abuse_as_moderator) 3766 |> Json.Codec.Object.opt_member "abuseNewMessage" NotificationSettingValue.T.jsont ~enc:(fun r -> r.abuse_new_message) 3767 |> Json.Codec.Object.opt_member "abuseStateChange" NotificationSettingValue.T.jsont ~enc:(fun r -> r.abuse_state_change) 3768 |> Json.Codec.Object.opt_member "autoInstanceFollowing" NotificationSettingValue.T.jsont ~enc:(fun r -> r.auto_instance_following) 3769 |> Json.Codec.Object.opt_member "blacklistOnMyVideo" NotificationSettingValue.T.jsont ~enc:(fun r -> r.blacklist_on_my_video) 3770 |> Json.Codec.Object.opt_member "commentMention" NotificationSettingValue.T.jsont ~enc:(fun r -> r.comment_mention) 3771 |> Json.Codec.Object.opt_member "myVideoImportFinished" NotificationSettingValue.T.jsont ~enc:(fun r -> r.my_video_import_finished) 3772 |> Json.Codec.Object.opt_member "myVideoPublished" NotificationSettingValue.T.jsont ~enc:(fun r -> r.my_video_published) 3773 |> Json.Codec.Object.opt_member "myVideoStudioEditionFinished" NotificationSettingValue.T.jsont ~enc:(fun r -> r.my_video_studio_edition_finished) 3774 |> Json.Codec.Object.opt_member "myVideoTranscriptionGenerated" NotificationSettingValue.T.jsont ~enc:(fun r -> r.my_video_transcription_generated) 3775 |> Json.Codec.Object.opt_member "newCommentOnMyVideo" NotificationSettingValue.T.jsont ~enc:(fun r -> r.new_comment_on_my_video) 3776 |> Json.Codec.Object.opt_member "newFollow" NotificationSettingValue.T.jsont ~enc:(fun r -> r.new_follow) 3777 |> Json.Codec.Object.opt_member "newInstanceFollower" NotificationSettingValue.T.jsont ~enc:(fun r -> r.new_instance_follower) 3778 |> Json.Codec.Object.opt_member "newPeerTubeVersion" NotificationSettingValue.T.jsont ~enc:(fun r -> r.new_peer_tube_version) 3779 |> Json.Codec.Object.opt_member "newPluginVersion" NotificationSettingValue.T.jsont ~enc:(fun r -> r.new_plugin_version) 3780 |> Json.Codec.Object.opt_member "newUserRegistration" NotificationSettingValue.T.jsont ~enc:(fun r -> r.new_user_registration) 3781 |> Json.Codec.Object.opt_member "newVideoFromSubscription" NotificationSettingValue.T.jsont ~enc:(fun r -> r.new_video_from_subscription) 3782 |> Json.Codec.Object.opt_member "videoAutoBlacklistAsModerator" NotificationSettingValue.T.jsont ~enc:(fun r -> r.video_auto_blacklist_as_moderator) 3783 |> Json.Codec.Object.skip_unknown 3784 |> Json.Codec.Object.seal 3785 end 3786end 3787 3788module NewFeatureInfo = struct 3789 module Types = struct 3790 module Type = struct 3791 (** Represent a new feature that can be displayed to inform users. One of the following values: 3792 3793 - `1` CHANNEL_COLLABORATION 3794 *) 3795 type t = string 3796 end 3797 end 3798 3799 module Type = struct 3800 include Types.Type 3801 let jsont = Json.Codec.string 3802 end 3803end 3804 3805module MrsspeerLink = struct 3806 module Types = struct 3807 module T = struct 3808 type t = { 3809 href : string option; 3810 type_ : string option; 3811 } 3812 end 3813 end 3814 3815 module T = struct 3816 include Types.T 3817 3818 let v ?href ?type_ () = { href; type_ } 3819 3820 let href t = t.href 3821 let type_ t = t.type_ 3822 3823 let jsont : t Json.codec = 3824 Json.Codec.Object.map ~kind:"MRSSPeerLink" 3825 (fun href type_ -> { href; type_ }) 3826 |> Json.Codec.Object.opt_member "href" Json.Codec.string ~enc:(fun r -> r.href) 3827 |> Json.Codec.Object.opt_member "type" Json.Codec.string ~enc:(fun r -> r.type_) 3828 |> Json.Codec.Object.skip_unknown 3829 |> Json.Codec.Object.seal 3830 end 3831end 3832 3833module MrssgroupContent = struct 3834 module Types = struct 3835 module T = struct 3836 type t = { 3837 duration : int option; 3838 file_size : int option; 3839 framerate : int option; 3840 height : int option; 3841 lang : string option; 3842 type_ : string option; 3843 url : string option; 3844 } 3845 end 3846 end 3847 3848 module T = struct 3849 include Types.T 3850 3851 let v ?duration ?file_size ?framerate ?height ?lang ?type_ ?url () = { duration; file_size; framerate; height; lang; type_; url } 3852 3853 let duration t = t.duration 3854 let file_size t = t.file_size 3855 let framerate t = t.framerate 3856 let height t = t.height 3857 let lang t = t.lang 3858 let type_ t = t.type_ 3859 let url t = t.url 3860 3861 let jsont : t Json.codec = 3862 Json.Codec.Object.map ~kind:"MRSSGroupContent" 3863 (fun duration file_size framerate height lang type_ url -> { duration; file_size; framerate; height; lang; type_; url }) 3864 |> Json.Codec.Object.opt_member "duration" Json.Codec.int ~enc:(fun r -> r.duration) 3865 |> Json.Codec.Object.opt_member "fileSize" Json.Codec.int ~enc:(fun r -> r.file_size) 3866 |> Json.Codec.Object.opt_member "framerate" Json.Codec.int ~enc:(fun r -> r.framerate) 3867 |> Json.Codec.Object.opt_member "height" Json.Codec.int ~enc:(fun r -> r.height) 3868 |> Json.Codec.Object.opt_member "lang" Json.Codec.string ~enc:(fun r -> r.lang) 3869 |> Json.Codec.Object.opt_member "type" Json.Codec.string ~enc:(fun r -> r.type_) 3870 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 3871 |> Json.Codec.Object.skip_unknown 3872 |> Json.Codec.Object.seal 3873 end 3874end 3875 3876module LiveVideoSession = struct 3877 module Types = struct 3878 module Response = struct 3879 type t = { 3880 end_date : Ptime.t option; (** End date of the live session *) 3881 error : int option; (** Error type if an error occurred during the live session: 3882 - `1`: Bad socket health (transcoding is too slow) 3883 - `2`: Max duration exceeded 3884 - `3`: Quota exceeded 3885 - `4`: Quota FFmpeg error 3886 - `5`: Video has been blacklisted during the live 3887 *) 3888 id : int option; 3889 replay_video : Json.t option; (** Video replay information *) 3890 start_date : Ptime.t option; (** Start date of the live session *) 3891 } 3892 end 3893 end 3894 3895 module Response = struct 3896 include Types.Response 3897 3898 let v ?end_date ?error ?id ?replay_video ?start_date () = { end_date; error; id; replay_video; start_date } 3899 3900 let end_date t = t.end_date 3901 let error t = t.error 3902 let id t = t.id 3903 let replay_video t = t.replay_video 3904 let start_date t = t.start_date 3905 3906 let jsont : t Json.codec = 3907 Json.Codec.Object.map ~kind:"LiveVideoSessionResponse" 3908 (fun end_date error id replay_video start_date -> { end_date; error; id; replay_video; start_date }) 3909 |> Json.Codec.Object.member "endDate" Openapi.Runtime.nullable_ptime 3910 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.end_date) 3911 |> Json.Codec.Object.member "error" Openapi.Runtime.nullable_int 3912 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.error) 3913 |> Json.Codec.Object.opt_member "id" Json.Codec.int ~enc:(fun r -> r.id) 3914 |> Json.Codec.Object.opt_member "replayVideo" Json.Codec.Value.t ~enc:(fun r -> r.replay_video) 3915 |> Json.Codec.Object.opt_member "startDate" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.start_date) 3916 |> Json.Codec.Object.skip_unknown 3917 |> Json.Codec.Object.seal 3918 end 3919 3920 (** Get live session of a replay 3921 3922 If the video is a replay of a live, you can find the associated live session using this endpoint 3923 @param id The object id, uuid or short uuid 3924 *) 3925 let get_api_v1_videos_live_session ~id client () = 3926 let op_name = "get_api_v1_videos_live_session" in 3927 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/live-session" in 3928 let query = "" in 3929 let url = client.base_url ^ url_path ^ query in 3930 let response = 3931 try Requests.get client.session url 3932 with Eio.Io _ as ex -> 3933 let bt = Printexc.get_raw_backtrace () in 3934 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 3935 in 3936 if Requests.Response.ok response then 3937 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 3938 else 3939 let body = Requests.Response.text response in 3940 let parsed_body = 3941 match Json.of_string Json.Codec.Value.t body with 3942 | Ok json -> Some (Openapi.Runtime.Json json) 3943 | Error _ -> Some (Openapi.Runtime.Raw body) 3944 in 3945 raise (Openapi.Runtime.Api_error { 3946 operation = op_name; 3947 method_ = "GET"; 3948 url; 3949 status = Requests.Response.status_code response; 3950 body; 3951 parsed_body; 3952 }) 3953end 3954 3955module LiveVideoLatencyMode = struct 3956 module Types = struct 3957 module T = struct 3958 (** The live latency mode (Default = `1`, High latency = `2`, Small Latency = `3`) *) 3959 type t = string 3960 end 3961 end 3962 3963 module T = struct 3964 include Types.T 3965 let jsont = Json.Codec.string 3966 end 3967end 3968 3969module LiveSchedule = struct 3970 module Types = struct 3971 module T = struct 3972 type t = { 3973 start_at : Ptime.t option; (** Date when the stream is scheduled to air at *) 3974 } 3975 end 3976 end 3977 3978 module T = struct 3979 include Types.T 3980 3981 let v ?start_at () = { start_at } 3982 3983 let start_at t = t.start_at 3984 3985 let jsont : t Json.codec = 3986 Json.Codec.Object.map ~kind:"LiveSchedule" 3987 (fun start_at -> { start_at }) 3988 |> Json.Codec.Object.opt_member "startAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.start_at) 3989 |> Json.Codec.Object.skip_unknown 3990 |> Json.Codec.Object.seal 3991 end 3992end 3993 3994module LiveVideo = struct 3995 module Types = struct 3996 module Update = struct 3997 type t = { 3998 latency_mode : LiveVideoLatencyMode.T.t option; (** User can select live latency mode if enabled by the instance *) 3999 permanent_live : bool option; (** User can stream multiple times in a permanent live *) 4000 replay_settings : LiveVideoReplaySettings.T.t option; 4001 save_replay : bool option; 4002 schedules : LiveSchedule.T.t list option; 4003 } 4004 end 4005 4006 module Response = struct 4007 type t = { 4008 latency_mode : LiveVideoLatencyMode.T.t option; (** User can select live latency mode if enabled by the instance *) 4009 permanent_live : bool option; (** User can stream multiple times in a permanent live *) 4010 replay_settings : LiveVideoReplaySettings.T.t option; 4011 rtmp_url : string option; (** Included in the response if an appropriate token is provided *) 4012 rtmps_url : string option; (** Included in the response if an appropriate token is provided *) 4013 save_replay : bool option; 4014 schedules : LiveSchedule.T.t list option; 4015 stream_key : string option; (** RTMP stream key to use to stream into this live video. Included in the response if an appropriate token is provided *) 4016 } 4017 end 4018 end 4019 4020 module Update = struct 4021 include Types.Update 4022 4023 let v ?latency_mode ?permanent_live ?replay_settings ?save_replay ?schedules () = { latency_mode; permanent_live; replay_settings; save_replay; schedules } 4024 4025 let latency_mode t = t.latency_mode 4026 let permanent_live t = t.permanent_live 4027 let replay_settings t = t.replay_settings 4028 let save_replay t = t.save_replay 4029 let schedules t = t.schedules 4030 4031 let jsont : t Json.codec = 4032 Json.Codec.Object.map ~kind:"LiveVideoUpdate" 4033 (fun latency_mode permanent_live replay_settings save_replay schedules -> { latency_mode; permanent_live; replay_settings; save_replay; schedules }) 4034 |> Json.Codec.Object.opt_member "latencyMode" LiveVideoLatencyMode.T.jsont ~enc:(fun r -> r.latency_mode) 4035 |> Json.Codec.Object.opt_member "permanentLive" Json.Codec.bool ~enc:(fun r -> r.permanent_live) 4036 |> Json.Codec.Object.opt_member "replaySettings" LiveVideoReplaySettings.T.jsont ~enc:(fun r -> r.replay_settings) 4037 |> Json.Codec.Object.opt_member "saveReplay" Json.Codec.bool ~enc:(fun r -> r.save_replay) 4038 |> Json.Codec.Object.opt_member "schedules" (Json.Codec.list LiveSchedule.T.jsont) ~enc:(fun r -> r.schedules) 4039 |> Json.Codec.Object.skip_unknown 4040 |> Json.Codec.Object.seal 4041 end 4042 4043 module Response = struct 4044 include Types.Response 4045 4046 let v ?latency_mode ?permanent_live ?replay_settings ?rtmp_url ?rtmps_url ?save_replay ?schedules ?stream_key () = { latency_mode; permanent_live; replay_settings; rtmp_url; rtmps_url; save_replay; schedules; stream_key } 4047 4048 let latency_mode t = t.latency_mode 4049 let permanent_live t = t.permanent_live 4050 let replay_settings t = t.replay_settings 4051 let rtmp_url t = t.rtmp_url 4052 let rtmps_url t = t.rtmps_url 4053 let save_replay t = t.save_replay 4054 let schedules t = t.schedules 4055 let stream_key t = t.stream_key 4056 4057 let jsont : t Json.codec = 4058 Json.Codec.Object.map ~kind:"LiveVideoResponse" 4059 (fun latency_mode permanent_live replay_settings rtmp_url rtmps_url save_replay schedules stream_key -> { latency_mode; permanent_live; replay_settings; rtmp_url; rtmps_url; save_replay; schedules; stream_key }) 4060 |> Json.Codec.Object.opt_member "latencyMode" LiveVideoLatencyMode.T.jsont ~enc:(fun r -> r.latency_mode) 4061 |> Json.Codec.Object.opt_member "permanentLive" Json.Codec.bool ~enc:(fun r -> r.permanent_live) 4062 |> Json.Codec.Object.opt_member "replaySettings" LiveVideoReplaySettings.T.jsont ~enc:(fun r -> r.replay_settings) 4063 |> Json.Codec.Object.opt_member "rtmpUrl" Json.Codec.string ~enc:(fun r -> r.rtmp_url) 4064 |> Json.Codec.Object.opt_member "rtmpsUrl" Json.Codec.string ~enc:(fun r -> r.rtmps_url) 4065 |> Json.Codec.Object.opt_member "saveReplay" Json.Codec.bool ~enc:(fun r -> r.save_replay) 4066 |> Json.Codec.Object.opt_member "schedules" (Json.Codec.list LiveSchedule.T.jsont) ~enc:(fun r -> r.schedules) 4067 |> Json.Codec.Object.opt_member "streamKey" Json.Codec.string ~enc:(fun r -> r.stream_key) 4068 |> Json.Codec.Object.skip_unknown 4069 |> Json.Codec.Object.seal 4070 end 4071 4072 (** Get information about a live 4073 @param id The object id, uuid or short uuid 4074 *) 4075 let get_live_id ~id client () = 4076 let op_name = "get_live_id" in 4077 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/live/{id}" in 4078 let query = "" in 4079 let url = client.base_url ^ url_path ^ query in 4080 let response = 4081 try Requests.get client.session url 4082 with Eio.Io _ as ex -> 4083 let bt = Printexc.get_raw_backtrace () in 4084 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 4085 in 4086 if Requests.Response.ok response then 4087 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 4088 else 4089 let body = Requests.Response.text response in 4090 let parsed_body = 4091 match Json.of_string Json.Codec.Value.t body with 4092 | Ok json -> Some (Openapi.Runtime.Json json) 4093 | Error _ -> Some (Openapi.Runtime.Raw body) 4094 in 4095 raise (Openapi.Runtime.Api_error { 4096 operation = op_name; 4097 method_ = "GET"; 4098 url; 4099 status = Requests.Response.status_code response; 4100 body; 4101 parsed_body; 4102 }) 4103end 4104 4105module ImportVideosInChannel = struct 4106 module Types = struct 4107 module Create = struct 4108 type t = { 4109 external_channel_url : string; 4110 video_channel_sync_id : int option; (** If part of a channel sync process, specify its id to assign video imports to this channel synchronization *) 4111 } 4112 end 4113 end 4114 4115 module Create = struct 4116 include Types.Create 4117 4118 let v ~external_channel_url ?video_channel_sync_id () = { external_channel_url; video_channel_sync_id } 4119 4120 let external_channel_url t = t.external_channel_url 4121 let video_channel_sync_id t = t.video_channel_sync_id 4122 4123 let jsont : t Json.codec = 4124 Json.Codec.Object.map ~kind:"ImportVideosInChannelCreate" 4125 (fun external_channel_url video_channel_sync_id -> { external_channel_url; video_channel_sync_id }) 4126 |> Json.Codec.Object.member "externalChannelUrl" Json.Codec.string ~enc:(fun r -> r.external_channel_url) 4127 |> Json.Codec.Object.opt_member "videoChannelSyncId" Json.Codec.int ~enc:(fun r -> r.video_channel_sync_id) 4128 |> Json.Codec.Object.skip_unknown 4129 |> Json.Codec.Object.seal 4130 end 4131end 4132 4133module Id = struct 4134 module Types = struct 4135 module T = struct 4136 type t = Json.t 4137 end 4138 end 4139 4140 module T = struct 4141 include Types.T 4142 let jsont = Json.Codec.Value.t 4143 let v () = Json.Null ((), Json.Meta.none) 4144 end 4145end 4146 4147module WatchedWordsLists = struct 4148 module Types = struct 4149 module T = struct 4150 type t = { 4151 created_at : Ptime.t option; 4152 id : Id.T.t option; 4153 list_name : string option; 4154 updated_at : Ptime.t option; 4155 words : string list option; 4156 } 4157 end 4158 end 4159 4160 module T = struct 4161 include Types.T 4162 4163 let v ?created_at ?id ?list_name ?updated_at ?words () = { created_at; id; list_name; updated_at; words } 4164 4165 let created_at t = t.created_at 4166 let id t = t.id 4167 let list_name t = t.list_name 4168 let updated_at t = t.updated_at 4169 let words t = t.words 4170 4171 let jsont : t Json.codec = 4172 Json.Codec.Object.map ~kind:"WatchedWordsLists" 4173 (fun created_at id list_name updated_at words -> { created_at; id; list_name; updated_at; words }) 4174 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 4175 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4176 |> Json.Codec.Object.opt_member "listName" Json.Codec.string ~enc:(fun r -> r.list_name) 4177 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 4178 |> Json.Codec.Object.opt_member "words" (Json.Codec.list Json.Codec.string) ~enc:(fun r -> r.words) 4179 |> Json.Codec.Object.skip_unknown 4180 |> Json.Codec.Object.seal 4181 end 4182end 4183 4184module VideoRedundancy = struct 4185 module Types = struct 4186 module T = struct 4187 type t = { 4188 id : Id.T.t option; 4189 name : string option; 4190 redundancies : Json.t option; 4191 url : string option; 4192 uuid : Uuidv4.T.t option; 4193 } 4194 end 4195 end 4196 4197 module T = struct 4198 include Types.T 4199 4200 let v ?id ?name ?redundancies ?url ?uuid () = { id; name; redundancies; url; uuid } 4201 4202 let id t = t.id 4203 let name t = t.name 4204 let redundancies t = t.redundancies 4205 let url t = t.url 4206 let uuid t = t.uuid 4207 4208 let jsont : t Json.codec = 4209 Json.Codec.Object.map ~kind:"VideoRedundancy" 4210 (fun id name redundancies url uuid -> { id; name; redundancies; url; uuid }) 4211 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4212 |> Json.Codec.Object.opt_member "name" Json.Codec.string ~enc:(fun r -> r.name) 4213 |> Json.Codec.Object.opt_member "redundancies" Json.Codec.Value.t ~enc:(fun r -> r.redundancies) 4214 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 4215 |> Json.Codec.Object.opt_member "uuid" Uuidv4.T.jsont ~enc:(fun r -> r.uuid) 4216 |> Json.Codec.Object.skip_unknown 4217 |> Json.Codec.Object.seal 4218 end 4219 4220 (** List videos being mirrored 4221 @param target direction of the mirror 4222 @param start Offset used to paginate results 4223 @param count Number of items to return 4224 @param sort Sort abuses by criteria 4225 *) 4226 let get_mirrored_videos ~target ?start ?count ?sort client () = 4227 let op_name = "get_mirrored_videos" in 4228 let url_path = "/api/v1/server/redundancy/videos" in 4229 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"target" ~value:target; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 4230 let url = client.base_url ^ url_path ^ query in 4231 let response = 4232 try Requests.get client.session url 4233 with Eio.Io _ as ex -> 4234 let bt = Printexc.get_raw_backtrace () in 4235 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 4236 in 4237 if Requests.Response.ok response then 4238 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 4239 else 4240 let body = Requests.Response.text response in 4241 let parsed_body = 4242 match Json.of_string Json.Codec.Value.t body with 4243 | Ok json -> Some (Openapi.Runtime.Json json) 4244 | Error _ -> Some (Openapi.Runtime.Raw body) 4245 in 4246 raise (Openapi.Runtime.Api_error { 4247 operation = op_name; 4248 method_ = "GET"; 4249 url; 4250 status = Requests.Response.status_code response; 4251 body; 4252 parsed_body; 4253 }) 4254end 4255 4256module VideoPassword = struct 4257 module Types = struct 4258 module T = struct 4259 type t = { 4260 id : Id.T.t option; 4261 password : string option; 4262 video_id : Id.T.t option; 4263 } 4264 end 4265 end 4266 4267 module T = struct 4268 include Types.T 4269 4270 let v ?id ?password ?video_id () = { id; password; video_id } 4271 4272 let id t = t.id 4273 let password t = t.password 4274 let video_id t = t.video_id 4275 4276 let jsont : t Json.codec = 4277 Json.Codec.Object.map ~kind:"VideoPassword" 4278 (fun id password video_id -> { id; password; video_id }) 4279 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4280 |> Json.Codec.Object.opt_member "password" (Openapi.Runtime.validated_string ~min_length:2 Json.Codec.string) ~enc:(fun r -> r.password) 4281 |> Json.Codec.Object.opt_member "videoId" Id.T.jsont ~enc:(fun r -> r.video_id) 4282 |> Json.Codec.Object.skip_unknown 4283 |> Json.Codec.Object.seal 4284 end 4285end 4286 4287module VideoPasswordList = struct 4288 module Types = struct 4289 module T = struct 4290 type t = { 4291 data : VideoPassword.T.t list option; 4292 total : int option; 4293 } 4294 end 4295 end 4296 4297 module T = struct 4298 include Types.T 4299 4300 let v ?data ?total () = { data; total } 4301 4302 let data t = t.data 4303 let total t = t.total 4304 4305 let jsont : t Json.codec = 4306 Json.Codec.Object.map ~kind:"VideoPasswordList" 4307 (fun data total -> { data; total }) 4308 |> Json.Codec.Object.opt_member "data" (Json.Codec.list VideoPassword.T.jsont) ~enc:(fun r -> r.data) 4309 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 4310 |> Json.Codec.Object.skip_unknown 4311 |> Json.Codec.Object.seal 4312 end 4313end 4314 4315module VideoBlacklist = struct 4316 module Types = struct 4317 module T = struct 4318 type t = { 4319 created_at : Ptime.t option; 4320 description : string option; 4321 dislikes : int option; 4322 duration : int option; 4323 id : Id.T.t option; 4324 likes : int option; 4325 name : string option; 4326 nsfw : bool option; 4327 updated_at : Ptime.t option; 4328 uuid : Uuidv4.T.t option; 4329 video_id : Json.t option; 4330 views : int option; 4331 } 4332 end 4333 end 4334 4335 module T = struct 4336 include Types.T 4337 4338 let v ?created_at ?description ?dislikes ?duration ?id ?likes ?name ?nsfw ?updated_at ?uuid ?video_id ?views () = { created_at; description; dislikes; duration; id; likes; name; nsfw; updated_at; uuid; video_id; views } 4339 4340 let created_at t = t.created_at 4341 let description t = t.description 4342 let dislikes t = t.dislikes 4343 let duration t = t.duration 4344 let id t = t.id 4345 let likes t = t.likes 4346 let name t = t.name 4347 let nsfw t = t.nsfw 4348 let updated_at t = t.updated_at 4349 let uuid t = t.uuid 4350 let video_id t = t.video_id 4351 let views t = t.views 4352 4353 let jsont : t Json.codec = 4354 Json.Codec.Object.map ~kind:"VideoBlacklist" 4355 (fun created_at description dislikes duration id likes name nsfw updated_at uuid video_id views -> { created_at; description; dislikes; duration; id; likes; name; nsfw; updated_at; uuid; video_id; views }) 4356 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 4357 |> Json.Codec.Object.opt_member "description" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:10000 Json.Codec.string) ~enc:(fun r -> r.description) 4358 |> Json.Codec.Object.opt_member "dislikes" Json.Codec.int ~enc:(fun r -> r.dislikes) 4359 |> Json.Codec.Object.opt_member "duration" Json.Codec.int ~enc:(fun r -> r.duration) 4360 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4361 |> Json.Codec.Object.opt_member "likes" Json.Codec.int ~enc:(fun r -> r.likes) 4362 |> Json.Codec.Object.opt_member "name" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.name) 4363 |> Json.Codec.Object.opt_member "nsfw" Json.Codec.bool ~enc:(fun r -> r.nsfw) 4364 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 4365 |> Json.Codec.Object.opt_member "uuid" Uuidv4.T.jsont ~enc:(fun r -> r.uuid) 4366 |> Json.Codec.Object.opt_member "videoId" Json.Codec.Value.t ~enc:(fun r -> r.video_id) 4367 |> Json.Codec.Object.opt_member "views" Json.Codec.int ~enc:(fun r -> r.views) 4368 |> Json.Codec.Object.skip_unknown 4369 |> Json.Codec.Object.seal 4370 end 4371end 4372 4373module UserRegistration = struct 4374 module Types = struct 4375 module Request = struct 4376 type t = { 4377 channel : Json.t option; (** channel base information used to create the first channel of the user *) 4378 display_name : string option; (** editable name of the user, displayed in its representations *) 4379 email : string; (** email of the user, used for login or service communications *) 4380 password : Password.T.t; 4381 username : Username.T.t; (** immutable name of the user, used to find or mention its actor *) 4382 registration_reason : string; (** reason for the user to register on the instance *) 4383 } 4384 end 4385 4386 module T = struct 4387 type t = { 4388 account_display_name : string option; 4389 channel_display_name : string option; 4390 channel_handle : string option; 4391 created_at : Ptime.t option; 4392 email : string option; 4393 email_verified : bool option; 4394 id : Id.T.t option; 4395 moderation_response : string option; 4396 registration_reason : string option; 4397 state : Json.t option; 4398 updated_at : Ptime.t option; 4399 user : Json.t option; (** If the registration has been accepted, this is a partial user object created by the registration *) 4400 username : string option; 4401 } 4402 end 4403 end 4404 4405 module Request = struct 4406 include Types.Request 4407 4408 let v ~email ~password ~username ~registration_reason ?channel ?display_name () = { channel; display_name; email; password; username; registration_reason } 4409 4410 let channel t = t.channel 4411 let display_name t = t.display_name 4412 let email t = t.email 4413 let password t = t.password 4414 let username t = t.username 4415 let registration_reason t = t.registration_reason 4416 4417 let jsont : t Json.codec = 4418 Json.Codec.Object.map ~kind:"UserRegistrationRequest" 4419 (fun channel display_name email password username registration_reason -> { channel; display_name; email; password; username; registration_reason }) 4420 |> Json.Codec.Object.opt_member "channel" Json.Codec.Value.t ~enc:(fun r -> r.channel) 4421 |> Json.Codec.Object.opt_member "displayName" (Openapi.Runtime.validated_string ~min_length:1 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.display_name) 4422 |> Json.Codec.Object.member "email" Json.Codec.string ~enc:(fun r -> r.email) 4423 |> Json.Codec.Object.member "password" Password.T.jsont ~enc:(fun r -> r.password) 4424 |> Json.Codec.Object.member "username" Username.T.jsont ~enc:(fun r -> r.username) 4425 |> Json.Codec.Object.member "registrationReason" Json.Codec.string ~enc:(fun r -> r.registration_reason) 4426 |> Json.Codec.Object.skip_unknown 4427 |> Json.Codec.Object.seal 4428 end 4429 4430 module T = struct 4431 include Types.T 4432 4433 let v ?account_display_name ?channel_display_name ?channel_handle ?created_at ?email ?email_verified ?id ?moderation_response ?registration_reason ?state ?updated_at ?user ?username () = { account_display_name; channel_display_name; channel_handle; created_at; email; email_verified; id; moderation_response; registration_reason; state; updated_at; user; username } 4434 4435 let account_display_name t = t.account_display_name 4436 let channel_display_name t = t.channel_display_name 4437 let channel_handle t = t.channel_handle 4438 let created_at t = t.created_at 4439 let email t = t.email 4440 let email_verified t = t.email_verified 4441 let id t = t.id 4442 let moderation_response t = t.moderation_response 4443 let registration_reason t = t.registration_reason 4444 let state t = t.state 4445 let updated_at t = t.updated_at 4446 let user t = t.user 4447 let username t = t.username 4448 4449 let jsont : t Json.codec = 4450 Json.Codec.Object.map ~kind:"UserRegistration" 4451 (fun account_display_name channel_display_name channel_handle created_at email email_verified id moderation_response registration_reason state updated_at user username -> { account_display_name; channel_display_name; channel_handle; created_at; email; email_verified; id; moderation_response; registration_reason; state; updated_at; user; username }) 4452 |> Json.Codec.Object.opt_member "accountDisplayName" Json.Codec.string ~enc:(fun r -> r.account_display_name) 4453 |> Json.Codec.Object.opt_member "channelDisplayName" Json.Codec.string ~enc:(fun r -> r.channel_display_name) 4454 |> Json.Codec.Object.opt_member "channelHandle" Json.Codec.string ~enc:(fun r -> r.channel_handle) 4455 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 4456 |> Json.Codec.Object.opt_member "email" Json.Codec.string ~enc:(fun r -> r.email) 4457 |> Json.Codec.Object.opt_member "emailVerified" Json.Codec.bool ~enc:(fun r -> r.email_verified) 4458 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4459 |> Json.Codec.Object.member "moderationResponse" Openapi.Runtime.nullable_string 4460 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.moderation_response) 4461 |> Json.Codec.Object.opt_member "registrationReason" Json.Codec.string ~enc:(fun r -> r.registration_reason) 4462 |> Json.Codec.Object.opt_member "state" Json.Codec.Value.t ~enc:(fun r -> r.state) 4463 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 4464 |> Json.Codec.Object.member "user" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 4465 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.user) 4466 |> Json.Codec.Object.opt_member "username" Json.Codec.string ~enc:(fun r -> r.username) 4467 |> Json.Codec.Object.skip_unknown 4468 |> Json.Codec.Object.seal 4469 end 4470 4471 (** Request registration 4472 4473 Signup has to be enabled and require approval on the instance *) 4474 let request_registration ~body client () = 4475 let op_name = "request_registration" in 4476 let url_path = "/api/v1/users/registrations/request" in 4477 let query = "" in 4478 let url = client.base_url ^ url_path ^ query in 4479 let response = 4480 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string Request.jsont body)) url 4481 with Eio.Io _ as ex -> 4482 let bt = Printexc.get_raw_backtrace () in 4483 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 4484 in 4485 if Requests.Response.ok response then 4486 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 4487 else 4488 let body = Requests.Response.text response in 4489 let parsed_body = 4490 match Json.of_string Json.Codec.Value.t body with 4491 | Ok json -> Some (Openapi.Runtime.Json json) 4492 | Error _ -> Some (Openapi.Runtime.Raw body) 4493 in 4494 raise (Openapi.Runtime.Api_error { 4495 operation = op_name; 4496 method_ = "POST"; 4497 url; 4498 status = Requests.Response.status_code response; 4499 body; 4500 parsed_body; 4501 }) 4502end 4503 4504module Job = struct 4505 module Types = struct 4506 module T = struct 4507 type t = { 4508 created_at : Ptime.t option; 4509 data : Json.t option; 4510 error : Json.t option; 4511 finished_on : Ptime.t option; 4512 id : Id.T.t option; 4513 processed_on : Ptime.t option; 4514 state : string option; 4515 type_ : string option; 4516 } 4517 end 4518 end 4519 4520 module T = struct 4521 include Types.T 4522 4523 let v ?created_at ?data ?error ?finished_on ?id ?processed_on ?state ?type_ () = { created_at; data; error; finished_on; id; processed_on; state; type_ } 4524 4525 let created_at t = t.created_at 4526 let data t = t.data 4527 let error t = t.error 4528 let finished_on t = t.finished_on 4529 let id t = t.id 4530 let processed_on t = t.processed_on 4531 let state t = t.state 4532 let type_ t = t.type_ 4533 4534 let jsont : t Json.codec = 4535 Json.Codec.Object.map ~kind:"Job" 4536 (fun created_at data error finished_on id processed_on state type_ -> { created_at; data; error; finished_on; id; processed_on; state; type_ }) 4537 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 4538 |> Json.Codec.Object.opt_member "data" Json.Codec.Value.t ~enc:(fun r -> r.data) 4539 |> Json.Codec.Object.opt_member "error" Json.Codec.Value.t ~enc:(fun r -> r.error) 4540 |> Json.Codec.Object.opt_member "finishedOn" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.finished_on) 4541 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4542 |> Json.Codec.Object.opt_member "processedOn" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.processed_on) 4543 |> Json.Codec.Object.opt_member "state" Json.Codec.string ~enc:(fun r -> r.state) 4544 |> Json.Codec.Object.opt_member "type" Json.Codec.string ~enc:(fun r -> r.type_) 4545 |> Json.Codec.Object.skip_unknown 4546 |> Json.Codec.Object.seal 4547 end 4548end 4549 4550module GetMeVideoRating = struct 4551 module Types = struct 4552 module T = struct 4553 type t = { 4554 id : Id.T.t; 4555 rating : string; (** Rating of the video *) 4556 } 4557 end 4558 end 4559 4560 module T = struct 4561 include Types.T 4562 4563 let v ~id ~rating () = { id; rating } 4564 4565 let id t = t.id 4566 let rating t = t.rating 4567 4568 let jsont : t Json.codec = 4569 Json.Codec.Object.map ~kind:"GetMeVideoRating" 4570 (fun id rating -> { id; rating }) 4571 |> Json.Codec.Object.member "id" Id.T.jsont ~enc:(fun r -> r.id) 4572 |> Json.Codec.Object.member "rating" Json.Codec.string ~enc:(fun r -> r.rating) 4573 |> Json.Codec.Object.skip_unknown 4574 |> Json.Codec.Object.seal 4575 end 4576 4577 (** Get rate of my user for a video 4578 @param video_id The video id 4579 *) 4580 let get_api_v1_users_me_videos_rating ~video_id client () = 4581 let op_name = "get_api_v1_users_me_videos_rating" in 4582 let url_path = Openapi.Runtime.Path.render ~params:[("videoId", video_id)] "/api/v1/users/me/videos/{videoId}/rating" in 4583 let query = "" in 4584 let url = client.base_url ^ url_path ^ query in 4585 let response = 4586 try Requests.get client.session url 4587 with Eio.Io _ as ex -> 4588 let bt = Printexc.get_raw_backtrace () in 4589 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 4590 in 4591 if Requests.Response.ok response then 4592 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 4593 else 4594 let body = Requests.Response.text response in 4595 let parsed_body = 4596 match Json.of_string Json.Codec.Value.t body with 4597 | Ok json -> Some (Openapi.Runtime.Json json) 4598 | Error _ -> Some (Openapi.Runtime.Raw body) 4599 in 4600 raise (Openapi.Runtime.Api_error { 4601 operation = op_name; 4602 method_ = "GET"; 4603 url; 4604 status = Requests.Response.status_code response; 4605 body; 4606 parsed_body; 4607 }) 4608end 4609 4610module FileRedundancyInformation = struct 4611 module Types = struct 4612 module T = struct 4613 type t = { 4614 created_at : Ptime.t option; 4615 expires_on : Ptime.t option; 4616 file_url : string option; 4617 id : Id.T.t option; 4618 size : int option; 4619 strategy : string option; 4620 updated_at : Ptime.t option; 4621 } 4622 end 4623 end 4624 4625 module T = struct 4626 include Types.T 4627 4628 let v ?created_at ?expires_on ?file_url ?id ?size ?strategy ?updated_at () = { created_at; expires_on; file_url; id; size; strategy; updated_at } 4629 4630 let created_at t = t.created_at 4631 let expires_on t = t.expires_on 4632 let file_url t = t.file_url 4633 let id t = t.id 4634 let size t = t.size 4635 let strategy t = t.strategy 4636 let updated_at t = t.updated_at 4637 4638 let jsont : t Json.codec = 4639 Json.Codec.Object.map ~kind:"FileRedundancyInformation" 4640 (fun created_at expires_on file_url id size strategy updated_at -> { created_at; expires_on; file_url; id; size; strategy; updated_at }) 4641 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 4642 |> Json.Codec.Object.opt_member "expiresOn" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.expires_on) 4643 |> Json.Codec.Object.opt_member "fileUrl" Json.Codec.string ~enc:(fun r -> r.file_url) 4644 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4645 |> Json.Codec.Object.opt_member "size" Json.Codec.int ~enc:(fun r -> r.size) 4646 |> Json.Codec.Object.opt_member "strategy" Json.Codec.string ~enc:(fun r -> r.strategy) 4647 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 4648 |> Json.Codec.Object.skip_unknown 4649 |> Json.Codec.Object.seal 4650 end 4651end 4652 4653module FileStorage = struct 4654 module Types = struct 4655 module T = struct 4656 (** The file storage type: 4657 - `0` File system 4658 - `1` Object storage 4659 *) 4660 type t = string 4661 end 4662 end 4663 4664 module T = struct 4665 include Types.T 4666 let jsont = Json.Codec.string 4667 end 4668end 4669 4670module VideoFile = struct 4671 module Types = struct 4672 module T = struct 4673 type t = { 4674 file_download_url : string option; (** URL endpoint that transfers the video file as an attachment (so that the browser opens a download dialog) *) 4675 file_url : string option; (** Direct URL of the video *) 4676 fps : float option; (** Frames per second of the video file *) 4677 has_audio : bool option; (** **PeerTube >= 6.2** The file container has an audio stream *) 4678 has_video : bool option; (** **PeerTube >= 6.2** The file container has a video stream *) 4679 height : float option; (** **PeerTube >= 6.1** Video stream height *) 4680 id : Id.T.t option; 4681 magnet_uri : string option; (** magnet URI allowing to resolve the video via BitTorrent without a metainfo file *) 4682 metadata_url : string option; (** URL dereferencing the output of ffprobe on the file *) 4683 playlist_url : string option; (** Playlist URL of the file if it is owned by a playlist *) 4684 resolution : VideoResolutionConstant.T.t option; 4685 size : int option; (** Video file size in bytes *) 4686 storage : FileStorage.T.t option; 4687 torrent_download_url : string option; (** URL endpoint that transfers the torrent file as an attachment (so that the browser opens a download dialog) *) 4688 torrent_url : string option; (** Direct URL of the torrent file *) 4689 width : float option; (** **PeerTube >= 6.1** Video stream width *) 4690 } 4691 end 4692 end 4693 4694 module T = struct 4695 include Types.T 4696 4697 let v ?file_download_url ?file_url ?fps ?has_audio ?has_video ?height ?id ?magnet_uri ?metadata_url ?playlist_url ?resolution ?size ?storage ?torrent_download_url ?torrent_url ?width () = { file_download_url; file_url; fps; has_audio; has_video; height; id; magnet_uri; metadata_url; playlist_url; resolution; size; storage; torrent_download_url; torrent_url; width } 4698 4699 let file_download_url t = t.file_download_url 4700 let file_url t = t.file_url 4701 let fps t = t.fps 4702 let has_audio t = t.has_audio 4703 let has_video t = t.has_video 4704 let height t = t.height 4705 let id t = t.id 4706 let magnet_uri t = t.magnet_uri 4707 let metadata_url t = t.metadata_url 4708 let playlist_url t = t.playlist_url 4709 let resolution t = t.resolution 4710 let size t = t.size 4711 let storage t = t.storage 4712 let torrent_download_url t = t.torrent_download_url 4713 let torrent_url t = t.torrent_url 4714 let width t = t.width 4715 4716 let jsont : t Json.codec = 4717 Json.Codec.Object.map ~kind:"VideoFile" 4718 (fun file_download_url file_url fps has_audio has_video height id magnet_uri metadata_url playlist_url resolution size storage torrent_download_url torrent_url width -> { file_download_url; file_url; fps; has_audio; has_video; height; id; magnet_uri; metadata_url; playlist_url; resolution; size; storage; torrent_download_url; torrent_url; width }) 4719 |> Json.Codec.Object.opt_member "fileDownloadUrl" Json.Codec.string ~enc:(fun r -> r.file_download_url) 4720 |> Json.Codec.Object.opt_member "fileUrl" Json.Codec.string ~enc:(fun r -> r.file_url) 4721 |> Json.Codec.Object.opt_member "fps" Json.Codec.number ~enc:(fun r -> r.fps) 4722 |> Json.Codec.Object.opt_member "hasAudio" Json.Codec.bool ~enc:(fun r -> r.has_audio) 4723 |> Json.Codec.Object.opt_member "hasVideo" Json.Codec.bool ~enc:(fun r -> r.has_video) 4724 |> Json.Codec.Object.opt_member "height" Json.Codec.number ~enc:(fun r -> r.height) 4725 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4726 |> Json.Codec.Object.opt_member "magnetUri" (Openapi.Runtime.validated_string ~pattern:"/magnet:\\?xt=urn:[a-z0-9]+:[a-z0-9]{32}/i" Json.Codec.string) ~enc:(fun r -> r.magnet_uri) 4727 |> Json.Codec.Object.opt_member "metadataUrl" Json.Codec.string ~enc:(fun r -> r.metadata_url) 4728 |> Json.Codec.Object.opt_member "playlistUrl" Json.Codec.string ~enc:(fun r -> r.playlist_url) 4729 |> Json.Codec.Object.opt_member "resolution" VideoResolutionConstant.T.jsont ~enc:(fun r -> r.resolution) 4730 |> Json.Codec.Object.opt_member "size" Json.Codec.int ~enc:(fun r -> r.size) 4731 |> Json.Codec.Object.opt_member "storage" FileStorage.T.jsont ~enc:(fun r -> r.storage) 4732 |> Json.Codec.Object.opt_member "torrentDownloadUrl" Json.Codec.string ~enc:(fun r -> r.torrent_download_url) 4733 |> Json.Codec.Object.opt_member "torrentUrl" Json.Codec.string ~enc:(fun r -> r.torrent_url) 4734 |> Json.Codec.Object.opt_member "width" Json.Codec.number ~enc:(fun r -> r.width) 4735 |> Json.Codec.Object.skip_unknown 4736 |> Json.Codec.Object.seal 4737 end 4738end 4739 4740module VideoStreamingPlaylistsHls = struct 4741 module Types = struct 4742 module T = struct 4743 type t = { 4744 files : VideoFile.T.t list option; (** Video files associated to this playlist. 4745 4746 The difference with the root `files` property is that these files are fragmented, so they can be used in this streaming playlist (HLS, etc.) 4747 *) 4748 playlist_url : string option; 4749 redundancies : Json.t list option; 4750 segments_sha256_url : string option; 4751 } 4752 end 4753 end 4754 4755 module T = struct 4756 include Types.T 4757 4758 let v ?files ?playlist_url ?redundancies ?segments_sha256_url () = { files; playlist_url; redundancies; segments_sha256_url } 4759 4760 let files t = t.files 4761 let playlist_url t = t.playlist_url 4762 let redundancies t = t.redundancies 4763 let segments_sha256_url t = t.segments_sha256_url 4764 4765 let jsont : t Json.codec = 4766 Json.Codec.Object.map ~kind:"VideoStreamingPlaylists-HLS" 4767 (fun files playlist_url redundancies segments_sha256_url -> { files; playlist_url; redundancies; segments_sha256_url }) 4768 |> Json.Codec.Object.opt_member "files" (Json.Codec.list VideoFile.T.jsont) ~enc:(fun r -> r.files) 4769 |> Json.Codec.Object.opt_member "playlistUrl" Json.Codec.string ~enc:(fun r -> r.playlist_url) 4770 |> Json.Codec.Object.opt_member "redundancies" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.redundancies) 4771 |> Json.Codec.Object.opt_member "segmentsSha256Url" Json.Codec.string ~enc:(fun r -> r.segments_sha256_url) 4772 |> Json.Codec.Object.skip_unknown 4773 |> Json.Codec.Object.seal 4774 end 4775end 4776 4777module VideoStreamingPlaylists = struct 4778 module Types = struct 4779 module T = struct 4780 type t = { 4781 id : Id.T.t option; 4782 type_ : int option; (** Playlist type: 4783 - `1`: HLS 4784 *) 4785 files : VideoFile.T.t list option; (** Video files associated to this playlist. 4786 4787 The difference with the root `files` property is that these files are fragmented, so they can be used in this streaming playlist (HLS, etc.) 4788 *) 4789 playlist_url : string option; 4790 redundancies : Json.t list option; 4791 segments_sha256_url : string option; 4792 } 4793 end 4794 end 4795 4796 module T = struct 4797 include Types.T 4798 4799 let v ?id ?type_ ?files ?playlist_url ?redundancies ?segments_sha256_url () = { id; type_; files; playlist_url; redundancies; segments_sha256_url } 4800 4801 let id t = t.id 4802 let type_ t = t.type_ 4803 let files t = t.files 4804 let playlist_url t = t.playlist_url 4805 let redundancies t = t.redundancies 4806 let segments_sha256_url t = t.segments_sha256_url 4807 4808 let jsont : t Json.codec = 4809 Json.Codec.Object.map ~kind:"VideoStreamingPlaylists" 4810 (fun id type_ files playlist_url redundancies segments_sha256_url -> { id; type_; files; playlist_url; redundancies; segments_sha256_url }) 4811 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 4812 |> Json.Codec.Object.opt_member "type" Json.Codec.int ~enc:(fun r -> r.type_) 4813 |> Json.Codec.Object.opt_member "files" (Json.Codec.list VideoFile.T.jsont) ~enc:(fun r -> r.files) 4814 |> Json.Codec.Object.opt_member "playlistUrl" Json.Codec.string ~enc:(fun r -> r.playlist_url) 4815 |> Json.Codec.Object.opt_member "redundancies" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.redundancies) 4816 |> Json.Codec.Object.opt_member "segmentsSha256Url" Json.Codec.string ~enc:(fun r -> r.segments_sha256_url) 4817 |> Json.Codec.Object.skip_unknown 4818 |> Json.Codec.Object.seal 4819 end 4820end 4821 4822module CustomHomepage = struct 4823 module Types = struct 4824 module T = struct 4825 type t = { 4826 content : string option; 4827 } 4828 end 4829 end 4830 4831 module T = struct 4832 include Types.T 4833 4834 let v ?content () = { content } 4835 4836 let content t = t.content 4837 4838 let jsont : t Json.codec = 4839 Json.Codec.Object.map ~kind:"CustomHomepage" 4840 (fun content -> { content }) 4841 |> Json.Codec.Object.opt_member "content" Json.Codec.string ~enc:(fun r -> r.content) 4842 |> Json.Codec.Object.skip_unknown 4843 |> Json.Codec.Object.seal 4844 end 4845 4846 (** Get instance custom homepage *) 4847 let get_api_v1_custom_pages_homepage_instance client () = 4848 let op_name = "get_api_v1_custom_pages_homepage_instance" in 4849 let url_path = "/api/v1/custom-pages/homepage/instance" in 4850 let query = "" in 4851 let url = client.base_url ^ url_path ^ query in 4852 let response = 4853 try Requests.get client.session url 4854 with Eio.Io _ as ex -> 4855 let bt = Printexc.get_raw_backtrace () in 4856 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 4857 in 4858 if Requests.Response.ok response then 4859 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 4860 else 4861 let body = Requests.Response.text response in 4862 let parsed_body = 4863 match Json.of_string Json.Codec.Value.t body with 4864 | Ok json -> Some (Openapi.Runtime.Json json) 4865 | Error _ -> Some (Openapi.Runtime.Raw body) 4866 in 4867 raise (Openapi.Runtime.Api_error { 4868 operation = op_name; 4869 method_ = "GET"; 4870 url; 4871 status = Requests.Response.status_code response; 4872 body; 4873 parsed_body; 4874 }) 4875end 4876 4877module CommentAutoTagPolicies = struct 4878 module Types = struct 4879 module T = struct 4880 type t = { 4881 review : string list option; (** Auto tags that automatically set the comment in review state *) 4882 } 4883 end 4884 end 4885 4886 module T = struct 4887 include Types.T 4888 4889 let v ?review () = { review } 4890 4891 let review t = t.review 4892 4893 let jsont : t Json.codec = 4894 Json.Codec.Object.map ~kind:"CommentAutoTagPolicies" 4895 (fun review -> { review }) 4896 |> Json.Codec.Object.opt_member "review" (Json.Codec.list Json.Codec.string) ~enc:(fun r -> r.review) 4897 |> Json.Codec.Object.skip_unknown 4898 |> Json.Codec.Object.seal 4899 end 4900 4901 (** Get account auto tag policies on comments 4902 4903 **PeerTube >= 6.2** 4904 @param account_name account name to get auto tag policies 4905 *) 4906 let get_api_v1_automatic_tags_policies_accounts_comments ~account_name client () = 4907 let op_name = "get_api_v1_automatic_tags_policies_accounts_comments" in 4908 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name)] "/api/v1/automatic-tags/policies/accounts/{accountName}/comments" in 4909 let query = "" in 4910 let url = client.base_url ^ url_path ^ query in 4911 let response = 4912 try Requests.get client.session url 4913 with Eio.Io _ as ex -> 4914 let bt = Printexc.get_raw_backtrace () in 4915 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 4916 in 4917 if Requests.Response.ok response then 4918 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 4919 else 4920 let body = Requests.Response.text response in 4921 let parsed_body = 4922 match Json.of_string Json.Codec.Value.t body with 4923 | Ok json -> Some (Openapi.Runtime.Json json) 4924 | Error _ -> Some (Openapi.Runtime.Raw body) 4925 in 4926 raise (Openapi.Runtime.Api_error { 4927 operation = op_name; 4928 method_ = "GET"; 4929 url; 4930 status = Requests.Response.status_code response; 4931 body; 4932 parsed_body; 4933 }) 4934end 4935 4936module ChannelActivityList = struct 4937 module Types = struct 4938 module Response = struct 4939 type t = { 4940 data : Json.t list option; 4941 total : int option; 4942 } 4943 end 4944 end 4945 4946 module Response = struct 4947 include Types.Response 4948 4949 let v ?data ?total () = { data; total } 4950 4951 let data t = t.data 4952 let total t = t.total 4953 4954 let jsont : t Json.codec = 4955 Json.Codec.Object.map ~kind:"ChannelActivityListResponse" 4956 (fun data total -> { data; total }) 4957 |> Json.Codec.Object.opt_member "data" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.data) 4958 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 4959 |> Json.Codec.Object.skip_unknown 4960 |> Json.Codec.Object.seal 4961 end 4962 4963 (** List activities of a video channel 4964 4965 **PeerTube >= 8.0** 4966 @param channel_handle The video channel handle 4967 @param start Offset used to paginate results 4968 @param count Number of items to return 4969 @param sort Sort column 4970 *) 4971 let list_video_channel_activities ~channel_handle ?start ?count ?sort client () = 4972 let op_name = "list_video_channel_activities" in 4973 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/activities" in 4974 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 4975 let url = client.base_url ^ url_path ^ query in 4976 let response = 4977 try Requests.get client.session url 4978 with Eio.Io _ as ex -> 4979 let bt = Printexc.get_raw_backtrace () in 4980 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 4981 in 4982 if Requests.Response.ok response then 4983 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 4984 else 4985 let body = Requests.Response.text response in 4986 let parsed_body = 4987 match Json.of_string Json.Codec.Value.t body with 4988 | Ok json -> Some (Openapi.Runtime.Json json) 4989 | Error _ -> Some (Openapi.Runtime.Raw body) 4990 in 4991 raise (Openapi.Runtime.Api_error { 4992 operation = op_name; 4993 method_ = "GET"; 4994 url; 4995 status = Requests.Response.status_code response; 4996 body; 4997 parsed_body; 4998 }) 4999end 5000 5001module Block = struct 5002 module Types = struct 5003 module Status = struct 5004 type t = { 5005 accounts : Json.t option; 5006 hosts : Json.t option; 5007 } 5008 end 5009 end 5010 5011 module Status = struct 5012 include Types.Status 5013 5014 let v ?accounts ?hosts () = { accounts; hosts } 5015 5016 let accounts t = t.accounts 5017 let hosts t = t.hosts 5018 5019 let jsont : t Json.codec = 5020 Json.Codec.Object.map ~kind:"BlockStatus" 5021 (fun accounts hosts -> { accounts; hosts }) 5022 |> Json.Codec.Object.opt_member "accounts" Json.Codec.Value.t ~enc:(fun r -> r.accounts) 5023 |> Json.Codec.Object.opt_member "hosts" Json.Codec.Value.t ~enc:(fun r -> r.hosts) 5024 |> Json.Codec.Object.skip_unknown 5025 |> Json.Codec.Object.seal 5026 end 5027 5028 (** Get block status of accounts/hosts 5029 @param accounts Check if these accounts are blocked 5030 @param hosts Check if these hosts are blocked 5031 *) 5032 let get_api_v1_blocklist_status ?accounts ?hosts client () = 5033 let op_name = "get_api_v1_blocklist_status" in 5034 let url_path = "/api/v1/blocklist/status" in 5035 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"accounts" ~value:accounts; Openapi.Runtime.Query.optional ~key:"hosts" ~value:hosts]) in 5036 let url = client.base_url ^ url_path ^ query in 5037 let response = 5038 try Requests.get client.session url 5039 with Eio.Io _ as ex -> 5040 let bt = Printexc.get_raw_backtrace () in 5041 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 5042 in 5043 if Requests.Response.ok response then 5044 Openapi.Runtime.Json.decode_json_exn Status.jsont (Requests.Response.text response) 5045 else 5046 let body = Requests.Response.text response in 5047 let parsed_body = 5048 match Json.of_string Json.Codec.Value.t body with 5049 | Ok json -> Some (Openapi.Runtime.Json json) 5050 | Error _ -> Some (Openapi.Runtime.Raw body) 5051 in 5052 raise (Openapi.Runtime.Api_error { 5053 operation = op_name; 5054 method_ = "GET"; 5055 url; 5056 status = Requests.Response.status_code response; 5057 body; 5058 parsed_body; 5059 }) 5060end 5061 5062module AutomaticTagAvailable = struct 5063 module Types = struct 5064 module T = struct 5065 type t = { 5066 available : Json.t list option; (** Available auto tags that can be used to filter objects or set a comment in review state *) 5067 } 5068 end 5069 end 5070 5071 module T = struct 5072 include Types.T 5073 5074 let v ?available () = { available } 5075 5076 let available t = t.available 5077 5078 let jsont : t Json.codec = 5079 Json.Codec.Object.map ~kind:"AutomaticTagAvailable" 5080 (fun available -> { available }) 5081 |> Json.Codec.Object.opt_member "available" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.available) 5082 |> Json.Codec.Object.skip_unknown 5083 |> Json.Codec.Object.seal 5084 end 5085 5086 (** Get account available auto tags 5087 5088 **PeerTube >= 6.2** 5089 @param account_name account name to get auto tag policies 5090 *) 5091 let get_api_v1_automatic_tags_accounts_available ~account_name client () = 5092 let op_name = "get_api_v1_automatic_tags_accounts_available" in 5093 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name)] "/api/v1/automatic-tags/accounts/{accountName}/available" in 5094 let query = "" in 5095 let url = client.base_url ^ url_path ^ query in 5096 let response = 5097 try Requests.get client.session url 5098 with Eio.Io _ as ex -> 5099 let bt = Printexc.get_raw_backtrace () in 5100 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 5101 in 5102 if Requests.Response.ok response then 5103 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 5104 else 5105 let body = Requests.Response.text response in 5106 let parsed_body = 5107 match Json.of_string Json.Codec.Value.t body with 5108 | Ok json -> Some (Openapi.Runtime.Json json) 5109 | Error _ -> Some (Openapi.Runtime.Raw body) 5110 in 5111 raise (Openapi.Runtime.Api_error { 5112 operation = op_name; 5113 method_ = "GET"; 5114 url; 5115 status = Requests.Response.status_code response; 5116 body; 5117 parsed_body; 5118 }) 5119 5120 (** Get server available auto tags 5121 5122 **PeerTube >= 6.2** *) 5123 let get_api_v1_automatic_tags_server_available client () = 5124 let op_name = "get_api_v1_automatic_tags_server_available" in 5125 let url_path = "/api/v1/automatic-tags/server/available" in 5126 let query = "" in 5127 let url = client.base_url ^ url_path ^ query in 5128 let response = 5129 try Requests.get client.session url 5130 with Eio.Io _ as ex -> 5131 let bt = Printexc.get_raw_backtrace () in 5132 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 5133 in 5134 if Requests.Response.ok response then 5135 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 5136 else 5137 let body = Requests.Response.text response in 5138 let parsed_body = 5139 match Json.of_string Json.Codec.Value.t body with 5140 | Ok json -> Some (Openapi.Runtime.Json json) 5141 | Error _ -> Some (Openapi.Runtime.Raw body) 5142 in 5143 raise (Openapi.Runtime.Api_error { 5144 operation = op_name; 5145 method_ = "GET"; 5146 url; 5147 status = Requests.Response.status_code response; 5148 body; 5149 parsed_body; 5150 }) 5151end 5152 5153module AddVideoPasswords = struct 5154 module Types = struct 5155 module T = struct 5156 type t = Json.t 5157 end 5158 end 5159 5160 module T = struct 5161 include Types.T 5162 let jsont = Json.Codec.Value.t 5163 let v () = Json.Null ((), Json.Meta.none) 5164 end 5165end 5166 5167module VideoUploadRequestResumable = struct 5168 module Types = struct 5169 module T = struct 5170 type t = { 5171 category : VideoCategorySet.T.t option; 5172 channel_id : int; (** Channel id that will contain this video *) 5173 comments_policy : VideoCommentsPolicySet.T.t option; 5174 description : string option; (** Video description *) 5175 download_enabled : bool option; (** Enable or disable downloading for this video *) 5176 generate_transcription : bool option; (** **PeerTube >= 6.2** If enabled by the admin, automatically generate a subtitle of the video *) 5177 language : VideoLanguageSet.T.t option; 5178 licence : VideoLicenceSet.T.t option; 5179 name : string; (** Video name *) 5180 nsfw : bool option; (** Whether or not this video contains sensitive content *) 5181 nsfw_flags : Nsfwflag.T.t option; 5182 nsfw_summary : Json.t option; (** More information about the sensitive content of the video *) 5183 originally_published_at : Ptime.t option; (** Date when the content was originally published *) 5184 privacy : VideoPrivacySet.T.t option; 5185 schedule_update : VideoScheduled.Update.t option; 5186 support : string option; (** A text tell the audience how to support the video creator *) 5187 tags : string list option; (** Video tags (maximum 5 tags each between 2 and 30 characters) *) 5188 video_passwords : AddVideoPasswords.T.t option; 5189 wait_transcoding : bool option; (** Whether or not we wait transcoding before publish the video *) 5190 filename : string; (** Video filename including extension *) 5191 thumbnailfile : string option; (** Video thumbnail file *) 5192 previewfile : string option; (** Video preview file *) 5193 } 5194 end 5195 end 5196 5197 module T = struct 5198 include Types.T 5199 5200 let v ~channel_id ~name ~filename ?category ?comments_policy ?description ?download_enabled ?generate_transcription ?language ?licence ?nsfw ?nsfw_flags ?nsfw_summary ?originally_published_at ?privacy ?schedule_update ?support ?tags ?video_passwords ?wait_transcoding ?thumbnailfile ?previewfile () = { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; privacy; schedule_update; support; tags; video_passwords; wait_transcoding; filename; thumbnailfile; previewfile } 5201 5202 let category t = t.category 5203 let channel_id t = t.channel_id 5204 let comments_policy t = t.comments_policy 5205 let description t = t.description 5206 let download_enabled t = t.download_enabled 5207 let generate_transcription t = t.generate_transcription 5208 let language t = t.language 5209 let licence t = t.licence 5210 let name t = t.name 5211 let nsfw t = t.nsfw 5212 let nsfw_flags t = t.nsfw_flags 5213 let nsfw_summary t = t.nsfw_summary 5214 let originally_published_at t = t.originally_published_at 5215 let privacy t = t.privacy 5216 let schedule_update t = t.schedule_update 5217 let support t = t.support 5218 let tags t = t.tags 5219 let video_passwords t = t.video_passwords 5220 let wait_transcoding t = t.wait_transcoding 5221 let filename t = t.filename 5222 let thumbnailfile t = t.thumbnailfile 5223 let previewfile t = t.previewfile 5224 5225 let jsont : t Json.codec = 5226 Json.Codec.Object.map ~kind:"VideoUploadRequestResumable" 5227 (fun category channel_id comments_policy description download_enabled generate_transcription language licence name nsfw nsfw_flags nsfw_summary originally_published_at privacy schedule_update support tags video_passwords wait_transcoding filename thumbnailfile previewfile -> { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; privacy; schedule_update; support; tags; video_passwords; wait_transcoding; filename; thumbnailfile; previewfile }) 5228 |> Json.Codec.Object.opt_member "category" VideoCategorySet.T.jsont ~enc:(fun r -> r.category) 5229 |> Json.Codec.Object.member "channelId" (Openapi.Runtime.validated_int ~minimum:1. Json.Codec.int) ~enc:(fun r -> r.channel_id) 5230 |> Json.Codec.Object.opt_member "commentsPolicy" VideoCommentsPolicySet.T.jsont ~enc:(fun r -> r.comments_policy) 5231 |> Json.Codec.Object.opt_member "description" Json.Codec.string ~enc:(fun r -> r.description) 5232 |> Json.Codec.Object.opt_member "downloadEnabled" Json.Codec.bool ~enc:(fun r -> r.download_enabled) 5233 |> Json.Codec.Object.opt_member "generateTranscription" Json.Codec.bool ~enc:(fun r -> r.generate_transcription) 5234 |> Json.Codec.Object.opt_member "language" VideoLanguageSet.T.jsont ~enc:(fun r -> r.language) 5235 |> Json.Codec.Object.opt_member "licence" VideoLicenceSet.T.jsont ~enc:(fun r -> r.licence) 5236 |> Json.Codec.Object.member "name" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.name) 5237 |> Json.Codec.Object.opt_member "nsfw" Json.Codec.bool ~enc:(fun r -> r.nsfw) 5238 |> Json.Codec.Object.opt_member "nsfwFlags" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags) 5239 |> Json.Codec.Object.opt_member "nsfwSummary" Json.Codec.Value.t ~enc:(fun r -> r.nsfw_summary) 5240 |> Json.Codec.Object.opt_member "originallyPublishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.originally_published_at) 5241 |> Json.Codec.Object.opt_member "privacy" VideoPrivacySet.T.jsont ~enc:(fun r -> r.privacy) 5242 |> Json.Codec.Object.opt_member "scheduleUpdate" VideoScheduled.Update.jsont ~enc:(fun r -> r.schedule_update) 5243 |> Json.Codec.Object.opt_member "support" Json.Codec.string ~enc:(fun r -> r.support) 5244 |> Json.Codec.Object.opt_member "tags" (Openapi.Runtime.validated_list ~min_items:1 ~max_items:5 ~unique_items:true Json.Codec.string) ~enc:(fun r -> r.tags) 5245 |> Json.Codec.Object.opt_member "videoPasswords" AddVideoPasswords.T.jsont ~enc:(fun r -> r.video_passwords) 5246 |> Json.Codec.Object.opt_member "waitTranscoding" Json.Codec.bool ~enc:(fun r -> r.wait_transcoding) 5247 |> Json.Codec.Object.member "filename" Json.Codec.string ~enc:(fun r -> r.filename) 5248 |> Json.Codec.Object.opt_member "thumbnailfile" Json.Codec.string ~enc:(fun r -> r.thumbnailfile) 5249 |> Json.Codec.Object.opt_member "previewfile" Json.Codec.string ~enc:(fun r -> r.previewfile) 5250 |> Json.Codec.Object.skip_unknown 5251 |> Json.Codec.Object.seal 5252 end 5253end 5254 5255module VideoUploadRequestLegacy = struct 5256 module Types = struct 5257 module T = struct 5258 type t = { 5259 category : VideoCategorySet.T.t option; 5260 channel_id : int; (** Channel id that will contain this video *) 5261 comments_policy : VideoCommentsPolicySet.T.t option; 5262 description : string option; (** Video description *) 5263 download_enabled : bool option; (** Enable or disable downloading for this video *) 5264 generate_transcription : bool option; (** **PeerTube >= 6.2** If enabled by the admin, automatically generate a subtitle of the video *) 5265 language : VideoLanguageSet.T.t option; 5266 licence : VideoLicenceSet.T.t option; 5267 name : string; (** Video name *) 5268 nsfw : bool option; (** Whether or not this video contains sensitive content *) 5269 nsfw_flags : Nsfwflag.T.t option; 5270 nsfw_summary : Json.t option; (** More information about the sensitive content of the video *) 5271 originally_published_at : Ptime.t option; (** Date when the content was originally published *) 5272 previewfile : string option; (** Video preview file *) 5273 privacy : VideoPrivacySet.T.t option; 5274 schedule_update : VideoScheduled.Update.t option; 5275 support : string option; (** A text tell the audience how to support the video creator *) 5276 tags : string list option; (** Video tags (maximum 5 tags each between 2 and 30 characters) *) 5277 thumbnailfile : string option; (** Video thumbnail file *) 5278 video_passwords : AddVideoPasswords.T.t option; 5279 wait_transcoding : bool option; (** Whether or not we wait transcoding before publish the video *) 5280 videofile : string; (** Video file *) 5281 } 5282 end 5283 end 5284 5285 module T = struct 5286 include Types.T 5287 5288 let v ~channel_id ~name ~videofile ?category ?comments_policy ?description ?download_enabled ?generate_transcription ?language ?licence ?nsfw ?nsfw_flags ?nsfw_summary ?originally_published_at ?previewfile ?privacy ?schedule_update ?support ?tags ?thumbnailfile ?video_passwords ?wait_transcoding () = { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; previewfile; privacy; schedule_update; support; tags; thumbnailfile; video_passwords; wait_transcoding; videofile } 5289 5290 let category t = t.category 5291 let channel_id t = t.channel_id 5292 let comments_policy t = t.comments_policy 5293 let description t = t.description 5294 let download_enabled t = t.download_enabled 5295 let generate_transcription t = t.generate_transcription 5296 let language t = t.language 5297 let licence t = t.licence 5298 let name t = t.name 5299 let nsfw t = t.nsfw 5300 let nsfw_flags t = t.nsfw_flags 5301 let nsfw_summary t = t.nsfw_summary 5302 let originally_published_at t = t.originally_published_at 5303 let previewfile t = t.previewfile 5304 let privacy t = t.privacy 5305 let schedule_update t = t.schedule_update 5306 let support t = t.support 5307 let tags t = t.tags 5308 let thumbnailfile t = t.thumbnailfile 5309 let video_passwords t = t.video_passwords 5310 let wait_transcoding t = t.wait_transcoding 5311 let videofile t = t.videofile 5312 5313 let jsont : t Json.codec = 5314 Json.Codec.Object.map ~kind:"VideoUploadRequestLegacy" 5315 (fun category channel_id comments_policy description download_enabled generate_transcription language licence name nsfw nsfw_flags nsfw_summary originally_published_at previewfile privacy schedule_update support tags thumbnailfile video_passwords wait_transcoding videofile -> { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; previewfile; privacy; schedule_update; support; tags; thumbnailfile; video_passwords; wait_transcoding; videofile }) 5316 |> Json.Codec.Object.opt_member "category" VideoCategorySet.T.jsont ~enc:(fun r -> r.category) 5317 |> Json.Codec.Object.member "channelId" (Openapi.Runtime.validated_int ~minimum:1. Json.Codec.int) ~enc:(fun r -> r.channel_id) 5318 |> Json.Codec.Object.opt_member "commentsPolicy" VideoCommentsPolicySet.T.jsont ~enc:(fun r -> r.comments_policy) 5319 |> Json.Codec.Object.opt_member "description" Json.Codec.string ~enc:(fun r -> r.description) 5320 |> Json.Codec.Object.opt_member "downloadEnabled" Json.Codec.bool ~enc:(fun r -> r.download_enabled) 5321 |> Json.Codec.Object.opt_member "generateTranscription" Json.Codec.bool ~enc:(fun r -> r.generate_transcription) 5322 |> Json.Codec.Object.opt_member "language" VideoLanguageSet.T.jsont ~enc:(fun r -> r.language) 5323 |> Json.Codec.Object.opt_member "licence" VideoLicenceSet.T.jsont ~enc:(fun r -> r.licence) 5324 |> Json.Codec.Object.member "name" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.name) 5325 |> Json.Codec.Object.opt_member "nsfw" Json.Codec.bool ~enc:(fun r -> r.nsfw) 5326 |> Json.Codec.Object.opt_member "nsfwFlags" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags) 5327 |> Json.Codec.Object.opt_member "nsfwSummary" Json.Codec.Value.t ~enc:(fun r -> r.nsfw_summary) 5328 |> Json.Codec.Object.opt_member "originallyPublishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.originally_published_at) 5329 |> Json.Codec.Object.opt_member "previewfile" Json.Codec.string ~enc:(fun r -> r.previewfile) 5330 |> Json.Codec.Object.opt_member "privacy" VideoPrivacySet.T.jsont ~enc:(fun r -> r.privacy) 5331 |> Json.Codec.Object.opt_member "scheduleUpdate" VideoScheduled.Update.jsont ~enc:(fun r -> r.schedule_update) 5332 |> Json.Codec.Object.opt_member "support" Json.Codec.string ~enc:(fun r -> r.support) 5333 |> Json.Codec.Object.opt_member "tags" (Openapi.Runtime.validated_list ~min_items:1 ~max_items:5 ~unique_items:true Json.Codec.string) ~enc:(fun r -> r.tags) 5334 |> Json.Codec.Object.opt_member "thumbnailfile" Json.Codec.string ~enc:(fun r -> r.thumbnailfile) 5335 |> Json.Codec.Object.opt_member "videoPasswords" AddVideoPasswords.T.jsont ~enc:(fun r -> r.video_passwords) 5336 |> Json.Codec.Object.opt_member "waitTranscoding" Json.Codec.bool ~enc:(fun r -> r.wait_transcoding) 5337 |> Json.Codec.Object.member "videofile" Json.Codec.string ~enc:(fun r -> r.videofile) 5338 |> Json.Codec.Object.skip_unknown 5339 |> Json.Codec.Object.seal 5340 end 5341end 5342 5343module VideoUploadRequestCommon = struct 5344 module Types = struct 5345 module T = struct 5346 type t = { 5347 category : VideoCategorySet.T.t option; 5348 channel_id : int; (** Channel id that will contain this video *) 5349 comments_policy : VideoCommentsPolicySet.T.t option; 5350 description : string option; (** Video description *) 5351 download_enabled : bool option; (** Enable or disable downloading for this video *) 5352 generate_transcription : bool option; (** **PeerTube >= 6.2** If enabled by the admin, automatically generate a subtitle of the video *) 5353 language : VideoLanguageSet.T.t option; 5354 licence : VideoLicenceSet.T.t option; 5355 name : string; (** Video name *) 5356 nsfw : bool option; (** Whether or not this video contains sensitive content *) 5357 nsfw_flags : Nsfwflag.T.t option; 5358 nsfw_summary : Json.t option; (** More information about the sensitive content of the video *) 5359 originally_published_at : Ptime.t option; (** Date when the content was originally published *) 5360 previewfile : string option; (** Video preview file *) 5361 privacy : VideoPrivacySet.T.t option; 5362 schedule_update : VideoScheduled.Update.t option; 5363 support : string option; (** A text tell the audience how to support the video creator *) 5364 tags : string list option; (** Video tags (maximum 5 tags each between 2 and 30 characters) *) 5365 thumbnailfile : string option; (** Video thumbnail file *) 5366 video_passwords : AddVideoPasswords.T.t option; 5367 wait_transcoding : bool option; (** Whether or not we wait transcoding before publish the video *) 5368 } 5369 end 5370 end 5371 5372 module T = struct 5373 include Types.T 5374 5375 let v ~channel_id ~name ?category ?comments_policy ?description ?download_enabled ?generate_transcription ?language ?licence ?nsfw ?nsfw_flags ?nsfw_summary ?originally_published_at ?previewfile ?privacy ?schedule_update ?support ?tags ?thumbnailfile ?video_passwords ?wait_transcoding () = { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; previewfile; privacy; schedule_update; support; tags; thumbnailfile; video_passwords; wait_transcoding } 5376 5377 let category t = t.category 5378 let channel_id t = t.channel_id 5379 let comments_policy t = t.comments_policy 5380 let description t = t.description 5381 let download_enabled t = t.download_enabled 5382 let generate_transcription t = t.generate_transcription 5383 let language t = t.language 5384 let licence t = t.licence 5385 let name t = t.name 5386 let nsfw t = t.nsfw 5387 let nsfw_flags t = t.nsfw_flags 5388 let nsfw_summary t = t.nsfw_summary 5389 let originally_published_at t = t.originally_published_at 5390 let previewfile t = t.previewfile 5391 let privacy t = t.privacy 5392 let schedule_update t = t.schedule_update 5393 let support t = t.support 5394 let tags t = t.tags 5395 let thumbnailfile t = t.thumbnailfile 5396 let video_passwords t = t.video_passwords 5397 let wait_transcoding t = t.wait_transcoding 5398 5399 let jsont : t Json.codec = 5400 Json.Codec.Object.map ~kind:"VideoUploadRequestCommon" 5401 (fun category channel_id comments_policy description download_enabled generate_transcription language licence name nsfw nsfw_flags nsfw_summary originally_published_at previewfile privacy schedule_update support tags thumbnailfile video_passwords wait_transcoding -> { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; previewfile; privacy; schedule_update; support; tags; thumbnailfile; video_passwords; wait_transcoding }) 5402 |> Json.Codec.Object.opt_member "category" VideoCategorySet.T.jsont ~enc:(fun r -> r.category) 5403 |> Json.Codec.Object.member "channelId" (Openapi.Runtime.validated_int ~minimum:1. Json.Codec.int) ~enc:(fun r -> r.channel_id) 5404 |> Json.Codec.Object.opt_member "commentsPolicy" VideoCommentsPolicySet.T.jsont ~enc:(fun r -> r.comments_policy) 5405 |> Json.Codec.Object.opt_member "description" Json.Codec.string ~enc:(fun r -> r.description) 5406 |> Json.Codec.Object.opt_member "downloadEnabled" Json.Codec.bool ~enc:(fun r -> r.download_enabled) 5407 |> Json.Codec.Object.opt_member "generateTranscription" Json.Codec.bool ~enc:(fun r -> r.generate_transcription) 5408 |> Json.Codec.Object.opt_member "language" VideoLanguageSet.T.jsont ~enc:(fun r -> r.language) 5409 |> Json.Codec.Object.opt_member "licence" VideoLicenceSet.T.jsont ~enc:(fun r -> r.licence) 5410 |> Json.Codec.Object.member "name" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.name) 5411 |> Json.Codec.Object.opt_member "nsfw" Json.Codec.bool ~enc:(fun r -> r.nsfw) 5412 |> Json.Codec.Object.opt_member "nsfwFlags" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags) 5413 |> Json.Codec.Object.opt_member "nsfwSummary" Json.Codec.Value.t ~enc:(fun r -> r.nsfw_summary) 5414 |> Json.Codec.Object.opt_member "originallyPublishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.originally_published_at) 5415 |> Json.Codec.Object.opt_member "previewfile" Json.Codec.string ~enc:(fun r -> r.previewfile) 5416 |> Json.Codec.Object.opt_member "privacy" VideoPrivacySet.T.jsont ~enc:(fun r -> r.privacy) 5417 |> Json.Codec.Object.opt_member "scheduleUpdate" VideoScheduled.Update.jsont ~enc:(fun r -> r.schedule_update) 5418 |> Json.Codec.Object.opt_member "support" Json.Codec.string ~enc:(fun r -> r.support) 5419 |> Json.Codec.Object.opt_member "tags" (Openapi.Runtime.validated_list ~min_items:1 ~max_items:5 ~unique_items:true Json.Codec.string) ~enc:(fun r -> r.tags) 5420 |> Json.Codec.Object.opt_member "thumbnailfile" Json.Codec.string ~enc:(fun r -> r.thumbnailfile) 5421 |> Json.Codec.Object.opt_member "videoPasswords" AddVideoPasswords.T.jsont ~enc:(fun r -> r.video_passwords) 5422 |> Json.Codec.Object.opt_member "waitTranscoding" Json.Codec.bool ~enc:(fun r -> r.wait_transcoding) 5423 |> Json.Codec.Object.skip_unknown 5424 |> Json.Codec.Object.seal 5425 end 5426end 5427 5428module VideoCreateImport = struct 5429 module Types = struct 5430 module T = struct 5431 type t = { 5432 category : VideoCategorySet.T.t option; 5433 channel_id : int; (** Channel id that will contain this video *) 5434 comments_policy : VideoCommentsPolicySet.T.t option; 5435 description : string option; (** Video description *) 5436 download_enabled : bool option; (** Enable or disable downloading for this video *) 5437 generate_transcription : bool option; (** **PeerTube >= 6.2** If enabled by the admin, automatically generate a subtitle of the video *) 5438 language : VideoLanguageSet.T.t option; 5439 licence : VideoLicenceSet.T.t option; 5440 name : string; (** Video name *) 5441 nsfw : bool option; (** Whether or not this video contains sensitive content *) 5442 nsfw_flags : Nsfwflag.T.t option; 5443 nsfw_summary : Json.t option; (** More information about the sensitive content of the video *) 5444 originally_published_at : Ptime.t option; (** Date when the content was originally published *) 5445 previewfile : string option; (** Video preview file *) 5446 privacy : VideoPrivacySet.T.t option; 5447 schedule_update : VideoScheduled.Update.t option; 5448 support : string option; (** A text tell the audience how to support the video creator *) 5449 tags : string list option; (** Video tags (maximum 5 tags each between 2 and 30 characters) *) 5450 thumbnailfile : string option; (** Video thumbnail file *) 5451 video_passwords : AddVideoPasswords.T.t option; 5452 wait_transcoding : bool option; (** Whether or not we wait transcoding before publish the video *) 5453 } 5454 end 5455 end 5456 5457 module T = struct 5458 include Types.T 5459 5460 let v ~channel_id ~name ?category ?comments_policy ?description ?download_enabled ?generate_transcription ?language ?licence ?nsfw ?nsfw_flags ?nsfw_summary ?originally_published_at ?previewfile ?privacy ?schedule_update ?support ?tags ?thumbnailfile ?video_passwords ?wait_transcoding () = { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; previewfile; privacy; schedule_update; support; tags; thumbnailfile; video_passwords; wait_transcoding } 5461 5462 let category t = t.category 5463 let channel_id t = t.channel_id 5464 let comments_policy t = t.comments_policy 5465 let description t = t.description 5466 let download_enabled t = t.download_enabled 5467 let generate_transcription t = t.generate_transcription 5468 let language t = t.language 5469 let licence t = t.licence 5470 let name t = t.name 5471 let nsfw t = t.nsfw 5472 let nsfw_flags t = t.nsfw_flags 5473 let nsfw_summary t = t.nsfw_summary 5474 let originally_published_at t = t.originally_published_at 5475 let previewfile t = t.previewfile 5476 let privacy t = t.privacy 5477 let schedule_update t = t.schedule_update 5478 let support t = t.support 5479 let tags t = t.tags 5480 let thumbnailfile t = t.thumbnailfile 5481 let video_passwords t = t.video_passwords 5482 let wait_transcoding t = t.wait_transcoding 5483 5484 let jsont : t Json.codec = 5485 Json.Codec.Object.map ~kind:"VideoCreateImport" 5486 (fun category channel_id comments_policy description download_enabled generate_transcription language licence name nsfw nsfw_flags nsfw_summary originally_published_at previewfile privacy schedule_update support tags thumbnailfile video_passwords wait_transcoding -> { category; channel_id; comments_policy; description; download_enabled; generate_transcription; language; licence; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; previewfile; privacy; schedule_update; support; tags; thumbnailfile; video_passwords; wait_transcoding }) 5487 |> Json.Codec.Object.opt_member "category" VideoCategorySet.T.jsont ~enc:(fun r -> r.category) 5488 |> Json.Codec.Object.member "channelId" (Openapi.Runtime.validated_int ~minimum:1. Json.Codec.int) ~enc:(fun r -> r.channel_id) 5489 |> Json.Codec.Object.opt_member "commentsPolicy" VideoCommentsPolicySet.T.jsont ~enc:(fun r -> r.comments_policy) 5490 |> Json.Codec.Object.opt_member "description" Json.Codec.string ~enc:(fun r -> r.description) 5491 |> Json.Codec.Object.opt_member "downloadEnabled" Json.Codec.bool ~enc:(fun r -> r.download_enabled) 5492 |> Json.Codec.Object.opt_member "generateTranscription" Json.Codec.bool ~enc:(fun r -> r.generate_transcription) 5493 |> Json.Codec.Object.opt_member "language" VideoLanguageSet.T.jsont ~enc:(fun r -> r.language) 5494 |> Json.Codec.Object.opt_member "licence" VideoLicenceSet.T.jsont ~enc:(fun r -> r.licence) 5495 |> Json.Codec.Object.member "name" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.name) 5496 |> Json.Codec.Object.opt_member "nsfw" Json.Codec.bool ~enc:(fun r -> r.nsfw) 5497 |> Json.Codec.Object.opt_member "nsfwFlags" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags) 5498 |> Json.Codec.Object.opt_member "nsfwSummary" Json.Codec.Value.t ~enc:(fun r -> r.nsfw_summary) 5499 |> Json.Codec.Object.opt_member "originallyPublishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.originally_published_at) 5500 |> Json.Codec.Object.opt_member "previewfile" Json.Codec.string ~enc:(fun r -> r.previewfile) 5501 |> Json.Codec.Object.opt_member "privacy" VideoPrivacySet.T.jsont ~enc:(fun r -> r.privacy) 5502 |> Json.Codec.Object.opt_member "scheduleUpdate" VideoScheduled.Update.jsont ~enc:(fun r -> r.schedule_update) 5503 |> Json.Codec.Object.opt_member "support" Json.Codec.string ~enc:(fun r -> r.support) 5504 |> Json.Codec.Object.opt_member "tags" (Openapi.Runtime.validated_list ~min_items:1 ~max_items:5 ~unique_items:true Json.Codec.string) ~enc:(fun r -> r.tags) 5505 |> Json.Codec.Object.opt_member "thumbnailfile" Json.Codec.string ~enc:(fun r -> r.thumbnailfile) 5506 |> Json.Codec.Object.opt_member "videoPasswords" AddVideoPasswords.T.jsont ~enc:(fun r -> r.video_passwords) 5507 |> Json.Codec.Object.opt_member "waitTranscoding" Json.Codec.bool ~enc:(fun r -> r.wait_transcoding) 5508 |> Json.Codec.Object.skip_unknown 5509 |> Json.Codec.Object.seal 5510 end 5511end 5512 5513module ActorImage = struct 5514 module Types = struct 5515 module T = struct 5516 type t = { 5517 created_at : Ptime.t option; 5518 file_url : string option; (** **PeerTube >= 7.1** *) 5519 height : int option; (** **PeerTube >= 7.3** *) 5520 path : string option; (** Deprecated in PeerTube v8.0, use fileUrl instead *) 5521 updated_at : Ptime.t option; 5522 width : int option; 5523 } 5524 end 5525 end 5526 5527 module T = struct 5528 include Types.T 5529 5530 let v ?created_at ?file_url ?height ?path ?updated_at ?width () = { created_at; file_url; height; path; updated_at; width } 5531 5532 let created_at t = t.created_at 5533 let file_url t = t.file_url 5534 let height t = t.height 5535 let path t = t.path 5536 let updated_at t = t.updated_at 5537 let width t = t.width 5538 5539 let jsont : t Json.codec = 5540 Json.Codec.Object.map ~kind:"ActorImage" 5541 (fun created_at file_url height path updated_at width -> { created_at; file_url; height; path; updated_at; width }) 5542 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 5543 |> Json.Codec.Object.opt_member "fileUrl" Json.Codec.string ~enc:(fun r -> r.file_url) 5544 |> Json.Codec.Object.opt_member "height" Json.Codec.int ~enc:(fun r -> r.height) 5545 |> Json.Codec.Object.opt_member "path" Json.Codec.string ~enc:(fun r -> r.path) 5546 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 5547 |> Json.Codec.Object.opt_member "width" Json.Codec.int ~enc:(fun r -> r.width) 5548 |> Json.Codec.Object.skip_unknown 5549 |> Json.Codec.Object.seal 5550 end 5551end 5552 5553module VideoChannelSummary = struct 5554 module Types = struct 5555 module T = struct 5556 type t = { 5557 avatars : ActorImage.T.t list option; 5558 display_name : string option; 5559 host : string option; 5560 id : Id.T.t option; 5561 name : string option; 5562 url : string option; 5563 } 5564 end 5565 end 5566 5567 module T = struct 5568 include Types.T 5569 5570 let v ?avatars ?display_name ?host ?id ?name ?url () = { avatars; display_name; host; id; name; url } 5571 5572 let avatars t = t.avatars 5573 let display_name t = t.display_name 5574 let host t = t.host 5575 let id t = t.id 5576 let name t = t.name 5577 let url t = t.url 5578 5579 let jsont : t Json.codec = 5580 Json.Codec.Object.map ~kind:"VideoChannelSummary" 5581 (fun avatars display_name host id name url -> { avatars; display_name; host; id; name; url }) 5582 |> Json.Codec.Object.opt_member "avatars" (Json.Codec.list ActorImage.T.jsont) ~enc:(fun r -> r.avatars) 5583 |> Json.Codec.Object.opt_member "displayName" Json.Codec.string ~enc:(fun r -> r.display_name) 5584 |> Json.Codec.Object.opt_member "host" Json.Codec.string ~enc:(fun r -> r.host) 5585 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 5586 |> Json.Codec.Object.opt_member "name" Json.Codec.string ~enc:(fun r -> r.name) 5587 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 5588 |> Json.Codec.Object.skip_unknown 5589 |> Json.Codec.Object.seal 5590 end 5591end 5592 5593module Actor = struct 5594 module Types = struct 5595 module Info = struct 5596 type t = { 5597 avatars : ActorImage.T.t list option; 5598 display_name : string option; 5599 host : string option; 5600 id : Id.T.t option; 5601 name : string option; 5602 } 5603 end 5604 5605 module T = struct 5606 type t = { 5607 avatars : ActorImage.T.t list option; 5608 created_at : Ptime.t option; 5609 followers_count : int option; (** number of followers of this actor, as seen by this instance *) 5610 following_count : int option; (** number of actors subscribed to by this actor, as seen by this instance *) 5611 host : string option; (** server on which the actor is resident *) 5612 host_redundancy_allowed : bool option; (** whether this actor's host allows redundancy of its videos *) 5613 id : Id.T.t option; 5614 name : Username.T.t option; (** immutable name of the actor, used to find or mention it *) 5615 updated_at : Ptime.t option; 5616 url : string option; 5617 } 5618 end 5619 end 5620 5621 module Info = struct 5622 include Types.Info 5623 5624 let v ?avatars ?display_name ?host ?id ?name () = { avatars; display_name; host; id; name } 5625 5626 let avatars t = t.avatars 5627 let display_name t = t.display_name 5628 let host t = t.host 5629 let id t = t.id 5630 let name t = t.name 5631 5632 let jsont : t Json.codec = 5633 Json.Codec.Object.map ~kind:"ActorInfo" 5634 (fun avatars display_name host id name -> { avatars; display_name; host; id; name }) 5635 |> Json.Codec.Object.opt_member "avatars" (Json.Codec.list ActorImage.T.jsont) ~enc:(fun r -> r.avatars) 5636 |> Json.Codec.Object.opt_member "displayName" Json.Codec.string ~enc:(fun r -> r.display_name) 5637 |> Json.Codec.Object.opt_member "host" Json.Codec.string ~enc:(fun r -> r.host) 5638 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 5639 |> Json.Codec.Object.opt_member "name" Json.Codec.string ~enc:(fun r -> r.name) 5640 |> Json.Codec.Object.skip_unknown 5641 |> Json.Codec.Object.seal 5642 end 5643 5644 module T = struct 5645 include Types.T 5646 5647 let v ?avatars ?created_at ?followers_count ?following_count ?host ?host_redundancy_allowed ?id ?name ?updated_at ?url () = { avatars; created_at; followers_count; following_count; host; host_redundancy_allowed; id; name; updated_at; url } 5648 5649 let avatars t = t.avatars 5650 let created_at t = t.created_at 5651 let followers_count t = t.followers_count 5652 let following_count t = t.following_count 5653 let host t = t.host 5654 let host_redundancy_allowed t = t.host_redundancy_allowed 5655 let id t = t.id 5656 let name t = t.name 5657 let updated_at t = t.updated_at 5658 let url t = t.url 5659 5660 let jsont : t Json.codec = 5661 Json.Codec.Object.map ~kind:"Actor" 5662 (fun avatars created_at followers_count following_count host host_redundancy_allowed id name updated_at url -> { avatars; created_at; followers_count; following_count; host; host_redundancy_allowed; id; name; updated_at; url }) 5663 |> Json.Codec.Object.opt_member "avatars" (Json.Codec.list ActorImage.T.jsont) ~enc:(fun r -> r.avatars) 5664 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 5665 |> Json.Codec.Object.opt_member "followersCount" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.followers_count) 5666 |> Json.Codec.Object.opt_member "followingCount" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.following_count) 5667 |> Json.Codec.Object.opt_member "host" Json.Codec.string ~enc:(fun r -> r.host) 5668 |> Json.Codec.Object.member "hostRedundancyAllowed" Openapi.Runtime.nullable_bool 5669 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.host_redundancy_allowed) 5670 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 5671 |> Json.Codec.Object.opt_member "name" Username.T.jsont ~enc:(fun r -> r.name) 5672 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 5673 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 5674 |> Json.Codec.Object.skip_unknown 5675 |> Json.Codec.Object.seal 5676 end 5677end 5678 5679module Follow = struct 5680 module Types = struct 5681 module T = struct 5682 type t = { 5683 created_at : Ptime.t option; 5684 follower : Actor.T.t option; 5685 following : Actor.T.t option; 5686 id : Id.T.t option; 5687 score : float option; (** score reflecting the reachability of the actor, with steps of `10` and a base score of `1000`. *) 5688 state : string option; 5689 updated_at : Ptime.t option; 5690 } 5691 end 5692 end 5693 5694 module T = struct 5695 include Types.T 5696 5697 let v ?created_at ?follower ?following ?id ?score ?state ?updated_at () = { created_at; follower; following; id; score; state; updated_at } 5698 5699 let created_at t = t.created_at 5700 let follower t = t.follower 5701 let following t = t.following 5702 let id t = t.id 5703 let score t = t.score 5704 let state t = t.state 5705 let updated_at t = t.updated_at 5706 5707 let jsont : t Json.codec = 5708 Json.Codec.Object.map ~kind:"Follow" 5709 (fun created_at follower following id score state updated_at -> { created_at; follower; following; id; score; state; updated_at }) 5710 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 5711 |> Json.Codec.Object.opt_member "follower" Actor.T.jsont ~enc:(fun r -> r.follower) 5712 |> Json.Codec.Object.opt_member "following" Actor.T.jsont ~enc:(fun r -> r.following) 5713 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 5714 |> Json.Codec.Object.opt_member "score" Json.Codec.number ~enc:(fun r -> r.score) 5715 |> Json.Codec.Object.opt_member "state" Json.Codec.string ~enc:(fun r -> r.state) 5716 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 5717 |> Json.Codec.Object.skip_unknown 5718 |> Json.Codec.Object.seal 5719 end 5720end 5721 5722module AccountSummary = struct 5723 module Types = struct 5724 module T = struct 5725 type t = { 5726 avatars : ActorImage.T.t list option; 5727 display_name : string option; 5728 host : string option; 5729 id : int option; 5730 name : string option; 5731 url : string option; 5732 } 5733 end 5734 end 5735 5736 module T = struct 5737 include Types.T 5738 5739 let v ?avatars ?display_name ?host ?id ?name ?url () = { avatars; display_name; host; id; name; url } 5740 5741 let avatars t = t.avatars 5742 let display_name t = t.display_name 5743 let host t = t.host 5744 let id t = t.id 5745 let name t = t.name 5746 let url t = t.url 5747 5748 let jsont : t Json.codec = 5749 Json.Codec.Object.map ~kind:"AccountSummary" 5750 (fun avatars display_name host id name url -> { avatars; display_name; host; id; name; url }) 5751 |> Json.Codec.Object.opt_member "avatars" (Json.Codec.list ActorImage.T.jsont) ~enc:(fun r -> r.avatars) 5752 |> Json.Codec.Object.opt_member "displayName" Json.Codec.string ~enc:(fun r -> r.display_name) 5753 |> Json.Codec.Object.opt_member "host" Json.Codec.string ~enc:(fun r -> r.host) 5754 |> Json.Codec.Object.opt_member "id" Json.Codec.int ~enc:(fun r -> r.id) 5755 |> Json.Codec.Object.opt_member "name" Json.Codec.string ~enc:(fun r -> r.name) 5756 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 5757 |> Json.Codec.Object.skip_unknown 5758 |> Json.Codec.Object.seal 5759 end 5760end 5761 5762module VideoPlaylist = struct 5763 module Types = struct 5764 module T = struct 5765 type t = { 5766 created_at : Ptime.t option; 5767 description : string option; 5768 display_name : string option; 5769 id : Id.T.t option; 5770 is_local : bool option; 5771 owner_account : AccountSummary.T.t option; 5772 privacy : VideoPlaylistPrivacyConstant.T.t option; 5773 short_uuid : ShortUuid.T.t option; 5774 thumbnail_path : string option; 5775 type_ : VideoPlaylistTypeConstant.T.t option; 5776 updated_at : Ptime.t option; 5777 uuid : Uuidv4.T.t option; 5778 video_channel : VideoChannelSummary.T.t option; 5779 video_channel_position : int option; (** Position of the playlist in the channel *) 5780 video_length : int option; 5781 } 5782 end 5783 end 5784 5785 module T = struct 5786 include Types.T 5787 5788 let v ?created_at ?description ?display_name ?id ?is_local ?owner_account ?privacy ?short_uuid ?thumbnail_path ?type_ ?updated_at ?uuid ?video_channel ?video_channel_position ?video_length () = { created_at; description; display_name; id; is_local; owner_account; privacy; short_uuid; thumbnail_path; type_; updated_at; uuid; video_channel; video_channel_position; video_length } 5789 5790 let created_at t = t.created_at 5791 let description t = t.description 5792 let display_name t = t.display_name 5793 let id t = t.id 5794 let is_local t = t.is_local 5795 let owner_account t = t.owner_account 5796 let privacy t = t.privacy 5797 let short_uuid t = t.short_uuid 5798 let thumbnail_path t = t.thumbnail_path 5799 let type_ t = t.type_ 5800 let updated_at t = t.updated_at 5801 let uuid t = t.uuid 5802 let video_channel t = t.video_channel 5803 let video_channel_position t = t.video_channel_position 5804 let video_length t = t.video_length 5805 5806 let jsont : t Json.codec = 5807 Json.Codec.Object.map ~kind:"VideoPlaylist" 5808 (fun created_at description display_name id is_local owner_account privacy short_uuid thumbnail_path type_ updated_at uuid video_channel video_channel_position video_length -> { created_at; description; display_name; id; is_local; owner_account; privacy; short_uuid; thumbnail_path; type_; updated_at; uuid; video_channel; video_channel_position; video_length }) 5809 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 5810 |> Json.Codec.Object.opt_member "description" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:1000 Json.Codec.string) ~enc:(fun r -> r.description) 5811 |> Json.Codec.Object.opt_member "displayName" (Openapi.Runtime.validated_string ~min_length:1 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.display_name) 5812 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 5813 |> Json.Codec.Object.opt_member "isLocal" Json.Codec.bool ~enc:(fun r -> r.is_local) 5814 |> Json.Codec.Object.opt_member "ownerAccount" AccountSummary.T.jsont ~enc:(fun r -> r.owner_account) 5815 |> Json.Codec.Object.opt_member "privacy" VideoPlaylistPrivacyConstant.T.jsont ~enc:(fun r -> r.privacy) 5816 |> Json.Codec.Object.opt_member "shortUUID" ShortUuid.T.jsont ~enc:(fun r -> r.short_uuid) 5817 |> Json.Codec.Object.opt_member "thumbnailPath" Json.Codec.string ~enc:(fun r -> r.thumbnail_path) 5818 |> Json.Codec.Object.opt_member "type" VideoPlaylistTypeConstant.T.jsont ~enc:(fun r -> r.type_) 5819 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 5820 |> Json.Codec.Object.opt_member "uuid" Uuidv4.T.jsont ~enc:(fun r -> r.uuid) 5821 |> Json.Codec.Object.opt_member "videoChannel" VideoChannelSummary.T.jsont ~enc:(fun r -> r.video_channel) 5822 |> Json.Codec.Object.opt_member "videoChannelPosition" (Openapi.Runtime.validated_int ~minimum:1. Json.Codec.int) ~enc:(fun r -> r.video_channel_position) 5823 |> Json.Codec.Object.opt_member "videoLength" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.video_length) 5824 |> Json.Codec.Object.skip_unknown 5825 |> Json.Codec.Object.seal 5826 end 5827 5828 (** Get a video playlist 5829 @param playlist_id Playlist id 5830 *) 5831 let get_api_v1_video_playlists ~playlist_id client () = 5832 let op_name = "get_api_v1_video_playlists" in 5833 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id)] "/api/v1/video-playlists/{playlistId}" in 5834 let query = "" in 5835 let url = client.base_url ^ url_path ^ query in 5836 let response = 5837 try Requests.get client.session url 5838 with Eio.Io _ as ex -> 5839 let bt = Printexc.get_raw_backtrace () in 5840 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 5841 in 5842 if Requests.Response.ok response then 5843 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 5844 else 5845 let body = Requests.Response.text response in 5846 let parsed_body = 5847 match Json.of_string Json.Codec.Value.t body with 5848 | Ok json -> Some (Openapi.Runtime.Json json) 5849 | Error _ -> Some (Openapi.Runtime.Raw body) 5850 in 5851 raise (Openapi.Runtime.Api_error { 5852 operation = op_name; 5853 method_ = "GET"; 5854 url; 5855 status = Requests.Response.status_code response; 5856 body; 5857 parsed_body; 5858 }) 5859end 5860 5861module VideoChannelCollaborator = struct 5862 module Types = struct 5863 module T = struct 5864 (** Representation of a channel collaboration *) 5865 type t = { 5866 account : AccountSummary.T.t option; 5867 created_at : Ptime.t option; 5868 id : Id.T.t option; 5869 state : Json.t option; 5870 updated_at : Ptime.t option; 5871 } 5872 end 5873 end 5874 5875 module T = struct 5876 include Types.T 5877 5878 let v ?account ?created_at ?id ?state ?updated_at () = { account; created_at; id; state; updated_at } 5879 5880 let account t = t.account 5881 let created_at t = t.created_at 5882 let id t = t.id 5883 let state t = t.state 5884 let updated_at t = t.updated_at 5885 5886 let jsont : t Json.codec = 5887 Json.Codec.Object.map ~kind:"VideoChannelCollaborator" 5888 (fun account created_at id state updated_at -> { account; created_at; id; state; updated_at }) 5889 |> Json.Codec.Object.opt_member "account" AccountSummary.T.jsont ~enc:(fun r -> r.account) 5890 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 5891 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 5892 |> Json.Codec.Object.opt_member "state" Json.Codec.Value.t ~enc:(fun r -> r.state) 5893 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 5894 |> Json.Codec.Object.skip_unknown 5895 |> Json.Codec.Object.seal 5896 end 5897end 5898 5899module Video = struct 5900 module Types = struct 5901 module Info = struct 5902 type t = { 5903 id : Json.t option; 5904 name : Json.t option; 5905 state : Json.t option; 5906 uuid : Json.t option; 5907 } 5908 end 5909 5910 module T = struct 5911 type t = { 5912 account : AccountSummary.T.t option; 5913 aspect_ratio : float option; (** **PeerTube >= 6.1** Aspect ratio of the video stream *) 5914 blacklisted : bool option; 5915 blacklisted_reason : string option; 5916 category : VideoConstantNumberCategory.T.t option; (** category in which the video is classified *) 5917 channel : VideoChannelSummary.T.t option; 5918 comments : int option; (** **PeerTube >= 7.2** Number of comments on the video *) 5919 created_at : Ptime.t option; (** time at which the video object was first drafted *) 5920 dislikes : int option; 5921 duration : int option; (** duration of the video in seconds *) 5922 embed_path : string option; 5923 id : Id.T.t option; (** object id for the video *) 5924 is_live : bool option; 5925 is_local : bool option; 5926 language : VideoConstantStringLanguage.T.t option; (** main language used in the video *) 5927 licence : VideoConstantNumberLicence.T.t option; (** licence under which the video is distributed *) 5928 likes : int option; 5929 live_schedules : LiveSchedule.T.t list option; 5930 name : string option; (** title of the video *) 5931 nsfw : bool option; 5932 nsfw_flags : Nsfwflag.T.t option; 5933 nsfw_summary : string option; (** **PeerTube >= 7.2** More information about the sensitive content of the video *) 5934 originally_published_at : Ptime.t option; (** used to represent a date of first publication, prior to the practical publication date of `publishedAt` *) 5935 preview_path : string option; 5936 privacy : VideoPrivacyConstant.T.t option; (** privacy policy used to distribute the video *) 5937 published_at : Ptime.t option; (** time at which the video was marked as ready for playback (with restrictions depending on `privacy`). Usually set after a `state` evolution. *) 5938 scheduled_update : VideoScheduled.Update.t option; 5939 short_uuid : ShortUuid.T.t option; 5940 state : VideoStateConstant.T.t option; (** represents the internal state of the video processing within the PeerTube instance *) 5941 thumbnail_path : string option; 5942 truncated_description : string option; (** truncated description of the video, written in Markdown. 5943 *) 5944 updated_at : Ptime.t option; (** last time the video's metadata was modified *) 5945 user_history : Json.t option; 5946 uuid : Uuidv4.T.t option; (** universal identifier for the video, that can be used across instances *) 5947 views : int option; 5948 wait_transcoding : bool option; 5949 } 5950 end 5951 end 5952 5953 module Info = struct 5954 include Types.Info 5955 5956 let v ?id ?name ?state ?uuid () = { id; name; state; uuid } 5957 5958 let id t = t.id 5959 let name t = t.name 5960 let state t = t.state 5961 let uuid t = t.uuid 5962 5963 let jsont : t Json.codec = 5964 Json.Codec.Object.map ~kind:"VideoInfo" 5965 (fun id name state uuid -> { id; name; state; uuid }) 5966 |> Json.Codec.Object.opt_member "id" Json.Codec.Value.t ~enc:(fun r -> r.id) 5967 |> Json.Codec.Object.opt_member "name" Json.Codec.Value.t ~enc:(fun r -> r.name) 5968 |> Json.Codec.Object.opt_member "state" Json.Codec.Value.t ~enc:(fun r -> r.state) 5969 |> Json.Codec.Object.opt_member "uuid" Json.Codec.Value.t ~enc:(fun r -> r.uuid) 5970 |> Json.Codec.Object.skip_unknown 5971 |> Json.Codec.Object.seal 5972 end 5973 5974 module T = struct 5975 include Types.T 5976 5977 let v ?account ?aspect_ratio ?blacklisted ?blacklisted_reason ?category ?channel ?comments ?created_at ?dislikes ?duration ?embed_path ?id ?is_live ?is_local ?language ?licence ?likes ?live_schedules ?name ?nsfw ?nsfw_flags ?nsfw_summary ?originally_published_at ?preview_path ?privacy ?published_at ?scheduled_update ?short_uuid ?state ?thumbnail_path ?truncated_description ?updated_at ?user_history ?uuid ?views ?wait_transcoding () = { account; aspect_ratio; blacklisted; blacklisted_reason; category; channel; comments; created_at; dislikes; duration; embed_path; id; is_live; is_local; language; licence; likes; live_schedules; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; preview_path; privacy; published_at; scheduled_update; short_uuid; state; thumbnail_path; truncated_description; updated_at; user_history; uuid; views; wait_transcoding } 5978 5979 let account t = t.account 5980 let aspect_ratio t = t.aspect_ratio 5981 let blacklisted t = t.blacklisted 5982 let blacklisted_reason t = t.blacklisted_reason 5983 let category t = t.category 5984 let channel t = t.channel 5985 let comments t = t.comments 5986 let created_at t = t.created_at 5987 let dislikes t = t.dislikes 5988 let duration t = t.duration 5989 let embed_path t = t.embed_path 5990 let id t = t.id 5991 let is_live t = t.is_live 5992 let is_local t = t.is_local 5993 let language t = t.language 5994 let licence t = t.licence 5995 let likes t = t.likes 5996 let live_schedules t = t.live_schedules 5997 let name t = t.name 5998 let nsfw t = t.nsfw 5999 let nsfw_flags t = t.nsfw_flags 6000 let nsfw_summary t = t.nsfw_summary 6001 let originally_published_at t = t.originally_published_at 6002 let preview_path t = t.preview_path 6003 let privacy t = t.privacy 6004 let published_at t = t.published_at 6005 let scheduled_update t = t.scheduled_update 6006 let short_uuid t = t.short_uuid 6007 let state t = t.state 6008 let thumbnail_path t = t.thumbnail_path 6009 let truncated_description t = t.truncated_description 6010 let updated_at t = t.updated_at 6011 let user_history t = t.user_history 6012 let uuid t = t.uuid 6013 let views t = t.views 6014 let wait_transcoding t = t.wait_transcoding 6015 6016 let jsont : t Json.codec = 6017 Json.Codec.Object.map ~kind:"Video" 6018 (fun account aspect_ratio blacklisted blacklisted_reason category channel comments created_at dislikes duration embed_path id is_live is_local language licence likes live_schedules name nsfw nsfw_flags nsfw_summary originally_published_at preview_path privacy published_at scheduled_update short_uuid state thumbnail_path truncated_description updated_at user_history uuid views wait_transcoding -> { account; aspect_ratio; blacklisted; blacklisted_reason; category; channel; comments; created_at; dislikes; duration; embed_path; id; is_live; is_local; language; licence; likes; live_schedules; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; preview_path; privacy; published_at; scheduled_update; short_uuid; state; thumbnail_path; truncated_description; updated_at; user_history; uuid; views; wait_transcoding }) 6019 |> Json.Codec.Object.opt_member "account" AccountSummary.T.jsont ~enc:(fun r -> r.account) 6020 |> Json.Codec.Object.member "aspectRatio" Openapi.Runtime.nullable_float 6021 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.aspect_ratio) 6022 |> Json.Codec.Object.member "blacklisted" Openapi.Runtime.nullable_bool 6023 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.blacklisted) 6024 |> Json.Codec.Object.member "blacklistedReason" Openapi.Runtime.nullable_string 6025 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.blacklisted_reason) 6026 |> Json.Codec.Object.opt_member "category" VideoConstantNumberCategory.T.jsont ~enc:(fun r -> r.category) 6027 |> Json.Codec.Object.opt_member "channel" VideoChannelSummary.T.jsont ~enc:(fun r -> r.channel) 6028 |> Json.Codec.Object.opt_member "comments" Json.Codec.int ~enc:(fun r -> r.comments) 6029 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 6030 |> Json.Codec.Object.opt_member "dislikes" Json.Codec.int ~enc:(fun r -> r.dislikes) 6031 |> Json.Codec.Object.opt_member "duration" Json.Codec.int ~enc:(fun r -> r.duration) 6032 |> Json.Codec.Object.opt_member "embedPath" Json.Codec.string ~enc:(fun r -> r.embed_path) 6033 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 6034 |> Json.Codec.Object.opt_member "isLive" Json.Codec.bool ~enc:(fun r -> r.is_live) 6035 |> Json.Codec.Object.opt_member "isLocal" Json.Codec.bool ~enc:(fun r -> r.is_local) 6036 |> Json.Codec.Object.opt_member "language" VideoConstantStringLanguage.T.jsont ~enc:(fun r -> r.language) 6037 |> Json.Codec.Object.opt_member "licence" VideoConstantNumberLicence.T.jsont ~enc:(fun r -> r.licence) 6038 |> Json.Codec.Object.opt_member "likes" Json.Codec.int ~enc:(fun r -> r.likes) 6039 |> Json.Codec.Object.opt_member "liveSchedules" (Json.Codec.list LiveSchedule.T.jsont) ~enc:(fun r -> r.live_schedules) 6040 |> Json.Codec.Object.opt_member "name" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.name) 6041 |> Json.Codec.Object.opt_member "nsfw" Json.Codec.bool ~enc:(fun r -> r.nsfw) 6042 |> Json.Codec.Object.opt_member "nsfwFlags" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags) 6043 |> Json.Codec.Object.member "nsfwSummary" Openapi.Runtime.nullable_string 6044 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.nsfw_summary) 6045 |> Json.Codec.Object.member "originallyPublishedAt" Openapi.Runtime.nullable_ptime 6046 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.originally_published_at) 6047 |> Json.Codec.Object.opt_member "previewPath" Json.Codec.string ~enc:(fun r -> r.preview_path) 6048 |> Json.Codec.Object.opt_member "privacy" VideoPrivacyConstant.T.jsont ~enc:(fun r -> r.privacy) 6049 |> Json.Codec.Object.opt_member "publishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.published_at) 6050 |> Json.Codec.Object.opt_member "scheduledUpdate" VideoScheduled.Update.jsont ~enc:(fun r -> r.scheduled_update) 6051 |> Json.Codec.Object.opt_member "shortUUID" ShortUuid.T.jsont ~enc:(fun r -> r.short_uuid) 6052 |> Json.Codec.Object.opt_member "state" VideoStateConstant.T.jsont ~enc:(fun r -> r.state) 6053 |> Json.Codec.Object.opt_member "thumbnailPath" Json.Codec.string ~enc:(fun r -> r.thumbnail_path) 6054 |> Json.Codec.Object.member "truncatedDescription" Openapi.Runtime.nullable_string 6055 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.truncated_description) 6056 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 6057 |> Json.Codec.Object.member "userHistory" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 6058 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.user_history) 6059 |> Json.Codec.Object.opt_member "uuid" Uuidv4.T.jsont ~enc:(fun r -> r.uuid) 6060 |> Json.Codec.Object.opt_member "views" Json.Codec.int ~enc:(fun r -> r.views) 6061 |> Json.Codec.Object.member "waitTranscoding" Openapi.Runtime.nullable_bool 6062 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.wait_transcoding) 6063 |> Json.Codec.Object.skip_unknown 6064 |> Json.Codec.Object.seal 6065 end 6066end 6067 6068module VideoRating = struct 6069 module Types = struct 6070 module T = struct 6071 type t = { 6072 rating : string; (** Rating of the video *) 6073 video : Video.T.t; 6074 } 6075 end 6076 end 6077 6078 module T = struct 6079 include Types.T 6080 6081 let v ~rating ~video () = { rating; video } 6082 6083 let rating t = t.rating 6084 let video t = t.video 6085 6086 let jsont : t Json.codec = 6087 Json.Codec.Object.map ~kind:"VideoRating" 6088 (fun rating video -> { rating; video }) 6089 |> Json.Codec.Object.member "rating" Json.Codec.string ~enc:(fun r -> r.rating) 6090 |> Json.Codec.Object.member "video" Video.T.jsont ~enc:(fun r -> r.video) 6091 |> Json.Codec.Object.skip_unknown 6092 |> Json.Codec.Object.seal 6093 end 6094 6095 (** List ratings of an account 6096 @param name The username or handle of the account 6097 @param start Offset used to paginate results 6098 @param count Number of items to return 6099 @param sort Sort column 6100 @param rating Optionally filter which ratings to retrieve 6101 *) 6102 let get_api_v1_accounts_ratings ~name ?start ?count ?sort ?rating client () = 6103 let op_name = "get_api_v1_accounts_ratings" in 6104 let url_path = Openapi.Runtime.Path.render ~params:[("name", name)] "/api/v1/accounts/{name}/ratings" in 6105 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"rating" ~value:rating]) in 6106 let url = client.base_url ^ url_path ^ query in 6107 let response = 6108 try Requests.get client.session url 6109 with Eio.Io _ as ex -> 6110 let bt = Printexc.get_raw_backtrace () in 6111 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6112 in 6113 if Requests.Response.ok response then 6114 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 6115 else 6116 let body = Requests.Response.text response in 6117 let parsed_body = 6118 match Json.of_string Json.Codec.Value.t body with 6119 | Ok json -> Some (Openapi.Runtime.Json json) 6120 | Error _ -> Some (Openapi.Runtime.Raw body) 6121 in 6122 raise (Openapi.Runtime.Api_error { 6123 operation = op_name; 6124 method_ = "GET"; 6125 url; 6126 status = Requests.Response.status_code response; 6127 body; 6128 parsed_body; 6129 }) 6130end 6131 6132module VideoList = struct 6133 module Types = struct 6134 module Response = struct 6135 type t = { 6136 data : Video.T.t list option; 6137 total : int option; 6138 } 6139 end 6140 end 6141 6142 module Response = struct 6143 include Types.Response 6144 6145 let v ?data ?total () = { data; total } 6146 6147 let data t = t.data 6148 let total t = t.total 6149 6150 let jsont : t Json.codec = 6151 Json.Codec.Object.map ~kind:"VideoListResponse" 6152 (fun data total -> { data; total }) 6153 |> Json.Codec.Object.opt_member "data" (Openapi.Runtime.validated_list ~max_items:100 Video.T.jsont) ~enc:(fun r -> r.data) 6154 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 6155 |> Json.Codec.Object.skip_unknown 6156 |> Json.Codec.Object.seal 6157 end 6158 6159 (** List videos of an account 6160 @param name The username or handle of the account 6161 @param start Offset used to paginate results 6162 @param count Number of items to return 6163 @param skip_count if you don't need the `total` in the response 6164 @param nsfw whether to include nsfw videos, if any 6165 @param is_live whether or not the video is a live 6166 @param include_scheduled_live whether or not include live that are scheduled for later 6167 @param category_one_of category id of the video (see [/videos/categories](#operation/getCategories)) 6168 @param licence_one_of licence id of the video (see [/videos/licences](#operation/getLicences)) 6169 @param language_one_of language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language 6170 @param tags_one_of tag(s) of the video 6171 @param tags_all_of tag(s) of the video, where all should be present in the video 6172 @param is_local **PeerTube >= 4.0** Display only local or remote objects 6173 @param include_ **Only administrators and moderators can use this parameter** 6174 6175 Include additional videos in results (can be combined using bitwise or operator) 6176 - `0` NONE 6177 - `1` NOT_PUBLISHED_STATE 6178 - `2` BLACKLISTED 6179 - `4` BLOCKED_OWNER 6180 - `8` FILES 6181 - `16` CAPTIONS 6182 - `32` VIDEO SOURCE 6183 6184 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 6185 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 6186 @param host Find elements owned by this host 6187 @param auto_tag_one_of **PeerTube >= 6.2** **Admins and moderators only** filter on videos that contain one of these automatic tags 6188 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 6189 @param exclude_already_watched Whether or not to exclude videos that are in the user's video history 6190 @param search Plain text search, applied to various parts of the model depending on endpoint 6191 *) 6192 let get_account_videos ~name ?start ?count ?skip_count ?sort ?nsfw ?nsfw_flags_included ?nsfw_flags_excluded ?is_live ?include_scheduled_live ?category_one_of ?licence_one_of ?language_one_of ?tags_one_of ?tags_all_of ?is_local ?include_ ?has_hlsfiles ?has_web_video_files ?host ?auto_tag_one_of ?privacy_one_of ?exclude_already_watched ?search client () = 6193 let op_name = "get_account_videos" in 6194 let url_path = Openapi.Runtime.Path.render ~params:[("name", name)] "/api/v1/accounts/{name}/videos" in 6195 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"skipCount" ~value:skip_count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"nsfwFlagsIncluded" ~value:nsfw_flags_included; Openapi.Runtime.Query.optional ~key:"nsfwFlagsExcluded" ~value:nsfw_flags_excluded; Openapi.Runtime.Query.optional ~key:"isLive" ~value:is_live; Openapi.Runtime.Query.optional ~key:"includeScheduledLive" ~value:include_scheduled_live; Openapi.Runtime.Query.optional ~key:"categoryOneOf" ~value:category_one_of; Openapi.Runtime.Query.optional ~key:"licenceOneOf" ~value:licence_one_of; Openapi.Runtime.Query.optional ~key:"languageOneOf" ~value:language_one_of; Openapi.Runtime.Query.optional ~key:"tagsOneOf" ~value:tags_one_of; Openapi.Runtime.Query.optional ~key:"tagsAllOf" ~value:tags_all_of; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"excludeAlreadyWatched" ~value:exclude_already_watched; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 6196 let url = client.base_url ^ url_path ^ query in 6197 let response = 6198 try Requests.get client.session url 6199 with Eio.Io _ as ex -> 6200 let bt = Printexc.get_raw_backtrace () in 6201 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6202 in 6203 if Requests.Response.ok response then 6204 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6205 else 6206 let body = Requests.Response.text response in 6207 let parsed_body = 6208 match Json.of_string Json.Codec.Value.t body with 6209 | Ok json -> Some (Openapi.Runtime.Json json) 6210 | Error _ -> Some (Openapi.Runtime.Raw body) 6211 in 6212 raise (Openapi.Runtime.Api_error { 6213 operation = op_name; 6214 method_ = "GET"; 6215 url; 6216 status = Requests.Response.status_code response; 6217 body; 6218 parsed_body; 6219 }) 6220 6221 (** Search videos 6222 @param search String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete video information and interact with it. 6223 6224 @param uuids Find elements with specific UUIDs 6225 @param search_target If the administrator enabled search index support, you can override the default search target. 6226 6227 **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: 6228 * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), 6229 then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. 6230 After that, you can use the classic REST API endpoints to fetch the complete object or interact with it 6231 * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch 6232 the data from the origin instance API 6233 6234 @param start Offset used to paginate results 6235 @param count Number of items to return 6236 @param skip_count if you don't need the `total` in the response 6237 @param nsfw whether to include nsfw videos, if any 6238 @param is_live whether or not the video is a live 6239 @param include_scheduled_live whether or not include live that are scheduled for later 6240 @param category_one_of category id of the video (see [/videos/categories](#operation/getCategories)) 6241 @param licence_one_of licence id of the video (see [/videos/licences](#operation/getLicences)) 6242 @param language_one_of language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language 6243 @param tags_one_of tag(s) of the video 6244 @param tags_all_of tag(s) of the video, where all should be present in the video 6245 @param is_local **PeerTube >= 4.0** Display only local or remote objects 6246 @param include_ **Only administrators and moderators can use this parameter** 6247 6248 Include additional videos in results (can be combined using bitwise or operator) 6249 - `0` NONE 6250 - `1` NOT_PUBLISHED_STATE 6251 - `2` BLACKLISTED 6252 - `4` BLOCKED_OWNER 6253 - `8` FILES 6254 - `16` CAPTIONS 6255 - `32` VIDEO SOURCE 6256 6257 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 6258 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 6259 @param host Find elements owned by this host 6260 @param auto_tag_one_of **PeerTube >= 6.2** **Admins and moderators only** filter on videos that contain one of these automatic tags 6261 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 6262 @param exclude_already_watched Whether or not to exclude videos that are in the user's video history 6263 @param start_date Get videos that are published after this date 6264 @param end_date Get videos that are published before this date 6265 @param originally_published_start_date Get videos that are originally published after this date 6266 @param originally_published_end_date Get videos that are originally published before this date 6267 @param duration_min Get videos that have this minimum duration 6268 @param duration_max Get videos that have this maximum duration 6269 *) 6270 let search_videos ~search ?uuids ?search_target ?start ?count ?skip_count ?sort ?nsfw ?nsfw_flags_included ?nsfw_flags_excluded ?is_live ?include_scheduled_live ?category_one_of ?licence_one_of ?language_one_of ?tags_one_of ?tags_all_of ?is_local ?include_ ?has_hlsfiles ?has_web_video_files ?host ?auto_tag_one_of ?privacy_one_of ?exclude_already_watched ?start_date ?end_date ?originally_published_start_date ?originally_published_end_date ?duration_min ?duration_max client () = 6271 let op_name = "search_videos" in 6272 let url_path = "/api/v1/search/videos" in 6273 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"uuids" ~value:uuids; Openapi.Runtime.Query.optional ~key:"searchTarget" ~value:search_target; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"skipCount" ~value:skip_count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"nsfwFlagsIncluded" ~value:nsfw_flags_included; Openapi.Runtime.Query.optional ~key:"nsfwFlagsExcluded" ~value:nsfw_flags_excluded; Openapi.Runtime.Query.optional ~key:"isLive" ~value:is_live; Openapi.Runtime.Query.optional ~key:"includeScheduledLive" ~value:include_scheduled_live; Openapi.Runtime.Query.optional ~key:"categoryOneOf" ~value:category_one_of; Openapi.Runtime.Query.optional ~key:"licenceOneOf" ~value:licence_one_of; Openapi.Runtime.Query.optional ~key:"languageOneOf" ~value:language_one_of; Openapi.Runtime.Query.optional ~key:"tagsOneOf" ~value:tags_one_of; Openapi.Runtime.Query.optional ~key:"tagsAllOf" ~value:tags_all_of; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"excludeAlreadyWatched" ~value:exclude_already_watched; Openapi.Runtime.Query.optional ~key:"startDate" ~value:start_date; Openapi.Runtime.Query.optional ~key:"endDate" ~value:end_date; Openapi.Runtime.Query.optional ~key:"originallyPublishedStartDate" ~value:originally_published_start_date; Openapi.Runtime.Query.optional ~key:"originallyPublishedEndDate" ~value:originally_published_end_date; Openapi.Runtime.Query.optional ~key:"durationMin" ~value:duration_min; Openapi.Runtime.Query.optional ~key:"durationMax" ~value:duration_max]) in 6274 let url = client.base_url ^ url_path ^ query in 6275 let response = 6276 try Requests.get client.session url 6277 with Eio.Io _ as ex -> 6278 let bt = Printexc.get_raw_backtrace () in 6279 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6280 in 6281 if Requests.Response.ok response then 6282 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6283 else 6284 let body = Requests.Response.text response in 6285 let parsed_body = 6286 match Json.of_string Json.Codec.Value.t body with 6287 | Ok json -> Some (Openapi.Runtime.Json json) 6288 | Error _ -> Some (Openapi.Runtime.Raw body) 6289 in 6290 raise (Openapi.Runtime.Api_error { 6291 operation = op_name; 6292 method_ = "GET"; 6293 url; 6294 status = Requests.Response.status_code response; 6295 body; 6296 parsed_body; 6297 }) 6298 6299 (** List watched videos history 6300 @param start Offset used to paginate results 6301 @param count Number of items to return 6302 @param search Plain text search, applied to various parts of the model depending on endpoint 6303 *) 6304 let get_api_v1_users_me_history_videos ?start ?count ?search client () = 6305 let op_name = "get_api_v1_users_me_history_videos" in 6306 let url_path = "/api/v1/users/me/history/videos" in 6307 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 6308 let url = client.base_url ^ url_path ^ query in 6309 let response = 6310 try Requests.get client.session url 6311 with Eio.Io _ as ex -> 6312 let bt = Printexc.get_raw_backtrace () in 6313 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6314 in 6315 if Requests.Response.ok response then 6316 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6317 else 6318 let body = Requests.Response.text response in 6319 let parsed_body = 6320 match Json.of_string Json.Codec.Value.t body with 6321 | Ok json -> Some (Openapi.Runtime.Json json) 6322 | Error _ -> Some (Openapi.Runtime.Raw body) 6323 in 6324 raise (Openapi.Runtime.Api_error { 6325 operation = op_name; 6326 method_ = "GET"; 6327 url; 6328 status = Requests.Response.status_code response; 6329 body; 6330 parsed_body; 6331 }) 6332 6333 (** List videos of subscriptions of my user 6334 @param start Offset used to paginate results 6335 @param count Number of items to return 6336 @param skip_count if you don't need the `total` in the response 6337 @param nsfw whether to include nsfw videos, if any 6338 @param is_live whether or not the video is a live 6339 @param include_scheduled_live whether or not include live that are scheduled for later 6340 @param category_one_of category id of the video (see [/videos/categories](#operation/getCategories)) 6341 @param licence_one_of licence id of the video (see [/videos/licences](#operation/getLicences)) 6342 @param language_one_of language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language 6343 @param tags_one_of tag(s) of the video 6344 @param tags_all_of tag(s) of the video, where all should be present in the video 6345 @param is_local **PeerTube >= 4.0** Display only local or remote objects 6346 @param include_ **Only administrators and moderators can use this parameter** 6347 6348 Include additional videos in results (can be combined using bitwise or operator) 6349 - `0` NONE 6350 - `1` NOT_PUBLISHED_STATE 6351 - `2` BLACKLISTED 6352 - `4` BLOCKED_OWNER 6353 - `8` FILES 6354 - `16` CAPTIONS 6355 - `32` VIDEO SOURCE 6356 6357 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 6358 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 6359 @param host Find elements owned by this host 6360 @param auto_tag_one_of **PeerTube >= 6.2** **Admins and moderators only** filter on videos that contain one of these automatic tags 6361 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 6362 @param exclude_already_watched Whether or not to exclude videos that are in the user's video history 6363 @param search Plain text search, applied to various parts of the model depending on endpoint 6364 *) 6365 let get_api_v1_users_me_subscriptions_videos ?start ?count ?skip_count ?sort ?nsfw ?nsfw_flags_included ?nsfw_flags_excluded ?is_live ?include_scheduled_live ?category_one_of ?licence_one_of ?language_one_of ?tags_one_of ?tags_all_of ?is_local ?include_ ?has_hlsfiles ?has_web_video_files ?host ?auto_tag_one_of ?privacy_one_of ?exclude_already_watched ?search client () = 6366 let op_name = "get_api_v1_users_me_subscriptions_videos" in 6367 let url_path = "/api/v1/users/me/subscriptions/videos" in 6368 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"skipCount" ~value:skip_count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"nsfwFlagsIncluded" ~value:nsfw_flags_included; Openapi.Runtime.Query.optional ~key:"nsfwFlagsExcluded" ~value:nsfw_flags_excluded; Openapi.Runtime.Query.optional ~key:"isLive" ~value:is_live; Openapi.Runtime.Query.optional ~key:"includeScheduledLive" ~value:include_scheduled_live; Openapi.Runtime.Query.optional ~key:"categoryOneOf" ~value:category_one_of; Openapi.Runtime.Query.optional ~key:"licenceOneOf" ~value:licence_one_of; Openapi.Runtime.Query.optional ~key:"languageOneOf" ~value:language_one_of; Openapi.Runtime.Query.optional ~key:"tagsOneOf" ~value:tags_one_of; Openapi.Runtime.Query.optional ~key:"tagsAllOf" ~value:tags_all_of; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"excludeAlreadyWatched" ~value:exclude_already_watched; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 6369 let url = client.base_url ^ url_path ^ query in 6370 let response = 6371 try Requests.get client.session url 6372 with Eio.Io _ as ex -> 6373 let bt = Printexc.get_raw_backtrace () in 6374 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6375 in 6376 if Requests.Response.ok response then 6377 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6378 else 6379 let body = Requests.Response.text response in 6380 let parsed_body = 6381 match Json.of_string Json.Codec.Value.t body with 6382 | Ok json -> Some (Openapi.Runtime.Json json) 6383 | Error _ -> Some (Openapi.Runtime.Raw body) 6384 in 6385 raise (Openapi.Runtime.Api_error { 6386 operation = op_name; 6387 method_ = "GET"; 6388 url; 6389 status = Requests.Response.status_code response; 6390 body; 6391 parsed_body; 6392 }) 6393 6394 (** List videos of my user 6395 @param channel_name_one_of **PeerTube >= 7.2** Filter on videos that are published by a channel with one of these names 6396 @param start Offset used to paginate results 6397 @param count Number of items to return 6398 @param skip_count if you don't need the `total` in the response 6399 @param nsfw whether to include nsfw videos, if any 6400 @param is_live whether or not the video is a live 6401 @param include_scheduled_live whether or not include live that are scheduled for later 6402 @param category_one_of category id of the video (see [/videos/categories](#operation/getCategories)) 6403 @param licence_one_of licence id of the video (see [/videos/licences](#operation/getLicences)) 6404 @param language_one_of language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language 6405 @param tags_one_of tag(s) of the video 6406 @param tags_all_of tag(s) of the video, where all should be present in the video 6407 @param is_local **PeerTube >= 4.0** Display only local or remote objects 6408 @param include_ **Only administrators and moderators can use this parameter** 6409 6410 Include additional videos in results (can be combined using bitwise or operator) 6411 - `0` NONE 6412 - `1` NOT_PUBLISHED_STATE 6413 - `2` BLACKLISTED 6414 - `4` BLOCKED_OWNER 6415 - `8` FILES 6416 - `16` CAPTIONS 6417 - `32` VIDEO SOURCE 6418 6419 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 6420 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 6421 @param host Find elements owned by this host 6422 @param auto_tag_one_of **PeerTube >= 6.2** **Admins and moderators only** filter on videos that contain one of these automatic tags 6423 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 6424 @param exclude_already_watched Whether or not to exclude videos that are in the user's video history 6425 @param search Plain text search, applied to various parts of the model depending on endpoint 6426 @param include_collaborations **PeerTube >= 8.0** Include objects from collaborated channels 6427 *) 6428 let get_api_v1_users_me_videos ?channel_name_one_of ?start ?count ?skip_count ?sort ?nsfw ?nsfw_flags_included ?nsfw_flags_excluded ?is_live ?include_scheduled_live ?category_one_of ?licence_one_of ?language_one_of ?tags_one_of ?tags_all_of ?is_local ?include_ ?has_hlsfiles ?has_web_video_files ?host ?auto_tag_one_of ?privacy_one_of ?exclude_already_watched ?search ?include_collaborations client () = 6429 let op_name = "get_api_v1_users_me_videos" in 6430 let url_path = "/api/v1/users/me/videos" in 6431 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"channelNameOneOf" ~value:channel_name_one_of; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"skipCount" ~value:skip_count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"nsfwFlagsIncluded" ~value:nsfw_flags_included; Openapi.Runtime.Query.optional ~key:"nsfwFlagsExcluded" ~value:nsfw_flags_excluded; Openapi.Runtime.Query.optional ~key:"isLive" ~value:is_live; Openapi.Runtime.Query.optional ~key:"includeScheduledLive" ~value:include_scheduled_live; Openapi.Runtime.Query.optional ~key:"categoryOneOf" ~value:category_one_of; Openapi.Runtime.Query.optional ~key:"licenceOneOf" ~value:licence_one_of; Openapi.Runtime.Query.optional ~key:"languageOneOf" ~value:language_one_of; Openapi.Runtime.Query.optional ~key:"tagsOneOf" ~value:tags_one_of; Openapi.Runtime.Query.optional ~key:"tagsAllOf" ~value:tags_all_of; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"excludeAlreadyWatched" ~value:exclude_already_watched; Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"includeCollaborations" ~value:include_collaborations]) in 6432 let url = client.base_url ^ url_path ^ query in 6433 let response = 6434 try Requests.get client.session url 6435 with Eio.Io _ as ex -> 6436 let bt = Printexc.get_raw_backtrace () in 6437 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6438 in 6439 if Requests.Response.ok response then 6440 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6441 else 6442 let body = Requests.Response.text response in 6443 let parsed_body = 6444 match Json.of_string Json.Codec.Value.t body with 6445 | Ok json -> Some (Openapi.Runtime.Json json) 6446 | Error _ -> Some (Openapi.Runtime.Raw body) 6447 in 6448 raise (Openapi.Runtime.Api_error { 6449 operation = op_name; 6450 method_ = "GET"; 6451 url; 6452 status = Requests.Response.status_code response; 6453 body; 6454 parsed_body; 6455 }) 6456 6457 (** List videos of a video channel 6458 @param channel_handle The video channel handle 6459 @param start Offset used to paginate results 6460 @param count Number of items to return 6461 @param skip_count if you don't need the `total` in the response 6462 @param nsfw whether to include nsfw videos, if any 6463 @param is_live whether or not the video is a live 6464 @param include_scheduled_live whether or not include live that are scheduled for later 6465 @param category_one_of category id of the video (see [/videos/categories](#operation/getCategories)) 6466 @param licence_one_of licence id of the video (see [/videos/licences](#operation/getLicences)) 6467 @param language_one_of language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language 6468 @param tags_one_of tag(s) of the video 6469 @param tags_all_of tag(s) of the video, where all should be present in the video 6470 @param is_local **PeerTube >= 4.0** Display only local or remote objects 6471 @param include_ **Only administrators and moderators can use this parameter** 6472 6473 Include additional videos in results (can be combined using bitwise or operator) 6474 - `0` NONE 6475 - `1` NOT_PUBLISHED_STATE 6476 - `2` BLACKLISTED 6477 - `4` BLOCKED_OWNER 6478 - `8` FILES 6479 - `16` CAPTIONS 6480 - `32` VIDEO SOURCE 6481 6482 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 6483 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 6484 @param host Find elements owned by this host 6485 @param auto_tag_one_of **PeerTube >= 6.2** **Admins and moderators only** filter on videos that contain one of these automatic tags 6486 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 6487 @param exclude_already_watched Whether or not to exclude videos that are in the user's video history 6488 @param search Plain text search, applied to various parts of the model depending on endpoint 6489 *) 6490 let get_video_channel_videos ~channel_handle ?start ?count ?skip_count ?sort ?nsfw ?nsfw_flags_included ?nsfw_flags_excluded ?is_live ?include_scheduled_live ?category_one_of ?licence_one_of ?language_one_of ?tags_one_of ?tags_all_of ?is_local ?include_ ?has_hlsfiles ?has_web_video_files ?host ?auto_tag_one_of ?privacy_one_of ?exclude_already_watched ?search client () = 6491 let op_name = "get_video_channel_videos" in 6492 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/videos" in 6493 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"skipCount" ~value:skip_count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"nsfwFlagsIncluded" ~value:nsfw_flags_included; Openapi.Runtime.Query.optional ~key:"nsfwFlagsExcluded" ~value:nsfw_flags_excluded; Openapi.Runtime.Query.optional ~key:"isLive" ~value:is_live; Openapi.Runtime.Query.optional ~key:"includeScheduledLive" ~value:include_scheduled_live; Openapi.Runtime.Query.optional ~key:"categoryOneOf" ~value:category_one_of; Openapi.Runtime.Query.optional ~key:"licenceOneOf" ~value:licence_one_of; Openapi.Runtime.Query.optional ~key:"languageOneOf" ~value:language_one_of; Openapi.Runtime.Query.optional ~key:"tagsOneOf" ~value:tags_one_of; Openapi.Runtime.Query.optional ~key:"tagsAllOf" ~value:tags_all_of; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"excludeAlreadyWatched" ~value:exclude_already_watched; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 6494 let url = client.base_url ^ url_path ^ query in 6495 let response = 6496 try Requests.get client.session url 6497 with Eio.Io _ as ex -> 6498 let bt = Printexc.get_raw_backtrace () in 6499 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6500 in 6501 if Requests.Response.ok response then 6502 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6503 else 6504 let body = Requests.Response.text response in 6505 let parsed_body = 6506 match Json.of_string Json.Codec.Value.t body with 6507 | Ok json -> Some (Openapi.Runtime.Json json) 6508 | Error _ -> Some (Openapi.Runtime.Raw body) 6509 in 6510 raise (Openapi.Runtime.Api_error { 6511 operation = op_name; 6512 method_ = "GET"; 6513 url; 6514 status = Requests.Response.status_code response; 6515 body; 6516 parsed_body; 6517 }) 6518 6519 (** List videos 6520 @param start Offset used to paginate results 6521 @param count Number of items to return 6522 @param skip_count if you don't need the `total` in the response 6523 @param nsfw whether to include nsfw videos, if any 6524 @param is_live whether or not the video is a live 6525 @param include_scheduled_live whether or not include live that are scheduled for later 6526 @param category_one_of category id of the video (see [/videos/categories](#operation/getCategories)) 6527 @param licence_one_of licence id of the video (see [/videos/licences](#operation/getLicences)) 6528 @param language_one_of language id of the video (see [/videos/languages](#operation/getLanguages)). Use `_unknown` to filter on videos that don't have a video language 6529 @param tags_one_of tag(s) of the video 6530 @param tags_all_of tag(s) of the video, where all should be present in the video 6531 @param is_local **PeerTube >= 4.0** Display only local or remote objects 6532 @param include_ **Only administrators and moderators can use this parameter** 6533 6534 Include additional videos in results (can be combined using bitwise or operator) 6535 - `0` NONE 6536 - `1` NOT_PUBLISHED_STATE 6537 - `2` BLACKLISTED 6538 - `4` BLOCKED_OWNER 6539 - `8` FILES 6540 - `16` CAPTIONS 6541 - `32` VIDEO SOURCE 6542 6543 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 6544 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 6545 @param host Find elements owned by this host 6546 @param auto_tag_one_of **PeerTube >= 6.2** **Admins and moderators only** filter on videos that contain one of these automatic tags 6547 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 6548 @param exclude_already_watched Whether or not to exclude videos that are in the user's video history 6549 @param search Plain text search, applied to various parts of the model depending on endpoint 6550 *) 6551 let get_videos ?start ?count ?skip_count ?sort ?nsfw ?nsfw_flags_included ?nsfw_flags_excluded ?is_live ?include_scheduled_live ?category_one_of ?licence_one_of ?language_one_of ?tags_one_of ?tags_all_of ?is_local ?include_ ?has_hlsfiles ?has_web_video_files ?host ?auto_tag_one_of ?privacy_one_of ?exclude_already_watched ?search client () = 6552 let op_name = "get_videos" in 6553 let url_path = "/api/v1/videos" in 6554 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"skipCount" ~value:skip_count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"nsfwFlagsIncluded" ~value:nsfw_flags_included; Openapi.Runtime.Query.optional ~key:"nsfwFlagsExcluded" ~value:nsfw_flags_excluded; Openapi.Runtime.Query.optional ~key:"isLive" ~value:is_live; Openapi.Runtime.Query.optional ~key:"includeScheduledLive" ~value:include_scheduled_live; Openapi.Runtime.Query.optional ~key:"categoryOneOf" ~value:category_one_of; Openapi.Runtime.Query.optional ~key:"licenceOneOf" ~value:licence_one_of; Openapi.Runtime.Query.optional ~key:"languageOneOf" ~value:language_one_of; Openapi.Runtime.Query.optional ~key:"tagsOneOf" ~value:tags_one_of; Openapi.Runtime.Query.optional ~key:"tagsAllOf" ~value:tags_all_of; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"excludeAlreadyWatched" ~value:exclude_already_watched; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 6555 let url = client.base_url ^ url_path ^ query in 6556 let response = 6557 try Requests.get client.session url 6558 with Eio.Io _ as ex -> 6559 let bt = Printexc.get_raw_backtrace () in 6560 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6561 in 6562 if Requests.Response.ok response then 6563 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6564 else 6565 let body = Requests.Response.text response in 6566 let parsed_body = 6567 match Json.of_string Json.Codec.Value.t body with 6568 | Ok json -> Some (Openapi.Runtime.Json json) 6569 | Error _ -> Some (Openapi.Runtime.Raw body) 6570 in 6571 raise (Openapi.Runtime.Api_error { 6572 operation = op_name; 6573 method_ = "GET"; 6574 url; 6575 status = Requests.Response.status_code response; 6576 body; 6577 parsed_body; 6578 }) 6579end 6580 6581module VideoImport = struct 6582 module Types = struct 6583 module T = struct 6584 type t = { 6585 created_at : Ptime.t option; 6586 error : string option; 6587 id : Id.T.t option; 6588 magnet_uri : string option; (** magnet URI allowing to resolve the import's source video *) 6589 state : VideoImportStateConstant.T.t option; 6590 target_url : string option; (** remote URL where to find the import's source video *) 6591 torrent_name : string option; 6592 torrentfile : string option; (** Torrent file containing only the video file *) 6593 updated_at : Ptime.t option; 6594 video : Video.T.t option; 6595 } 6596 end 6597 end 6598 6599 module T = struct 6600 include Types.T 6601 6602 let v ?created_at ?error ?id ?magnet_uri ?state ?target_url ?torrent_name ?torrentfile ?updated_at ?video () = { created_at; error; id; magnet_uri; state; target_url; torrent_name; torrentfile; updated_at; video } 6603 6604 let created_at t = t.created_at 6605 let error t = t.error 6606 let id t = t.id 6607 let magnet_uri t = t.magnet_uri 6608 let state t = t.state 6609 let target_url t = t.target_url 6610 let torrent_name t = t.torrent_name 6611 let torrentfile t = t.torrentfile 6612 let updated_at t = t.updated_at 6613 let video t = t.video 6614 6615 let jsont : t Json.codec = 6616 Json.Codec.Object.map ~kind:"VideoImport" 6617 (fun created_at error id magnet_uri state target_url torrent_name torrentfile updated_at video -> { created_at; error; id; magnet_uri; state; target_url; torrent_name; torrentfile; updated_at; video }) 6618 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 6619 |> Json.Codec.Object.opt_member "error" Json.Codec.string ~enc:(fun r -> r.error) 6620 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 6621 |> Json.Codec.Object.opt_member "magnetUri" (Openapi.Runtime.validated_string ~pattern:"/magnet:\\?xt=urn:[a-z0-9]+:[a-z0-9]{32}/i" Json.Codec.string) ~enc:(fun r -> r.magnet_uri) 6622 |> Json.Codec.Object.opt_member "state" VideoImportStateConstant.T.jsont ~enc:(fun r -> r.state) 6623 |> Json.Codec.Object.opt_member "targetUrl" Json.Codec.string ~enc:(fun r -> r.target_url) 6624 |> Json.Codec.Object.opt_member "torrentName" Json.Codec.string ~enc:(fun r -> r.torrent_name) 6625 |> Json.Codec.Object.opt_member "torrentfile" Json.Codec.string ~enc:(fun r -> r.torrentfile) 6626 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 6627 |> Json.Codec.Object.opt_member "video" Video.T.jsont ~enc:(fun r -> r.video) 6628 |> Json.Codec.Object.skip_unknown 6629 |> Json.Codec.Object.seal 6630 end 6631end 6632 6633module VideoImportsList = struct 6634 module Types = struct 6635 module T = struct 6636 type t = { 6637 data : VideoImport.T.t list option; 6638 total : int option; 6639 } 6640 end 6641 end 6642 6643 module T = struct 6644 include Types.T 6645 6646 let v ?data ?total () = { data; total } 6647 6648 let data t = t.data 6649 let total t = t.total 6650 6651 let jsont : t Json.codec = 6652 Json.Codec.Object.map ~kind:"VideoImportsList" 6653 (fun data total -> { data; total }) 6654 |> Json.Codec.Object.opt_member "data" (Openapi.Runtime.validated_list ~max_items:100 VideoImport.T.jsont) ~enc:(fun r -> r.data) 6655 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 6656 |> Json.Codec.Object.skip_unknown 6657 |> Json.Codec.Object.seal 6658 end 6659 6660 (** Get video imports of my user 6661 @param id Entity id 6662 @param start Offset used to paginate results 6663 @param count Number of items to return 6664 @param sort Sort column 6665 @param include_collaborations **PeerTube >= 8.0** Include objects from collaborated channels 6666 @param video_id Filter on import video ID 6667 @param target_url Filter on import target URL 6668 @param video_channel_sync_id Filter on imports created by a specific channel synchronization 6669 @param search Search in video names 6670 *) 6671 let get_api_v1_users_me_videos_imports ~id ?start ?count ?sort ?include_collaborations ?video_id ?target_url ?video_channel_sync_id ?search client () = 6672 let op_name = "get_api_v1_users_me_videos_imports" in 6673 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/me/videos/imports" in 6674 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"includeCollaborations" ~value:include_collaborations; Openapi.Runtime.Query.optional ~key:"videoId" ~value:video_id; Openapi.Runtime.Query.optional ~key:"targetUrl" ~value:target_url; Openapi.Runtime.Query.optional ~key:"videoChannelSyncId" ~value:video_channel_sync_id; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 6675 let url = client.base_url ^ url_path ^ query in 6676 let response = 6677 try Requests.get client.session url 6678 with Eio.Io _ as ex -> 6679 let bt = Printexc.get_raw_backtrace () in 6680 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6681 in 6682 if Requests.Response.ok response then 6683 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 6684 else 6685 let body = Requests.Response.text response in 6686 let parsed_body = 6687 match Json.of_string Json.Codec.Value.t body with 6688 | Ok json -> Some (Openapi.Runtime.Json json) 6689 | Error _ -> Some (Openapi.Runtime.Raw body) 6690 in 6691 raise (Openapi.Runtime.Api_error { 6692 operation = op_name; 6693 method_ = "GET"; 6694 url; 6695 status = Requests.Response.status_code response; 6696 body; 6697 parsed_body; 6698 }) 6699end 6700 6701module VideoCommentForOwnerOrAdmin = struct 6702 module Types = struct 6703 module T = struct 6704 type t = { 6705 account : Json.t option; 6706 automatic_tags : string list option; 6707 created_at : Json.t option; 6708 held_for_review : Json.t option; 6709 id : Id.T.t option; 6710 in_reply_to_comment_id : Json.t option; 6711 text : Json.t option; 6712 thread_id : Json.t option; 6713 updated_at : Json.t option; 6714 url : Json.t option; 6715 video : Video.Info.t option; 6716 } 6717 end 6718 end 6719 6720 module T = struct 6721 include Types.T 6722 6723 let v ?account ?automatic_tags ?created_at ?held_for_review ?id ?in_reply_to_comment_id ?text ?thread_id ?updated_at ?url ?video () = { account; automatic_tags; created_at; held_for_review; id; in_reply_to_comment_id; text; thread_id; updated_at; url; video } 6724 6725 let account t = t.account 6726 let automatic_tags t = t.automatic_tags 6727 let created_at t = t.created_at 6728 let held_for_review t = t.held_for_review 6729 let id t = t.id 6730 let in_reply_to_comment_id t = t.in_reply_to_comment_id 6731 let text t = t.text 6732 let thread_id t = t.thread_id 6733 let updated_at t = t.updated_at 6734 let url t = t.url 6735 let video t = t.video 6736 6737 let jsont : t Json.codec = 6738 Json.Codec.Object.map ~kind:"VideoCommentForOwnerOrAdmin" 6739 (fun account automatic_tags created_at held_for_review id in_reply_to_comment_id text thread_id updated_at url video -> { account; automatic_tags; created_at; held_for_review; id; in_reply_to_comment_id; text; thread_id; updated_at; url; video }) 6740 |> Json.Codec.Object.opt_member "account" Json.Codec.Value.t ~enc:(fun r -> r.account) 6741 |> Json.Codec.Object.opt_member "automaticTags" (Json.Codec.list Json.Codec.string) ~enc:(fun r -> r.automatic_tags) 6742 |> Json.Codec.Object.opt_member "createdAt" Json.Codec.Value.t ~enc:(fun r -> r.created_at) 6743 |> Json.Codec.Object.opt_member "heldForReview" Json.Codec.Value.t ~enc:(fun r -> r.held_for_review) 6744 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 6745 |> Json.Codec.Object.opt_member "inReplyToCommentId" Json.Codec.Value.t ~enc:(fun r -> r.in_reply_to_comment_id) 6746 |> Json.Codec.Object.opt_member "text" Json.Codec.Value.t ~enc:(fun r -> r.text) 6747 |> Json.Codec.Object.opt_member "threadId" Json.Codec.Value.t ~enc:(fun r -> r.thread_id) 6748 |> Json.Codec.Object.opt_member "updatedAt" Json.Codec.Value.t ~enc:(fun r -> r.updated_at) 6749 |> Json.Codec.Object.opt_member "url" Json.Codec.Value.t ~enc:(fun r -> r.url) 6750 |> Json.Codec.Object.opt_member "video" Video.Info.jsont ~enc:(fun r -> r.video) 6751 |> Json.Codec.Object.skip_unknown 6752 |> Json.Codec.Object.seal 6753 end 6754end 6755 6756module PlaylistElement = struct 6757 module Types = struct 6758 module T = struct 6759 type t = { 6760 position : int option; 6761 start_timestamp : int option; 6762 stop_timestamp : int option; 6763 video : Video.T.t option; 6764 } 6765 end 6766 end 6767 6768 module T = struct 6769 include Types.T 6770 6771 let v ?position ?start_timestamp ?stop_timestamp ?video () = { position; start_timestamp; stop_timestamp; video } 6772 6773 let position t = t.position 6774 let start_timestamp t = t.start_timestamp 6775 let stop_timestamp t = t.stop_timestamp 6776 let video t = t.video 6777 6778 let jsont : t Json.codec = 6779 Json.Codec.Object.map ~kind:"PlaylistElement" 6780 (fun position start_timestamp stop_timestamp video -> { position; start_timestamp; stop_timestamp; video }) 6781 |> Json.Codec.Object.opt_member "position" Json.Codec.int ~enc:(fun r -> r.position) 6782 |> Json.Codec.Object.opt_member "startTimestamp" Json.Codec.int ~enc:(fun r -> r.start_timestamp) 6783 |> Json.Codec.Object.opt_member "stopTimestamp" Json.Codec.int ~enc:(fun r -> r.stop_timestamp) 6784 |> Json.Codec.Object.opt_member "video" Video.T.jsont ~enc:(fun r -> r.video) 6785 |> Json.Codec.Object.skip_unknown 6786 |> Json.Codec.Object.seal 6787 end 6788end 6789 6790module Notification = struct 6791 module Types = struct 6792 module Type = struct 6793 (** Notification type. One of the following values: 6794 6795 - `1` NEW_VIDEO_FROM_SUBSCRIPTION 6796 6797 - `2` NEW_COMMENT_ON_MY_VIDEO 6798 6799 - `3` NEW_ABUSE_FOR_MODERATORS 6800 6801 - `4` BLACKLIST_ON_MY_VIDEO 6802 6803 - `5` UNBLACKLIST_ON_MY_VIDEO 6804 6805 - `6` MY_VIDEO_PUBLISHED 6806 6807 - `7` MY_VIDEO_IMPORT_SUCCESS 6808 6809 - `8` MY_VIDEO_IMPORT_ERROR 6810 6811 - `9` NEW_USER_REGISTRATION 6812 6813 - `10` NEW_FOLLOW 6814 6815 - `11` COMMENT_MENTION 6816 6817 - `12` VIDEO_AUTO_BLACKLIST_FOR_MODERATORS 6818 6819 - `13` NEW_INSTANCE_FOLLOWER 6820 6821 - `14` AUTO_INSTANCE_FOLLOWING 6822 6823 - `15` ABUSE_STATE_CHANGE 6824 6825 - `16` ABUSE_NEW_MESSAGE 6826 6827 - `17` NEW_PLUGIN_VERSION 6828 6829 - `18` NEW_PEERTUBE_VERSION 6830 6831 - `19` MY_VIDEO_STUDIO_EDITION_FINISHED 6832 6833 - `20` NEW_USER_REGISTRATION_REQUEST 6834 6835 - `21` NEW_LIVE_FROM_SUBSCRIPTION 6836 6837 - `22` MY_VIDEO_TRANSCRIPTION_GENERATED 6838 *) 6839 type t = string 6840 end 6841 6842 module T = struct 6843 type t = { 6844 account : Actor.Info.t option; 6845 actor_follow : Json.t option; 6846 comment : Json.t option; 6847 created_at : Ptime.t option; 6848 id : Id.T.t option; 6849 read : bool option; 6850 type_ : Type.t option; 6851 updated_at : Ptime.t option; 6852 video : Video.Info.t option; 6853 video_abuse : Json.t option; 6854 video_blacklist : Json.t option; 6855 video_import : Json.t option; 6856 } 6857 end 6858 end 6859 6860 module Type = struct 6861 include Types.Type 6862 let jsont = Json.Codec.string 6863 end 6864 6865 module T = struct 6866 include Types.T 6867 6868 let v ?account ?actor_follow ?comment ?created_at ?id ?read ?type_ ?updated_at ?video ?video_abuse ?video_blacklist ?video_import () = { account; actor_follow; comment; created_at; id; read; type_; updated_at; video; video_abuse; video_blacklist; video_import } 6869 6870 let account t = t.account 6871 let actor_follow t = t.actor_follow 6872 let comment t = t.comment 6873 let created_at t = t.created_at 6874 let id t = t.id 6875 let read t = t.read 6876 let type_ t = t.type_ 6877 let updated_at t = t.updated_at 6878 let video t = t.video 6879 let video_abuse t = t.video_abuse 6880 let video_blacklist t = t.video_blacklist 6881 let video_import t = t.video_import 6882 6883 let jsont : t Json.codec = 6884 Json.Codec.Object.map ~kind:"Notification" 6885 (fun account actor_follow comment created_at id read type_ updated_at video video_abuse video_blacklist video_import -> { account; actor_follow; comment; created_at; id; read; type_; updated_at; video; video_abuse; video_blacklist; video_import }) 6886 |> Json.Codec.Object.opt_member "account" Actor.Info.jsont ~enc:(fun r -> r.account) 6887 |> Json.Codec.Object.member "actorFollow" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 6888 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.actor_follow) 6889 |> Json.Codec.Object.member "comment" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 6890 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.comment) 6891 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 6892 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 6893 |> Json.Codec.Object.opt_member "read" Json.Codec.bool ~enc:(fun r -> r.read) 6894 |> Json.Codec.Object.opt_member "type" Type.jsont ~enc:(fun r -> r.type_) 6895 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 6896 |> Json.Codec.Object.member "video" (Openapi.Runtime.nullable_any Video.Info.jsont) 6897 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.video) 6898 |> Json.Codec.Object.member "videoAbuse" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 6899 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.video_abuse) 6900 |> Json.Codec.Object.member "videoBlacklist" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 6901 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.video_blacklist) 6902 |> Json.Codec.Object.member "videoImport" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 6903 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.video_import) 6904 |> Json.Codec.Object.skip_unknown 6905 |> Json.Codec.Object.seal 6906 end 6907end 6908 6909module NotificationList = struct 6910 module Types = struct 6911 module Response = struct 6912 type t = { 6913 data : Notification.T.t list option; 6914 total : int option; 6915 } 6916 end 6917 end 6918 6919 module Response = struct 6920 include Types.Response 6921 6922 let v ?data ?total () = { data; total } 6923 6924 let data t = t.data 6925 let total t = t.total 6926 6927 let jsont : t Json.codec = 6928 Json.Codec.Object.map ~kind:"NotificationListResponse" 6929 (fun data total -> { data; total }) 6930 |> Json.Codec.Object.opt_member "data" (Openapi.Runtime.validated_list ~max_items:100 Notification.T.jsont) ~enc:(fun r -> r.data) 6931 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 6932 |> Json.Codec.Object.skip_unknown 6933 |> Json.Codec.Object.seal 6934 end 6935 6936 (** List my notifications 6937 @param type_one_of only list notifications of these types 6938 @param unread only list unread notifications 6939 @param start Offset used to paginate results 6940 @param count Number of items to return 6941 @param sort Sort column 6942 *) 6943 let get_api_v1_users_me_notifications ?type_one_of ?unread ?start ?count ?sort client () = 6944 let op_name = "get_api_v1_users_me_notifications" in 6945 let url_path = "/api/v1/users/me/notifications" in 6946 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"typeOneOf" ~value:type_one_of; Openapi.Runtime.Query.optional ~key:"unread" ~value:unread; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 6947 let url = client.base_url ^ url_path ^ query in 6948 let response = 6949 try Requests.get client.session url 6950 with Eio.Io _ as ex -> 6951 let bt = Printexc.get_raw_backtrace () in 6952 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 6953 in 6954 if Requests.Response.ok response then 6955 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 6956 else 6957 let body = Requests.Response.text response in 6958 let parsed_body = 6959 match Json.of_string Json.Codec.Value.t body with 6960 | Ok json -> Some (Openapi.Runtime.Json json) 6961 | Error _ -> Some (Openapi.Runtime.Raw body) 6962 in 6963 raise (Openapi.Runtime.Api_error { 6964 operation = op_name; 6965 method_ = "GET"; 6966 url; 6967 status = Requests.Response.status_code response; 6968 body; 6969 parsed_body; 6970 }) 6971end 6972 6973module AbuseMessage = struct 6974 module Types = struct 6975 module T = struct 6976 type t = { 6977 account : AccountSummary.T.t option; 6978 by_moderator : bool option; 6979 created_at : Ptime.t option; 6980 id : Id.T.t option; 6981 message : string option; 6982 } 6983 end 6984 end 6985 6986 module T = struct 6987 include Types.T 6988 6989 let v ?account ?by_moderator ?created_at ?id ?message () = { account; by_moderator; created_at; id; message } 6990 6991 let account t = t.account 6992 let by_moderator t = t.by_moderator 6993 let created_at t = t.created_at 6994 let id t = t.id 6995 let message t = t.message 6996 6997 let jsont : t Json.codec = 6998 Json.Codec.Object.map ~kind:"AbuseMessage" 6999 (fun account by_moderator created_at id message -> { account; by_moderator; created_at; id; message }) 7000 |> Json.Codec.Object.opt_member "account" AccountSummary.T.jsont ~enc:(fun r -> r.account) 7001 |> Json.Codec.Object.opt_member "byModerator" Json.Codec.bool ~enc:(fun r -> r.by_moderator) 7002 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 7003 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 7004 |> Json.Codec.Object.opt_member "message" (Openapi.Runtime.validated_string ~min_length:2 ~max_length:3000 Json.Codec.string) ~enc:(fun r -> r.message) 7005 |> Json.Codec.Object.skip_unknown 7006 |> Json.Codec.Object.seal 7007 end 7008end 7009 7010module Account = struct 7011 module Types = struct 7012 module T = struct 7013 type t = { 7014 avatars : ActorImage.T.t list option; 7015 created_at : Ptime.t option; 7016 followers_count : int option; (** number of followers of this actor, as seen by this instance *) 7017 following_count : int option; (** number of actors subscribed to by this actor, as seen by this instance *) 7018 host : string option; (** server on which the actor is resident *) 7019 host_redundancy_allowed : bool option; (** whether this actor's host allows redundancy of its videos *) 7020 id : Id.T.t option; 7021 name : Username.T.t option; (** immutable name of the actor, used to find or mention it *) 7022 updated_at : Ptime.t option; 7023 url : string option; 7024 user_id : Json.t option; (** object id for the user tied to this account *) 7025 display_name : string option; (** editable name of the account, displayed in its representations *) 7026 description : string option; (** text or bio displayed on the account's profile *) 7027 } 7028 end 7029 end 7030 7031 module T = struct 7032 include Types.T 7033 7034 let v ?avatars ?created_at ?followers_count ?following_count ?host ?host_redundancy_allowed ?id ?name ?updated_at ?url ?user_id ?display_name ?description () = { avatars; created_at; followers_count; following_count; host; host_redundancy_allowed; id; name; updated_at; url; user_id; display_name; description } 7035 7036 let avatars t = t.avatars 7037 let created_at t = t.created_at 7038 let followers_count t = t.followers_count 7039 let following_count t = t.following_count 7040 let host t = t.host 7041 let host_redundancy_allowed t = t.host_redundancy_allowed 7042 let id t = t.id 7043 let name t = t.name 7044 let updated_at t = t.updated_at 7045 let url t = t.url 7046 let user_id t = t.user_id 7047 let display_name t = t.display_name 7048 let description t = t.description 7049 7050 let jsont : t Json.codec = 7051 Json.Codec.Object.map ~kind:"Account" 7052 (fun avatars created_at followers_count following_count host host_redundancy_allowed id name updated_at url user_id display_name description -> { avatars; created_at; followers_count; following_count; host; host_redundancy_allowed; id; name; updated_at; url; user_id; display_name; description }) 7053 |> Json.Codec.Object.opt_member "avatars" (Json.Codec.list ActorImage.T.jsont) ~enc:(fun r -> r.avatars) 7054 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 7055 |> Json.Codec.Object.opt_member "followersCount" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.followers_count) 7056 |> Json.Codec.Object.opt_member "followingCount" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.following_count) 7057 |> Json.Codec.Object.opt_member "host" Json.Codec.string ~enc:(fun r -> r.host) 7058 |> Json.Codec.Object.member "hostRedundancyAllowed" Openapi.Runtime.nullable_bool 7059 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.host_redundancy_allowed) 7060 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 7061 |> Json.Codec.Object.opt_member "name" Username.T.jsont ~enc:(fun r -> r.name) 7062 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 7063 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 7064 |> Json.Codec.Object.opt_member "userId" Json.Codec.Value.t ~enc:(fun r -> r.user_id) 7065 |> Json.Codec.Object.opt_member "displayName" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.display_name) 7066 |> Json.Codec.Object.member "description" Openapi.Runtime.nullable_string 7067 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.description) 7068 |> Json.Codec.Object.skip_unknown 7069 |> Json.Codec.Object.seal 7070 end 7071 7072 (** Get an account 7073 @param name The username or handle of the account 7074 *) 7075 let get_account ~name client () = 7076 let op_name = "get_account" in 7077 let url_path = Openapi.Runtime.Path.render ~params:[("name", name)] "/api/v1/accounts/{name}" in 7078 let query = "" in 7079 let url = client.base_url ^ url_path ^ query in 7080 let response = 7081 try Requests.get client.session url 7082 with Eio.Io _ as ex -> 7083 let bt = Printexc.get_raw_backtrace () in 7084 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7085 in 7086 if Requests.Response.ok response then 7087 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 7088 else 7089 let body = Requests.Response.text response in 7090 let parsed_body = 7091 match Json.of_string Json.Codec.Value.t body with 7092 | Ok json -> Some (Openapi.Runtime.Json json) 7093 | Error _ -> Some (Openapi.Runtime.Raw body) 7094 in 7095 raise (Openapi.Runtime.Api_error { 7096 operation = op_name; 7097 method_ = "GET"; 7098 url; 7099 status = Requests.Response.status_code response; 7100 body; 7101 parsed_body; 7102 }) 7103end 7104 7105module VideoComment = struct 7106 module Types = struct 7107 module T = struct 7108 type t = { 7109 account : Account.T.t option; 7110 created_at : Ptime.t option; 7111 deleted_at : Ptime.t option; 7112 held_for_review : bool option; 7113 id : Id.T.t option; 7114 in_reply_to_comment_id : Id.T.t option; 7115 is_deleted : bool; 7116 text : string option; (** Text of the comment *) 7117 thread_id : Id.T.t option; 7118 total_replies : int option; 7119 total_replies_from_video_author : int option; 7120 updated_at : Ptime.t option; 7121 url : string option; 7122 video_id : Json.t option; 7123 } 7124 end 7125 end 7126 7127 module T = struct 7128 include Types.T 7129 7130 let v ?(deleted_at=None) ?(is_deleted=false) ?account ?created_at ?held_for_review ?id ?in_reply_to_comment_id ?text ?thread_id ?total_replies ?total_replies_from_video_author ?updated_at ?url ?video_id () = { account; created_at; deleted_at; held_for_review; id; in_reply_to_comment_id; is_deleted; text; thread_id; total_replies; total_replies_from_video_author; updated_at; url; video_id } 7131 7132 let account t = t.account 7133 let created_at t = t.created_at 7134 let deleted_at t = t.deleted_at 7135 let held_for_review t = t.held_for_review 7136 let id t = t.id 7137 let in_reply_to_comment_id t = t.in_reply_to_comment_id 7138 let is_deleted t = t.is_deleted 7139 let text t = t.text 7140 let thread_id t = t.thread_id 7141 let total_replies t = t.total_replies 7142 let total_replies_from_video_author t = t.total_replies_from_video_author 7143 let updated_at t = t.updated_at 7144 let url t = t.url 7145 let video_id t = t.video_id 7146 7147 let jsont : t Json.codec = 7148 Json.Codec.Object.map ~kind:"VideoComment" 7149 (fun account created_at deleted_at held_for_review id in_reply_to_comment_id is_deleted text thread_id total_replies total_replies_from_video_author updated_at url video_id -> { account; created_at; deleted_at; held_for_review; id; in_reply_to_comment_id; is_deleted; text; thread_id; total_replies; total_replies_from_video_author; updated_at; url; video_id }) 7150 |> Json.Codec.Object.opt_member "account" Account.T.jsont ~enc:(fun r -> r.account) 7151 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 7152 |> Json.Codec.Object.member "deletedAt" Openapi.Runtime.nullable_ptime 7153 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.deleted_at) 7154 |> Json.Codec.Object.opt_member "heldForReview" Json.Codec.bool ~enc:(fun r -> r.held_for_review) 7155 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 7156 |> Json.Codec.Object.opt_member "inReplyToCommentId" Id.T.jsont ~enc:(fun r -> r.in_reply_to_comment_id) 7157 |> Json.Codec.Object.member "isDeleted" Json.Codec.bool ~dec_absent:false ~enc:(fun r -> r.is_deleted) 7158 |> Json.Codec.Object.opt_member "text" (Openapi.Runtime.validated_string ~min_length:1 Json.Codec.string) ~enc:(fun r -> r.text) 7159 |> Json.Codec.Object.opt_member "threadId" Id.T.jsont ~enc:(fun r -> r.thread_id) 7160 |> Json.Codec.Object.opt_member "totalReplies" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.total_replies) 7161 |> Json.Codec.Object.opt_member "totalRepliesFromVideoAuthor" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.total_replies_from_video_author) 7162 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 7163 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 7164 |> Json.Codec.Object.opt_member "videoId" Json.Codec.Value.t ~enc:(fun r -> r.video_id) 7165 |> Json.Codec.Object.skip_unknown 7166 |> Json.Codec.Object.seal 7167 end 7168end 7169 7170module VideoCommentThreadTree = struct 7171 module Types = struct 7172 module T = struct 7173 type t = { 7174 children : Json.t list option; 7175 comment : VideoComment.T.t option; 7176 } 7177 end 7178 end 7179 7180 module T = struct 7181 include Types.T 7182 7183 let v ?children ?comment () = { children; comment } 7184 7185 let children t = t.children 7186 let comment t = t.comment 7187 7188 let jsont : t Json.codec = 7189 Json.Codec.Object.map ~kind:"VideoCommentThreadTree" 7190 (fun children comment -> { children; comment }) 7191 |> Json.Codec.Object.opt_member "children" (Json.Codec.list Json.Codec.Value.t) ~enc:(fun r -> r.children) 7192 |> Json.Codec.Object.opt_member "comment" VideoComment.T.jsont ~enc:(fun r -> r.comment) 7193 |> Json.Codec.Object.skip_unknown 7194 |> Json.Codec.Object.seal 7195 end 7196 7197 (** Get a thread 7198 @param id The object id, uuid or short uuid 7199 @param thread_id The thread id (root comment id) 7200 *) 7201 let get_api_v1_videos_comment_threads ~id ~thread_id client () = 7202 let op_name = "get_api_v1_videos_comment_threads" in 7203 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("threadId", thread_id)] "/api/v1/videos/{id}/comment-threads/{threadId}" in 7204 let query = "" in 7205 let url = client.base_url ^ url_path ^ query in 7206 let response = 7207 try Requests.get client.session url 7208 with Eio.Io _ as ex -> 7209 let bt = Printexc.get_raw_backtrace () in 7210 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7211 in 7212 if Requests.Response.ok response then 7213 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 7214 else 7215 let body = Requests.Response.text response in 7216 let parsed_body = 7217 match Json.of_string Json.Codec.Value.t body with 7218 | Ok json -> Some (Openapi.Runtime.Json json) 7219 | Error _ -> Some (Openapi.Runtime.Raw body) 7220 in 7221 raise (Openapi.Runtime.Api_error { 7222 operation = op_name; 7223 method_ = "GET"; 7224 url; 7225 status = Requests.Response.status_code response; 7226 body; 7227 parsed_body; 7228 }) 7229end 7230 7231module CommentThreadPost = struct 7232 module Types = struct 7233 module Response = struct 7234 type t = { 7235 comment : VideoComment.T.t option; 7236 } 7237 end 7238 end 7239 7240 module Response = struct 7241 include Types.Response 7242 7243 let v ?comment () = { comment } 7244 7245 let comment t = t.comment 7246 7247 let jsont : t Json.codec = 7248 Json.Codec.Object.map ~kind:"CommentThreadPostResponse" 7249 (fun comment -> { comment }) 7250 |> Json.Codec.Object.opt_member "comment" VideoComment.T.jsont ~enc:(fun r -> r.comment) 7251 |> Json.Codec.Object.skip_unknown 7252 |> Json.Codec.Object.seal 7253 end 7254 7255 (** Create a thread 7256 @param id The object id, uuid or short uuid 7257 *) 7258 let post_api_v1_videos_comment_threads ~id client () = 7259 let op_name = "post_api_v1_videos_comment_threads" in 7260 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/comment-threads" in 7261 let query = "" in 7262 let url = client.base_url ^ url_path ^ query in 7263 let response = 7264 try Requests.post client.session url 7265 with Eio.Io _ as ex -> 7266 let bt = Printexc.get_raw_backtrace () in 7267 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 7268 in 7269 if Requests.Response.ok response then 7270 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 7271 else 7272 let body = Requests.Response.text response in 7273 let parsed_body = 7274 match Json.of_string Json.Codec.Value.t body with 7275 | Ok json -> Some (Openapi.Runtime.Json json) 7276 | Error _ -> Some (Openapi.Runtime.Raw body) 7277 in 7278 raise (Openapi.Runtime.Api_error { 7279 operation = op_name; 7280 method_ = "POST"; 7281 url; 7282 status = Requests.Response.status_code response; 7283 body; 7284 parsed_body; 7285 }) 7286 7287 (** Reply to a thread of a video 7288 @param id The object id, uuid or short uuid 7289 @param comment_id The comment id 7290 *) 7291 let post_api_v1_videos_comments ~id ~comment_id client () = 7292 let op_name = "post_api_v1_videos_comments" in 7293 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("commentId", comment_id)] "/api/v1/videos/{id}/comments/{commentId}" in 7294 let query = "" in 7295 let url = client.base_url ^ url_path ^ query in 7296 let response = 7297 try Requests.post client.session url 7298 with Eio.Io _ as ex -> 7299 let bt = Printexc.get_raw_backtrace () in 7300 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 7301 in 7302 if Requests.Response.ok response then 7303 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 7304 else 7305 let body = Requests.Response.text response in 7306 let parsed_body = 7307 match Json.of_string Json.Codec.Value.t body with 7308 | Ok json -> Some (Openapi.Runtime.Json json) 7309 | Error _ -> Some (Openapi.Runtime.Raw body) 7310 in 7311 raise (Openapi.Runtime.Api_error { 7312 operation = op_name; 7313 method_ = "POST"; 7314 url; 7315 status = Requests.Response.status_code response; 7316 body; 7317 parsed_body; 7318 }) 7319end 7320 7321module CommentThread = struct 7322 module Types = struct 7323 module Response = struct 7324 type t = { 7325 data : VideoComment.T.t list option; 7326 total : int option; (** Total threads (included deleted ones) on this video *) 7327 total_not_deleted_comments : int option; (** Total not-deleted threads (included deleted ones) on this video *) 7328 } 7329 end 7330 end 7331 7332 module Response = struct 7333 include Types.Response 7334 7335 let v ?data ?total ?total_not_deleted_comments () = { data; total; total_not_deleted_comments } 7336 7337 let data t = t.data 7338 let total t = t.total 7339 let total_not_deleted_comments t = t.total_not_deleted_comments 7340 7341 let jsont : t Json.codec = 7342 Json.Codec.Object.map ~kind:"CommentThreadResponse" 7343 (fun data total total_not_deleted_comments -> { data; total; total_not_deleted_comments }) 7344 |> Json.Codec.Object.opt_member "data" (Openapi.Runtime.validated_list ~max_items:100 VideoComment.T.jsont) ~enc:(fun r -> r.data) 7345 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 7346 |> Json.Codec.Object.opt_member "totalNotDeletedComments" Json.Codec.int ~enc:(fun r -> r.total_not_deleted_comments) 7347 |> Json.Codec.Object.skip_unknown 7348 |> Json.Codec.Object.seal 7349 end 7350 7351 (** List threads of a video 7352 @param id The object id, uuid or short uuid 7353 @param start Offset used to paginate results 7354 @param count Number of items to return 7355 @param sort Sort comments by criteria 7356 *) 7357 let get_api_v1_videos_comment_threads ~id ?start ?count ?sort client () = 7358 let op_name = "get_api_v1_videos_comment_threads" in 7359 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/comment-threads" in 7360 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 7361 let url = client.base_url ^ url_path ^ query in 7362 let response = 7363 try Requests.get client.session url 7364 with Eio.Io _ as ex -> 7365 let bt = Printexc.get_raw_backtrace () in 7366 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7367 in 7368 if Requests.Response.ok response then 7369 Openapi.Runtime.Json.decode_json_exn Response.jsont (Requests.Response.text response) 7370 else 7371 let body = Requests.Response.text response in 7372 let parsed_body = 7373 match Json.of_string Json.Codec.Value.t body with 7374 | Ok json -> Some (Openapi.Runtime.Json json) 7375 | Error _ -> Some (Openapi.Runtime.Raw body) 7376 in 7377 raise (Openapi.Runtime.Api_error { 7378 operation = op_name; 7379 method_ = "GET"; 7380 url; 7381 status = Requests.Response.status_code response; 7382 body; 7383 parsed_body; 7384 }) 7385end 7386 7387module VideoChannel = struct 7388 module Types = struct 7389 module Update = struct 7390 type t = { 7391 description : Json.t option; (** Channel description *) 7392 display_name : Json.t option; (** Channel display name *) 7393 support : Json.t option; (** How to support/fund the channel *) 7394 bulk_videos_support_update : bool option; (** Update the support field for all videos of this channel *) 7395 } 7396 end 7397 7398 module Create = struct 7399 type t = { 7400 description : Json.t option; (** Channel description *) 7401 display_name : Json.t; (** Channel display name *) 7402 support : Json.t option; (** How to support/fund the channel *) 7403 name : UsernameChannel.T.t; (** username of the channel to create *) 7404 } 7405 end 7406 7407 module T = struct 7408 type t = { 7409 avatars : ActorImage.T.t list option; 7410 created_at : Ptime.t option; 7411 followers_count : int option; (** number of followers of this actor, as seen by this instance *) 7412 following_count : int option; (** number of actors subscribed to by this actor, as seen by this instance *) 7413 host : string option; (** server on which the actor is resident *) 7414 host_redundancy_allowed : bool option; (** whether this actor's host allows redundancy of its videos *) 7415 id : Id.T.t option; 7416 name : Username.T.t option; (** immutable name of the actor, used to find or mention it *) 7417 url : string option; 7418 display_name : string option; (** editable name of the channel, displayed in its representations *) 7419 description : string option; 7420 support : string option; (** text shown by default on all videos of this channel, to tell the audience how to support it *) 7421 is_local : bool option; 7422 updated_at : Ptime.t option; 7423 banners : ActorImage.T.t list option; 7424 owner_account : Account.T.t option; 7425 } 7426 end 7427 end 7428 7429 module Update = struct 7430 include Types.Update 7431 7432 let v ?description ?display_name ?support ?bulk_videos_support_update () = { description; display_name; support; bulk_videos_support_update } 7433 7434 let description t = t.description 7435 let display_name t = t.display_name 7436 let support t = t.support 7437 let bulk_videos_support_update t = t.bulk_videos_support_update 7438 7439 let jsont : t Json.codec = 7440 Json.Codec.Object.map ~kind:"VideoChannelUpdate" 7441 (fun description display_name support bulk_videos_support_update -> { description; display_name; support; bulk_videos_support_update }) 7442 |> Json.Codec.Object.opt_member "description" Json.Codec.Value.t ~enc:(fun r -> r.description) 7443 |> Json.Codec.Object.opt_member "displayName" Json.Codec.Value.t ~enc:(fun r -> r.display_name) 7444 |> Json.Codec.Object.opt_member "support" Json.Codec.Value.t ~enc:(fun r -> r.support) 7445 |> Json.Codec.Object.opt_member "bulkVideosSupportUpdate" Json.Codec.bool ~enc:(fun r -> r.bulk_videos_support_update) 7446 |> Json.Codec.Object.skip_unknown 7447 |> Json.Codec.Object.seal 7448 end 7449 7450 module Create = struct 7451 include Types.Create 7452 7453 let v ~display_name ~name ?description ?support () = { description; display_name; support; name } 7454 7455 let description t = t.description 7456 let display_name t = t.display_name 7457 let support t = t.support 7458 let name t = t.name 7459 7460 let jsont : t Json.codec = 7461 Json.Codec.Object.map ~kind:"VideoChannelCreate" 7462 (fun description display_name support name -> { description; display_name; support; name }) 7463 |> Json.Codec.Object.opt_member "description" Json.Codec.Value.t ~enc:(fun r -> r.description) 7464 |> Json.Codec.Object.member "displayName" Json.Codec.Value.t ~enc:(fun r -> r.display_name) 7465 |> Json.Codec.Object.opt_member "support" Json.Codec.Value.t ~enc:(fun r -> r.support) 7466 |> Json.Codec.Object.member "name" UsernameChannel.T.jsont ~enc:(fun r -> r.name) 7467 |> Json.Codec.Object.skip_unknown 7468 |> Json.Codec.Object.seal 7469 end 7470 7471 module T = struct 7472 include Types.T 7473 7474 let v ?avatars ?created_at ?followers_count ?following_count ?host ?host_redundancy_allowed ?id ?name ?url ?display_name ?description ?support ?is_local ?updated_at ?banners ?owner_account () = { avatars; created_at; followers_count; following_count; host; host_redundancy_allowed; id; name; url; display_name; description; support; is_local; updated_at; banners; owner_account } 7475 7476 let avatars t = t.avatars 7477 let created_at t = t.created_at 7478 let followers_count t = t.followers_count 7479 let following_count t = t.following_count 7480 let host t = t.host 7481 let host_redundancy_allowed t = t.host_redundancy_allowed 7482 let id t = t.id 7483 let name t = t.name 7484 let url t = t.url 7485 let display_name t = t.display_name 7486 let description t = t.description 7487 let support t = t.support 7488 let is_local t = t.is_local 7489 let updated_at t = t.updated_at 7490 let banners t = t.banners 7491 let owner_account t = t.owner_account 7492 7493 let jsont : t Json.codec = 7494 Json.Codec.Object.map ~kind:"VideoChannel" 7495 (fun avatars created_at followers_count following_count host host_redundancy_allowed id name url display_name description support is_local updated_at banners owner_account -> { avatars; created_at; followers_count; following_count; host; host_redundancy_allowed; id; name; url; display_name; description; support; is_local; updated_at; banners; owner_account }) 7496 |> Json.Codec.Object.opt_member "avatars" (Json.Codec.list ActorImage.T.jsont) ~enc:(fun r -> r.avatars) 7497 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 7498 |> Json.Codec.Object.opt_member "followersCount" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.followers_count) 7499 |> Json.Codec.Object.opt_member "followingCount" (Openapi.Runtime.validated_int ~minimum:0. Json.Codec.int) ~enc:(fun r -> r.following_count) 7500 |> Json.Codec.Object.opt_member "host" Json.Codec.string ~enc:(fun r -> r.host) 7501 |> Json.Codec.Object.member "hostRedundancyAllowed" Openapi.Runtime.nullable_bool 7502 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.host_redundancy_allowed) 7503 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 7504 |> Json.Codec.Object.opt_member "name" Username.T.jsont ~enc:(fun r -> r.name) 7505 |> Json.Codec.Object.opt_member "url" Json.Codec.string ~enc:(fun r -> r.url) 7506 |> Json.Codec.Object.opt_member "displayName" (Openapi.Runtime.validated_string ~min_length:1 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.display_name) 7507 |> Json.Codec.Object.member "description" Openapi.Runtime.nullable_string 7508 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.description) 7509 |> Json.Codec.Object.member "support" Openapi.Runtime.nullable_string 7510 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.support) 7511 |> Json.Codec.Object.opt_member "isLocal" Json.Codec.bool ~enc:(fun r -> r.is_local) 7512 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 7513 |> Json.Codec.Object.opt_member "banners" (Json.Codec.list ActorImage.T.jsont) ~enc:(fun r -> r.banners) 7514 |> Json.Codec.Object.opt_member "ownerAccount" Account.T.jsont ~enc:(fun r -> r.owner_account) 7515 |> Json.Codec.Object.skip_unknown 7516 |> Json.Codec.Object.seal 7517 end 7518 7519 (** Get subscription of my user 7520 @param subscription_handle The subscription handle 7521 *) 7522 let get_api_v1_users_me_subscriptions ~subscription_handle client () = 7523 let op_name = "get_api_v1_users_me_subscriptions" in 7524 let url_path = Openapi.Runtime.Path.render ~params:[("subscriptionHandle", subscription_handle)] "/api/v1/users/me/subscriptions/{subscriptionHandle}" in 7525 let query = "" in 7526 let url = client.base_url ^ url_path ^ query in 7527 let response = 7528 try Requests.get client.session url 7529 with Eio.Io _ as ex -> 7530 let bt = Printexc.get_raw_backtrace () in 7531 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7532 in 7533 if Requests.Response.ok response then 7534 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 7535 else 7536 let body = Requests.Response.text response in 7537 let parsed_body = 7538 match Json.of_string Json.Codec.Value.t body with 7539 | Ok json -> Some (Openapi.Runtime.Json json) 7540 | Error _ -> Some (Openapi.Runtime.Raw body) 7541 in 7542 raise (Openapi.Runtime.Api_error { 7543 operation = op_name; 7544 method_ = "GET"; 7545 url; 7546 status = Requests.Response.status_code response; 7547 body; 7548 parsed_body; 7549 }) 7550 7551 (** Get a video channel 7552 @param channel_handle The video channel handle 7553 *) 7554 let get_video_channel ~channel_handle client () = 7555 let op_name = "get_video_channel" in 7556 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}" in 7557 let query = "" in 7558 let url = client.base_url ^ url_path ^ query in 7559 let response = 7560 try Requests.get client.session url 7561 with Eio.Io _ as ex -> 7562 let bt = Printexc.get_raw_backtrace () in 7563 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7564 in 7565 if Requests.Response.ok response then 7566 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 7567 else 7568 let body = Requests.Response.text response in 7569 let parsed_body = 7570 match Json.of_string Json.Codec.Value.t body with 7571 | Ok json -> Some (Openapi.Runtime.Json json) 7572 | Error _ -> Some (Openapi.Runtime.Raw body) 7573 in 7574 raise (Openapi.Runtime.Api_error { 7575 operation = op_name; 7576 method_ = "GET"; 7577 url; 7578 status = Requests.Response.status_code response; 7579 body; 7580 parsed_body; 7581 }) 7582end 7583 7584module VideoDetails = struct 7585 module Types = struct 7586 module T = struct 7587 type t = { 7588 aspect_ratio : float option; (** **PeerTube >= 6.1** Aspect ratio of the video stream *) 7589 blacklisted : bool option; 7590 blacklisted_reason : string option; 7591 category : VideoConstantNumberCategory.T.t option; (** category in which the video is classified *) 7592 comments : int option; (** **PeerTube >= 7.2** Number of comments on the video *) 7593 created_at : Ptime.t option; (** time at which the video object was first drafted *) 7594 dislikes : int option; 7595 duration : int option; (** duration of the video in seconds *) 7596 embed_path : string option; 7597 id : Id.T.t option; (** object id for the video *) 7598 is_live : bool option; 7599 is_local : bool option; 7600 language : VideoConstantStringLanguage.T.t option; (** main language used in the video *) 7601 licence : VideoConstantNumberLicence.T.t option; (** licence under which the video is distributed *) 7602 likes : int option; 7603 live_schedules : LiveSchedule.T.t list option; 7604 name : string option; (** title of the video *) 7605 nsfw : bool option; 7606 nsfw_flags : Nsfwflag.T.t option; 7607 nsfw_summary : string option; (** **PeerTube >= 7.2** More information about the sensitive content of the video *) 7608 originally_published_at : Ptime.t option; (** used to represent a date of first publication, prior to the practical publication date of `publishedAt` *) 7609 preview_path : string option; 7610 privacy : VideoPrivacyConstant.T.t option; (** privacy policy used to distribute the video *) 7611 published_at : Ptime.t option; (** time at which the video was marked as ready for playback (with restrictions depending on `privacy`). Usually set after a `state` evolution. *) 7612 scheduled_update : VideoScheduled.Update.t option; 7613 short_uuid : ShortUuid.T.t option; 7614 state : VideoStateConstant.T.t option; (** represents the internal state of the video processing within the PeerTube instance *) 7615 thumbnail_path : string option; 7616 truncated_description : string option; (** truncated description of the video, written in Markdown. 7617 *) 7618 updated_at : Ptime.t option; (** last time the video's metadata was modified *) 7619 user_history : Json.t option; 7620 uuid : Uuidv4.T.t option; (** universal identifier for the video, that can be used across instances *) 7621 views : int option; 7622 wait_transcoding : bool option; 7623 viewers : int option; (** If the video is a live, you have the amount of current viewers *) 7624 description : string option; (** full description of the video, written in Markdown. 7625 *) 7626 support : string option; (** A text tell the audience how to support the video creator *) 7627 channel : VideoChannel.T.t option; 7628 account : Account.T.t option; 7629 tags : string list option; 7630 comments_policy : VideoCommentsPolicyConstant.T.t option; 7631 download_enabled : bool option; 7632 input_file_updated_at : Ptime.t option; (** Latest input file update. Null if the file has never been replaced since the original upload *) 7633 tracker_urls : string list option; 7634 files : VideoFile.T.t list option; (** Web compatible video files. If Web Video is disabled on the server: 7635 7636 - field will be empty 7637 - video files will be found in `streamingPlaylists[].files` field 7638 *) 7639 streaming_playlists : VideoStreamingPlaylists.T.t list option; (** HLS playlists/manifest files. If HLS is disabled on the server: 7640 7641 - field will be empty 7642 - video files will be found in `files` field 7643 *) 7644 } 7645 end 7646 end 7647 7648 module T = struct 7649 include Types.T 7650 7651 let v ?aspect_ratio ?blacklisted ?blacklisted_reason ?category ?comments ?created_at ?dislikes ?duration ?embed_path ?id ?is_live ?is_local ?language ?licence ?likes ?live_schedules ?name ?nsfw ?nsfw_flags ?nsfw_summary ?originally_published_at ?preview_path ?privacy ?published_at ?scheduled_update ?short_uuid ?state ?thumbnail_path ?truncated_description ?updated_at ?user_history ?uuid ?views ?wait_transcoding ?viewers ?description ?support ?channel ?account ?tags ?comments_policy ?download_enabled ?input_file_updated_at ?tracker_urls ?files ?streaming_playlists () = { aspect_ratio; blacklisted; blacklisted_reason; category; comments; created_at; dislikes; duration; embed_path; id; is_live; is_local; language; licence; likes; live_schedules; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; preview_path; privacy; published_at; scheduled_update; short_uuid; state; thumbnail_path; truncated_description; updated_at; user_history; uuid; views; wait_transcoding; viewers; description; support; channel; account; tags; comments_policy; download_enabled; input_file_updated_at; tracker_urls; files; streaming_playlists } 7652 7653 let aspect_ratio t = t.aspect_ratio 7654 let blacklisted t = t.blacklisted 7655 let blacklisted_reason t = t.blacklisted_reason 7656 let category t = t.category 7657 let comments t = t.comments 7658 let created_at t = t.created_at 7659 let dislikes t = t.dislikes 7660 let duration t = t.duration 7661 let embed_path t = t.embed_path 7662 let id t = t.id 7663 let is_live t = t.is_live 7664 let is_local t = t.is_local 7665 let language t = t.language 7666 let licence t = t.licence 7667 let likes t = t.likes 7668 let live_schedules t = t.live_schedules 7669 let name t = t.name 7670 let nsfw t = t.nsfw 7671 let nsfw_flags t = t.nsfw_flags 7672 let nsfw_summary t = t.nsfw_summary 7673 let originally_published_at t = t.originally_published_at 7674 let preview_path t = t.preview_path 7675 let privacy t = t.privacy 7676 let published_at t = t.published_at 7677 let scheduled_update t = t.scheduled_update 7678 let short_uuid t = t.short_uuid 7679 let state t = t.state 7680 let thumbnail_path t = t.thumbnail_path 7681 let truncated_description t = t.truncated_description 7682 let updated_at t = t.updated_at 7683 let user_history t = t.user_history 7684 let uuid t = t.uuid 7685 let views t = t.views 7686 let wait_transcoding t = t.wait_transcoding 7687 let viewers t = t.viewers 7688 let description t = t.description 7689 let support t = t.support 7690 let channel t = t.channel 7691 let account t = t.account 7692 let tags t = t.tags 7693 let comments_policy t = t.comments_policy 7694 let download_enabled t = t.download_enabled 7695 let input_file_updated_at t = t.input_file_updated_at 7696 let tracker_urls t = t.tracker_urls 7697 let files t = t.files 7698 let streaming_playlists t = t.streaming_playlists 7699 7700 let jsont : t Json.codec = 7701 Json.Codec.Object.map ~kind:"VideoDetails" 7702 (fun aspect_ratio blacklisted blacklisted_reason category comments created_at dislikes duration embed_path id is_live is_local language licence likes live_schedules name nsfw nsfw_flags nsfw_summary originally_published_at preview_path privacy published_at scheduled_update short_uuid state thumbnail_path truncated_description updated_at user_history uuid views wait_transcoding viewers description support channel account tags comments_policy download_enabled input_file_updated_at tracker_urls files streaming_playlists -> { aspect_ratio; blacklisted; blacklisted_reason; category; comments; created_at; dislikes; duration; embed_path; id; is_live; is_local; language; licence; likes; live_schedules; name; nsfw; nsfw_flags; nsfw_summary; originally_published_at; preview_path; privacy; published_at; scheduled_update; short_uuid; state; thumbnail_path; truncated_description; updated_at; user_history; uuid; views; wait_transcoding; viewers; description; support; channel; account; tags; comments_policy; download_enabled; input_file_updated_at; tracker_urls; files; streaming_playlists }) 7703 |> Json.Codec.Object.member "aspectRatio" Openapi.Runtime.nullable_float 7704 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.aspect_ratio) 7705 |> Json.Codec.Object.member "blacklisted" Openapi.Runtime.nullable_bool 7706 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.blacklisted) 7707 |> Json.Codec.Object.member "blacklistedReason" Openapi.Runtime.nullable_string 7708 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.blacklisted_reason) 7709 |> Json.Codec.Object.opt_member "category" VideoConstantNumberCategory.T.jsont ~enc:(fun r -> r.category) 7710 |> Json.Codec.Object.opt_member "comments" Json.Codec.int ~enc:(fun r -> r.comments) 7711 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 7712 |> Json.Codec.Object.opt_member "dislikes" Json.Codec.int ~enc:(fun r -> r.dislikes) 7713 |> Json.Codec.Object.opt_member "duration" Json.Codec.int ~enc:(fun r -> r.duration) 7714 |> Json.Codec.Object.opt_member "embedPath" Json.Codec.string ~enc:(fun r -> r.embed_path) 7715 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 7716 |> Json.Codec.Object.opt_member "isLive" Json.Codec.bool ~enc:(fun r -> r.is_live) 7717 |> Json.Codec.Object.opt_member "isLocal" Json.Codec.bool ~enc:(fun r -> r.is_local) 7718 |> Json.Codec.Object.opt_member "language" VideoConstantStringLanguage.T.jsont ~enc:(fun r -> r.language) 7719 |> Json.Codec.Object.opt_member "licence" VideoConstantNumberLicence.T.jsont ~enc:(fun r -> r.licence) 7720 |> Json.Codec.Object.opt_member "likes" Json.Codec.int ~enc:(fun r -> r.likes) 7721 |> Json.Codec.Object.opt_member "liveSchedules" (Json.Codec.list LiveSchedule.T.jsont) ~enc:(fun r -> r.live_schedules) 7722 |> Json.Codec.Object.opt_member "name" (Openapi.Runtime.validated_string ~min_length:3 ~max_length:120 Json.Codec.string) ~enc:(fun r -> r.name) 7723 |> Json.Codec.Object.opt_member "nsfw" Json.Codec.bool ~enc:(fun r -> r.nsfw) 7724 |> Json.Codec.Object.opt_member "nsfwFlags" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags) 7725 |> Json.Codec.Object.member "nsfwSummary" Openapi.Runtime.nullable_string 7726 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.nsfw_summary) 7727 |> Json.Codec.Object.member "originallyPublishedAt" Openapi.Runtime.nullable_ptime 7728 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.originally_published_at) 7729 |> Json.Codec.Object.opt_member "previewPath" Json.Codec.string ~enc:(fun r -> r.preview_path) 7730 |> Json.Codec.Object.opt_member "privacy" VideoPrivacyConstant.T.jsont ~enc:(fun r -> r.privacy) 7731 |> Json.Codec.Object.opt_member "publishedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.published_at) 7732 |> Json.Codec.Object.opt_member "scheduledUpdate" VideoScheduled.Update.jsont ~enc:(fun r -> r.scheduled_update) 7733 |> Json.Codec.Object.opt_member "shortUUID" ShortUuid.T.jsont ~enc:(fun r -> r.short_uuid) 7734 |> Json.Codec.Object.opt_member "state" VideoStateConstant.T.jsont ~enc:(fun r -> r.state) 7735 |> Json.Codec.Object.opt_member "thumbnailPath" Json.Codec.string ~enc:(fun r -> r.thumbnail_path) 7736 |> Json.Codec.Object.member "truncatedDescription" Openapi.Runtime.nullable_string 7737 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.truncated_description) 7738 |> Json.Codec.Object.opt_member "updatedAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.updated_at) 7739 |> Json.Codec.Object.member "userHistory" (Openapi.Runtime.nullable_any Json.Codec.Value.t) 7740 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.user_history) 7741 |> Json.Codec.Object.opt_member "uuid" Uuidv4.T.jsont ~enc:(fun r -> r.uuid) 7742 |> Json.Codec.Object.opt_member "views" Json.Codec.int ~enc:(fun r -> r.views) 7743 |> Json.Codec.Object.member "waitTranscoding" Openapi.Runtime.nullable_bool 7744 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.wait_transcoding) 7745 |> Json.Codec.Object.opt_member "viewers" Json.Codec.int ~enc:(fun r -> r.viewers) 7746 |> Json.Codec.Object.member "description" Openapi.Runtime.nullable_string 7747 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.description) 7748 |> Json.Codec.Object.member "support" Openapi.Runtime.nullable_string 7749 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.support) 7750 |> Json.Codec.Object.opt_member "channel" VideoChannel.T.jsont ~enc:(fun r -> r.channel) 7751 |> Json.Codec.Object.opt_member "account" Account.T.jsont ~enc:(fun r -> r.account) 7752 |> Json.Codec.Object.opt_member "tags" (Openapi.Runtime.validated_list ~min_items:1 ~max_items:5 Json.Codec.string) ~enc:(fun r -> r.tags) 7753 |> Json.Codec.Object.opt_member "commentsPolicy" VideoCommentsPolicyConstant.T.jsont ~enc:(fun r -> r.comments_policy) 7754 |> Json.Codec.Object.opt_member "downloadEnabled" Json.Codec.bool ~enc:(fun r -> r.download_enabled) 7755 |> Json.Codec.Object.member "inputFileUpdatedAt" Openapi.Runtime.nullable_ptime 7756 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.input_file_updated_at) 7757 |> Json.Codec.Object.opt_member "trackerUrls" (Json.Codec.list Json.Codec.string) ~enc:(fun r -> r.tracker_urls) 7758 |> Json.Codec.Object.opt_member "files" (Json.Codec.list VideoFile.T.jsont) ~enc:(fun r -> r.files) 7759 |> Json.Codec.Object.opt_member "streamingPlaylists" (Json.Codec.list VideoStreamingPlaylists.T.jsont) ~enc:(fun r -> r.streaming_playlists) 7760 |> Json.Codec.Object.skip_unknown 7761 |> Json.Codec.Object.seal 7762 end 7763 7764 (** Get a video 7765 @param id The object id, uuid or short uuid 7766 *) 7767 let get_video ~id client () = 7768 let op_name = "get_video" in 7769 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}" in 7770 let query = "" in 7771 let url = client.base_url ^ url_path ^ query in 7772 let response = 7773 try Requests.get client.session url 7774 with Eio.Io _ as ex -> 7775 let bt = Printexc.get_raw_backtrace () in 7776 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7777 in 7778 if Requests.Response.ok response then 7779 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 7780 else 7781 let body = Requests.Response.text response in 7782 let status = Requests.Response.status_code response in 7783 let parsed_body = match status with 7784 | 401 -> 7785 (match Openapi.Runtime.Json.decode_json ServerError.T.jsont (Requests.Response.text response) with 7786 | Ok v -> Some (Openapi.Runtime.Typed ("ServerError", Openapi.Runtime.Json.encode_json_string ServerError.T.jsont v)) 7787 | Error _ -> None) 7788 | 403 -> 7789 (match Openapi.Runtime.Json.decode_json ServerError.T.jsont (Requests.Response.text response) with 7790 | Ok v -> Some (Openapi.Runtime.Typed ("ServerError", Openapi.Runtime.Json.encode_json_string ServerError.T.jsont v)) 7791 | Error _ -> None) 7792 | _ -> 7793 (match Json.of_string Json.Codec.Value.t body with 7794 | Ok json -> Some (Openapi.Runtime.Json json) 7795 | Error _ -> Some (Openapi.Runtime.Raw body)) 7796 in 7797 raise (Openapi.Runtime.Api_error { 7798 operation = op_name; 7799 method_ = "GET"; 7800 url; 7801 status; 7802 body; 7803 parsed_body; 7804 }) 7805end 7806 7807module VideoChannelSync = struct 7808 module Types = struct 7809 module Create = struct 7810 type t = { 7811 external_channel_url : string option; 7812 video_channel_id : Id.T.t option; 7813 } 7814 end 7815 7816 module T = struct 7817 type t = { 7818 channel : VideoChannel.T.t option; 7819 created_at : Ptime.t option; 7820 external_channel_url : string option; 7821 id : Id.T.t option; 7822 last_sync_at : Ptime.t option; 7823 state : Json.t option; 7824 } 7825 end 7826 end 7827 7828 module Create = struct 7829 include Types.Create 7830 7831 let v ?external_channel_url ?video_channel_id () = { external_channel_url; video_channel_id } 7832 7833 let external_channel_url t = t.external_channel_url 7834 let video_channel_id t = t.video_channel_id 7835 7836 let jsont : t Json.codec = 7837 Json.Codec.Object.map ~kind:"VideoChannelSyncCreate" 7838 (fun external_channel_url video_channel_id -> { external_channel_url; video_channel_id }) 7839 |> Json.Codec.Object.opt_member "externalChannelUrl" Json.Codec.string ~enc:(fun r -> r.external_channel_url) 7840 |> Json.Codec.Object.opt_member "videoChannelId" Id.T.jsont ~enc:(fun r -> r.video_channel_id) 7841 |> Json.Codec.Object.skip_unknown 7842 |> Json.Codec.Object.seal 7843 end 7844 7845 module T = struct 7846 include Types.T 7847 7848 let v ?channel ?created_at ?external_channel_url ?id ?last_sync_at ?state () = { channel; created_at; external_channel_url; id; last_sync_at; state } 7849 7850 let channel t = t.channel 7851 let created_at t = t.created_at 7852 let external_channel_url t = t.external_channel_url 7853 let id t = t.id 7854 let last_sync_at t = t.last_sync_at 7855 let state t = t.state 7856 7857 let jsont : t Json.codec = 7858 Json.Codec.Object.map ~kind:"VideoChannelSync" 7859 (fun channel created_at external_channel_url id last_sync_at state -> { channel; created_at; external_channel_url; id; last_sync_at; state }) 7860 |> Json.Codec.Object.opt_member "channel" VideoChannel.T.jsont ~enc:(fun r -> r.channel) 7861 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 7862 |> Json.Codec.Object.opt_member "externalChannelUrl" Json.Codec.string ~enc:(fun r -> r.external_channel_url) 7863 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 7864 |> Json.Codec.Object.member "lastSyncAt" Openapi.Runtime.nullable_ptime 7865 ~dec_absent:None ~enc_omit:Option.is_none ~enc:(fun r -> r.last_sync_at) 7866 |> Json.Codec.Object.opt_member "state" Json.Codec.Value.t ~enc:(fun r -> r.state) 7867 |> Json.Codec.Object.skip_unknown 7868 |> Json.Codec.Object.seal 7869 end 7870end 7871 7872module VideoChannelSyncList = struct 7873 module Types = struct 7874 module T = struct 7875 type t = { 7876 data : VideoChannelSync.T.t list option; 7877 total : int option; 7878 } 7879 end 7880 end 7881 7882 module T = struct 7883 include Types.T 7884 7885 let v ?data ?total () = { data; total } 7886 7887 let data t = t.data 7888 let total t = t.total 7889 7890 let jsont : t Json.codec = 7891 Json.Codec.Object.map ~kind:"VideoChannelSyncList" 7892 (fun data total -> { data; total }) 7893 |> Json.Codec.Object.opt_member "data" (Json.Codec.list VideoChannelSync.T.jsont) ~enc:(fun r -> r.data) 7894 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 7895 |> Json.Codec.Object.skip_unknown 7896 |> Json.Codec.Object.seal 7897 end 7898 7899 (** List the synchronizations of video channels of an account 7900 @param name The username or handle of the account 7901 @param start Offset used to paginate results 7902 @param count Number of items to return 7903 @param sort Sort column 7904 @param include_collaborations **PeerTube >= 8.0** Include objects from collaborated channels 7905 *) 7906 let get_api_v1_accounts_video_channel_syncs ~name ?start ?count ?sort ?include_collaborations client () = 7907 let op_name = "get_api_v1_accounts_video_channel_syncs" in 7908 let url_path = Openapi.Runtime.Path.render ~params:[("name", name)] "/api/v1/accounts/{name}/video-channel-syncs" in 7909 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"includeCollaborations" ~value:include_collaborations]) in 7910 let url = client.base_url ^ url_path ^ query in 7911 let response = 7912 try Requests.get client.session url 7913 with Eio.Io _ as ex -> 7914 let bt = Printexc.get_raw_backtrace () in 7915 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7916 in 7917 if Requests.Response.ok response then 7918 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 7919 else 7920 let body = Requests.Response.text response in 7921 let parsed_body = 7922 match Json.of_string Json.Codec.Value.t body with 7923 | Ok json -> Some (Openapi.Runtime.Json json) 7924 | Error _ -> Some (Openapi.Runtime.Raw body) 7925 in 7926 raise (Openapi.Runtime.Api_error { 7927 operation = op_name; 7928 method_ = "GET"; 7929 url; 7930 status = Requests.Response.status_code response; 7931 body; 7932 parsed_body; 7933 }) 7934end 7935 7936module Client = struct 7937 (** List abuses 7938 @param id only list the report with this id 7939 @param predefined_reason predefined reason the listed reports should contain 7940 @param search plain search that will match with video titles, reporter names and more 7941 @param search_reporter only list reports of a specific reporter 7942 @param search_reportee only list reports of a specific reportee 7943 @param search_video only list reports of a specific video 7944 @param search_video_channel only list reports of a specific video channel 7945 @param video_is only list deleted or blocklisted videos 7946 @param filter only list account, comment or video reports 7947 @param start Offset used to paginate results 7948 @param count Number of items to return 7949 @param sort Sort abuses by criteria 7950 *) 7951 let get_abuses ?id ?predefined_reason ?search ?state ?search_reporter ?search_reportee ?search_video ?search_video_channel ?video_is ?filter ?start ?count ?sort client () = 7952 let op_name = "get_abuses" in 7953 let url_path = "/api/v1/abuses" in 7954 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"id" ~value:id; Openapi.Runtime.Query.optional ~key:"predefinedReason" ~value:predefined_reason; Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"state" ~value:state; Openapi.Runtime.Query.optional ~key:"searchReporter" ~value:search_reporter; Openapi.Runtime.Query.optional ~key:"searchReportee" ~value:search_reportee; Openapi.Runtime.Query.optional ~key:"searchVideo" ~value:search_video; Openapi.Runtime.Query.optional ~key:"searchVideoChannel" ~value:search_video_channel; Openapi.Runtime.Query.optional ~key:"videoIs" ~value:video_is; Openapi.Runtime.Query.optional ~key:"filter" ~value:filter; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 7955 let url = client.base_url ^ url_path ^ query in 7956 let response = 7957 try Requests.get client.session url 7958 with Eio.Io _ as ex -> 7959 let bt = Printexc.get_raw_backtrace () in 7960 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 7961 in 7962 if Requests.Response.ok response then 7963 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 7964 else 7965 let body = Requests.Response.text response in 7966 let parsed_body = 7967 match Json.of_string Json.Codec.Value.t body with 7968 | Ok json -> Some (Openapi.Runtime.Json json) 7969 | Error _ -> Some (Openapi.Runtime.Raw body) 7970 in 7971 raise (Openapi.Runtime.Api_error { 7972 operation = op_name; 7973 method_ = "GET"; 7974 url; 7975 status = Requests.Response.status_code response; 7976 body; 7977 parsed_body; 7978 }) 7979 7980 (** Report an abuse *) 7981 let post_api_v1_abuses client () = 7982 let op_name = "post_api_v1_abuses" in 7983 let url_path = "/api/v1/abuses" in 7984 let query = "" in 7985 let url = client.base_url ^ url_path ^ query in 7986 let response = 7987 try Requests.post client.session url 7988 with Eio.Io _ as ex -> 7989 let bt = Printexc.get_raw_backtrace () in 7990 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 7991 in 7992 if Requests.Response.ok response then 7993 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 7994 else 7995 let body = Requests.Response.text response in 7996 let parsed_body = 7997 match Json.of_string Json.Codec.Value.t body with 7998 | Ok json -> Some (Openapi.Runtime.Json json) 7999 | Error _ -> Some (Openapi.Runtime.Raw body) 8000 in 8001 raise (Openapi.Runtime.Api_error { 8002 operation = op_name; 8003 method_ = "POST"; 8004 url; 8005 status = Requests.Response.status_code response; 8006 body; 8007 parsed_body; 8008 }) 8009 8010 (** Update an abuse 8011 @param abuse_id Abuse id 8012 *) 8013 let put_api_v1_abuses ~abuse_id client () = 8014 let op_name = "put_api_v1_abuses" in 8015 let url_path = Openapi.Runtime.Path.render ~params:[("abuseId", abuse_id)] "/api/v1/abuses/{abuseId}" in 8016 let query = "" in 8017 let url = client.base_url ^ url_path ^ query in 8018 let response = 8019 try Requests.put client.session url 8020 with Eio.Io _ as ex -> 8021 let bt = Printexc.get_raw_backtrace () in 8022 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 8023 in 8024 if Requests.Response.ok response then 8025 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8026 else 8027 let body = Requests.Response.text response in 8028 let parsed_body = 8029 match Json.of_string Json.Codec.Value.t body with 8030 | Ok json -> Some (Openapi.Runtime.Json json) 8031 | Error _ -> Some (Openapi.Runtime.Raw body) 8032 in 8033 raise (Openapi.Runtime.Api_error { 8034 operation = op_name; 8035 method_ = "PUT"; 8036 url; 8037 status = Requests.Response.status_code response; 8038 body; 8039 parsed_body; 8040 }) 8041 8042 (** Delete an abuse 8043 @param abuse_id Abuse id 8044 *) 8045 let delete_api_v1_abuses ~abuse_id client () = 8046 let op_name = "delete_api_v1_abuses" in 8047 let url_path = Openapi.Runtime.Path.render ~params:[("abuseId", abuse_id)] "/api/v1/abuses/{abuseId}" in 8048 let query = "" in 8049 let url = client.base_url ^ url_path ^ query in 8050 let response = 8051 try Requests.delete client.session url 8052 with Eio.Io _ as ex -> 8053 let bt = Printexc.get_raw_backtrace () in 8054 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 8055 in 8056 if Requests.Response.ok response then 8057 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8058 else 8059 let body = Requests.Response.text response in 8060 let parsed_body = 8061 match Json.of_string Json.Codec.Value.t body with 8062 | Ok json -> Some (Openapi.Runtime.Json json) 8063 | Error _ -> Some (Openapi.Runtime.Raw body) 8064 in 8065 raise (Openapi.Runtime.Api_error { 8066 operation = op_name; 8067 method_ = "DELETE"; 8068 url; 8069 status = Requests.Response.status_code response; 8070 body; 8071 parsed_body; 8072 }) 8073 8074 (** List messages of an abuse 8075 @param abuse_id Abuse id 8076 *) 8077 let get_api_v1_abuses_messages ~abuse_id client () = 8078 let op_name = "get_api_v1_abuses_messages" in 8079 let url_path = Openapi.Runtime.Path.render ~params:[("abuseId", abuse_id)] "/api/v1/abuses/{abuseId}/messages" in 8080 let query = "" in 8081 let url = client.base_url ^ url_path ^ query in 8082 let response = 8083 try Requests.get client.session url 8084 with Eio.Io _ as ex -> 8085 let bt = Printexc.get_raw_backtrace () in 8086 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8087 in 8088 if Requests.Response.ok response then 8089 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8090 else 8091 let body = Requests.Response.text response in 8092 let parsed_body = 8093 match Json.of_string Json.Codec.Value.t body with 8094 | Ok json -> Some (Openapi.Runtime.Json json) 8095 | Error _ -> Some (Openapi.Runtime.Raw body) 8096 in 8097 raise (Openapi.Runtime.Api_error { 8098 operation = op_name; 8099 method_ = "GET"; 8100 url; 8101 status = Requests.Response.status_code response; 8102 body; 8103 parsed_body; 8104 }) 8105 8106 (** Add message to an abuse 8107 @param abuse_id Abuse id 8108 *) 8109 let post_api_v1_abuses_messages ~abuse_id client () = 8110 let op_name = "post_api_v1_abuses_messages" in 8111 let url_path = Openapi.Runtime.Path.render ~params:[("abuseId", abuse_id)] "/api/v1/abuses/{abuseId}/messages" in 8112 let query = "" in 8113 let url = client.base_url ^ url_path ^ query in 8114 let response = 8115 try Requests.post client.session url 8116 with Eio.Io _ as ex -> 8117 let bt = Printexc.get_raw_backtrace () in 8118 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8119 in 8120 if Requests.Response.ok response then 8121 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8122 else 8123 let body = Requests.Response.text response in 8124 let parsed_body = 8125 match Json.of_string Json.Codec.Value.t body with 8126 | Ok json -> Some (Openapi.Runtime.Json json) 8127 | Error _ -> Some (Openapi.Runtime.Raw body) 8128 in 8129 raise (Openapi.Runtime.Api_error { 8130 operation = op_name; 8131 method_ = "POST"; 8132 url; 8133 status = Requests.Response.status_code response; 8134 body; 8135 parsed_body; 8136 }) 8137 8138 (** Delete an abuse message 8139 @param abuse_id Abuse id 8140 @param abuse_message_id Abuse message id 8141 *) 8142 let delete_api_v1_abuses_messages ~abuse_id ~abuse_message_id client () = 8143 let op_name = "delete_api_v1_abuses_messages" in 8144 let url_path = Openapi.Runtime.Path.render ~params:[("abuseId", abuse_id); ("abuseMessageId", abuse_message_id)] "/api/v1/abuses/{abuseId}/messages/{abuseMessageId}" in 8145 let query = "" in 8146 let url = client.base_url ^ url_path ^ query in 8147 let response = 8148 try Requests.delete client.session url 8149 with Eio.Io _ as ex -> 8150 let bt = Printexc.get_raw_backtrace () in 8151 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 8152 in 8153 if Requests.Response.ok response then 8154 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8155 else 8156 let body = Requests.Response.text response in 8157 let parsed_body = 8158 match Json.of_string Json.Codec.Value.t body with 8159 | Ok json -> Some (Openapi.Runtime.Json json) 8160 | Error _ -> Some (Openapi.Runtime.Raw body) 8161 in 8162 raise (Openapi.Runtime.Api_error { 8163 operation = op_name; 8164 method_ = "DELETE"; 8165 url; 8166 status = Requests.Response.status_code response; 8167 body; 8168 parsed_body; 8169 }) 8170 8171 (** List accounts 8172 @param start Offset used to paginate results 8173 @param count Number of items to return 8174 @param sort Sort column 8175 *) 8176 let get_accounts ?start ?count ?sort client () = 8177 let op_name = "get_accounts" in 8178 let url_path = "/api/v1/accounts" in 8179 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 8180 let url = client.base_url ^ url_path ^ query in 8181 let response = 8182 try Requests.get client.session url 8183 with Eio.Io _ as ex -> 8184 let bt = Printexc.get_raw_backtrace () in 8185 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8186 in 8187 if Requests.Response.ok response then 8188 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8189 else 8190 let body = Requests.Response.text response in 8191 let parsed_body = 8192 match Json.of_string Json.Codec.Value.t body with 8193 | Ok json -> Some (Openapi.Runtime.Json json) 8194 | Error _ -> Some (Openapi.Runtime.Raw body) 8195 in 8196 raise (Openapi.Runtime.Api_error { 8197 operation = op_name; 8198 method_ = "GET"; 8199 url; 8200 status = Requests.Response.status_code response; 8201 body; 8202 parsed_body; 8203 }) 8204 8205 (** List followers of an account 8206 @param name The username or handle of the account 8207 @param start Offset used to paginate results 8208 @param count Number of items to return 8209 @param sort Sort followers by criteria 8210 @param search Plain text search, applied to various parts of the model depending on endpoint 8211 *) 8212 let get_account_followers ~name ?start ?count ?sort ?search client () = 8213 let op_name = "get_account_followers" in 8214 let url_path = Openapi.Runtime.Path.render ~params:[("name", name)] "/api/v1/accounts/{name}/followers" in 8215 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 8216 let url = client.base_url ^ url_path ^ query in 8217 let response = 8218 try Requests.get client.session url 8219 with Eio.Io _ as ex -> 8220 let bt = Printexc.get_raw_backtrace () in 8221 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8222 in 8223 if Requests.Response.ok response then 8224 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8225 else 8226 let body = Requests.Response.text response in 8227 let parsed_body = 8228 match Json.of_string Json.Codec.Value.t body with 8229 | Ok json -> Some (Openapi.Runtime.Json json) 8230 | Error _ -> Some (Openapi.Runtime.Raw body) 8231 in 8232 raise (Openapi.Runtime.Api_error { 8233 operation = op_name; 8234 method_ = "GET"; 8235 url; 8236 status = Requests.Response.status_code response; 8237 body; 8238 parsed_body; 8239 }) 8240 8241 (** List playlists of an account 8242 @param name The username or handle of the account 8243 @param start Offset used to paginate results 8244 @param count Number of items to return 8245 @param sort Sort column 8246 @param search Plain text search, applied to various parts of the model depending on endpoint 8247 @param include_collaborations **PeerTube >= 8.0** Include objects from collaborated channels 8248 @param channel_name_one_of **PeerTube >= 8.0** Filter on playlists that are published on a channel with one of these names 8249 *) 8250 let get_api_v1_accounts_video_playlists ~name ?start ?count ?sort ?search ?playlist_type ?include_collaborations ?channel_name_one_of client () = 8251 let op_name = "get_api_v1_accounts_video_playlists" in 8252 let url_path = Openapi.Runtime.Path.render ~params:[("name", name)] "/api/v1/accounts/{name}/video-playlists" in 8253 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"playlistType" ~value:playlist_type; Openapi.Runtime.Query.optional ~key:"includeCollaborations" ~value:include_collaborations; Openapi.Runtime.Query.optional ~key:"channelNameOneOf" ~value:channel_name_one_of]) in 8254 let url = client.base_url ^ url_path ^ query in 8255 let response = 8256 try Requests.get client.session url 8257 with Eio.Io _ as ex -> 8258 let bt = Printexc.get_raw_backtrace () in 8259 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8260 in 8261 if Requests.Response.ok response then 8262 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8263 else 8264 let body = Requests.Response.text response in 8265 let parsed_body = 8266 match Json.of_string Json.Codec.Value.t body with 8267 | Ok json -> Some (Openapi.Runtime.Json json) 8268 | Error _ -> Some (Openapi.Runtime.Raw body) 8269 in 8270 raise (Openapi.Runtime.Api_error { 8271 operation = op_name; 8272 method_ = "GET"; 8273 url; 8274 status = Requests.Response.status_code response; 8275 body; 8276 parsed_body; 8277 }) 8278 8279 (** Update account auto tag policies on comments 8280 8281 **PeerTube >= 6.2** 8282 @param account_name account name to update auto tag policies 8283 *) 8284 let put_api_v1_automatic_tags_policies_accounts_comments ~account_name client () = 8285 let op_name = "put_api_v1_automatic_tags_policies_accounts_comments" in 8286 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name)] "/api/v1/automatic-tags/policies/accounts/{accountName}/comments" in 8287 let query = "" in 8288 let url = client.base_url ^ url_path ^ query in 8289 let response = 8290 try Requests.put client.session url 8291 with Eio.Io _ as ex -> 8292 let bt = Printexc.get_raw_backtrace () in 8293 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 8294 in 8295 if Requests.Response.ok response then 8296 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8297 else 8298 let body = Requests.Response.text response in 8299 let parsed_body = 8300 match Json.of_string Json.Codec.Value.t body with 8301 | Ok json -> Some (Openapi.Runtime.Json json) 8302 | Error _ -> Some (Openapi.Runtime.Raw body) 8303 in 8304 raise (Openapi.Runtime.Api_error { 8305 operation = op_name; 8306 method_ = "PUT"; 8307 url; 8308 status = Requests.Response.status_code response; 8309 body; 8310 parsed_body; 8311 }) 8312 8313 (** Update client language 8314 8315 Set a cookie so that, the next time the client refreshes the HTML of the web interface, PeerTube will use the next language *) 8316 let update_client_language client () = 8317 let op_name = "update_client_language" in 8318 let url_path = "/api/v1/client-config/update-language" in 8319 let query = "" in 8320 let url = client.base_url ^ url_path ^ query in 8321 let response = 8322 try Requests.post client.session url 8323 with Eio.Io _ as ex -> 8324 let bt = Printexc.get_raw_backtrace () in 8325 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8326 in 8327 if Requests.Response.ok response then 8328 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8329 else 8330 let body = Requests.Response.text response in 8331 let parsed_body = 8332 match Json.of_string Json.Codec.Value.t body with 8333 | Ok json -> Some (Openapi.Runtime.Json json) 8334 | Error _ -> Some (Openapi.Runtime.Raw body) 8335 in 8336 raise (Openapi.Runtime.Api_error { 8337 operation = op_name; 8338 method_ = "POST"; 8339 url; 8340 status = Requests.Response.status_code response; 8341 body; 8342 parsed_body; 8343 }) 8344 8345 (** Set instance runtime configuration *) 8346 let put_custom_config client () = 8347 let op_name = "put_custom_config" in 8348 let url_path = "/api/v1/config/custom" in 8349 let query = "" in 8350 let url = client.base_url ^ url_path ^ query in 8351 let response = 8352 try Requests.put client.session url 8353 with Eio.Io _ as ex -> 8354 let bt = Printexc.get_raw_backtrace () in 8355 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 8356 in 8357 if Requests.Response.ok response then 8358 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8359 else 8360 let body = Requests.Response.text response in 8361 let parsed_body = 8362 match Json.of_string Json.Codec.Value.t body with 8363 | Ok json -> Some (Openapi.Runtime.Json json) 8364 | Error _ -> Some (Openapi.Runtime.Raw body) 8365 in 8366 raise (Openapi.Runtime.Api_error { 8367 operation = op_name; 8368 method_ = "PUT"; 8369 url; 8370 status = Requests.Response.status_code response; 8371 body; 8372 parsed_body; 8373 }) 8374 8375 (** Delete instance runtime configuration *) 8376 let del_custom_config client () = 8377 let op_name = "del_custom_config" in 8378 let url_path = "/api/v1/config/custom" in 8379 let query = "" in 8380 let url = client.base_url ^ url_path ^ query in 8381 let response = 8382 try Requests.delete client.session url 8383 with Eio.Io _ as ex -> 8384 let bt = Printexc.get_raw_backtrace () in 8385 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 8386 in 8387 if Requests.Response.ok response then 8388 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8389 else 8390 let body = Requests.Response.text response in 8391 let parsed_body = 8392 match Json.of_string Json.Codec.Value.t body with 8393 | Ok json -> Some (Openapi.Runtime.Json json) 8394 | Error _ -> Some (Openapi.Runtime.Raw body) 8395 in 8396 raise (Openapi.Runtime.Api_error { 8397 operation = op_name; 8398 method_ = "DELETE"; 8399 url; 8400 status = Requests.Response.status_code response; 8401 body; 8402 parsed_body; 8403 }) 8404 8405 (** Delete instance avatar *) 8406 let delete_api_v1_config_instance_avatar client () = 8407 let op_name = "delete_api_v1_config_instance_avatar" in 8408 let url_path = "/api/v1/config/instance-avatar" in 8409 let query = "" in 8410 let url = client.base_url ^ url_path ^ query in 8411 let response = 8412 try Requests.delete client.session url 8413 with Eio.Io _ as ex -> 8414 let bt = Printexc.get_raw_backtrace () in 8415 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 8416 in 8417 if Requests.Response.ok response then 8418 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8419 else 8420 let body = Requests.Response.text response in 8421 let parsed_body = 8422 match Json.of_string Json.Codec.Value.t body with 8423 | Ok json -> Some (Openapi.Runtime.Json json) 8424 | Error _ -> Some (Openapi.Runtime.Raw body) 8425 in 8426 raise (Openapi.Runtime.Api_error { 8427 operation = op_name; 8428 method_ = "DELETE"; 8429 url; 8430 status = Requests.Response.status_code response; 8431 body; 8432 parsed_body; 8433 }) 8434 8435 (** Update instance avatar *) 8436 let post_api_v1_config_instance_avatar_pick client () = 8437 let op_name = "post_api_v1_config_instance_avatar_pick" in 8438 let url_path = "/api/v1/config/instance-avatar/pick" in 8439 let query = "" in 8440 let url = client.base_url ^ url_path ^ query in 8441 let response = 8442 try Requests.post client.session url 8443 with Eio.Io _ as ex -> 8444 let bt = Printexc.get_raw_backtrace () in 8445 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8446 in 8447 if Requests.Response.ok response then 8448 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8449 else 8450 let body = Requests.Response.text response in 8451 let parsed_body = 8452 match Json.of_string Json.Codec.Value.t body with 8453 | Ok json -> Some (Openapi.Runtime.Json json) 8454 | Error _ -> Some (Openapi.Runtime.Raw body) 8455 in 8456 raise (Openapi.Runtime.Api_error { 8457 operation = op_name; 8458 method_ = "POST"; 8459 url; 8460 status = Requests.Response.status_code response; 8461 body; 8462 parsed_body; 8463 }) 8464 8465 (** Delete instance banner *) 8466 let delete_api_v1_config_instance_banner client () = 8467 let op_name = "delete_api_v1_config_instance_banner" in 8468 let url_path = "/api/v1/config/instance-banner" in 8469 let query = "" in 8470 let url = client.base_url ^ url_path ^ query in 8471 let response = 8472 try Requests.delete client.session url 8473 with Eio.Io _ as ex -> 8474 let bt = Printexc.get_raw_backtrace () in 8475 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 8476 in 8477 if Requests.Response.ok response then 8478 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8479 else 8480 let body = Requests.Response.text response in 8481 let parsed_body = 8482 match Json.of_string Json.Codec.Value.t body with 8483 | Ok json -> Some (Openapi.Runtime.Json json) 8484 | Error _ -> Some (Openapi.Runtime.Raw body) 8485 in 8486 raise (Openapi.Runtime.Api_error { 8487 operation = op_name; 8488 method_ = "DELETE"; 8489 url; 8490 status = Requests.Response.status_code response; 8491 body; 8492 parsed_body; 8493 }) 8494 8495 (** Update instance banner *) 8496 let post_api_v1_config_instance_banner_pick client () = 8497 let op_name = "post_api_v1_config_instance_banner_pick" in 8498 let url_path = "/api/v1/config/instance-banner/pick" in 8499 let query = "" in 8500 let url = client.base_url ^ url_path ^ query in 8501 let response = 8502 try Requests.post client.session url 8503 with Eio.Io _ as ex -> 8504 let bt = Printexc.get_raw_backtrace () in 8505 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8506 in 8507 if Requests.Response.ok response then 8508 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8509 else 8510 let body = Requests.Response.text response in 8511 let parsed_body = 8512 match Json.of_string Json.Codec.Value.t body with 8513 | Ok json -> Some (Openapi.Runtime.Json json) 8514 | Error _ -> Some (Openapi.Runtime.Raw body) 8515 in 8516 raise (Openapi.Runtime.Api_error { 8517 operation = op_name; 8518 method_ = "POST"; 8519 url; 8520 status = Requests.Response.status_code response; 8521 body; 8522 parsed_body; 8523 }) 8524 8525 (** Delete instance logo *) 8526 let delete_api_v1_config_instance_logo_logo_type ~logo_type client () = 8527 let op_name = "delete_api_v1_config_instance_logo_logo_type" in 8528 let url_path = Openapi.Runtime.Path.render ~params:[("logoType", logo_type)] "/api/v1/config/instance-logo/:logoType" in 8529 let query = "" in 8530 let url = client.base_url ^ url_path ^ query in 8531 let response = 8532 try Requests.delete client.session url 8533 with Eio.Io _ as ex -> 8534 let bt = Printexc.get_raw_backtrace () in 8535 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 8536 in 8537 if Requests.Response.ok response then 8538 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8539 else 8540 let body = Requests.Response.text response in 8541 let parsed_body = 8542 match Json.of_string Json.Codec.Value.t body with 8543 | Ok json -> Some (Openapi.Runtime.Json json) 8544 | Error _ -> Some (Openapi.Runtime.Raw body) 8545 in 8546 raise (Openapi.Runtime.Api_error { 8547 operation = op_name; 8548 method_ = "DELETE"; 8549 url; 8550 status = Requests.Response.status_code response; 8551 body; 8552 parsed_body; 8553 }) 8554 8555 (** Update instance logo *) 8556 let post_api_v1_config_instance_logo_logo_type_pick ~logo_type client () = 8557 let op_name = "post_api_v1_config_instance_logo_logo_type_pick" in 8558 let url_path = Openapi.Runtime.Path.render ~params:[("logoType", logo_type)] "/api/v1/config/instance-logo/:logoType/pick" in 8559 let query = "" in 8560 let url = client.base_url ^ url_path ^ query in 8561 let response = 8562 try Requests.post client.session url 8563 with Eio.Io _ as ex -> 8564 let bt = Printexc.get_raw_backtrace () in 8565 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8566 in 8567 if Requests.Response.ok response then 8568 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8569 else 8570 let body = Requests.Response.text response in 8571 let parsed_body = 8572 match Json.of_string Json.Codec.Value.t body with 8573 | Ok json -> Some (Openapi.Runtime.Json json) 8574 | Error _ -> Some (Openapi.Runtime.Raw body) 8575 in 8576 raise (Openapi.Runtime.Api_error { 8577 operation = op_name; 8578 method_ = "POST"; 8579 url; 8580 status = Requests.Response.status_code response; 8581 body; 8582 parsed_body; 8583 }) 8584 8585 (** Set instance custom homepage *) 8586 let put_api_v1_custom_pages_homepage_instance client () = 8587 let op_name = "put_api_v1_custom_pages_homepage_instance" in 8588 let url_path = "/api/v1/custom-pages/homepage/instance" in 8589 let query = "" in 8590 let url = client.base_url ^ url_path ^ query in 8591 let response = 8592 try Requests.put client.session url 8593 with Eio.Io _ as ex -> 8594 let bt = Printexc.get_raw_backtrace () in 8595 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 8596 in 8597 if Requests.Response.ok response then 8598 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8599 else 8600 let body = Requests.Response.text response in 8601 let parsed_body = 8602 match Json.of_string Json.Codec.Value.t body with 8603 | Ok json -> Some (Openapi.Runtime.Json json) 8604 | Error _ -> Some (Openapi.Runtime.Raw body) 8605 in 8606 raise (Openapi.Runtime.Api_error { 8607 operation = op_name; 8608 method_ = "PUT"; 8609 url; 8610 status = Requests.Response.status_code response; 8611 body; 8612 parsed_body; 8613 }) 8614 8615 (** Pause job queue *) 8616 let post_api_v1_jobs_pause client () = 8617 let op_name = "post_api_v1_jobs_pause" in 8618 let url_path = "/api/v1/jobs/pause" in 8619 let query = "" in 8620 let url = client.base_url ^ url_path ^ query in 8621 let response = 8622 try Requests.post client.session url 8623 with Eio.Io _ as ex -> 8624 let bt = Printexc.get_raw_backtrace () in 8625 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8626 in 8627 if Requests.Response.ok response then 8628 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8629 else 8630 let body = Requests.Response.text response in 8631 let parsed_body = 8632 match Json.of_string Json.Codec.Value.t body with 8633 | Ok json -> Some (Openapi.Runtime.Json json) 8634 | Error _ -> Some (Openapi.Runtime.Raw body) 8635 in 8636 raise (Openapi.Runtime.Api_error { 8637 operation = op_name; 8638 method_ = "POST"; 8639 url; 8640 status = Requests.Response.status_code response; 8641 body; 8642 parsed_body; 8643 }) 8644 8645 (** Resume job queue *) 8646 let post_api_v1_jobs_resume client () = 8647 let op_name = "post_api_v1_jobs_resume" in 8648 let url_path = "/api/v1/jobs/resume" in 8649 let query = "" in 8650 let url = client.base_url ^ url_path ^ query in 8651 let response = 8652 try Requests.post client.session url 8653 with Eio.Io _ as ex -> 8654 let bt = Printexc.get_raw_backtrace () in 8655 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8656 in 8657 if Requests.Response.ok response then 8658 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8659 else 8660 let body = Requests.Response.text response in 8661 let parsed_body = 8662 match Json.of_string Json.Codec.Value.t body with 8663 | Ok json -> Some (Openapi.Runtime.Json json) 8664 | Error _ -> Some (Openapi.Runtime.Raw body) 8665 in 8666 raise (Openapi.Runtime.Api_error { 8667 operation = op_name; 8668 method_ = "POST"; 8669 url; 8670 status = Requests.Response.status_code response; 8671 body; 8672 parsed_body; 8673 }) 8674 8675 (** List instance jobs 8676 @param state The state of the job ('' for for no filter) 8677 @param job_type job type 8678 @param start Offset used to paginate results 8679 @param count Number of items to return 8680 @param sort Sort column 8681 *) 8682 let get_jobs ~state ?job_type ?start ?count ?sort client () = 8683 let op_name = "get_jobs" in 8684 let url_path = Openapi.Runtime.Path.render ~params:[("state", state)] "/api/v1/jobs/{state}" in 8685 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"jobType" ~value:job_type; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 8686 let url = client.base_url ^ url_path ^ query in 8687 let response = 8688 try Requests.get client.session url 8689 with Eio.Io _ as ex -> 8690 let bt = Printexc.get_raw_backtrace () in 8691 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8692 in 8693 if Requests.Response.ok response then 8694 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8695 else 8696 let body = Requests.Response.text response in 8697 let parsed_body = 8698 match Json.of_string Json.Codec.Value.t body with 8699 | Ok json -> Some (Openapi.Runtime.Json json) 8700 | Error _ -> Some (Openapi.Runtime.Raw body) 8701 in 8702 raise (Openapi.Runtime.Api_error { 8703 operation = op_name; 8704 method_ = "GET"; 8705 url; 8706 status = Requests.Response.status_code response; 8707 body; 8708 parsed_body; 8709 }) 8710 8711 (** Create playback metrics 8712 8713 These metrics are exposed by OpenTelemetry metrics exporter if enabled. *) 8714 let post_api_v1_metrics_playback ~body client () = 8715 let op_name = "post_api_v1_metrics_playback" in 8716 let url_path = "/api/v1/metrics/playback" in 8717 let query = "" in 8718 let url = client.base_url ^ url_path ^ query in 8719 let response = 8720 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string PlaybackMetric.Create.jsont body)) url 8721 with Eio.Io _ as ex -> 8722 let bt = Printexc.get_raw_backtrace () in 8723 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8724 in 8725 if Requests.Response.ok response then 8726 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8727 else 8728 let body = Requests.Response.text response in 8729 let parsed_body = 8730 match Json.of_string Json.Codec.Value.t body with 8731 | Ok json -> Some (Openapi.Runtime.Json json) 8732 | Error _ -> Some (Openapi.Runtime.Raw body) 8733 in 8734 raise (Openapi.Runtime.Api_error { 8735 operation = op_name; 8736 method_ = "POST"; 8737 url; 8738 status = Requests.Response.status_code response; 8739 body; 8740 parsed_body; 8741 }) 8742 8743 (** Install a plugin *) 8744 let add_plugin client () = 8745 let op_name = "add_plugin" in 8746 let url_path = "/api/v1/plugins/install" in 8747 let query = "" in 8748 let url = client.base_url ^ url_path ^ query in 8749 let response = 8750 try Requests.post client.session url 8751 with Eio.Io _ as ex -> 8752 let bt = Printexc.get_raw_backtrace () in 8753 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8754 in 8755 if Requests.Response.ok response then 8756 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8757 else 8758 let body = Requests.Response.text response in 8759 let parsed_body = 8760 match Json.of_string Json.Codec.Value.t body with 8761 | Ok json -> Some (Openapi.Runtime.Json json) 8762 | Error _ -> Some (Openapi.Runtime.Raw body) 8763 in 8764 raise (Openapi.Runtime.Api_error { 8765 operation = op_name; 8766 method_ = "POST"; 8767 url; 8768 status = Requests.Response.status_code response; 8769 body; 8770 parsed_body; 8771 }) 8772 8773 (** Uninstall a plugin *) 8774 let uninstall_plugin client () = 8775 let op_name = "uninstall_plugin" in 8776 let url_path = "/api/v1/plugins/uninstall" in 8777 let query = "" in 8778 let url = client.base_url ^ url_path ^ query in 8779 let response = 8780 try Requests.post client.session url 8781 with Eio.Io _ as ex -> 8782 let bt = Printexc.get_raw_backtrace () in 8783 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8784 in 8785 if Requests.Response.ok response then 8786 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8787 else 8788 let body = Requests.Response.text response in 8789 let parsed_body = 8790 match Json.of_string Json.Codec.Value.t body with 8791 | Ok json -> Some (Openapi.Runtime.Json json) 8792 | Error _ -> Some (Openapi.Runtime.Raw body) 8793 in 8794 raise (Openapi.Runtime.Api_error { 8795 operation = op_name; 8796 method_ = "POST"; 8797 url; 8798 status = Requests.Response.status_code response; 8799 body; 8800 parsed_body; 8801 }) 8802 8803 (** Update a plugin *) 8804 let update_plugin client () = 8805 let op_name = "update_plugin" in 8806 let url_path = "/api/v1/plugins/update" in 8807 let query = "" in 8808 let url = client.base_url ^ url_path ^ query in 8809 let response = 8810 try Requests.post client.session url 8811 with Eio.Io _ as ex -> 8812 let bt = Printexc.get_raw_backtrace () in 8813 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 8814 in 8815 if Requests.Response.ok response then 8816 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8817 else 8818 let body = Requests.Response.text response in 8819 let parsed_body = 8820 match Json.of_string Json.Codec.Value.t body with 8821 | Ok json -> Some (Openapi.Runtime.Json json) 8822 | Error _ -> Some (Openapi.Runtime.Raw body) 8823 in 8824 raise (Openapi.Runtime.Api_error { 8825 operation = op_name; 8826 method_ = "POST"; 8827 url; 8828 status = Requests.Response.status_code response; 8829 body; 8830 parsed_body; 8831 }) 8832 8833 (** Get a plugin's public settings 8834 @param npm_name name of the plugin/theme on npmjs.com or in its package.json 8835 *) 8836 let get_api_v1_plugins_public_settings ~npm_name client () = 8837 let op_name = "get_api_v1_plugins_public_settings" in 8838 let url_path = Openapi.Runtime.Path.render ~params:[("npmName", npm_name)] "/api/v1/plugins/{npmName}/public-settings" in 8839 let query = "" in 8840 let url = client.base_url ^ url_path ^ query in 8841 let response = 8842 try Requests.get client.session url 8843 with Eio.Io _ as ex -> 8844 let bt = Printexc.get_raw_backtrace () in 8845 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8846 in 8847 if Requests.Response.ok response then 8848 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8849 else 8850 let body = Requests.Response.text response in 8851 let parsed_body = 8852 match Json.of_string Json.Codec.Value.t body with 8853 | Ok json -> Some (Openapi.Runtime.Json json) 8854 | Error _ -> Some (Openapi.Runtime.Raw body) 8855 in 8856 raise (Openapi.Runtime.Api_error { 8857 operation = op_name; 8858 method_ = "GET"; 8859 url; 8860 status = Requests.Response.status_code response; 8861 body; 8862 parsed_body; 8863 }) 8864 8865 (** Get a plugin's registered settings 8866 @param npm_name name of the plugin/theme on npmjs.com or in its package.json 8867 *) 8868 let get_api_v1_plugins_registered_settings ~npm_name client () = 8869 let op_name = "get_api_v1_plugins_registered_settings" in 8870 let url_path = Openapi.Runtime.Path.render ~params:[("npmName", npm_name)] "/api/v1/plugins/{npmName}/registered-settings" in 8871 let query = "" in 8872 let url = client.base_url ^ url_path ^ query in 8873 let response = 8874 try Requests.get client.session url 8875 with Eio.Io _ as ex -> 8876 let bt = Printexc.get_raw_backtrace () in 8877 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8878 in 8879 if Requests.Response.ok response then 8880 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8881 else 8882 let body = Requests.Response.text response in 8883 let parsed_body = 8884 match Json.of_string Json.Codec.Value.t body with 8885 | Ok json -> Some (Openapi.Runtime.Json json) 8886 | Error _ -> Some (Openapi.Runtime.Raw body) 8887 in 8888 raise (Openapi.Runtime.Api_error { 8889 operation = op_name; 8890 method_ = "GET"; 8891 url; 8892 status = Requests.Response.status_code response; 8893 body; 8894 parsed_body; 8895 }) 8896 8897 (** Set a plugin's settings 8898 @param npm_name name of the plugin/theme on npmjs.com or in its package.json 8899 *) 8900 let put_api_v1_plugins_settings ~npm_name client () = 8901 let op_name = "put_api_v1_plugins_settings" in 8902 let url_path = Openapi.Runtime.Path.render ~params:[("npmName", npm_name)] "/api/v1/plugins/{npmName}/settings" in 8903 let query = "" in 8904 let url = client.base_url ^ url_path ^ query in 8905 let response = 8906 try Requests.put client.session url 8907 with Eio.Io _ as ex -> 8908 let bt = Printexc.get_raw_backtrace () in 8909 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 8910 in 8911 if Requests.Response.ok response then 8912 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8913 else 8914 let body = Requests.Response.text response in 8915 let parsed_body = 8916 match Json.of_string Json.Codec.Value.t body with 8917 | Ok json -> Some (Openapi.Runtime.Json json) 8918 | Error _ -> Some (Openapi.Runtime.Raw body) 8919 in 8920 raise (Openapi.Runtime.Api_error { 8921 operation = op_name; 8922 method_ = "PUT"; 8923 url; 8924 status = Requests.Response.status_code response; 8925 body; 8926 parsed_body; 8927 }) 8928 8929 (** List runners 8930 @param start Offset used to paginate results 8931 @param count Number of items to return 8932 @param sort Sort runners by criteria 8933 *) 8934 let get_api_v1_runners ?start ?count ?sort client () = 8935 let op_name = "get_api_v1_runners" in 8936 let url_path = "/api/v1/runners" in 8937 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 8938 let url = client.base_url ^ url_path ^ query in 8939 let response = 8940 try Requests.get client.session url 8941 with Eio.Io _ as ex -> 8942 let bt = Printexc.get_raw_backtrace () in 8943 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8944 in 8945 if Requests.Response.ok response then 8946 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8947 else 8948 let body = Requests.Response.text response in 8949 let parsed_body = 8950 match Json.of_string Json.Codec.Value.t body with 8951 | Ok json -> Some (Openapi.Runtime.Json json) 8952 | Error _ -> Some (Openapi.Runtime.Raw body) 8953 in 8954 raise (Openapi.Runtime.Api_error { 8955 operation = op_name; 8956 method_ = "GET"; 8957 url; 8958 status = Requests.Response.status_code response; 8959 body; 8960 parsed_body; 8961 }) 8962 8963 (** List jobs 8964 @param start Offset used to paginate results 8965 @param count Number of items to return 8966 @param sort Sort runner jobs by criteria 8967 @param search Plain text search, applied to various parts of the model depending on endpoint 8968 *) 8969 let get_api_v1_runners_jobs ?start ?count ?sort ?search ?state_one_of client () = 8970 let op_name = "get_api_v1_runners_jobs" in 8971 let url_path = "/api/v1/runners/jobs" in 8972 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"stateOneOf" ~value:state_one_of]) in 8973 let url = client.base_url ^ url_path ^ query in 8974 let response = 8975 try Requests.get client.session url 8976 with Eio.Io _ as ex -> 8977 let bt = Printexc.get_raw_backtrace () in 8978 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 8979 in 8980 if Requests.Response.ok response then 8981 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 8982 else 8983 let body = Requests.Response.text response in 8984 let parsed_body = 8985 match Json.of_string Json.Codec.Value.t body with 8986 | Ok json -> Some (Openapi.Runtime.Json json) 8987 | Error _ -> Some (Openapi.Runtime.Raw body) 8988 in 8989 raise (Openapi.Runtime.Api_error { 8990 operation = op_name; 8991 method_ = "GET"; 8992 url; 8993 status = Requests.Response.status_code response; 8994 body; 8995 parsed_body; 8996 }) 8997 8998 (** Request a new job 8999 9000 API used by PeerTube runners *) 9001 let post_api_v1_runners_jobs_request client () = 9002 let op_name = "post_api_v1_runners_jobs_request" in 9003 let url_path = "/api/v1/runners/jobs/request" in 9004 let query = "" in 9005 let url = client.base_url ^ url_path ^ query in 9006 let response = 9007 try Requests.post client.session url 9008 with Eio.Io _ as ex -> 9009 let bt = Printexc.get_raw_backtrace () in 9010 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9011 in 9012 if Requests.Response.ok response then 9013 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9014 else 9015 let body = Requests.Response.text response in 9016 let parsed_body = 9017 match Json.of_string Json.Codec.Value.t body with 9018 | Ok json -> Some (Openapi.Runtime.Json json) 9019 | Error _ -> Some (Openapi.Runtime.Raw body) 9020 in 9021 raise (Openapi.Runtime.Api_error { 9022 operation = op_name; 9023 method_ = "POST"; 9024 url; 9025 status = Requests.Response.status_code response; 9026 body; 9027 parsed_body; 9028 }) 9029 9030 (** Delete a job 9031 9032 The endpoint will first cancel the job if needed, and then remove it from the database. Children jobs will also be removed *) 9033 let delete_api_v1_runners_jobs ~job_uuid client () = 9034 let op_name = "delete_api_v1_runners_jobs" in 9035 let url_path = Openapi.Runtime.Path.render ~params:[("jobUUID", job_uuid)] "/api/v1/runners/jobs/{jobUUID}" in 9036 let query = "" in 9037 let url = client.base_url ^ url_path ^ query in 9038 let response = 9039 try Requests.delete client.session url 9040 with Eio.Io _ as ex -> 9041 let bt = Printexc.get_raw_backtrace () in 9042 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 9043 in 9044 if Requests.Response.ok response then 9045 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9046 else 9047 let body = Requests.Response.text response in 9048 let parsed_body = 9049 match Json.of_string Json.Codec.Value.t body with 9050 | Ok json -> Some (Openapi.Runtime.Json json) 9051 | Error _ -> Some (Openapi.Runtime.Raw body) 9052 in 9053 raise (Openapi.Runtime.Api_error { 9054 operation = op_name; 9055 method_ = "DELETE"; 9056 url; 9057 status = Requests.Response.status_code response; 9058 body; 9059 parsed_body; 9060 }) 9061 9062 (** Abort job 9063 9064 API used by PeerTube runners *) 9065 let post_api_v1_runners_jobs_abort ~job_uuid client () = 9066 let op_name = "post_api_v1_runners_jobs_abort" in 9067 let url_path = Openapi.Runtime.Path.render ~params:[("jobUUID", job_uuid)] "/api/v1/runners/jobs/{jobUUID}/abort" in 9068 let query = "" in 9069 let url = client.base_url ^ url_path ^ query in 9070 let response = 9071 try Requests.post client.session url 9072 with Eio.Io _ as ex -> 9073 let bt = Printexc.get_raw_backtrace () in 9074 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9075 in 9076 if Requests.Response.ok response then 9077 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9078 else 9079 let body = Requests.Response.text response in 9080 let parsed_body = 9081 match Json.of_string Json.Codec.Value.t body with 9082 | Ok json -> Some (Openapi.Runtime.Json json) 9083 | Error _ -> Some (Openapi.Runtime.Raw body) 9084 in 9085 raise (Openapi.Runtime.Api_error { 9086 operation = op_name; 9087 method_ = "POST"; 9088 url; 9089 status = Requests.Response.status_code response; 9090 body; 9091 parsed_body; 9092 }) 9093 9094 (** Accept job 9095 9096 API used by PeerTube runners *) 9097 let post_api_v1_runners_jobs_accept ~job_uuid client () = 9098 let op_name = "post_api_v1_runners_jobs_accept" in 9099 let url_path = Openapi.Runtime.Path.render ~params:[("jobUUID", job_uuid)] "/api/v1/runners/jobs/{jobUUID}/accept" in 9100 let query = "" in 9101 let url = client.base_url ^ url_path ^ query in 9102 let response = 9103 try Requests.post client.session url 9104 with Eio.Io _ as ex -> 9105 let bt = Printexc.get_raw_backtrace () in 9106 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9107 in 9108 if Requests.Response.ok response then 9109 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9110 else 9111 let body = Requests.Response.text response in 9112 let parsed_body = 9113 match Json.of_string Json.Codec.Value.t body with 9114 | Ok json -> Some (Openapi.Runtime.Json json) 9115 | Error _ -> Some (Openapi.Runtime.Raw body) 9116 in 9117 raise (Openapi.Runtime.Api_error { 9118 operation = op_name; 9119 method_ = "POST"; 9120 url; 9121 status = Requests.Response.status_code response; 9122 body; 9123 parsed_body; 9124 }) 9125 9126 (** Cancel a job *) 9127 let get_api_v1_runners_jobs_cancel ~job_uuid client () = 9128 let op_name = "get_api_v1_runners_jobs_cancel" in 9129 let url_path = Openapi.Runtime.Path.render ~params:[("jobUUID", job_uuid)] "/api/v1/runners/jobs/{jobUUID}/cancel" in 9130 let query = "" in 9131 let url = client.base_url ^ url_path ^ query in 9132 let response = 9133 try Requests.get client.session url 9134 with Eio.Io _ as ex -> 9135 let bt = Printexc.get_raw_backtrace () in 9136 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9137 in 9138 if Requests.Response.ok response then 9139 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9140 else 9141 let body = Requests.Response.text response in 9142 let parsed_body = 9143 match Json.of_string Json.Codec.Value.t body with 9144 | Ok json -> Some (Openapi.Runtime.Json json) 9145 | Error _ -> Some (Openapi.Runtime.Raw body) 9146 in 9147 raise (Openapi.Runtime.Api_error { 9148 operation = op_name; 9149 method_ = "GET"; 9150 url; 9151 status = Requests.Response.status_code response; 9152 body; 9153 parsed_body; 9154 }) 9155 9156 (** Post job error 9157 9158 API used by PeerTube runners *) 9159 let post_api_v1_runners_jobs_error ~job_uuid client () = 9160 let op_name = "post_api_v1_runners_jobs_error" in 9161 let url_path = Openapi.Runtime.Path.render ~params:[("jobUUID", job_uuid)] "/api/v1/runners/jobs/{jobUUID}/error" in 9162 let query = "" in 9163 let url = client.base_url ^ url_path ^ query in 9164 let response = 9165 try Requests.post client.session url 9166 with Eio.Io _ as ex -> 9167 let bt = Printexc.get_raw_backtrace () in 9168 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9169 in 9170 if Requests.Response.ok response then 9171 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9172 else 9173 let body = Requests.Response.text response in 9174 let parsed_body = 9175 match Json.of_string Json.Codec.Value.t body with 9176 | Ok json -> Some (Openapi.Runtime.Json json) 9177 | Error _ -> Some (Openapi.Runtime.Raw body) 9178 in 9179 raise (Openapi.Runtime.Api_error { 9180 operation = op_name; 9181 method_ = "POST"; 9182 url; 9183 status = Requests.Response.status_code response; 9184 body; 9185 parsed_body; 9186 }) 9187 9188 (** Post job success 9189 9190 API used by PeerTube runners *) 9191 let post_api_v1_runners_jobs_success ~job_uuid client () = 9192 let op_name = "post_api_v1_runners_jobs_success" in 9193 let url_path = Openapi.Runtime.Path.render ~params:[("jobUUID", job_uuid)] "/api/v1/runners/jobs/{jobUUID}/success" in 9194 let query = "" in 9195 let url = client.base_url ^ url_path ^ query in 9196 let response = 9197 try Requests.post client.session url 9198 with Eio.Io _ as ex -> 9199 let bt = Printexc.get_raw_backtrace () in 9200 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9201 in 9202 if Requests.Response.ok response then 9203 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9204 else 9205 let body = Requests.Response.text response in 9206 let parsed_body = 9207 match Json.of_string Json.Codec.Value.t body with 9208 | Ok json -> Some (Openapi.Runtime.Json json) 9209 | Error _ -> Some (Openapi.Runtime.Raw body) 9210 in 9211 raise (Openapi.Runtime.Api_error { 9212 operation = op_name; 9213 method_ = "POST"; 9214 url; 9215 status = Requests.Response.status_code response; 9216 body; 9217 parsed_body; 9218 }) 9219 9220 (** Update job 9221 9222 API used by PeerTube runners *) 9223 let post_api_v1_runners_jobs_update ~job_uuid client () = 9224 let op_name = "post_api_v1_runners_jobs_update" in 9225 let url_path = Openapi.Runtime.Path.render ~params:[("jobUUID", job_uuid)] "/api/v1/runners/jobs/{jobUUID}/update" in 9226 let query = "" in 9227 let url = client.base_url ^ url_path ^ query in 9228 let response = 9229 try Requests.post client.session url 9230 with Eio.Io _ as ex -> 9231 let bt = Printexc.get_raw_backtrace () in 9232 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9233 in 9234 if Requests.Response.ok response then 9235 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9236 else 9237 let body = Requests.Response.text response in 9238 let parsed_body = 9239 match Json.of_string Json.Codec.Value.t body with 9240 | Ok json -> Some (Openapi.Runtime.Json json) 9241 | Error _ -> Some (Openapi.Runtime.Raw body) 9242 in 9243 raise (Openapi.Runtime.Api_error { 9244 operation = op_name; 9245 method_ = "POST"; 9246 url; 9247 status = Requests.Response.status_code response; 9248 body; 9249 parsed_body; 9250 }) 9251 9252 (** Register a new runner 9253 9254 API used by PeerTube runners *) 9255 let post_api_v1_runners_register client () = 9256 let op_name = "post_api_v1_runners_register" in 9257 let url_path = "/api/v1/runners/register" in 9258 let query = "" in 9259 let url = client.base_url ^ url_path ^ query in 9260 let response = 9261 try Requests.post client.session url 9262 with Eio.Io _ as ex -> 9263 let bt = Printexc.get_raw_backtrace () in 9264 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9265 in 9266 if Requests.Response.ok response then 9267 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9268 else 9269 let body = Requests.Response.text response in 9270 let parsed_body = 9271 match Json.of_string Json.Codec.Value.t body with 9272 | Ok json -> Some (Openapi.Runtime.Json json) 9273 | Error _ -> Some (Openapi.Runtime.Raw body) 9274 in 9275 raise (Openapi.Runtime.Api_error { 9276 operation = op_name; 9277 method_ = "POST"; 9278 url; 9279 status = Requests.Response.status_code response; 9280 body; 9281 parsed_body; 9282 }) 9283 9284 (** List registration tokens 9285 @param start Offset used to paginate results 9286 @param count Number of items to return 9287 @param sort Sort registration tokens by criteria 9288 *) 9289 let get_api_v1_runners_registration_tokens ?start ?count ?sort client () = 9290 let op_name = "get_api_v1_runners_registration_tokens" in 9291 let url_path = "/api/v1/runners/registration-tokens" in 9292 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 9293 let url = client.base_url ^ url_path ^ query in 9294 let response = 9295 try Requests.get client.session url 9296 with Eio.Io _ as ex -> 9297 let bt = Printexc.get_raw_backtrace () in 9298 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9299 in 9300 if Requests.Response.ok response then 9301 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9302 else 9303 let body = Requests.Response.text response in 9304 let parsed_body = 9305 match Json.of_string Json.Codec.Value.t body with 9306 | Ok json -> Some (Openapi.Runtime.Json json) 9307 | Error _ -> Some (Openapi.Runtime.Raw body) 9308 in 9309 raise (Openapi.Runtime.Api_error { 9310 operation = op_name; 9311 method_ = "GET"; 9312 url; 9313 status = Requests.Response.status_code response; 9314 body; 9315 parsed_body; 9316 }) 9317 9318 (** Generate registration token 9319 9320 Generate a new runner registration token *) 9321 let post_api_v1_runners_registration_tokens_generate client () = 9322 let op_name = "post_api_v1_runners_registration_tokens_generate" in 9323 let url_path = "/api/v1/runners/registration-tokens/generate" in 9324 let query = "" in 9325 let url = client.base_url ^ url_path ^ query in 9326 let response = 9327 try Requests.post client.session url 9328 with Eio.Io _ as ex -> 9329 let bt = Printexc.get_raw_backtrace () in 9330 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9331 in 9332 if Requests.Response.ok response then 9333 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9334 else 9335 let body = Requests.Response.text response in 9336 let parsed_body = 9337 match Json.of_string Json.Codec.Value.t body with 9338 | Ok json -> Some (Openapi.Runtime.Json json) 9339 | Error _ -> Some (Openapi.Runtime.Raw body) 9340 in 9341 raise (Openapi.Runtime.Api_error { 9342 operation = op_name; 9343 method_ = "POST"; 9344 url; 9345 status = Requests.Response.status_code response; 9346 body; 9347 parsed_body; 9348 }) 9349 9350 (** Remove registration token 9351 9352 Remove a registration token. Runners that used this token for their registration are automatically removed. *) 9353 let delete_api_v1_runners_registration_tokens ~registration_token_id client () = 9354 let op_name = "delete_api_v1_runners_registration_tokens" in 9355 let url_path = Openapi.Runtime.Path.render ~params:[("registrationTokenId", registration_token_id)] "/api/v1/runners/registration-tokens/{registrationTokenId}" in 9356 let query = "" in 9357 let url = client.base_url ^ url_path ^ query in 9358 let response = 9359 try Requests.delete client.session url 9360 with Eio.Io _ as ex -> 9361 let bt = Printexc.get_raw_backtrace () in 9362 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 9363 in 9364 if Requests.Response.ok response then 9365 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9366 else 9367 let body = Requests.Response.text response in 9368 let parsed_body = 9369 match Json.of_string Json.Codec.Value.t body with 9370 | Ok json -> Some (Openapi.Runtime.Json json) 9371 | Error _ -> Some (Openapi.Runtime.Raw body) 9372 in 9373 raise (Openapi.Runtime.Api_error { 9374 operation = op_name; 9375 method_ = "DELETE"; 9376 url; 9377 status = Requests.Response.status_code response; 9378 body; 9379 parsed_body; 9380 }) 9381 9382 (** Unregister a runner 9383 9384 API used by PeerTube runners *) 9385 let post_api_v1_runners_unregister client () = 9386 let op_name = "post_api_v1_runners_unregister" in 9387 let url_path = "/api/v1/runners/unregister" in 9388 let query = "" in 9389 let url = client.base_url ^ url_path ^ query in 9390 let response = 9391 try Requests.post client.session url 9392 with Eio.Io _ as ex -> 9393 let bt = Printexc.get_raw_backtrace () in 9394 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9395 in 9396 if Requests.Response.ok response then 9397 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9398 else 9399 let body = Requests.Response.text response in 9400 let parsed_body = 9401 match Json.of_string Json.Codec.Value.t body with 9402 | Ok json -> Some (Openapi.Runtime.Json json) 9403 | Error _ -> Some (Openapi.Runtime.Raw body) 9404 in 9405 raise (Openapi.Runtime.Api_error { 9406 operation = op_name; 9407 method_ = "POST"; 9408 url; 9409 status = Requests.Response.status_code response; 9410 body; 9411 parsed_body; 9412 }) 9413 9414 (** Delete a runner *) 9415 let delete_api_v1_runners ~runner_id client () = 9416 let op_name = "delete_api_v1_runners" in 9417 let url_path = Openapi.Runtime.Path.render ~params:[("runnerId", runner_id)] "/api/v1/runners/{runnerId}" in 9418 let query = "" in 9419 let url = client.base_url ^ url_path ^ query in 9420 let response = 9421 try Requests.delete client.session url 9422 with Eio.Io _ as ex -> 9423 let bt = Printexc.get_raw_backtrace () in 9424 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 9425 in 9426 if Requests.Response.ok response then 9427 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9428 else 9429 let body = Requests.Response.text response in 9430 let parsed_body = 9431 match Json.of_string Json.Codec.Value.t body with 9432 | Ok json -> Some (Openapi.Runtime.Json json) 9433 | Error _ -> Some (Openapi.Runtime.Raw body) 9434 in 9435 raise (Openapi.Runtime.Api_error { 9436 operation = op_name; 9437 method_ = "DELETE"; 9438 url; 9439 status = Requests.Response.status_code response; 9440 body; 9441 parsed_body; 9442 }) 9443 9444 (** Search playlists 9445 @param search String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete playlist information and interact with it. 9446 9447 @param start Offset used to paginate results 9448 @param count Number of items to return 9449 @param search_target If the administrator enabled search index support, you can override the default search target. 9450 9451 **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: 9452 * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), 9453 then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. 9454 After that, you can use the classic REST API endpoints to fetch the complete object or interact with it 9455 * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch 9456 the data from the origin instance API 9457 9458 @param sort Sort column 9459 @param host Find elements owned by this host 9460 @param uuids Find elements with specific UUIDs 9461 *) 9462 let search_playlists ~search ?start ?count ?search_target ?sort ?host ?uuids client () = 9463 let op_name = "search_playlists" in 9464 let url_path = "/api/v1/search/video-playlists" in 9465 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"searchTarget" ~value:search_target; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"uuids" ~value:uuids]) in 9466 let url = client.base_url ^ url_path ^ query in 9467 let response = 9468 try Requests.get client.session url 9469 with Eio.Io _ as ex -> 9470 let bt = Printexc.get_raw_backtrace () in 9471 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9472 in 9473 if Requests.Response.ok response then 9474 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9475 else 9476 let body = Requests.Response.text response in 9477 let parsed_body = 9478 match Json.of_string Json.Codec.Value.t body with 9479 | Ok json -> Some (Openapi.Runtime.Json json) 9480 | Error _ -> Some (Openapi.Runtime.Raw body) 9481 in 9482 raise (Openapi.Runtime.Api_error { 9483 operation = op_name; 9484 method_ = "GET"; 9485 url; 9486 status = Requests.Response.status_code response; 9487 body; 9488 parsed_body; 9489 }) 9490 9491 (** Get instance audit logs *) 9492 let get_instance_audit_logs client () = 9493 let op_name = "get_instance_audit_logs" in 9494 let url_path = "/api/v1/server/audit-logs" in 9495 let query = "" in 9496 let url = client.base_url ^ url_path ^ query in 9497 let response = 9498 try Requests.get client.session url 9499 with Eio.Io _ as ex -> 9500 let bt = Printexc.get_raw_backtrace () in 9501 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9502 in 9503 if Requests.Response.ok response then 9504 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9505 else 9506 let body = Requests.Response.text response in 9507 let parsed_body = 9508 match Json.of_string Json.Codec.Value.t body with 9509 | Ok json -> Some (Openapi.Runtime.Json json) 9510 | Error _ -> Some (Openapi.Runtime.Raw body) 9511 in 9512 raise (Openapi.Runtime.Api_error { 9513 operation = op_name; 9514 method_ = "GET"; 9515 url; 9516 status = Requests.Response.status_code response; 9517 body; 9518 parsed_body; 9519 }) 9520 9521 (** List account blocks 9522 @param start Offset used to paginate results 9523 @param count Number of items to return 9524 @param sort Sort column 9525 *) 9526 let get_api_v1_server_blocklist_accounts ?start ?count ?sort client () = 9527 let op_name = "get_api_v1_server_blocklist_accounts" in 9528 let url_path = "/api/v1/server/blocklist/accounts" in 9529 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 9530 let url = client.base_url ^ url_path ^ query in 9531 let response = 9532 try Requests.get client.session url 9533 with Eio.Io _ as ex -> 9534 let bt = Printexc.get_raw_backtrace () in 9535 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9536 in 9537 if Requests.Response.ok response then 9538 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9539 else 9540 let body = Requests.Response.text response in 9541 let parsed_body = 9542 match Json.of_string Json.Codec.Value.t body with 9543 | Ok json -> Some (Openapi.Runtime.Json json) 9544 | Error _ -> Some (Openapi.Runtime.Raw body) 9545 in 9546 raise (Openapi.Runtime.Api_error { 9547 operation = op_name; 9548 method_ = "GET"; 9549 url; 9550 status = Requests.Response.status_code response; 9551 body; 9552 parsed_body; 9553 }) 9554 9555 (** Block an account *) 9556 let post_api_v1_server_blocklist_accounts client () = 9557 let op_name = "post_api_v1_server_blocklist_accounts" in 9558 let url_path = "/api/v1/server/blocklist/accounts" in 9559 let query = "" in 9560 let url = client.base_url ^ url_path ^ query in 9561 let response = 9562 try Requests.post client.session url 9563 with Eio.Io _ as ex -> 9564 let bt = Printexc.get_raw_backtrace () in 9565 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9566 in 9567 if Requests.Response.ok response then 9568 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9569 else 9570 let body = Requests.Response.text response in 9571 let parsed_body = 9572 match Json.of_string Json.Codec.Value.t body with 9573 | Ok json -> Some (Openapi.Runtime.Json json) 9574 | Error _ -> Some (Openapi.Runtime.Raw body) 9575 in 9576 raise (Openapi.Runtime.Api_error { 9577 operation = op_name; 9578 method_ = "POST"; 9579 url; 9580 status = Requests.Response.status_code response; 9581 body; 9582 parsed_body; 9583 }) 9584 9585 (** Unblock an account by its handle 9586 @param account_name account to unblock, in the form `username@domain` 9587 *) 9588 let delete_api_v1_server_blocklist_accounts ~account_name client () = 9589 let op_name = "delete_api_v1_server_blocklist_accounts" in 9590 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name)] "/api/v1/server/blocklist/accounts/{accountName}" in 9591 let query = "" in 9592 let url = client.base_url ^ url_path ^ query in 9593 let response = 9594 try Requests.delete client.session url 9595 with Eio.Io _ as ex -> 9596 let bt = Printexc.get_raw_backtrace () in 9597 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 9598 in 9599 if Requests.Response.ok response then 9600 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9601 else 9602 let body = Requests.Response.text response in 9603 let parsed_body = 9604 match Json.of_string Json.Codec.Value.t body with 9605 | Ok json -> Some (Openapi.Runtime.Json json) 9606 | Error _ -> Some (Openapi.Runtime.Raw body) 9607 in 9608 raise (Openapi.Runtime.Api_error { 9609 operation = op_name; 9610 method_ = "DELETE"; 9611 url; 9612 status = Requests.Response.status_code response; 9613 body; 9614 parsed_body; 9615 }) 9616 9617 (** List server blocks 9618 @param start Offset used to paginate results 9619 @param count Number of items to return 9620 @param sort Sort column 9621 *) 9622 let get_api_v1_server_blocklist_servers ?start ?count ?sort client () = 9623 let op_name = "get_api_v1_server_blocklist_servers" in 9624 let url_path = "/api/v1/server/blocklist/servers" in 9625 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 9626 let url = client.base_url ^ url_path ^ query in 9627 let response = 9628 try Requests.get client.session url 9629 with Eio.Io _ as ex -> 9630 let bt = Printexc.get_raw_backtrace () in 9631 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9632 in 9633 if Requests.Response.ok response then 9634 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9635 else 9636 let body = Requests.Response.text response in 9637 let parsed_body = 9638 match Json.of_string Json.Codec.Value.t body with 9639 | Ok json -> Some (Openapi.Runtime.Json json) 9640 | Error _ -> Some (Openapi.Runtime.Raw body) 9641 in 9642 raise (Openapi.Runtime.Api_error { 9643 operation = op_name; 9644 method_ = "GET"; 9645 url; 9646 status = Requests.Response.status_code response; 9647 body; 9648 parsed_body; 9649 }) 9650 9651 (** Block a server *) 9652 let post_api_v1_server_blocklist_servers client () = 9653 let op_name = "post_api_v1_server_blocklist_servers" in 9654 let url_path = "/api/v1/server/blocklist/servers" in 9655 let query = "" in 9656 let url = client.base_url ^ url_path ^ query in 9657 let response = 9658 try Requests.post client.session url 9659 with Eio.Io _ as ex -> 9660 let bt = Printexc.get_raw_backtrace () in 9661 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9662 in 9663 if Requests.Response.ok response then 9664 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9665 else 9666 let body = Requests.Response.text response in 9667 let parsed_body = 9668 match Json.of_string Json.Codec.Value.t body with 9669 | Ok json -> Some (Openapi.Runtime.Json json) 9670 | Error _ -> Some (Openapi.Runtime.Raw body) 9671 in 9672 raise (Openapi.Runtime.Api_error { 9673 operation = op_name; 9674 method_ = "POST"; 9675 url; 9676 status = Requests.Response.status_code response; 9677 body; 9678 parsed_body; 9679 }) 9680 9681 (** Unblock a server by its domain 9682 @param host server domain to unblock 9683 *) 9684 let delete_api_v1_server_blocklist_servers ~host client () = 9685 let op_name = "delete_api_v1_server_blocklist_servers" in 9686 let url_path = Openapi.Runtime.Path.render ~params:[("host", host)] "/api/v1/server/blocklist/servers/{host}" in 9687 let query = "" in 9688 let url = client.base_url ^ url_path ^ query in 9689 let response = 9690 try Requests.delete client.session url 9691 with Eio.Io _ as ex -> 9692 let bt = Printexc.get_raw_backtrace () in 9693 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 9694 in 9695 if Requests.Response.ok response then 9696 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9697 else 9698 let body = Requests.Response.text response in 9699 let parsed_body = 9700 match Json.of_string Json.Codec.Value.t body with 9701 | Ok json -> Some (Openapi.Runtime.Json json) 9702 | Error _ -> Some (Openapi.Runtime.Raw body) 9703 in 9704 raise (Openapi.Runtime.Api_error { 9705 operation = op_name; 9706 method_ = "DELETE"; 9707 url; 9708 status = Requests.Response.status_code response; 9709 body; 9710 parsed_body; 9711 }) 9712 9713 (** List instances following the server 9714 @param start Offset used to paginate results 9715 @param count Number of items to return 9716 @param sort Sort column 9717 *) 9718 let get_api_v1_server_followers ?state ?actor_type ?start ?count ?sort client () = 9719 let op_name = "get_api_v1_server_followers" in 9720 let url_path = "/api/v1/server/followers" in 9721 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"state" ~value:state; Openapi.Runtime.Query.optional ~key:"actorType" ~value:actor_type; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 9722 let url = client.base_url ^ url_path ^ query in 9723 let response = 9724 try Requests.get client.session url 9725 with Eio.Io _ as ex -> 9726 let bt = Printexc.get_raw_backtrace () in 9727 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9728 in 9729 if Requests.Response.ok response then 9730 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9731 else 9732 let body = Requests.Response.text response in 9733 let parsed_body = 9734 match Json.of_string Json.Codec.Value.t body with 9735 | Ok json -> Some (Openapi.Runtime.Json json) 9736 | Error _ -> Some (Openapi.Runtime.Raw body) 9737 in 9738 raise (Openapi.Runtime.Api_error { 9739 operation = op_name; 9740 method_ = "GET"; 9741 url; 9742 status = Requests.Response.status_code response; 9743 body; 9744 parsed_body; 9745 }) 9746 9747 (** Remove or reject a follower to your server 9748 @param handle The remote actor handle to remove from your followers 9749 *) 9750 let delete_api_v1_server_followers ~handle client () = 9751 let op_name = "delete_api_v1_server_followers" in 9752 let url_path = Openapi.Runtime.Path.render ~params:[("handle", handle)] "/api/v1/server/followers/{handle}" in 9753 let query = "" in 9754 let url = client.base_url ^ url_path ^ query in 9755 let response = 9756 try Requests.delete client.session url 9757 with Eio.Io _ as ex -> 9758 let bt = Printexc.get_raw_backtrace () in 9759 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 9760 in 9761 if Requests.Response.ok response then 9762 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9763 else 9764 let body = Requests.Response.text response in 9765 let parsed_body = 9766 match Json.of_string Json.Codec.Value.t body with 9767 | Ok json -> Some (Openapi.Runtime.Json json) 9768 | Error _ -> Some (Openapi.Runtime.Raw body) 9769 in 9770 raise (Openapi.Runtime.Api_error { 9771 operation = op_name; 9772 method_ = "DELETE"; 9773 url; 9774 status = Requests.Response.status_code response; 9775 body; 9776 parsed_body; 9777 }) 9778 9779 (** Accept a pending follower to your server 9780 @param handle The remote actor handle to remove from your followers 9781 *) 9782 let post_api_v1_server_followers_accept ~handle client () = 9783 let op_name = "post_api_v1_server_followers_accept" in 9784 let url_path = Openapi.Runtime.Path.render ~params:[("handle", handle)] "/api/v1/server/followers/{handle}/accept" in 9785 let query = "" in 9786 let url = client.base_url ^ url_path ^ query in 9787 let response = 9788 try Requests.post client.session url 9789 with Eio.Io _ as ex -> 9790 let bt = Printexc.get_raw_backtrace () in 9791 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9792 in 9793 if Requests.Response.ok response then 9794 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9795 else 9796 let body = Requests.Response.text response in 9797 let parsed_body = 9798 match Json.of_string Json.Codec.Value.t body with 9799 | Ok json -> Some (Openapi.Runtime.Json json) 9800 | Error _ -> Some (Openapi.Runtime.Raw body) 9801 in 9802 raise (Openapi.Runtime.Api_error { 9803 operation = op_name; 9804 method_ = "POST"; 9805 url; 9806 status = Requests.Response.status_code response; 9807 body; 9808 parsed_body; 9809 }) 9810 9811 (** Reject a pending follower to your server 9812 @param handle The remote actor handle to remove from your followers 9813 *) 9814 let post_api_v1_server_followers_reject ~handle client () = 9815 let op_name = "post_api_v1_server_followers_reject" in 9816 let url_path = Openapi.Runtime.Path.render ~params:[("handle", handle)] "/api/v1/server/followers/{handle}/reject" in 9817 let query = "" in 9818 let url = client.base_url ^ url_path ^ query in 9819 let response = 9820 try Requests.post client.session url 9821 with Eio.Io _ as ex -> 9822 let bt = Printexc.get_raw_backtrace () in 9823 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9824 in 9825 if Requests.Response.ok response then 9826 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9827 else 9828 let body = Requests.Response.text response in 9829 let parsed_body = 9830 match Json.of_string Json.Codec.Value.t body with 9831 | Ok json -> Some (Openapi.Runtime.Json json) 9832 | Error _ -> Some (Openapi.Runtime.Raw body) 9833 in 9834 raise (Openapi.Runtime.Api_error { 9835 operation = op_name; 9836 method_ = "POST"; 9837 url; 9838 status = Requests.Response.status_code response; 9839 body; 9840 parsed_body; 9841 }) 9842 9843 (** List instances followed by the server 9844 @param start Offset used to paginate results 9845 @param count Number of items to return 9846 @param sort Sort column 9847 *) 9848 let get_api_v1_server_following ?state ?actor_type ?start ?count ?sort client () = 9849 let op_name = "get_api_v1_server_following" in 9850 let url_path = "/api/v1/server/following" in 9851 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"state" ~value:state; Openapi.Runtime.Query.optional ~key:"actorType" ~value:actor_type; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 9852 let url = client.base_url ^ url_path ^ query in 9853 let response = 9854 try Requests.get client.session url 9855 with Eio.Io _ as ex -> 9856 let bt = Printexc.get_raw_backtrace () in 9857 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9858 in 9859 if Requests.Response.ok response then 9860 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9861 else 9862 let body = Requests.Response.text response in 9863 let parsed_body = 9864 match Json.of_string Json.Codec.Value.t body with 9865 | Ok json -> Some (Openapi.Runtime.Json json) 9866 | Error _ -> Some (Openapi.Runtime.Raw body) 9867 in 9868 raise (Openapi.Runtime.Api_error { 9869 operation = op_name; 9870 method_ = "GET"; 9871 url; 9872 status = Requests.Response.status_code response; 9873 body; 9874 parsed_body; 9875 }) 9876 9877 (** Follow a list of actors (PeerTube instance, channel or account) *) 9878 let post_api_v1_server_following client () = 9879 let op_name = "post_api_v1_server_following" in 9880 let url_path = "/api/v1/server/following" in 9881 let query = "" in 9882 let url = client.base_url ^ url_path ^ query in 9883 let response = 9884 try Requests.post client.session url 9885 with Eio.Io _ as ex -> 9886 let bt = Printexc.get_raw_backtrace () in 9887 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9888 in 9889 if Requests.Response.ok response then 9890 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9891 else 9892 let body = Requests.Response.text response in 9893 let parsed_body = 9894 match Json.of_string Json.Codec.Value.t body with 9895 | Ok json -> Some (Openapi.Runtime.Json json) 9896 | Error _ -> Some (Openapi.Runtime.Raw body) 9897 in 9898 raise (Openapi.Runtime.Api_error { 9899 operation = op_name; 9900 method_ = "POST"; 9901 url; 9902 status = Requests.Response.status_code response; 9903 body; 9904 parsed_body; 9905 }) 9906 9907 (** Unfollow an actor (PeerTube instance, channel or account) 9908 @param host_or_handle The hostOrHandle to unfollow 9909 *) 9910 let delete_api_v1_server_following ~host_or_handle client () = 9911 let op_name = "delete_api_v1_server_following" in 9912 let url_path = Openapi.Runtime.Path.render ~params:[("hostOrHandle", host_or_handle)] "/api/v1/server/following/{hostOrHandle}" in 9913 let query = "" in 9914 let url = client.base_url ^ url_path ^ query in 9915 let response = 9916 try Requests.delete client.session url 9917 with Eio.Io _ as ex -> 9918 let bt = Printexc.get_raw_backtrace () in 9919 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 9920 in 9921 if Requests.Response.ok response then 9922 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9923 else 9924 let body = Requests.Response.text response in 9925 let parsed_body = 9926 match Json.of_string Json.Codec.Value.t body with 9927 | Ok json -> Some (Openapi.Runtime.Json json) 9928 | Error _ -> Some (Openapi.Runtime.Raw body) 9929 in 9930 raise (Openapi.Runtime.Api_error { 9931 operation = op_name; 9932 method_ = "DELETE"; 9933 url; 9934 status = Requests.Response.status_code response; 9935 body; 9936 parsed_body; 9937 }) 9938 9939 (** Get instance logs *) 9940 let get_instance_logs client () = 9941 let op_name = "get_instance_logs" in 9942 let url_path = "/api/v1/server/logs" in 9943 let query = "" in 9944 let url = client.base_url ^ url_path ^ query in 9945 let response = 9946 try Requests.get client.session url 9947 with Eio.Io _ as ex -> 9948 let bt = Printexc.get_raw_backtrace () in 9949 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 9950 in 9951 if Requests.Response.ok response then 9952 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9953 else 9954 let body = Requests.Response.text response in 9955 let parsed_body = 9956 match Json.of_string Json.Codec.Value.t body with 9957 | Ok json -> Some (Openapi.Runtime.Json json) 9958 | Error _ -> Some (Openapi.Runtime.Raw body) 9959 in 9960 raise (Openapi.Runtime.Api_error { 9961 operation = op_name; 9962 method_ = "GET"; 9963 url; 9964 status = Requests.Response.status_code response; 9965 body; 9966 parsed_body; 9967 }) 9968 9969 (** Send client log *) 9970 let send_client_log ~body client () = 9971 let op_name = "send_client_log" in 9972 let url_path = "/api/v1/server/logs/client" in 9973 let query = "" in 9974 let url = client.base_url ^ url_path ^ query in 9975 let response = 9976 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string SendClientLog.T.jsont body)) url 9977 with Eio.Io _ as ex -> 9978 let bt = Printexc.get_raw_backtrace () in 9979 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 9980 in 9981 if Requests.Response.ok response then 9982 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 9983 else 9984 let body = Requests.Response.text response in 9985 let parsed_body = 9986 match Json.of_string Json.Codec.Value.t body with 9987 | Ok json -> Some (Openapi.Runtime.Json json) 9988 | Error _ -> Some (Openapi.Runtime.Raw body) 9989 in 9990 raise (Openapi.Runtime.Api_error { 9991 operation = op_name; 9992 method_ = "POST"; 9993 url; 9994 status = Requests.Response.status_code response; 9995 body; 9996 parsed_body; 9997 }) 9998 9999 (** Mirror a video *) 10000 let put_mirrored_video client () = 10001 let op_name = "put_mirrored_video" in 10002 let url_path = "/api/v1/server/redundancy/videos" in 10003 let query = "" in 10004 let url = client.base_url ^ url_path ^ query in 10005 let response = 10006 try Requests.post client.session url 10007 with Eio.Io _ as ex -> 10008 let bt = Printexc.get_raw_backtrace () in 10009 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10010 in 10011 if Requests.Response.ok response then 10012 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10013 else 10014 let body = Requests.Response.text response in 10015 let parsed_body = 10016 match Json.of_string Json.Codec.Value.t body with 10017 | Ok json -> Some (Openapi.Runtime.Json json) 10018 | Error _ -> Some (Openapi.Runtime.Raw body) 10019 in 10020 raise (Openapi.Runtime.Api_error { 10021 operation = op_name; 10022 method_ = "POST"; 10023 url; 10024 status = Requests.Response.status_code response; 10025 body; 10026 parsed_body; 10027 }) 10028 10029 (** Delete a mirror done on a video 10030 @param redundancy_id id of an existing redundancy on a video 10031 *) 10032 let del_mirrored_video ~redundancy_id client () = 10033 let op_name = "del_mirrored_video" in 10034 let url_path = Openapi.Runtime.Path.render ~params:[("redundancyId", redundancy_id)] "/api/v1/server/redundancy/videos/{redundancyId}" in 10035 let query = "" in 10036 let url = client.base_url ^ url_path ^ query in 10037 let response = 10038 try Requests.delete client.session url 10039 with Eio.Io _ as ex -> 10040 let bt = Printexc.get_raw_backtrace () in 10041 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 10042 in 10043 if Requests.Response.ok response then 10044 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10045 else 10046 let body = Requests.Response.text response in 10047 let parsed_body = 10048 match Json.of_string Json.Codec.Value.t body with 10049 | Ok json -> Some (Openapi.Runtime.Json json) 10050 | Error _ -> Some (Openapi.Runtime.Raw body) 10051 in 10052 raise (Openapi.Runtime.Api_error { 10053 operation = op_name; 10054 method_ = "DELETE"; 10055 url; 10056 status = Requests.Response.status_code response; 10057 body; 10058 parsed_body; 10059 }) 10060 10061 (** Update a server redundancy policy 10062 @param host server domain to mirror 10063 *) 10064 let put_api_v1_server_redundancy ~host client () = 10065 let op_name = "put_api_v1_server_redundancy" in 10066 let url_path = Openapi.Runtime.Path.render ~params:[("host", host)] "/api/v1/server/redundancy/{host}" in 10067 let query = "" in 10068 let url = client.base_url ^ url_path ^ query in 10069 let response = 10070 try Requests.put client.session url 10071 with Eio.Io _ as ex -> 10072 let bt = Printexc.get_raw_backtrace () in 10073 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 10074 in 10075 if Requests.Response.ok response then 10076 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10077 else 10078 let body = Requests.Response.text response in 10079 let parsed_body = 10080 match Json.of_string Json.Codec.Value.t body with 10081 | Ok json -> Some (Openapi.Runtime.Json json) 10082 | Error _ -> Some (Openapi.Runtime.Raw body) 10083 in 10084 raise (Openapi.Runtime.Api_error { 10085 operation = op_name; 10086 method_ = "PUT"; 10087 url; 10088 status = Requests.Response.status_code response; 10089 body; 10090 parsed_body; 10091 }) 10092 10093 (** Ask to reset password 10094 10095 An email containing a reset password link *) 10096 let post_api_v1_users_ask_reset_password client () = 10097 let op_name = "post_api_v1_users_ask_reset_password" in 10098 let url_path = "/api/v1/users/ask-reset-password" in 10099 let query = "" in 10100 let url = client.base_url ^ url_path ^ query in 10101 let response = 10102 try Requests.post client.session url 10103 with Eio.Io _ as ex -> 10104 let bt = Printexc.get_raw_backtrace () in 10105 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10106 in 10107 if Requests.Response.ok response then 10108 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10109 else 10110 let body = Requests.Response.text response in 10111 let parsed_body = 10112 match Json.of_string Json.Codec.Value.t body with 10113 | Ok json -> Some (Openapi.Runtime.Json json) 10114 | Error _ -> Some (Openapi.Runtime.Raw body) 10115 in 10116 raise (Openapi.Runtime.Api_error { 10117 operation = op_name; 10118 method_ = "POST"; 10119 url; 10120 status = Requests.Response.status_code response; 10121 body; 10122 parsed_body; 10123 }) 10124 10125 (** Resend user verification link *) 10126 let resend_email_to_verify_user client () = 10127 let op_name = "resend_email_to_verify_user" in 10128 let url_path = "/api/v1/users/ask-send-verify-email" in 10129 let query = "" in 10130 let url = client.base_url ^ url_path ^ query in 10131 let response = 10132 try Requests.post client.session url 10133 with Eio.Io _ as ex -> 10134 let bt = Printexc.get_raw_backtrace () in 10135 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10136 in 10137 if Requests.Response.ok response then 10138 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10139 else 10140 let body = Requests.Response.text response in 10141 let parsed_body = 10142 match Json.of_string Json.Codec.Value.t body with 10143 | Ok json -> Some (Openapi.Runtime.Json json) 10144 | Error _ -> Some (Openapi.Runtime.Raw body) 10145 in 10146 raise (Openapi.Runtime.Api_error { 10147 operation = op_name; 10148 method_ = "POST"; 10149 url; 10150 status = Requests.Response.status_code response; 10151 body; 10152 parsed_body; 10153 }) 10154 10155 (** Update my user information *) 10156 let put_user_info ~body client () = 10157 let op_name = "put_user_info" in 10158 let url_path = "/api/v1/users/me" in 10159 let query = "" in 10160 let url = client.base_url ^ url_path ^ query in 10161 let response = 10162 try Requests.put client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string UpdateMe.T.jsont body)) url 10163 with Eio.Io _ as ex -> 10164 let bt = Printexc.get_raw_backtrace () in 10165 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 10166 in 10167 if Requests.Response.ok response then 10168 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10169 else 10170 let body = Requests.Response.text response in 10171 let parsed_body = 10172 match Json.of_string Json.Codec.Value.t body with 10173 | Ok json -> Some (Openapi.Runtime.Json json) 10174 | Error _ -> Some (Openapi.Runtime.Raw body) 10175 in 10176 raise (Openapi.Runtime.Api_error { 10177 operation = op_name; 10178 method_ = "PUT"; 10179 url; 10180 status = Requests.Response.status_code response; 10181 body; 10182 parsed_body; 10183 }) 10184 10185 (** List my abuses 10186 @param id only list the report with this id 10187 @param sort Sort abuses by criteria 10188 @param start Offset used to paginate results 10189 @param count Number of items to return 10190 *) 10191 let get_my_abuses ?id ?state ?sort ?start ?count client () = 10192 let op_name = "get_my_abuses" in 10193 let url_path = "/api/v1/users/me/abuses" in 10194 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"id" ~value:id; Openapi.Runtime.Query.optional ~key:"state" ~value:state; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count]) in 10195 let url = client.base_url ^ url_path ^ query in 10196 let response = 10197 try Requests.get client.session url 10198 with Eio.Io _ as ex -> 10199 let bt = Printexc.get_raw_backtrace () in 10200 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 10201 in 10202 if Requests.Response.ok response then 10203 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10204 else 10205 let body = Requests.Response.text response in 10206 let parsed_body = 10207 match Json.of_string Json.Codec.Value.t body with 10208 | Ok json -> Some (Openapi.Runtime.Json json) 10209 | Error _ -> Some (Openapi.Runtime.Raw body) 10210 in 10211 raise (Openapi.Runtime.Api_error { 10212 operation = op_name; 10213 method_ = "GET"; 10214 url; 10215 status = Requests.Response.status_code response; 10216 body; 10217 parsed_body; 10218 }) 10219 10220 (** Delete my avatar *) 10221 let delete_api_v1_users_me_avatar client () = 10222 let op_name = "delete_api_v1_users_me_avatar" in 10223 let url_path = "/api/v1/users/me/avatar" in 10224 let query = "" in 10225 let url = client.base_url ^ url_path ^ query in 10226 let response = 10227 try Requests.delete client.session url 10228 with Eio.Io _ as ex -> 10229 let bt = Printexc.get_raw_backtrace () in 10230 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 10231 in 10232 if Requests.Response.ok response then 10233 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10234 else 10235 let body = Requests.Response.text response in 10236 let parsed_body = 10237 match Json.of_string Json.Codec.Value.t body with 10238 | Ok json -> Some (Openapi.Runtime.Json json) 10239 | Error _ -> Some (Openapi.Runtime.Raw body) 10240 in 10241 raise (Openapi.Runtime.Api_error { 10242 operation = op_name; 10243 method_ = "DELETE"; 10244 url; 10245 status = Requests.Response.status_code response; 10246 body; 10247 parsed_body; 10248 }) 10249 10250 (** Update my user avatar *) 10251 let post_api_v1_users_me_avatar_pick client () = 10252 let op_name = "post_api_v1_users_me_avatar_pick" in 10253 let url_path = "/api/v1/users/me/avatar/pick" in 10254 let query = "" in 10255 let url = client.base_url ^ url_path ^ query in 10256 let response = 10257 try Requests.post client.session url 10258 with Eio.Io _ as ex -> 10259 let bt = Printexc.get_raw_backtrace () in 10260 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10261 in 10262 if Requests.Response.ok response then 10263 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10264 else 10265 let body = Requests.Response.text response in 10266 let parsed_body = 10267 match Json.of_string Json.Codec.Value.t body with 10268 | Ok json -> Some (Openapi.Runtime.Json json) 10269 | Error _ -> Some (Openapi.Runtime.Raw body) 10270 in 10271 raise (Openapi.Runtime.Api_error { 10272 operation = op_name; 10273 method_ = "POST"; 10274 url; 10275 status = Requests.Response.status_code response; 10276 body; 10277 parsed_body; 10278 }) 10279 10280 (** Clear video history *) 10281 let post_api_v1_users_me_history_videos_remove client () = 10282 let op_name = "post_api_v1_users_me_history_videos_remove" in 10283 let url_path = "/api/v1/users/me/history/videos/remove" in 10284 let query = "" in 10285 let url = client.base_url ^ url_path ^ query in 10286 let response = 10287 try Requests.post client.session url 10288 with Eio.Io _ as ex -> 10289 let bt = Printexc.get_raw_backtrace () in 10290 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10291 in 10292 if Requests.Response.ok response then 10293 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10294 else 10295 let body = Requests.Response.text response in 10296 let parsed_body = 10297 match Json.of_string Json.Codec.Value.t body with 10298 | Ok json -> Some (Openapi.Runtime.Json json) 10299 | Error _ -> Some (Openapi.Runtime.Raw body) 10300 in 10301 raise (Openapi.Runtime.Api_error { 10302 operation = op_name; 10303 method_ = "POST"; 10304 url; 10305 status = Requests.Response.status_code response; 10306 body; 10307 parsed_body; 10308 }) 10309 10310 (** Delete history element *) 10311 let delete_api_v1_users_me_history_videos ~video_id client () = 10312 let op_name = "delete_api_v1_users_me_history_videos" in 10313 let url_path = Openapi.Runtime.Path.render ~params:[("videoId", video_id)] "/api/v1/users/me/history/videos/{videoId}" in 10314 let query = "" in 10315 let url = client.base_url ^ url_path ^ query in 10316 let response = 10317 try Requests.delete client.session url 10318 with Eio.Io _ as ex -> 10319 let bt = Printexc.get_raw_backtrace () in 10320 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 10321 in 10322 if Requests.Response.ok response then 10323 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10324 else 10325 let body = Requests.Response.text response in 10326 let parsed_body = 10327 match Json.of_string Json.Codec.Value.t body with 10328 | Ok json -> Some (Openapi.Runtime.Json json) 10329 | Error _ -> Some (Openapi.Runtime.Raw body) 10330 in 10331 raise (Openapi.Runtime.Api_error { 10332 operation = op_name; 10333 method_ = "DELETE"; 10334 url; 10335 status = Requests.Response.status_code response; 10336 body; 10337 parsed_body; 10338 }) 10339 10340 (** Mark feature info as read 10341 10342 **PeerTube >= v8.0.0 *) 10343 let post_api_v1_users_me_new_feature_info_read client () = 10344 let op_name = "post_api_v1_users_me_new_feature_info_read" in 10345 let url_path = "/api/v1/users/me/new-feature-info/read" in 10346 let query = "" in 10347 let url = client.base_url ^ url_path ^ query in 10348 let response = 10349 try Requests.post client.session url 10350 with Eio.Io _ as ex -> 10351 let bt = Printexc.get_raw_backtrace () in 10352 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10353 in 10354 if Requests.Response.ok response then 10355 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10356 else 10357 let body = Requests.Response.text response in 10358 let parsed_body = 10359 match Json.of_string Json.Codec.Value.t body with 10360 | Ok json -> Some (Openapi.Runtime.Json json) 10361 | Error _ -> Some (Openapi.Runtime.Raw body) 10362 in 10363 raise (Openapi.Runtime.Api_error { 10364 operation = op_name; 10365 method_ = "POST"; 10366 url; 10367 status = Requests.Response.status_code response; 10368 body; 10369 parsed_body; 10370 }) 10371 10372 (** Update my notification settings *) 10373 let put_api_v1_users_me_notification_settings ~body client () = 10374 let op_name = "put_api_v1_users_me_notification_settings" in 10375 let url_path = "/api/v1/users/me/notification-settings" in 10376 let query = "" in 10377 let url = client.base_url ^ url_path ^ query in 10378 let response = 10379 try Requests.put client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string UserNotificationSettings.T.jsont body)) url 10380 with Eio.Io _ as ex -> 10381 let bt = Printexc.get_raw_backtrace () in 10382 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 10383 in 10384 if Requests.Response.ok response then 10385 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10386 else 10387 let body = Requests.Response.text response in 10388 let parsed_body = 10389 match Json.of_string Json.Codec.Value.t body with 10390 | Ok json -> Some (Openapi.Runtime.Json json) 10391 | Error _ -> Some (Openapi.Runtime.Raw body) 10392 in 10393 raise (Openapi.Runtime.Api_error { 10394 operation = op_name; 10395 method_ = "PUT"; 10396 url; 10397 status = Requests.Response.status_code response; 10398 body; 10399 parsed_body; 10400 }) 10401 10402 (** Mark notifications as read by their id *) 10403 let post_api_v1_users_me_notifications_read client () = 10404 let op_name = "post_api_v1_users_me_notifications_read" in 10405 let url_path = "/api/v1/users/me/notifications/read" in 10406 let query = "" in 10407 let url = client.base_url ^ url_path ^ query in 10408 let response = 10409 try Requests.post client.session url 10410 with Eio.Io _ as ex -> 10411 let bt = Printexc.get_raw_backtrace () in 10412 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10413 in 10414 if Requests.Response.ok response then 10415 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10416 else 10417 let body = Requests.Response.text response in 10418 let parsed_body = 10419 match Json.of_string Json.Codec.Value.t body with 10420 | Ok json -> Some (Openapi.Runtime.Json json) 10421 | Error _ -> Some (Openapi.Runtime.Raw body) 10422 in 10423 raise (Openapi.Runtime.Api_error { 10424 operation = op_name; 10425 method_ = "POST"; 10426 url; 10427 status = Requests.Response.status_code response; 10428 body; 10429 parsed_body; 10430 }) 10431 10432 (** Mark all my notification as read *) 10433 let post_api_v1_users_me_notifications_read_all client () = 10434 let op_name = "post_api_v1_users_me_notifications_read_all" in 10435 let url_path = "/api/v1/users/me/notifications/read-all" in 10436 let query = "" in 10437 let url = client.base_url ^ url_path ^ query in 10438 let response = 10439 try Requests.post client.session url 10440 with Eio.Io _ as ex -> 10441 let bt = Printexc.get_raw_backtrace () in 10442 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10443 in 10444 if Requests.Response.ok response then 10445 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10446 else 10447 let body = Requests.Response.text response in 10448 let parsed_body = 10449 match Json.of_string Json.Codec.Value.t body with 10450 | Ok json -> Some (Openapi.Runtime.Json json) 10451 | Error _ -> Some (Openapi.Runtime.Raw body) 10452 in 10453 raise (Openapi.Runtime.Api_error { 10454 operation = op_name; 10455 method_ = "POST"; 10456 url; 10457 status = Requests.Response.status_code response; 10458 body; 10459 parsed_body; 10460 }) 10461 10462 (** Add subscription to my user *) 10463 let post_api_v1_users_me_subscriptions client () = 10464 let op_name = "post_api_v1_users_me_subscriptions" in 10465 let url_path = "/api/v1/users/me/subscriptions" in 10466 let query = "" in 10467 let url = client.base_url ^ url_path ^ query in 10468 let response = 10469 try Requests.post client.session url 10470 with Eio.Io _ as ex -> 10471 let bt = Printexc.get_raw_backtrace () in 10472 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10473 in 10474 if Requests.Response.ok response then 10475 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10476 else 10477 let body = Requests.Response.text response in 10478 let parsed_body = 10479 match Json.of_string Json.Codec.Value.t body with 10480 | Ok json -> Some (Openapi.Runtime.Json json) 10481 | Error _ -> Some (Openapi.Runtime.Raw body) 10482 in 10483 raise (Openapi.Runtime.Api_error { 10484 operation = op_name; 10485 method_ = "POST"; 10486 url; 10487 status = Requests.Response.status_code response; 10488 body; 10489 parsed_body; 10490 }) 10491 10492 (** Get if subscriptions exist for my user 10493 @param uris list of uris to check if each is part of the user subscriptions 10494 *) 10495 let get_api_v1_users_me_subscriptions_exist ~uris client () = 10496 let op_name = "get_api_v1_users_me_subscriptions_exist" in 10497 let url_path = "/api/v1/users/me/subscriptions/exist" in 10498 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"uris" ~value:uris]) in 10499 let url = client.base_url ^ url_path ^ query in 10500 let response = 10501 try Requests.get client.session url 10502 with Eio.Io _ as ex -> 10503 let bt = Printexc.get_raw_backtrace () in 10504 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 10505 in 10506 if Requests.Response.ok response then 10507 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10508 else 10509 let body = Requests.Response.text response in 10510 let parsed_body = 10511 match Json.of_string Json.Codec.Value.t body with 10512 | Ok json -> Some (Openapi.Runtime.Json json) 10513 | Error _ -> Some (Openapi.Runtime.Raw body) 10514 in 10515 raise (Openapi.Runtime.Api_error { 10516 operation = op_name; 10517 method_ = "GET"; 10518 url; 10519 status = Requests.Response.status_code response; 10520 body; 10521 parsed_body; 10522 }) 10523 10524 (** Delete subscription of my user 10525 @param subscription_handle The subscription handle 10526 *) 10527 let delete_api_v1_users_me_subscriptions ~subscription_handle client () = 10528 let op_name = "delete_api_v1_users_me_subscriptions" in 10529 let url_path = Openapi.Runtime.Path.render ~params:[("subscriptionHandle", subscription_handle)] "/api/v1/users/me/subscriptions/{subscriptionHandle}" in 10530 let query = "" in 10531 let url = client.base_url ^ url_path ^ query in 10532 let response = 10533 try Requests.delete client.session url 10534 with Eio.Io _ as ex -> 10535 let bt = Printexc.get_raw_backtrace () in 10536 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 10537 in 10538 if Requests.Response.ok response then 10539 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10540 else 10541 let body = Requests.Response.text response in 10542 let parsed_body = 10543 match Json.of_string Json.Codec.Value.t body with 10544 | Ok json -> Some (Openapi.Runtime.Json json) 10545 | Error _ -> Some (Openapi.Runtime.Raw body) 10546 in 10547 raise (Openapi.Runtime.Api_error { 10548 operation = op_name; 10549 method_ = "DELETE"; 10550 url; 10551 status = Requests.Response.status_code response; 10552 body; 10553 parsed_body; 10554 }) 10555 10556 (** Check video exists in my playlists 10557 @param video_ids The video ids to check 10558 *) 10559 let get_api_v1_users_me_video_playlists_videos_exist ~video_ids client () = 10560 let op_name = "get_api_v1_users_me_video_playlists_videos_exist" in 10561 let url_path = "/api/v1/users/me/video-playlists/videos-exist" in 10562 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"videoIds" ~value:video_ids]) in 10563 let url = client.base_url ^ url_path ^ query in 10564 let response = 10565 try Requests.get client.session url 10566 with Eio.Io _ as ex -> 10567 let bt = Printexc.get_raw_backtrace () in 10568 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 10569 in 10570 if Requests.Response.ok response then 10571 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10572 else 10573 let body = Requests.Response.text response in 10574 let parsed_body = 10575 match Json.of_string Json.Codec.Value.t body with 10576 | Ok json -> Some (Openapi.Runtime.Json json) 10577 | Error _ -> Some (Openapi.Runtime.Raw body) 10578 in 10579 raise (Openapi.Runtime.Api_error { 10580 operation = op_name; 10581 method_ = "GET"; 10582 url; 10583 status = Requests.Response.status_code response; 10584 body; 10585 parsed_body; 10586 }) 10587 10588 (** Get my user used quota *) 10589 let get_api_v1_users_me_video_quota_used client () = 10590 let op_name = "get_api_v1_users_me_video_quota_used" in 10591 let url_path = "/api/v1/users/me/video-quota-used" in 10592 let query = "" in 10593 let url = client.base_url ^ url_path ^ query in 10594 let response = 10595 try Requests.get client.session url 10596 with Eio.Io _ as ex -> 10597 let bt = Printexc.get_raw_backtrace () in 10598 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 10599 in 10600 if Requests.Response.ok response then 10601 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10602 else 10603 let body = Requests.Response.text response in 10604 let parsed_body = 10605 match Json.of_string Json.Codec.Value.t body with 10606 | Ok json -> Some (Openapi.Runtime.Json json) 10607 | Error _ -> Some (Openapi.Runtime.Raw body) 10608 in 10609 raise (Openapi.Runtime.Api_error { 10610 operation = op_name; 10611 method_ = "GET"; 10612 url; 10613 status = Requests.Response.status_code response; 10614 body; 10615 parsed_body; 10616 }) 10617 10618 (** List comments on user's videos 10619 10620 **PeerTube >= 6.2** 10621 @param search Plain text search, applied to various parts of the model depending on endpoint 10622 @param search_account Filter comments by searching on the account 10623 @param search_video Filter comments by searching on the video 10624 @param video_id Limit results on this specific video 10625 @param video_channel_id Limit results on this specific video channel 10626 @param auto_tag_one_of **PeerTube >= 6.2** filter on comments that contain one of these automatic tags 10627 @param is_held_for_review only display comments that are held for review 10628 @param include_collaborations **PeerTube >= 8.0** Include objects from collaborated channels 10629 *) 10630 let get_api_v1_users_me_videos_comments ?search ?search_account ?search_video ?video_id ?video_channel_id ?auto_tag_one_of ?is_held_for_review ?include_collaborations client () = 10631 let op_name = "get_api_v1_users_me_videos_comments" in 10632 let url_path = "/api/v1/users/me/videos/comments" in 10633 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"searchAccount" ~value:search_account; Openapi.Runtime.Query.optional ~key:"searchVideo" ~value:search_video; Openapi.Runtime.Query.optional ~key:"videoId" ~value:video_id; Openapi.Runtime.Query.optional ~key:"videoChannelId" ~value:video_channel_id; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"isHeldForReview" ~value:is_held_for_review; Openapi.Runtime.Query.optional ~key:"includeCollaborations" ~value:include_collaborations]) in 10634 let url = client.base_url ^ url_path ^ query in 10635 let response = 10636 try Requests.get client.session url 10637 with Eio.Io _ as ex -> 10638 let bt = Printexc.get_raw_backtrace () in 10639 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 10640 in 10641 if Requests.Response.ok response then 10642 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10643 else 10644 let body = Requests.Response.text response in 10645 let parsed_body = 10646 match Json.of_string Json.Codec.Value.t body with 10647 | Ok json -> Some (Openapi.Runtime.Json json) 10648 | Error _ -> Some (Openapi.Runtime.Raw body) 10649 in 10650 raise (Openapi.Runtime.Api_error { 10651 operation = op_name; 10652 method_ = "GET"; 10653 url; 10654 status = Requests.Response.status_code response; 10655 body; 10656 parsed_body; 10657 }) 10658 10659 (** Register a user 10660 10661 Signup has to be enabled and signup approval is not required *) 10662 let register_user ~body client () = 10663 let op_name = "register_user" in 10664 let url_path = "/api/v1/users/register" in 10665 let query = "" in 10666 let url = client.base_url ^ url_path ^ query in 10667 let response = 10668 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string RegisterUser.T.jsont body)) url 10669 with Eio.Io _ as ex -> 10670 let bt = Printexc.get_raw_backtrace () in 10671 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10672 in 10673 if Requests.Response.ok response then 10674 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10675 else 10676 let body = Requests.Response.text response in 10677 let parsed_body = 10678 match Json.of_string Json.Codec.Value.t body with 10679 | Ok json -> Some (Openapi.Runtime.Json json) 10680 | Error _ -> Some (Openapi.Runtime.Raw body) 10681 in 10682 raise (Openapi.Runtime.Api_error { 10683 operation = op_name; 10684 method_ = "POST"; 10685 url; 10686 status = Requests.Response.status_code response; 10687 body; 10688 parsed_body; 10689 }) 10690 10691 (** List registrations 10692 @param start Offset used to paginate results 10693 @param count Number of items to return 10694 *) 10695 let list_registrations ?start ?count ?search ?sort client () = 10696 let op_name = "list_registrations" in 10697 let url_path = "/api/v1/users/registrations" in 10698 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 10699 let url = client.base_url ^ url_path ^ query in 10700 let response = 10701 try Requests.get client.session url 10702 with Eio.Io _ as ex -> 10703 let bt = Printexc.get_raw_backtrace () in 10704 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 10705 in 10706 if Requests.Response.ok response then 10707 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10708 else 10709 let body = Requests.Response.text response in 10710 let parsed_body = 10711 match Json.of_string Json.Codec.Value.t body with 10712 | Ok json -> Some (Openapi.Runtime.Json json) 10713 | Error _ -> Some (Openapi.Runtime.Raw body) 10714 in 10715 raise (Openapi.Runtime.Api_error { 10716 operation = op_name; 10717 method_ = "GET"; 10718 url; 10719 status = Requests.Response.status_code response; 10720 body; 10721 parsed_body; 10722 }) 10723 10724 (** Resend verification link to registration request email *) 10725 let resend_email_to_verify_registration client () = 10726 let op_name = "resend_email_to_verify_registration" in 10727 let url_path = "/api/v1/users/registrations/ask-send-verify-email" in 10728 let query = "" in 10729 let url = client.base_url ^ url_path ^ query in 10730 let response = 10731 try Requests.post client.session url 10732 with Eio.Io _ as ex -> 10733 let bt = Printexc.get_raw_backtrace () in 10734 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10735 in 10736 if Requests.Response.ok response then 10737 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10738 else 10739 let body = Requests.Response.text response in 10740 let parsed_body = 10741 match Json.of_string Json.Codec.Value.t body with 10742 | Ok json -> Some (Openapi.Runtime.Json json) 10743 | Error _ -> Some (Openapi.Runtime.Raw body) 10744 in 10745 raise (Openapi.Runtime.Api_error { 10746 operation = op_name; 10747 method_ = "POST"; 10748 url; 10749 status = Requests.Response.status_code response; 10750 body; 10751 parsed_body; 10752 }) 10753 10754 (** Delete registration 10755 10756 Delete the registration entry. It will not remove the user associated with this registration (if any) 10757 @param registration_id Registration ID 10758 *) 10759 let delete_registration ~registration_id client () = 10760 let op_name = "delete_registration" in 10761 let url_path = Openapi.Runtime.Path.render ~params:[("registrationId", registration_id)] "/api/v1/users/registrations/{registrationId}" in 10762 let query = "" in 10763 let url = client.base_url ^ url_path ^ query in 10764 let response = 10765 try Requests.delete client.session url 10766 with Eio.Io _ as ex -> 10767 let bt = Printexc.get_raw_backtrace () in 10768 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 10769 in 10770 if Requests.Response.ok response then 10771 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10772 else 10773 let body = Requests.Response.text response in 10774 let parsed_body = 10775 match Json.of_string Json.Codec.Value.t body with 10776 | Ok json -> Some (Openapi.Runtime.Json json) 10777 | Error _ -> Some (Openapi.Runtime.Raw body) 10778 in 10779 raise (Openapi.Runtime.Api_error { 10780 operation = op_name; 10781 method_ = "DELETE"; 10782 url; 10783 status = Requests.Response.status_code response; 10784 body; 10785 parsed_body; 10786 }) 10787 10788 (** Accept registration 10789 @param registration_id Registration ID 10790 *) 10791 let accept_registration ~registration_id ~body client () = 10792 let op_name = "accept_registration" in 10793 let url_path = Openapi.Runtime.Path.render ~params:[("registrationId", registration_id)] "/api/v1/users/registrations/{registrationId}/accept" in 10794 let query = "" in 10795 let url = client.base_url ^ url_path ^ query in 10796 let response = 10797 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string UserRegistrationAcceptOrReject.T.jsont body)) url 10798 with Eio.Io _ as ex -> 10799 let bt = Printexc.get_raw_backtrace () in 10800 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10801 in 10802 if Requests.Response.ok response then 10803 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10804 else 10805 let body = Requests.Response.text response in 10806 let parsed_body = 10807 match Json.of_string Json.Codec.Value.t body with 10808 | Ok json -> Some (Openapi.Runtime.Json json) 10809 | Error _ -> Some (Openapi.Runtime.Raw body) 10810 in 10811 raise (Openapi.Runtime.Api_error { 10812 operation = op_name; 10813 method_ = "POST"; 10814 url; 10815 status = Requests.Response.status_code response; 10816 body; 10817 parsed_body; 10818 }) 10819 10820 (** Reject registration 10821 @param registration_id Registration ID 10822 *) 10823 let reject_registration ~registration_id ~body client () = 10824 let op_name = "reject_registration" in 10825 let url_path = Openapi.Runtime.Path.render ~params:[("registrationId", registration_id)] "/api/v1/users/registrations/{registrationId}/reject" in 10826 let query = "" in 10827 let url = client.base_url ^ url_path ^ query in 10828 let response = 10829 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string UserRegistrationAcceptOrReject.T.jsont body)) url 10830 with Eio.Io _ as ex -> 10831 let bt = Printexc.get_raw_backtrace () in 10832 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10833 in 10834 if Requests.Response.ok response then 10835 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10836 else 10837 let body = Requests.Response.text response in 10838 let parsed_body = 10839 match Json.of_string Json.Codec.Value.t body with 10840 | Ok json -> Some (Openapi.Runtime.Json json) 10841 | Error _ -> Some (Openapi.Runtime.Raw body) 10842 in 10843 raise (Openapi.Runtime.Api_error { 10844 operation = op_name; 10845 method_ = "POST"; 10846 url; 10847 status = Requests.Response.status_code response; 10848 body; 10849 parsed_body; 10850 }) 10851 10852 (** Verify a registration email 10853 10854 Following a user registration request, the user will receive an email asking to click a link 10855 containing a secret. 10856 10857 @param registration_id Registration ID 10858 *) 10859 let verify_registration_email ~registration_id client () = 10860 let op_name = "verify_registration_email" in 10861 let url_path = Openapi.Runtime.Path.render ~params:[("registrationId", registration_id)] "/api/v1/users/registrations/{registrationId}/verify-email" in 10862 let query = "" in 10863 let url = client.base_url ^ url_path ^ query in 10864 let response = 10865 try Requests.post client.session url 10866 with Eio.Io _ as ex -> 10867 let bt = Printexc.get_raw_backtrace () in 10868 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10869 in 10870 if Requests.Response.ok response then 10871 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10872 else 10873 let body = Requests.Response.text response in 10874 let parsed_body = 10875 match Json.of_string Json.Codec.Value.t body with 10876 | Ok json -> Some (Openapi.Runtime.Json json) 10877 | Error _ -> Some (Openapi.Runtime.Raw body) 10878 in 10879 raise (Openapi.Runtime.Api_error { 10880 operation = op_name; 10881 method_ = "POST"; 10882 url; 10883 status = Requests.Response.status_code response; 10884 body; 10885 parsed_body; 10886 }) 10887 10888 (** Logout 10889 10890 Revokes your access token and its associated refresh token, destroying your current session. *) 10891 let revoke_oauth_token client () = 10892 let op_name = "revoke_oauth_token" in 10893 let url_path = "/api/v1/users/revoke-token" in 10894 let query = "" in 10895 let url = client.base_url ^ url_path ^ query in 10896 let response = 10897 try Requests.post client.session url 10898 with Eio.Io _ as ex -> 10899 let bt = Printexc.get_raw_backtrace () in 10900 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10901 in 10902 if Requests.Response.ok response then 10903 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10904 else 10905 let body = Requests.Response.text response in 10906 let parsed_body = 10907 match Json.of_string Json.Codec.Value.t body with 10908 | Ok json -> Some (Openapi.Runtime.Json json) 10909 | Error _ -> Some (Openapi.Runtime.Raw body) 10910 in 10911 raise (Openapi.Runtime.Api_error { 10912 operation = op_name; 10913 method_ = "POST"; 10914 url; 10915 status = Requests.Response.status_code response; 10916 body; 10917 parsed_body; 10918 }) 10919 10920 (** Login 10921 10922 With your [client id and secret](#operation/getOAuthClient), you can retrieve an access and refresh tokens. *) 10923 let get_oauth_token client () = 10924 let op_name = "get_oauth_token" in 10925 let url_path = "/api/v1/users/token" in 10926 let query = "" in 10927 let url = client.base_url ^ url_path ^ query in 10928 let response = 10929 try Requests.post client.session url 10930 with Eio.Io _ as ex -> 10931 let bt = Printexc.get_raw_backtrace () in 10932 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 10933 in 10934 if Requests.Response.ok response then 10935 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10936 else 10937 let body = Requests.Response.text response in 10938 let parsed_body = 10939 match Json.of_string Json.Codec.Value.t body with 10940 | Ok json -> Some (Openapi.Runtime.Json json) 10941 | Error _ -> Some (Openapi.Runtime.Raw body) 10942 in 10943 raise (Openapi.Runtime.Api_error { 10944 operation = op_name; 10945 method_ = "POST"; 10946 url; 10947 status = Requests.Response.status_code response; 10948 body; 10949 parsed_body; 10950 }) 10951 10952 (** Get a user 10953 @param id Entity id 10954 @param with_stats include statistics about the user (only available as a moderator/admin) 10955 *) 10956 let get_user ~id ?with_stats client () = 10957 let op_name = "get_user" in 10958 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}" in 10959 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"withStats" ~value:with_stats]) in 10960 let url = client.base_url ^ url_path ^ query in 10961 let response = 10962 try Requests.get client.session url 10963 with Eio.Io _ as ex -> 10964 let bt = Printexc.get_raw_backtrace () in 10965 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 10966 in 10967 if Requests.Response.ok response then 10968 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 10969 else 10970 let body = Requests.Response.text response in 10971 let parsed_body = 10972 match Json.of_string Json.Codec.Value.t body with 10973 | Ok json -> Some (Openapi.Runtime.Json json) 10974 | Error _ -> Some (Openapi.Runtime.Raw body) 10975 in 10976 raise (Openapi.Runtime.Api_error { 10977 operation = op_name; 10978 method_ = "GET"; 10979 url; 10980 status = Requests.Response.status_code response; 10981 body; 10982 parsed_body; 10983 }) 10984 10985 (** Update a user 10986 @param id Entity id 10987 *) 10988 let put_user ~id ~body client () = 10989 let op_name = "put_user" in 10990 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}" in 10991 let query = "" in 10992 let url = client.base_url ^ url_path ^ query in 10993 let response = 10994 try Requests.put client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string UpdateUser.T.jsont body)) url 10995 with Eio.Io _ as ex -> 10996 let bt = Printexc.get_raw_backtrace () in 10997 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 10998 in 10999 if Requests.Response.ok response then 11000 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11001 else 11002 let body = Requests.Response.text response in 11003 let parsed_body = 11004 match Json.of_string Json.Codec.Value.t body with 11005 | Ok json -> Some (Openapi.Runtime.Json json) 11006 | Error _ -> Some (Openapi.Runtime.Raw body) 11007 in 11008 raise (Openapi.Runtime.Api_error { 11009 operation = op_name; 11010 method_ = "PUT"; 11011 url; 11012 status = Requests.Response.status_code response; 11013 body; 11014 parsed_body; 11015 }) 11016 11017 (** Delete a user 11018 @param id Entity id 11019 *) 11020 let del_user ~id client () = 11021 let op_name = "del_user" in 11022 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}" in 11023 let query = "" in 11024 let url = client.base_url ^ url_path ^ query in 11025 let response = 11026 try Requests.delete client.session url 11027 with Eio.Io _ as ex -> 11028 let bt = Printexc.get_raw_backtrace () in 11029 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11030 in 11031 if Requests.Response.ok response then 11032 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11033 else 11034 let body = Requests.Response.text response in 11035 let parsed_body = 11036 match Json.of_string Json.Codec.Value.t body with 11037 | Ok json -> Some (Openapi.Runtime.Json json) 11038 | Error _ -> Some (Openapi.Runtime.Raw body) 11039 in 11040 raise (Openapi.Runtime.Api_error { 11041 operation = op_name; 11042 method_ = "DELETE"; 11043 url; 11044 status = Requests.Response.status_code response; 11045 body; 11046 parsed_body; 11047 }) 11048 11049 (** Reset password 11050 @param id Entity id 11051 *) 11052 let post_api_v1_users_reset_password ~id client () = 11053 let op_name = "post_api_v1_users_reset_password" in 11054 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}/reset-password" in 11055 let query = "" in 11056 let url = client.base_url ^ url_path ^ query in 11057 let response = 11058 try Requests.post client.session url 11059 with Eio.Io _ as ex -> 11060 let bt = Printexc.get_raw_backtrace () in 11061 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11062 in 11063 if Requests.Response.ok response then 11064 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11065 else 11066 let body = Requests.Response.text response in 11067 let parsed_body = 11068 match Json.of_string Json.Codec.Value.t body with 11069 | Ok json -> Some (Openapi.Runtime.Json json) 11070 | Error _ -> Some (Openapi.Runtime.Raw body) 11071 in 11072 raise (Openapi.Runtime.Api_error { 11073 operation = op_name; 11074 method_ = "POST"; 11075 url; 11076 status = Requests.Response.status_code response; 11077 body; 11078 parsed_body; 11079 }) 11080 11081 (** List token sessions 11082 @param id Entity id 11083 *) 11084 let get_api_v1_users_token_sessions ~id client () = 11085 let op_name = "get_api_v1_users_token_sessions" in 11086 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}/token-sessions" in 11087 let query = "" in 11088 let url = client.base_url ^ url_path ^ query in 11089 let response = 11090 try Requests.get client.session url 11091 with Eio.Io _ as ex -> 11092 let bt = Printexc.get_raw_backtrace () in 11093 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 11094 in 11095 if Requests.Response.ok response then 11096 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11097 else 11098 let body = Requests.Response.text response in 11099 let parsed_body = 11100 match Json.of_string Json.Codec.Value.t body with 11101 | Ok json -> Some (Openapi.Runtime.Json json) 11102 | Error _ -> Some (Openapi.Runtime.Raw body) 11103 in 11104 raise (Openapi.Runtime.Api_error { 11105 operation = op_name; 11106 method_ = "GET"; 11107 url; 11108 status = Requests.Response.status_code response; 11109 body; 11110 parsed_body; 11111 }) 11112 11113 (** List token sessions 11114 @param id Entity id 11115 @param token_session_id Token session Id 11116 *) 11117 let get_api_v1_users_token_sessions_revoke ~id ~token_session_id client () = 11118 let op_name = "get_api_v1_users_token_sessions_revoke" in 11119 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("tokenSessionId", token_session_id)] "/api/v1/users/{id}/token-sessions/{tokenSessionId}/revoke" in 11120 let query = "" in 11121 let url = client.base_url ^ url_path ^ query in 11122 let response = 11123 try Requests.get client.session url 11124 with Eio.Io _ as ex -> 11125 let bt = Printexc.get_raw_backtrace () in 11126 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 11127 in 11128 if Requests.Response.ok response then 11129 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11130 else 11131 let body = Requests.Response.text response in 11132 let parsed_body = 11133 match Json.of_string Json.Codec.Value.t body with 11134 | Ok json -> Some (Openapi.Runtime.Json json) 11135 | Error _ -> Some (Openapi.Runtime.Raw body) 11136 in 11137 raise (Openapi.Runtime.Api_error { 11138 operation = op_name; 11139 method_ = "GET"; 11140 url; 11141 status = Requests.Response.status_code response; 11142 body; 11143 parsed_body; 11144 }) 11145 11146 (** Confirm two factor auth 11147 11148 Confirm a two factor authentication request 11149 @param id Entity id 11150 *) 11151 let confirm_two_factor_request ~id client () = 11152 let op_name = "confirm_two_factor_request" in 11153 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}/two-factor/confirm-request" in 11154 let query = "" in 11155 let url = client.base_url ^ url_path ^ query in 11156 let response = 11157 try Requests.post client.session url 11158 with Eio.Io _ as ex -> 11159 let bt = Printexc.get_raw_backtrace () in 11160 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11161 in 11162 if Requests.Response.ok response then 11163 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11164 else 11165 let body = Requests.Response.text response in 11166 let parsed_body = 11167 match Json.of_string Json.Codec.Value.t body with 11168 | Ok json -> Some (Openapi.Runtime.Json json) 11169 | Error _ -> Some (Openapi.Runtime.Raw body) 11170 in 11171 raise (Openapi.Runtime.Api_error { 11172 operation = op_name; 11173 method_ = "POST"; 11174 url; 11175 status = Requests.Response.status_code response; 11176 body; 11177 parsed_body; 11178 }) 11179 11180 (** Disable two factor auth 11181 11182 Disable two factor authentication of a user 11183 @param id Entity id 11184 *) 11185 let disable_two_factor ~id client () = 11186 let op_name = "disable_two_factor" in 11187 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}/two-factor/disable" in 11188 let query = "" in 11189 let url = client.base_url ^ url_path ^ query in 11190 let response = 11191 try Requests.post client.session url 11192 with Eio.Io _ as ex -> 11193 let bt = Printexc.get_raw_backtrace () in 11194 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11195 in 11196 if Requests.Response.ok response then 11197 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11198 else 11199 let body = Requests.Response.text response in 11200 let parsed_body = 11201 match Json.of_string Json.Codec.Value.t body with 11202 | Ok json -> Some (Openapi.Runtime.Json json) 11203 | Error _ -> Some (Openapi.Runtime.Raw body) 11204 in 11205 raise (Openapi.Runtime.Api_error { 11206 operation = op_name; 11207 method_ = "POST"; 11208 url; 11209 status = Requests.Response.status_code response; 11210 body; 11211 parsed_body; 11212 }) 11213 11214 (** Verify a user 11215 11216 Following a user registration, the new user will receive an email asking to click a link 11217 containing a secret. 11218 This endpoint can also be used to verify a new email set in the user account. 11219 11220 @param id Entity id 11221 *) 11222 let verify_user ~id client () = 11223 let op_name = "verify_user" in 11224 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/users/{id}/verify-email" in 11225 let query = "" in 11226 let url = client.base_url ^ url_path ^ query in 11227 let response = 11228 try Requests.post client.session url 11229 with Eio.Io _ as ex -> 11230 let bt = Printexc.get_raw_backtrace () in 11231 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11232 in 11233 if Requests.Response.ok response then 11234 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11235 else 11236 let body = Requests.Response.text response in 11237 let parsed_body = 11238 match Json.of_string Json.Codec.Value.t body with 11239 | Ok json -> Some (Openapi.Runtime.Json json) 11240 | Error _ -> Some (Openapi.Runtime.Raw body) 11241 in 11242 raise (Openapi.Runtime.Api_error { 11243 operation = op_name; 11244 method_ = "POST"; 11245 url; 11246 status = Requests.Response.status_code response; 11247 body; 11248 parsed_body; 11249 }) 11250 11251 (** List user exports 11252 11253 **PeerTube >= 6.1** 11254 @param user_id User id 11255 *) 11256 let list_user_exports ~user_id client () = 11257 let op_name = "list_user_exports" in 11258 let url_path = Openapi.Runtime.Path.render ~params:[("userId", user_id)] "/api/v1/users/{userId}/exports" in 11259 let query = "" in 11260 let url = client.base_url ^ url_path ^ query in 11261 let response = 11262 try Requests.get client.session url 11263 with Eio.Io _ as ex -> 11264 let bt = Printexc.get_raw_backtrace () in 11265 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 11266 in 11267 if Requests.Response.ok response then 11268 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11269 else 11270 let body = Requests.Response.text response in 11271 let parsed_body = 11272 match Json.of_string Json.Codec.Value.t body with 11273 | Ok json -> Some (Openapi.Runtime.Json json) 11274 | Error _ -> Some (Openapi.Runtime.Raw body) 11275 in 11276 raise (Openapi.Runtime.Api_error { 11277 operation = op_name; 11278 method_ = "GET"; 11279 url; 11280 status = Requests.Response.status_code response; 11281 body; 11282 parsed_body; 11283 }) 11284 11285 (** Request user export 11286 11287 Request an archive of user data. An email is sent when the archive is ready. 11288 @param user_id User id 11289 *) 11290 let request_user_export ~user_id client () = 11291 let op_name = "request_user_export" in 11292 let url_path = Openapi.Runtime.Path.render ~params:[("userId", user_id)] "/api/v1/users/{userId}/exports/request" in 11293 let query = "" in 11294 let url = client.base_url ^ url_path ^ query in 11295 let response = 11296 try Requests.post client.session url 11297 with Eio.Io _ as ex -> 11298 let bt = Printexc.get_raw_backtrace () in 11299 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11300 in 11301 if Requests.Response.ok response then 11302 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11303 else 11304 let body = Requests.Response.text response in 11305 let parsed_body = 11306 match Json.of_string Json.Codec.Value.t body with 11307 | Ok json -> Some (Openapi.Runtime.Json json) 11308 | Error _ -> Some (Openapi.Runtime.Raw body) 11309 in 11310 raise (Openapi.Runtime.Api_error { 11311 operation = op_name; 11312 method_ = "POST"; 11313 url; 11314 status = Requests.Response.status_code response; 11315 body; 11316 parsed_body; 11317 }) 11318 11319 (** Delete a user export 11320 11321 **PeerTube >= 6.1** 11322 @param user_id User id 11323 @param id Entity id 11324 *) 11325 let delete_user_export ~user_id ~id client () = 11326 let op_name = "delete_user_export" in 11327 let url_path = Openapi.Runtime.Path.render ~params:[("userId", user_id); ("id", id)] "/api/v1/users/{userId}/exports/{id}" in 11328 let query = "" in 11329 let url = client.base_url ^ url_path ^ query in 11330 let response = 11331 try Requests.delete client.session url 11332 with Eio.Io _ as ex -> 11333 let bt = Printexc.get_raw_backtrace () in 11334 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11335 in 11336 if Requests.Response.ok response then 11337 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11338 else 11339 let body = Requests.Response.text response in 11340 let parsed_body = 11341 match Json.of_string Json.Codec.Value.t body with 11342 | Ok json -> Some (Openapi.Runtime.Json json) 11343 | Error _ -> Some (Openapi.Runtime.Raw body) 11344 in 11345 raise (Openapi.Runtime.Api_error { 11346 operation = op_name; 11347 method_ = "DELETE"; 11348 url; 11349 status = Requests.Response.status_code response; 11350 body; 11351 parsed_body; 11352 }) 11353 11354 (** Initialize the resumable user import 11355 11356 **PeerTube >= 6.1** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the import of the archive 11357 @param user_id User id 11358 *) 11359 let user_import_resumable_init ~user_id ~body client () = 11360 let op_name = "user_import_resumable_init" in 11361 let url_path = Openapi.Runtime.Path.render ~params:[("userId", user_id)] "/api/v1/users/{userId}/imports/import-resumable" in 11362 let query = "" in 11363 let url = client.base_url ^ url_path ^ query in 11364 let response = 11365 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string UserImportResumable.T.jsont body)) url 11366 with Eio.Io _ as ex -> 11367 let bt = Printexc.get_raw_backtrace () in 11368 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11369 in 11370 if Requests.Response.ok response then 11371 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11372 else 11373 let body = Requests.Response.text response in 11374 let parsed_body = 11375 match Json.of_string Json.Codec.Value.t body with 11376 | Ok json -> Some (Openapi.Runtime.Json json) 11377 | Error _ -> Some (Openapi.Runtime.Raw body) 11378 in 11379 raise (Openapi.Runtime.Api_error { 11380 operation = op_name; 11381 method_ = "POST"; 11382 url; 11383 status = Requests.Response.status_code response; 11384 body; 11385 parsed_body; 11386 }) 11387 11388 (** Send chunk for the resumable user import 11389 11390 **PeerTube >= 6.1** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the import of the archive 11391 @param user_id User id 11392 @param upload_id Created session id to proceed with. If you didn't send chunks in the last hour, it is 11393 not valid anymore and you need to initialize a new upload. 11394 11395 *) 11396 let user_import_resumable ~user_id ~upload_id client () = 11397 let op_name = "user_import_resumable" in 11398 let url_path = Openapi.Runtime.Path.render ~params:[("userId", user_id)] "/api/v1/users/{userId}/imports/import-resumable" in 11399 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"upload_id" ~value:upload_id]) in 11400 let url = client.base_url ^ url_path ^ query in 11401 let response = 11402 try Requests.put client.session url 11403 with Eio.Io _ as ex -> 11404 let bt = Printexc.get_raw_backtrace () in 11405 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 11406 in 11407 if Requests.Response.ok response then 11408 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11409 else 11410 let body = Requests.Response.text response in 11411 let parsed_body = 11412 match Json.of_string Json.Codec.Value.t body with 11413 | Ok json -> Some (Openapi.Runtime.Json json) 11414 | Error _ -> Some (Openapi.Runtime.Raw body) 11415 in 11416 raise (Openapi.Runtime.Api_error { 11417 operation = op_name; 11418 method_ = "PUT"; 11419 url; 11420 status = Requests.Response.status_code response; 11421 body; 11422 parsed_body; 11423 }) 11424 11425 (** Cancel the resumable user import 11426 11427 **PeerTube >= 6.1** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the resumable user import 11428 @param user_id User id 11429 @param upload_id Created session id to proceed with. If you didn't send chunks in the last hour, it is 11430 not valid anymore and you need to initialize a new upload. 11431 11432 *) 11433 let user_import_resumable_cancel ~user_id ~upload_id client () = 11434 let op_name = "user_import_resumable_cancel" in 11435 let url_path = Openapi.Runtime.Path.render ~params:[("userId", user_id)] "/api/v1/users/{userId}/imports/import-resumable" in 11436 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"upload_id" ~value:upload_id]) in 11437 let url = client.base_url ^ url_path ^ query in 11438 let response = 11439 try Requests.delete client.session url 11440 with Eio.Io _ as ex -> 11441 let bt = Printexc.get_raw_backtrace () in 11442 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11443 in 11444 if Requests.Response.ok response then 11445 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11446 else 11447 let body = Requests.Response.text response in 11448 let parsed_body = 11449 match Json.of_string Json.Codec.Value.t body with 11450 | Ok json -> Some (Openapi.Runtime.Json json) 11451 | Error _ -> Some (Openapi.Runtime.Raw body) 11452 in 11453 raise (Openapi.Runtime.Api_error { 11454 operation = op_name; 11455 method_ = "DELETE"; 11456 url; 11457 status = Requests.Response.status_code response; 11458 body; 11459 parsed_body; 11460 }) 11461 11462 (** Get latest user import 11463 11464 **PeerTube >= 6.1** 11465 @param user_id User id 11466 *) 11467 let get_latest_user_import ~user_id client () = 11468 let op_name = "get_latest_user_import" in 11469 let url_path = Openapi.Runtime.Path.render ~params:[("userId", user_id)] "/api/v1/users/{userId}/imports/latest" in 11470 let query = "" in 11471 let url = client.base_url ^ url_path ^ query in 11472 let response = 11473 try Requests.get client.session url 11474 with Eio.Io _ as ex -> 11475 let bt = Printexc.get_raw_backtrace () in 11476 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 11477 in 11478 if Requests.Response.ok response then 11479 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11480 else 11481 let body = Requests.Response.text response in 11482 let parsed_body = 11483 match Json.of_string Json.Codec.Value.t body with 11484 | Ok json -> Some (Openapi.Runtime.Json json) 11485 | Error _ -> Some (Openapi.Runtime.Raw body) 11486 in 11487 raise (Openapi.Runtime.Api_error { 11488 operation = op_name; 11489 method_ = "GET"; 11490 url; 11491 status = Requests.Response.status_code response; 11492 body; 11493 parsed_body; 11494 }) 11495 11496 (** Create a synchronization for a video channel *) 11497 let add_video_channel_sync ~body client () = 11498 let op_name = "add_video_channel_sync" in 11499 let url_path = "/api/v1/video-channel-syncs" in 11500 let query = "" in 11501 let url = client.base_url ^ url_path ^ query in 11502 let response = 11503 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string VideoChannelSync.Create.jsont body)) url 11504 with Eio.Io _ as ex -> 11505 let bt = Printexc.get_raw_backtrace () in 11506 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11507 in 11508 if Requests.Response.ok response then 11509 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11510 else 11511 let body = Requests.Response.text response in 11512 let parsed_body = 11513 match Json.of_string Json.Codec.Value.t body with 11514 | Ok json -> Some (Openapi.Runtime.Json json) 11515 | Error _ -> Some (Openapi.Runtime.Raw body) 11516 in 11517 raise (Openapi.Runtime.Api_error { 11518 operation = op_name; 11519 method_ = "POST"; 11520 url; 11521 status = Requests.Response.status_code response; 11522 body; 11523 parsed_body; 11524 }) 11525 11526 (** Delete a video channel synchronization 11527 @param channel_sync_id Channel Sync id 11528 *) 11529 let del_video_channel_sync ~channel_sync_id client () = 11530 let op_name = "del_video_channel_sync" in 11531 let url_path = Openapi.Runtime.Path.render ~params:[("channelSyncId", channel_sync_id)] "/api/v1/video-channel-syncs/{channelSyncId}" in 11532 let query = "" in 11533 let url = client.base_url ^ url_path ^ query in 11534 let response = 11535 try Requests.delete client.session url 11536 with Eio.Io _ as ex -> 11537 let bt = Printexc.get_raw_backtrace () in 11538 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11539 in 11540 if Requests.Response.ok response then 11541 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11542 else 11543 let body = Requests.Response.text response in 11544 let parsed_body = 11545 match Json.of_string Json.Codec.Value.t body with 11546 | Ok json -> Some (Openapi.Runtime.Json json) 11547 | Error _ -> Some (Openapi.Runtime.Raw body) 11548 in 11549 raise (Openapi.Runtime.Api_error { 11550 operation = op_name; 11551 method_ = "DELETE"; 11552 url; 11553 status = Requests.Response.status_code response; 11554 body; 11555 parsed_body; 11556 }) 11557 11558 (** Triggers the channel synchronization job, fetching all the videos from the remote channel 11559 @param channel_sync_id Channel Sync id 11560 *) 11561 let trigger_video_channel_sync ~channel_sync_id client () = 11562 let op_name = "trigger_video_channel_sync" in 11563 let url_path = Openapi.Runtime.Path.render ~params:[("channelSyncId", channel_sync_id)] "/api/v1/video-channel-syncs/{channelSyncId}/sync" in 11564 let query = "" in 11565 let url = client.base_url ^ url_path ^ query in 11566 let response = 11567 try Requests.post client.session url 11568 with Eio.Io _ as ex -> 11569 let bt = Printexc.get_raw_backtrace () in 11570 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11571 in 11572 if Requests.Response.ok response then 11573 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11574 else 11575 let body = Requests.Response.text response in 11576 let parsed_body = 11577 match Json.of_string Json.Codec.Value.t body with 11578 | Ok json -> Some (Openapi.Runtime.Json json) 11579 | Error _ -> Some (Openapi.Runtime.Raw body) 11580 in 11581 raise (Openapi.Runtime.Api_error { 11582 operation = op_name; 11583 method_ = "POST"; 11584 url; 11585 status = Requests.Response.status_code response; 11586 body; 11587 parsed_body; 11588 }) 11589 11590 (** Create a video channel *) 11591 let add_video_channel ~body client () = 11592 let op_name = "add_video_channel" in 11593 let url_path = "/api/v1/video-channels" in 11594 let query = "" in 11595 let url = client.base_url ^ url_path ^ query in 11596 let response = 11597 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string VideoChannel.Create.jsont body)) url 11598 with Eio.Io _ as ex -> 11599 let bt = Printexc.get_raw_backtrace () in 11600 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11601 in 11602 if Requests.Response.ok response then 11603 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11604 else 11605 let body = Requests.Response.text response in 11606 let parsed_body = 11607 match Json.of_string Json.Codec.Value.t body with 11608 | Ok json -> Some (Openapi.Runtime.Json json) 11609 | Error _ -> Some (Openapi.Runtime.Raw body) 11610 in 11611 raise (Openapi.Runtime.Api_error { 11612 operation = op_name; 11613 method_ = "POST"; 11614 url; 11615 status = Requests.Response.status_code response; 11616 body; 11617 parsed_body; 11618 }) 11619 11620 (** Update a video channel 11621 @param channel_handle The video channel handle 11622 *) 11623 let put_video_channel ~channel_handle ~body client () = 11624 let op_name = "put_video_channel" in 11625 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}" in 11626 let query = "" in 11627 let url = client.base_url ^ url_path ^ query in 11628 let response = 11629 try Requests.put client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string VideoChannel.Update.jsont body)) url 11630 with Eio.Io _ as ex -> 11631 let bt = Printexc.get_raw_backtrace () in 11632 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 11633 in 11634 if Requests.Response.ok response then 11635 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11636 else 11637 let body = Requests.Response.text response in 11638 let parsed_body = 11639 match Json.of_string Json.Codec.Value.t body with 11640 | Ok json -> Some (Openapi.Runtime.Json json) 11641 | Error _ -> Some (Openapi.Runtime.Raw body) 11642 in 11643 raise (Openapi.Runtime.Api_error { 11644 operation = op_name; 11645 method_ = "PUT"; 11646 url; 11647 status = Requests.Response.status_code response; 11648 body; 11649 parsed_body; 11650 }) 11651 11652 (** Delete a video channel 11653 @param channel_handle The video channel handle 11654 *) 11655 let del_video_channel ~channel_handle client () = 11656 let op_name = "del_video_channel" in 11657 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}" in 11658 let query = "" in 11659 let url = client.base_url ^ url_path ^ query in 11660 let response = 11661 try Requests.delete client.session url 11662 with Eio.Io _ as ex -> 11663 let bt = Printexc.get_raw_backtrace () in 11664 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11665 in 11666 if Requests.Response.ok response then 11667 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11668 else 11669 let body = Requests.Response.text response in 11670 let parsed_body = 11671 match Json.of_string Json.Codec.Value.t body with 11672 | Ok json -> Some (Openapi.Runtime.Json json) 11673 | Error _ -> Some (Openapi.Runtime.Raw body) 11674 in 11675 raise (Openapi.Runtime.Api_error { 11676 operation = op_name; 11677 method_ = "DELETE"; 11678 url; 11679 status = Requests.Response.status_code response; 11680 body; 11681 parsed_body; 11682 }) 11683 11684 (** Delete channel avatar 11685 @param channel_handle The video channel handle 11686 *) 11687 let delete_api_v1_video_channels_avatar ~channel_handle client () = 11688 let op_name = "delete_api_v1_video_channels_avatar" in 11689 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/avatar" in 11690 let query = "" in 11691 let url = client.base_url ^ url_path ^ query in 11692 let response = 11693 try Requests.delete client.session url 11694 with Eio.Io _ as ex -> 11695 let bt = Printexc.get_raw_backtrace () in 11696 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11697 in 11698 if Requests.Response.ok response then 11699 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11700 else 11701 let body = Requests.Response.text response in 11702 let parsed_body = 11703 match Json.of_string Json.Codec.Value.t body with 11704 | Ok json -> Some (Openapi.Runtime.Json json) 11705 | Error _ -> Some (Openapi.Runtime.Raw body) 11706 in 11707 raise (Openapi.Runtime.Api_error { 11708 operation = op_name; 11709 method_ = "DELETE"; 11710 url; 11711 status = Requests.Response.status_code response; 11712 body; 11713 parsed_body; 11714 }) 11715 11716 (** Update channel avatar 11717 @param channel_handle The video channel handle 11718 *) 11719 let post_api_v1_video_channels_avatar_pick ~channel_handle client () = 11720 let op_name = "post_api_v1_video_channels_avatar_pick" in 11721 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/avatar/pick" in 11722 let query = "" in 11723 let url = client.base_url ^ url_path ^ query in 11724 let response = 11725 try Requests.post client.session url 11726 with Eio.Io _ as ex -> 11727 let bt = Printexc.get_raw_backtrace () in 11728 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11729 in 11730 if Requests.Response.ok response then 11731 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11732 else 11733 let body = Requests.Response.text response in 11734 let parsed_body = 11735 match Json.of_string Json.Codec.Value.t body with 11736 | Ok json -> Some (Openapi.Runtime.Json json) 11737 | Error _ -> Some (Openapi.Runtime.Raw body) 11738 in 11739 raise (Openapi.Runtime.Api_error { 11740 operation = op_name; 11741 method_ = "POST"; 11742 url; 11743 status = Requests.Response.status_code response; 11744 body; 11745 parsed_body; 11746 }) 11747 11748 (** Delete channel banner 11749 @param channel_handle The video channel handle 11750 *) 11751 let delete_api_v1_video_channels_banner ~channel_handle client () = 11752 let op_name = "delete_api_v1_video_channels_banner" in 11753 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/banner" in 11754 let query = "" in 11755 let url = client.base_url ^ url_path ^ query in 11756 let response = 11757 try Requests.delete client.session url 11758 with Eio.Io _ as ex -> 11759 let bt = Printexc.get_raw_backtrace () in 11760 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11761 in 11762 if Requests.Response.ok response then 11763 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11764 else 11765 let body = Requests.Response.text response in 11766 let parsed_body = 11767 match Json.of_string Json.Codec.Value.t body with 11768 | Ok json -> Some (Openapi.Runtime.Json json) 11769 | Error _ -> Some (Openapi.Runtime.Raw body) 11770 in 11771 raise (Openapi.Runtime.Api_error { 11772 operation = op_name; 11773 method_ = "DELETE"; 11774 url; 11775 status = Requests.Response.status_code response; 11776 body; 11777 parsed_body; 11778 }) 11779 11780 (** Update channel banner 11781 @param channel_handle The video channel handle 11782 *) 11783 let post_api_v1_video_channels_banner_pick ~channel_handle client () = 11784 let op_name = "post_api_v1_video_channels_banner_pick" in 11785 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/banner/pick" in 11786 let query = "" in 11787 let url = client.base_url ^ url_path ^ query in 11788 let response = 11789 try Requests.post client.session url 11790 with Eio.Io _ as ex -> 11791 let bt = Printexc.get_raw_backtrace () in 11792 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11793 in 11794 if Requests.Response.ok response then 11795 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11796 else 11797 let body = Requests.Response.text response in 11798 let parsed_body = 11799 match Json.of_string Json.Codec.Value.t body with 11800 | Ok json -> Some (Openapi.Runtime.Json json) 11801 | Error _ -> Some (Openapi.Runtime.Raw body) 11802 in 11803 raise (Openapi.Runtime.Api_error { 11804 operation = op_name; 11805 method_ = "POST"; 11806 url; 11807 status = Requests.Response.status_code response; 11808 body; 11809 parsed_body; 11810 }) 11811 11812 (** *List channel collaborators 11813 11814 **PeerTube >= 8.0** 11815 @param channel_handle The video channel handle 11816 *) 11817 let list_video_channel_collaborators ~channel_handle client () = 11818 let op_name = "list_video_channel_collaborators" in 11819 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/collaborators" in 11820 let query = "" in 11821 let url = client.base_url ^ url_path ^ query in 11822 let response = 11823 try Requests.get client.session url 11824 with Eio.Io _ as ex -> 11825 let bt = Printexc.get_raw_backtrace () in 11826 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 11827 in 11828 if Requests.Response.ok response then 11829 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11830 else 11831 let body = Requests.Response.text response in 11832 let parsed_body = 11833 match Json.of_string Json.Codec.Value.t body with 11834 | Ok json -> Some (Openapi.Runtime.Json json) 11835 | Error _ -> Some (Openapi.Runtime.Raw body) 11836 in 11837 raise (Openapi.Runtime.Api_error { 11838 operation = op_name; 11839 method_ = "GET"; 11840 url; 11841 status = Requests.Response.status_code response; 11842 body; 11843 parsed_body; 11844 }) 11845 11846 (** Invite a collaborator 11847 11848 **PeerTube >= 8.0** Invite a local user to collaborate on the specified video channel. 11849 @param channel_handle The video channel handle 11850 *) 11851 let invite_video_channel_collaborator ~channel_handle client () = 11852 let op_name = "invite_video_channel_collaborator" in 11853 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/collaborators/invite" in 11854 let query = "" in 11855 let url = client.base_url ^ url_path ^ query in 11856 let response = 11857 try Requests.post client.session url 11858 with Eio.Io _ as ex -> 11859 let bt = Printexc.get_raw_backtrace () in 11860 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11861 in 11862 if Requests.Response.ok response then 11863 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11864 else 11865 let body = Requests.Response.text response in 11866 let parsed_body = 11867 match Json.of_string Json.Codec.Value.t body with 11868 | Ok json -> Some (Openapi.Runtime.Json json) 11869 | Error _ -> Some (Openapi.Runtime.Raw body) 11870 in 11871 raise (Openapi.Runtime.Api_error { 11872 operation = op_name; 11873 method_ = "POST"; 11874 url; 11875 status = Requests.Response.status_code response; 11876 body; 11877 parsed_body; 11878 }) 11879 11880 (** Remove a channel collaborator 11881 11882 **PeerTube >= 8.0** Only the channel owner or the collaborator themselves can remove a collaborator from a channel 11883 @param channel_handle The video channel handle 11884 @param collaborator_id The collaborator id 11885 *) 11886 let remove_video_channel_collaborator ~channel_handle ~collaborator_id client () = 11887 let op_name = "remove_video_channel_collaborator" in 11888 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle); ("collaboratorId", collaborator_id)] "/api/v1/video-channels/{channelHandle}/collaborators/{collaboratorId}" in 11889 let query = "" in 11890 let url = client.base_url ^ url_path ^ query in 11891 let response = 11892 try Requests.delete client.session url 11893 with Eio.Io _ as ex -> 11894 let bt = Printexc.get_raw_backtrace () in 11895 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 11896 in 11897 if Requests.Response.ok response then 11898 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11899 else 11900 let body = Requests.Response.text response in 11901 let parsed_body = 11902 match Json.of_string Json.Codec.Value.t body with 11903 | Ok json -> Some (Openapi.Runtime.Json json) 11904 | Error _ -> Some (Openapi.Runtime.Raw body) 11905 in 11906 raise (Openapi.Runtime.Api_error { 11907 operation = op_name; 11908 method_ = "DELETE"; 11909 url; 11910 status = Requests.Response.status_code response; 11911 body; 11912 parsed_body; 11913 }) 11914 11915 (** Accept a collaboration invitation 11916 11917 **PeerTube >= 8.0** 11918 @param channel_handle The video channel handle 11919 @param collaborator_id The collaborator id 11920 *) 11921 let accept_video_channel_collaborator ~channel_handle ~collaborator_id client () = 11922 let op_name = "accept_video_channel_collaborator" in 11923 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle); ("collaboratorId", collaborator_id)] "/api/v1/video-channels/{channelHandle}/collaborators/{collaboratorId}/accept" in 11924 let query = "" in 11925 let url = client.base_url ^ url_path ^ query in 11926 let response = 11927 try Requests.post client.session url 11928 with Eio.Io _ as ex -> 11929 let bt = Printexc.get_raw_backtrace () in 11930 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11931 in 11932 if Requests.Response.ok response then 11933 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11934 else 11935 let body = Requests.Response.text response in 11936 let parsed_body = 11937 match Json.of_string Json.Codec.Value.t body with 11938 | Ok json -> Some (Openapi.Runtime.Json json) 11939 | Error _ -> Some (Openapi.Runtime.Raw body) 11940 in 11941 raise (Openapi.Runtime.Api_error { 11942 operation = op_name; 11943 method_ = "POST"; 11944 url; 11945 status = Requests.Response.status_code response; 11946 body; 11947 parsed_body; 11948 }) 11949 11950 (** Reject a collaboration invitation 11951 11952 **PeerTube >= 8.0** 11953 @param channel_handle The video channel handle 11954 @param collaborator_id The collaborator id 11955 *) 11956 let reject_video_channel_collaborator ~channel_handle ~collaborator_id client () = 11957 let op_name = "reject_video_channel_collaborator" in 11958 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle); ("collaboratorId", collaborator_id)] "/api/v1/video-channels/{channelHandle}/collaborators/{collaboratorId}/reject" in 11959 let query = "" in 11960 let url = client.base_url ^ url_path ^ query in 11961 let response = 11962 try Requests.post client.session url 11963 with Eio.Io _ as ex -> 11964 let bt = Printexc.get_raw_backtrace () in 11965 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 11966 in 11967 if Requests.Response.ok response then 11968 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 11969 else 11970 let body = Requests.Response.text response in 11971 let parsed_body = 11972 match Json.of_string Json.Codec.Value.t body with 11973 | Ok json -> Some (Openapi.Runtime.Json json) 11974 | Error _ -> Some (Openapi.Runtime.Raw body) 11975 in 11976 raise (Openapi.Runtime.Api_error { 11977 operation = op_name; 11978 method_ = "POST"; 11979 url; 11980 status = Requests.Response.status_code response; 11981 body; 11982 parsed_body; 11983 }) 11984 11985 (** List followers of a video channel 11986 @param channel_handle The video channel handle 11987 @param start Offset used to paginate results 11988 @param count Number of items to return 11989 @param sort Sort followers by criteria 11990 @param search Plain text search, applied to various parts of the model depending on endpoint 11991 *) 11992 let get_video_channel_followers ~channel_handle ?start ?count ?sort ?search client () = 11993 let op_name = "get_video_channel_followers" in 11994 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/followers" in 11995 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"search" ~value:search]) in 11996 let url = client.base_url ^ url_path ^ query in 11997 let response = 11998 try Requests.get client.session url 11999 with Eio.Io _ as ex -> 12000 let bt = Printexc.get_raw_backtrace () in 12001 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12002 in 12003 if Requests.Response.ok response then 12004 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12005 else 12006 let body = Requests.Response.text response in 12007 let parsed_body = 12008 match Json.of_string Json.Codec.Value.t body with 12009 | Ok json -> Some (Openapi.Runtime.Json json) 12010 | Error _ -> Some (Openapi.Runtime.Raw body) 12011 in 12012 raise (Openapi.Runtime.Api_error { 12013 operation = op_name; 12014 method_ = "GET"; 12015 url; 12016 status = Requests.Response.status_code response; 12017 body; 12018 parsed_body; 12019 }) 12020 12021 (** Import videos in channel 12022 12023 Import a remote channel/playlist videos into a channel 12024 @param channel_handle The video channel handle 12025 *) 12026 let post_api_v1_video_channels_import_videos ~channel_handle ~body client () = 12027 let op_name = "post_api_v1_video_channels_import_videos" in 12028 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/import-videos" in 12029 let query = "" in 12030 let url = client.base_url ^ url_path ^ query in 12031 let response = 12032 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string ImportVideosInChannel.Create.jsont body)) url 12033 with Eio.Io _ as ex -> 12034 let bt = Printexc.get_raw_backtrace () in 12035 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12036 in 12037 if Requests.Response.ok response then 12038 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12039 else 12040 let body = Requests.Response.text response in 12041 let parsed_body = 12042 match Json.of_string Json.Codec.Value.t body with 12043 | Ok json -> Some (Openapi.Runtime.Json json) 12044 | Error _ -> Some (Openapi.Runtime.Raw body) 12045 in 12046 raise (Openapi.Runtime.Api_error { 12047 operation = op_name; 12048 method_ = "POST"; 12049 url; 12050 status = Requests.Response.status_code response; 12051 body; 12052 parsed_body; 12053 }) 12054 12055 (** List playlists of a channel 12056 @param channel_handle The video channel handle 12057 @param start Offset used to paginate results 12058 @param count Number of items to return 12059 @param sort Sort column 12060 *) 12061 let get_api_v1_video_channels_video_playlists ~channel_handle ?start ?count ?sort ?playlist_type client () = 12062 let op_name = "get_api_v1_video_channels_video_playlists" in 12063 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/video-playlists" in 12064 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"playlistType" ~value:playlist_type]) in 12065 let url = client.base_url ^ url_path ^ query in 12066 let response = 12067 try Requests.get client.session url 12068 with Eio.Io _ as ex -> 12069 let bt = Printexc.get_raw_backtrace () in 12070 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12071 in 12072 if Requests.Response.ok response then 12073 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12074 else 12075 let body = Requests.Response.text response in 12076 let parsed_body = 12077 match Json.of_string Json.Codec.Value.t body with 12078 | Ok json -> Some (Openapi.Runtime.Json json) 12079 | Error _ -> Some (Openapi.Runtime.Raw body) 12080 in 12081 raise (Openapi.Runtime.Api_error { 12082 operation = op_name; 12083 method_ = "GET"; 12084 url; 12085 status = Requests.Response.status_code response; 12086 body; 12087 parsed_body; 12088 }) 12089 12090 (** Reorder channel playlists 12091 @param channel_handle The video channel handle 12092 *) 12093 let reorder_video_playlists_of_channel ~channel_handle client () = 12094 let op_name = "reorder_video_playlists_of_channel" in 12095 let url_path = Openapi.Runtime.Path.render ~params:[("channelHandle", channel_handle)] "/api/v1/video-channels/{channelHandle}/video-playlists/reorder" in 12096 let query = "" in 12097 let url = client.base_url ^ url_path ^ query in 12098 let response = 12099 try Requests.post client.session url 12100 with Eio.Io _ as ex -> 12101 let bt = Printexc.get_raw_backtrace () in 12102 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12103 in 12104 if Requests.Response.ok response then 12105 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12106 else 12107 let body = Requests.Response.text response in 12108 let parsed_body = 12109 match Json.of_string Json.Codec.Value.t body with 12110 | Ok json -> Some (Openapi.Runtime.Json json) 12111 | Error _ -> Some (Openapi.Runtime.Raw body) 12112 in 12113 raise (Openapi.Runtime.Api_error { 12114 operation = op_name; 12115 method_ = "POST"; 12116 url; 12117 status = Requests.Response.status_code response; 12118 body; 12119 parsed_body; 12120 }) 12121 12122 (** List video playlists 12123 @param start Offset used to paginate results 12124 @param count Number of items to return 12125 @param sort Sort column 12126 *) 12127 let get_playlists ?start ?count ?sort ?playlist_type client () = 12128 let op_name = "get_playlists" in 12129 let url_path = "/api/v1/video-playlists" in 12130 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"playlistType" ~value:playlist_type]) in 12131 let url = client.base_url ^ url_path ^ query in 12132 let response = 12133 try Requests.get client.session url 12134 with Eio.Io _ as ex -> 12135 let bt = Printexc.get_raw_backtrace () in 12136 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12137 in 12138 if Requests.Response.ok response then 12139 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12140 else 12141 let body = Requests.Response.text response in 12142 let parsed_body = 12143 match Json.of_string Json.Codec.Value.t body with 12144 | Ok json -> Some (Openapi.Runtime.Json json) 12145 | Error _ -> Some (Openapi.Runtime.Raw body) 12146 in 12147 raise (Openapi.Runtime.Api_error { 12148 operation = op_name; 12149 method_ = "GET"; 12150 url; 12151 status = Requests.Response.status_code response; 12152 body; 12153 parsed_body; 12154 }) 12155 12156 (** Create a video playlist 12157 12158 If the video playlist is set as public, `videoChannelId` is mandatory. *) 12159 let add_playlist client () = 12160 let op_name = "add_playlist" in 12161 let url_path = "/api/v1/video-playlists" in 12162 let query = "" in 12163 let url = client.base_url ^ url_path ^ query in 12164 let response = 12165 try Requests.post client.session url 12166 with Eio.Io _ as ex -> 12167 let bt = Printexc.get_raw_backtrace () in 12168 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12169 in 12170 if Requests.Response.ok response then 12171 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12172 else 12173 let body = Requests.Response.text response in 12174 let parsed_body = 12175 match Json.of_string Json.Codec.Value.t body with 12176 | Ok json -> Some (Openapi.Runtime.Json json) 12177 | Error _ -> Some (Openapi.Runtime.Raw body) 12178 in 12179 raise (Openapi.Runtime.Api_error { 12180 operation = op_name; 12181 method_ = "POST"; 12182 url; 12183 status = Requests.Response.status_code response; 12184 body; 12185 parsed_body; 12186 }) 12187 12188 (** List available playlist privacy policies *) 12189 let get_playlist_privacy_policies client () = 12190 let op_name = "get_playlist_privacy_policies" in 12191 let url_path = "/api/v1/video-playlists/privacies" in 12192 let query = "" in 12193 let url = client.base_url ^ url_path ^ query in 12194 let response = 12195 try Requests.get client.session url 12196 with Eio.Io _ as ex -> 12197 let bt = Printexc.get_raw_backtrace () in 12198 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12199 in 12200 if Requests.Response.ok response then 12201 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12202 else 12203 let body = Requests.Response.text response in 12204 let parsed_body = 12205 match Json.of_string Json.Codec.Value.t body with 12206 | Ok json -> Some (Openapi.Runtime.Json json) 12207 | Error _ -> Some (Openapi.Runtime.Raw body) 12208 in 12209 raise (Openapi.Runtime.Api_error { 12210 operation = op_name; 12211 method_ = "GET"; 12212 url; 12213 status = Requests.Response.status_code response; 12214 body; 12215 parsed_body; 12216 }) 12217 12218 (** Update a video playlist 12219 12220 If the video playlist is set as public, the playlist must have a assigned channel. 12221 @param playlist_id Playlist id 12222 *) 12223 let put_api_v1_video_playlists ~playlist_id client () = 12224 let op_name = "put_api_v1_video_playlists" in 12225 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id)] "/api/v1/video-playlists/{playlistId}" in 12226 let query = "" in 12227 let url = client.base_url ^ url_path ^ query in 12228 let response = 12229 try Requests.put client.session url 12230 with Eio.Io _ as ex -> 12231 let bt = Printexc.get_raw_backtrace () in 12232 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 12233 in 12234 if Requests.Response.ok response then 12235 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12236 else 12237 let body = Requests.Response.text response in 12238 let parsed_body = 12239 match Json.of_string Json.Codec.Value.t body with 12240 | Ok json -> Some (Openapi.Runtime.Json json) 12241 | Error _ -> Some (Openapi.Runtime.Raw body) 12242 in 12243 raise (Openapi.Runtime.Api_error { 12244 operation = op_name; 12245 method_ = "PUT"; 12246 url; 12247 status = Requests.Response.status_code response; 12248 body; 12249 parsed_body; 12250 }) 12251 12252 (** Delete a video playlist 12253 @param playlist_id Playlist id 12254 *) 12255 let delete_api_v1_video_playlists ~playlist_id client () = 12256 let op_name = "delete_api_v1_video_playlists" in 12257 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id)] "/api/v1/video-playlists/{playlistId}" in 12258 let query = "" in 12259 let url = client.base_url ^ url_path ^ query in 12260 let response = 12261 try Requests.delete client.session url 12262 with Eio.Io _ as ex -> 12263 let bt = Printexc.get_raw_backtrace () in 12264 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 12265 in 12266 if Requests.Response.ok response then 12267 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12268 else 12269 let body = Requests.Response.text response in 12270 let parsed_body = 12271 match Json.of_string Json.Codec.Value.t body with 12272 | Ok json -> Some (Openapi.Runtime.Json json) 12273 | Error _ -> Some (Openapi.Runtime.Raw body) 12274 in 12275 raise (Openapi.Runtime.Api_error { 12276 operation = op_name; 12277 method_ = "DELETE"; 12278 url; 12279 status = Requests.Response.status_code response; 12280 body; 12281 parsed_body; 12282 }) 12283 12284 (** List videos of a playlist 12285 @param playlist_id Playlist id 12286 @param start Offset used to paginate results 12287 @param count Number of items to return 12288 *) 12289 let get_video_playlist_videos ~playlist_id ?start ?count client () = 12290 let op_name = "get_video_playlist_videos" in 12291 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id)] "/api/v1/video-playlists/{playlistId}/videos" in 12292 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count]) in 12293 let url = client.base_url ^ url_path ^ query in 12294 let response = 12295 try Requests.get client.session url 12296 with Eio.Io _ as ex -> 12297 let bt = Printexc.get_raw_backtrace () in 12298 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12299 in 12300 if Requests.Response.ok response then 12301 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12302 else 12303 let body = Requests.Response.text response in 12304 let parsed_body = 12305 match Json.of_string Json.Codec.Value.t body with 12306 | Ok json -> Some (Openapi.Runtime.Json json) 12307 | Error _ -> Some (Openapi.Runtime.Raw body) 12308 in 12309 raise (Openapi.Runtime.Api_error { 12310 operation = op_name; 12311 method_ = "GET"; 12312 url; 12313 status = Requests.Response.status_code response; 12314 body; 12315 parsed_body; 12316 }) 12317 12318 (** Add a video in a playlist 12319 @param playlist_id Playlist id 12320 *) 12321 let add_video_playlist_video ~playlist_id client () = 12322 let op_name = "add_video_playlist_video" in 12323 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id)] "/api/v1/video-playlists/{playlistId}/videos" in 12324 let query = "" in 12325 let url = client.base_url ^ url_path ^ query in 12326 let response = 12327 try Requests.post client.session url 12328 with Eio.Io _ as ex -> 12329 let bt = Printexc.get_raw_backtrace () in 12330 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12331 in 12332 if Requests.Response.ok response then 12333 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12334 else 12335 let body = Requests.Response.text response in 12336 let parsed_body = 12337 match Json.of_string Json.Codec.Value.t body with 12338 | Ok json -> Some (Openapi.Runtime.Json json) 12339 | Error _ -> Some (Openapi.Runtime.Raw body) 12340 in 12341 raise (Openapi.Runtime.Api_error { 12342 operation = op_name; 12343 method_ = "POST"; 12344 url; 12345 status = Requests.Response.status_code response; 12346 body; 12347 parsed_body; 12348 }) 12349 12350 (** Reorder playlist elements 12351 @param playlist_id Playlist id 12352 *) 12353 let reorder_video_playlist ~playlist_id client () = 12354 let op_name = "reorder_video_playlist" in 12355 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id)] "/api/v1/video-playlists/{playlistId}/videos/reorder" in 12356 let query = "" in 12357 let url = client.base_url ^ url_path ^ query in 12358 let response = 12359 try Requests.post client.session url 12360 with Eio.Io _ as ex -> 12361 let bt = Printexc.get_raw_backtrace () in 12362 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12363 in 12364 if Requests.Response.ok response then 12365 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12366 else 12367 let body = Requests.Response.text response in 12368 let parsed_body = 12369 match Json.of_string Json.Codec.Value.t body with 12370 | Ok json -> Some (Openapi.Runtime.Json json) 12371 | Error _ -> Some (Openapi.Runtime.Raw body) 12372 in 12373 raise (Openapi.Runtime.Api_error { 12374 operation = op_name; 12375 method_ = "POST"; 12376 url; 12377 status = Requests.Response.status_code response; 12378 body; 12379 parsed_body; 12380 }) 12381 12382 (** Update a playlist element 12383 @param playlist_id Playlist id 12384 @param playlist_element_id Playlist element id 12385 *) 12386 let put_video_playlist_video ~playlist_id ~playlist_element_id client () = 12387 let op_name = "put_video_playlist_video" in 12388 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id); ("playlistElementId", playlist_element_id)] "/api/v1/video-playlists/{playlistId}/videos/{playlistElementId}" in 12389 let query = "" in 12390 let url = client.base_url ^ url_path ^ query in 12391 let response = 12392 try Requests.put client.session url 12393 with Eio.Io _ as ex -> 12394 let bt = Printexc.get_raw_backtrace () in 12395 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 12396 in 12397 if Requests.Response.ok response then 12398 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12399 else 12400 let body = Requests.Response.text response in 12401 let parsed_body = 12402 match Json.of_string Json.Codec.Value.t body with 12403 | Ok json -> Some (Openapi.Runtime.Json json) 12404 | Error _ -> Some (Openapi.Runtime.Raw body) 12405 in 12406 raise (Openapi.Runtime.Api_error { 12407 operation = op_name; 12408 method_ = "PUT"; 12409 url; 12410 status = Requests.Response.status_code response; 12411 body; 12412 parsed_body; 12413 }) 12414 12415 (** Delete an element from a playlist 12416 @param playlist_id Playlist id 12417 @param playlist_element_id Playlist element id 12418 *) 12419 let del_video_playlist_video ~playlist_id ~playlist_element_id client () = 12420 let op_name = "del_video_playlist_video" in 12421 let url_path = Openapi.Runtime.Path.render ~params:[("playlistId", playlist_id); ("playlistElementId", playlist_element_id)] "/api/v1/video-playlists/{playlistId}/videos/{playlistElementId}" in 12422 let query = "" in 12423 let url = client.base_url ^ url_path ^ query in 12424 let response = 12425 try Requests.delete client.session url 12426 with Eio.Io _ as ex -> 12427 let bt = Printexc.get_raw_backtrace () in 12428 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 12429 in 12430 if Requests.Response.ok response then 12431 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12432 else 12433 let body = Requests.Response.text response in 12434 let parsed_body = 12435 match Json.of_string Json.Codec.Value.t body with 12436 | Ok json -> Some (Openapi.Runtime.Json json) 12437 | Error _ -> Some (Openapi.Runtime.Raw body) 12438 in 12439 raise (Openapi.Runtime.Api_error { 12440 operation = op_name; 12441 method_ = "DELETE"; 12442 url; 12443 status = Requests.Response.status_code response; 12444 body; 12445 parsed_body; 12446 }) 12447 12448 (** List video blocks 12449 @param type_ list only blocks that match this type: 12450 - `1`: manual block 12451 - `2`: automatic block that needs review 12452 12453 @param search plain search that will match with video titles, and more 12454 @param start Offset used to paginate results 12455 @param count Number of items to return 12456 @param sort Sort blocklists by criteria 12457 *) 12458 let get_video_blocks ?type_ ?search ?start ?count ?sort client () = 12459 let op_name = "get_video_blocks" in 12460 let url_path = "/api/v1/videos/blacklist" in 12461 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"type" ~value:type_; Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 12462 let url = client.base_url ^ url_path ^ query in 12463 let response = 12464 try Requests.get client.session url 12465 with Eio.Io _ as ex -> 12466 let bt = Printexc.get_raw_backtrace () in 12467 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12468 in 12469 if Requests.Response.ok response then 12470 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12471 else 12472 let body = Requests.Response.text response in 12473 let parsed_body = 12474 match Json.of_string Json.Codec.Value.t body with 12475 | Ok json -> Some (Openapi.Runtime.Json json) 12476 | Error _ -> Some (Openapi.Runtime.Raw body) 12477 in 12478 raise (Openapi.Runtime.Api_error { 12479 operation = op_name; 12480 method_ = "GET"; 12481 url; 12482 status = Requests.Response.status_code response; 12483 body; 12484 parsed_body; 12485 }) 12486 12487 (** List available video categories *) 12488 let get_categories client () = 12489 let op_name = "get_categories" in 12490 let url_path = "/api/v1/videos/categories" in 12491 let query = "" in 12492 let url = client.base_url ^ url_path ^ query in 12493 let response = 12494 try Requests.get client.session url 12495 with Eio.Io _ as ex -> 12496 let bt = Printexc.get_raw_backtrace () in 12497 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12498 in 12499 if Requests.Response.ok response then 12500 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12501 else 12502 let body = Requests.Response.text response in 12503 let parsed_body = 12504 match Json.of_string Json.Codec.Value.t body with 12505 | Ok json -> Some (Openapi.Runtime.Json json) 12506 | Error _ -> Some (Openapi.Runtime.Raw body) 12507 in 12508 raise (Openapi.Runtime.Api_error { 12509 operation = op_name; 12510 method_ = "GET"; 12511 url; 12512 status = Requests.Response.status_code response; 12513 body; 12514 parsed_body; 12515 }) 12516 12517 (** List instance comments 12518 @param search Plain text search, applied to various parts of the model depending on endpoint 12519 @param search_account Filter comments by searching on the account 12520 @param search_video Filter comments by searching on the video 12521 @param video_id Limit results on this specific video 12522 @param video_channel_id Limit results on this specific video channel 12523 @param auto_tag_one_of **PeerTube >= 6.2** filter on comments that contain one of these automatic tags 12524 @param is_local **PeerTube >= 4.0** Display only local or remote objects 12525 @param on_local_video Display only objects of local or remote videos 12526 *) 12527 let get_api_v1_videos_comments ?search ?search_account ?search_video ?video_id ?video_channel_id ?auto_tag_one_of ?is_local ?on_local_video client () = 12528 let op_name = "get_api_v1_videos_comments" in 12529 let url_path = "/api/v1/videos/comments" in 12530 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"searchAccount" ~value:search_account; Openapi.Runtime.Query.optional ~key:"searchVideo" ~value:search_video; Openapi.Runtime.Query.optional ~key:"videoId" ~value:video_id; Openapi.Runtime.Query.optional ~key:"videoChannelId" ~value:video_channel_id; Openapi.Runtime.Query.optional ~key:"autoTagOneOf" ~value:auto_tag_one_of; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"onLocalVideo" ~value:on_local_video]) in 12531 let url = client.base_url ^ url_path ^ query in 12532 let response = 12533 try Requests.get client.session url 12534 with Eio.Io _ as ex -> 12535 let bt = Printexc.get_raw_backtrace () in 12536 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12537 in 12538 if Requests.Response.ok response then 12539 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12540 else 12541 let body = Requests.Response.text response in 12542 let parsed_body = 12543 match Json.of_string Json.Codec.Value.t body with 12544 | Ok json -> Some (Openapi.Runtime.Json json) 12545 | Error _ -> Some (Openapi.Runtime.Raw body) 12546 in 12547 raise (Openapi.Runtime.Api_error { 12548 operation = op_name; 12549 method_ = "GET"; 12550 url; 12551 status = Requests.Response.status_code response; 12552 body; 12553 parsed_body; 12554 }) 12555 12556 (** Delete video import 12557 12558 Delete ended video import 12559 @param id Entity id 12560 *) 12561 let delete_api_v1_videos_imports ~id client () = 12562 let op_name = "delete_api_v1_videos_imports" in 12563 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/imports/{id}" in 12564 let query = "" in 12565 let url = client.base_url ^ url_path ^ query in 12566 let response = 12567 try Requests.delete client.session url 12568 with Eio.Io _ as ex -> 12569 let bt = Printexc.get_raw_backtrace () in 12570 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 12571 in 12572 if Requests.Response.ok response then 12573 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12574 else 12575 let body = Requests.Response.text response in 12576 let parsed_body = 12577 match Json.of_string Json.Codec.Value.t body with 12578 | Ok json -> Some (Openapi.Runtime.Json json) 12579 | Error _ -> Some (Openapi.Runtime.Raw body) 12580 in 12581 raise (Openapi.Runtime.Api_error { 12582 operation = op_name; 12583 method_ = "DELETE"; 12584 url; 12585 status = Requests.Response.status_code response; 12586 body; 12587 parsed_body; 12588 }) 12589 12590 (** Cancel video import 12591 12592 Cancel a pending video import 12593 @param id Entity id 12594 *) 12595 let post_api_v1_videos_imports_cancel ~id client () = 12596 let op_name = "post_api_v1_videos_imports_cancel" in 12597 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/imports/{id}/cancel" in 12598 let query = "" in 12599 let url = client.base_url ^ url_path ^ query in 12600 let response = 12601 try Requests.post client.session url 12602 with Eio.Io _ as ex -> 12603 let bt = Printexc.get_raw_backtrace () in 12604 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12605 in 12606 if Requests.Response.ok response then 12607 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12608 else 12609 let body = Requests.Response.text response in 12610 let parsed_body = 12611 match Json.of_string Json.Codec.Value.t body with 12612 | Ok json -> Some (Openapi.Runtime.Json json) 12613 | Error _ -> Some (Openapi.Runtime.Raw body) 12614 in 12615 raise (Openapi.Runtime.Api_error { 12616 operation = op_name; 12617 method_ = "POST"; 12618 url; 12619 status = Requests.Response.status_code response; 12620 body; 12621 parsed_body; 12622 }) 12623 12624 (** Retry video import 12625 12626 **PeerTube >= 8.0** Retry a pending video import 12627 @param id Entity id 12628 *) 12629 let post_api_v1_videos_imports_retry ~id client () = 12630 let op_name = "post_api_v1_videos_imports_retry" in 12631 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/imports/{id}/retry" in 12632 let query = "" in 12633 let url = client.base_url ^ url_path ^ query in 12634 let response = 12635 try Requests.post client.session url 12636 with Eio.Io _ as ex -> 12637 let bt = Printexc.get_raw_backtrace () in 12638 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12639 in 12640 if Requests.Response.ok response then 12641 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12642 else 12643 let body = Requests.Response.text response in 12644 let parsed_body = 12645 match Json.of_string Json.Codec.Value.t body with 12646 | Ok json -> Some (Openapi.Runtime.Json json) 12647 | Error _ -> Some (Openapi.Runtime.Raw body) 12648 in 12649 raise (Openapi.Runtime.Api_error { 12650 operation = op_name; 12651 method_ = "POST"; 12652 url; 12653 status = Requests.Response.status_code response; 12654 body; 12655 parsed_body; 12656 }) 12657 12658 (** List available video languages *) 12659 let get_languages client () = 12660 let op_name = "get_languages" in 12661 let url_path = "/api/v1/videos/languages" in 12662 let query = "" in 12663 let url = client.base_url ^ url_path ^ query in 12664 let response = 12665 try Requests.get client.session url 12666 with Eio.Io _ as ex -> 12667 let bt = Printexc.get_raw_backtrace () in 12668 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12669 in 12670 if Requests.Response.ok response then 12671 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12672 else 12673 let body = Requests.Response.text response in 12674 let parsed_body = 12675 match Json.of_string Json.Codec.Value.t body with 12676 | Ok json -> Some (Openapi.Runtime.Json json) 12677 | Error _ -> Some (Openapi.Runtime.Raw body) 12678 in 12679 raise (Openapi.Runtime.Api_error { 12680 operation = op_name; 12681 method_ = "GET"; 12682 url; 12683 status = Requests.Response.status_code response; 12684 body; 12685 parsed_body; 12686 }) 12687 12688 (** List available video licences *) 12689 let get_licences client () = 12690 let op_name = "get_licences" in 12691 let url_path = "/api/v1/videos/licences" in 12692 let query = "" in 12693 let url = client.base_url ^ url_path ^ query in 12694 let response = 12695 try Requests.get client.session url 12696 with Eio.Io _ as ex -> 12697 let bt = Printexc.get_raw_backtrace () in 12698 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12699 in 12700 if Requests.Response.ok response then 12701 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12702 else 12703 let body = Requests.Response.text response in 12704 let parsed_body = 12705 match Json.of_string Json.Codec.Value.t body with 12706 | Ok json -> Some (Openapi.Runtime.Json json) 12707 | Error _ -> Some (Openapi.Runtime.Raw body) 12708 in 12709 raise (Openapi.Runtime.Api_error { 12710 operation = op_name; 12711 method_ = "GET"; 12712 url; 12713 status = Requests.Response.status_code response; 12714 body; 12715 parsed_body; 12716 }) 12717 12718 (** Update information about a live 12719 @param id The object id, uuid or short uuid 12720 *) 12721 let update_live_id ~id ~body client () = 12722 let op_name = "update_live_id" in 12723 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/live/{id}" in 12724 let query = "" in 12725 let url = client.base_url ^ url_path ^ query in 12726 let response = 12727 try Requests.put client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string LiveVideo.Update.jsont body)) url 12728 with Eio.Io _ as ex -> 12729 let bt = Printexc.get_raw_backtrace () in 12730 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 12731 in 12732 if Requests.Response.ok response then 12733 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12734 else 12735 let body = Requests.Response.text response in 12736 let parsed_body = 12737 match Json.of_string Json.Codec.Value.t body with 12738 | Ok json -> Some (Openapi.Runtime.Json json) 12739 | Error _ -> Some (Openapi.Runtime.Raw body) 12740 in 12741 raise (Openapi.Runtime.Api_error { 12742 operation = op_name; 12743 method_ = "PUT"; 12744 url; 12745 status = Requests.Response.status_code response; 12746 body; 12747 parsed_body; 12748 }) 12749 12750 (** List live sessions 12751 12752 List all sessions created in a particular live 12753 @param id The object id, uuid or short uuid 12754 @param sort Sort column 12755 *) 12756 let get_api_v1_videos_live_sessions ~id ?sort client () = 12757 let op_name = "get_api_v1_videos_live_sessions" in 12758 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/live/{id}/sessions" in 12759 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 12760 let url = client.base_url ^ url_path ^ query in 12761 let response = 12762 try Requests.get client.session url 12763 with Eio.Io _ as ex -> 12764 let bt = Printexc.get_raw_backtrace () in 12765 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12766 in 12767 if Requests.Response.ok response then 12768 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12769 else 12770 let body = Requests.Response.text response in 12771 let parsed_body = 12772 match Json.of_string Json.Codec.Value.t body with 12773 | Ok json -> Some (Openapi.Runtime.Json json) 12774 | Error _ -> Some (Openapi.Runtime.Raw body) 12775 in 12776 raise (Openapi.Runtime.Api_error { 12777 operation = op_name; 12778 method_ = "GET"; 12779 url; 12780 status = Requests.Response.status_code response; 12781 body; 12782 parsed_body; 12783 }) 12784 12785 (** List video ownership changes *) 12786 let get_api_v1_videos_ownership client () = 12787 let op_name = "get_api_v1_videos_ownership" in 12788 let url_path = "/api/v1/videos/ownership" in 12789 let query = "" in 12790 let url = client.base_url ^ url_path ^ query in 12791 let response = 12792 try Requests.get client.session url 12793 with Eio.Io _ as ex -> 12794 let bt = Printexc.get_raw_backtrace () in 12795 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12796 in 12797 if Requests.Response.ok response then 12798 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12799 else 12800 let body = Requests.Response.text response in 12801 let parsed_body = 12802 match Json.of_string Json.Codec.Value.t body with 12803 | Ok json -> Some (Openapi.Runtime.Json json) 12804 | Error _ -> Some (Openapi.Runtime.Raw body) 12805 in 12806 raise (Openapi.Runtime.Api_error { 12807 operation = op_name; 12808 method_ = "GET"; 12809 url; 12810 status = Requests.Response.status_code response; 12811 body; 12812 parsed_body; 12813 }) 12814 12815 (** Accept ownership change request 12816 @param id The object id, uuid or short uuid 12817 *) 12818 let post_api_v1_videos_ownership_accept ~id client () = 12819 let op_name = "post_api_v1_videos_ownership_accept" in 12820 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/ownership/{id}/accept" in 12821 let query = "" in 12822 let url = client.base_url ^ url_path ^ query in 12823 let response = 12824 try Requests.post client.session url 12825 with Eio.Io _ as ex -> 12826 let bt = Printexc.get_raw_backtrace () in 12827 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12828 in 12829 if Requests.Response.ok response then 12830 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12831 else 12832 let body = Requests.Response.text response in 12833 let parsed_body = 12834 match Json.of_string Json.Codec.Value.t body with 12835 | Ok json -> Some (Openapi.Runtime.Json json) 12836 | Error _ -> Some (Openapi.Runtime.Raw body) 12837 in 12838 raise (Openapi.Runtime.Api_error { 12839 operation = op_name; 12840 method_ = "POST"; 12841 url; 12842 status = Requests.Response.status_code response; 12843 body; 12844 parsed_body; 12845 }) 12846 12847 (** Refuse ownership change request 12848 @param id The object id, uuid or short uuid 12849 *) 12850 let post_api_v1_videos_ownership_refuse ~id client () = 12851 let op_name = "post_api_v1_videos_ownership_refuse" in 12852 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/ownership/{id}/refuse" in 12853 let query = "" in 12854 let url = client.base_url ^ url_path ^ query in 12855 let response = 12856 try Requests.post client.session url 12857 with Eio.Io _ as ex -> 12858 let bt = Printexc.get_raw_backtrace () in 12859 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12860 in 12861 if Requests.Response.ok response then 12862 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12863 else 12864 let body = Requests.Response.text response in 12865 let parsed_body = 12866 match Json.of_string Json.Codec.Value.t body with 12867 | Ok json -> Some (Openapi.Runtime.Json json) 12868 | Error _ -> Some (Openapi.Runtime.Raw body) 12869 in 12870 raise (Openapi.Runtime.Api_error { 12871 operation = op_name; 12872 method_ = "POST"; 12873 url; 12874 status = Requests.Response.status_code response; 12875 body; 12876 parsed_body; 12877 }) 12878 12879 (** List available video privacy policies *) 12880 let get_video_privacy_policies client () = 12881 let op_name = "get_video_privacy_policies" in 12882 let url_path = "/api/v1/videos/privacies" in 12883 let query = "" in 12884 let url = client.base_url ^ url_path ^ query in 12885 let response = 12886 try Requests.get client.session url 12887 with Eio.Io _ as ex -> 12888 let bt = Printexc.get_raw_backtrace () in 12889 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 12890 in 12891 if Requests.Response.ok response then 12892 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12893 else 12894 let body = Requests.Response.text response in 12895 let parsed_body = 12896 match Json.of_string Json.Codec.Value.t body with 12897 | Ok json -> Some (Openapi.Runtime.Json json) 12898 | Error _ -> Some (Openapi.Runtime.Raw body) 12899 in 12900 raise (Openapi.Runtime.Api_error { 12901 operation = op_name; 12902 method_ = "GET"; 12903 url; 12904 status = Requests.Response.status_code response; 12905 body; 12906 parsed_body; 12907 }) 12908 12909 (** Initialize the resumable upload of a video 12910 12911 Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the upload of a video *) 12912 let upload_resumable_init ~body client () = 12913 let op_name = "upload_resumable_init" in 12914 let url_path = "/api/v1/videos/upload-resumable" in 12915 let query = "" in 12916 let url = client.base_url ^ url_path ^ query in 12917 let response = 12918 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string VideoUploadRequestResumable.T.jsont body)) url 12919 with Eio.Io _ as ex -> 12920 let bt = Printexc.get_raw_backtrace () in 12921 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 12922 in 12923 if Requests.Response.ok response then 12924 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12925 else 12926 let body = Requests.Response.text response in 12927 let parsed_body = 12928 match Json.of_string Json.Codec.Value.t body with 12929 | Ok json -> Some (Openapi.Runtime.Json json) 12930 | Error _ -> Some (Openapi.Runtime.Raw body) 12931 in 12932 raise (Openapi.Runtime.Api_error { 12933 operation = op_name; 12934 method_ = "POST"; 12935 url; 12936 status = Requests.Response.status_code response; 12937 body; 12938 parsed_body; 12939 }) 12940 12941 (** Cancel the resumable upload of a video, deleting any data uploaded so far 12942 12943 Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the upload of a video 12944 @param upload_id Created session id to proceed with. If you didn't send chunks in the last hour, it is 12945 not valid anymore and you need to initialize a new upload. 12946 12947 *) 12948 let upload_resumable_cancel ~upload_id client () = 12949 let op_name = "upload_resumable_cancel" in 12950 let url_path = "/api/v1/videos/upload-resumable" in 12951 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"upload_id" ~value:upload_id]) in 12952 let url = client.base_url ^ url_path ^ query in 12953 let response = 12954 try Requests.delete client.session url 12955 with Eio.Io _ as ex -> 12956 let bt = Printexc.get_raw_backtrace () in 12957 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 12958 in 12959 if Requests.Response.ok response then 12960 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12961 else 12962 let body = Requests.Response.text response in 12963 let parsed_body = 12964 match Json.of_string Json.Codec.Value.t body with 12965 | Ok json -> Some (Openapi.Runtime.Json json) 12966 | Error _ -> Some (Openapi.Runtime.Raw body) 12967 in 12968 raise (Openapi.Runtime.Api_error { 12969 operation = op_name; 12970 method_ = "DELETE"; 12971 url; 12972 status = Requests.Response.status_code response; 12973 body; 12974 parsed_body; 12975 }) 12976 12977 (** Update a video 12978 @param id The object id, uuid or short uuid 12979 *) 12980 let put_video ~id client () = 12981 let op_name = "put_video" in 12982 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}" in 12983 let query = "" in 12984 let url = client.base_url ^ url_path ^ query in 12985 let response = 12986 try Requests.put client.session url 12987 with Eio.Io _ as ex -> 12988 let bt = Printexc.get_raw_backtrace () in 12989 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 12990 in 12991 if Requests.Response.ok response then 12992 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 12993 else 12994 let body = Requests.Response.text response in 12995 let parsed_body = 12996 match Json.of_string Json.Codec.Value.t body with 12997 | Ok json -> Some (Openapi.Runtime.Json json) 12998 | Error _ -> Some (Openapi.Runtime.Raw body) 12999 in 13000 raise (Openapi.Runtime.Api_error { 13001 operation = op_name; 13002 method_ = "PUT"; 13003 url; 13004 status = Requests.Response.status_code response; 13005 body; 13006 parsed_body; 13007 }) 13008 13009 (** Delete a video 13010 @param id The object id, uuid or short uuid 13011 *) 13012 let del_video ~id client () = 13013 let op_name = "del_video" in 13014 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}" in 13015 let query = "" in 13016 let url = client.base_url ^ url_path ^ query in 13017 let response = 13018 try Requests.delete client.session url 13019 with Eio.Io _ as ex -> 13020 let bt = Printexc.get_raw_backtrace () in 13021 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13022 in 13023 if Requests.Response.ok response then 13024 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13025 else 13026 let body = Requests.Response.text response in 13027 let parsed_body = 13028 match Json.of_string Json.Codec.Value.t body with 13029 | Ok json -> Some (Openapi.Runtime.Json json) 13030 | Error _ -> Some (Openapi.Runtime.Raw body) 13031 in 13032 raise (Openapi.Runtime.Api_error { 13033 operation = op_name; 13034 method_ = "DELETE"; 13035 url; 13036 status = Requests.Response.status_code response; 13037 body; 13038 parsed_body; 13039 }) 13040 13041 (** Block a video 13042 @param id The object id, uuid or short uuid 13043 *) 13044 let add_video_block ~id client () = 13045 let op_name = "add_video_block" in 13046 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/blacklist" in 13047 let query = "" in 13048 let url = client.base_url ^ url_path ^ query in 13049 let response = 13050 try Requests.post client.session url 13051 with Eio.Io _ as ex -> 13052 let bt = Printexc.get_raw_backtrace () in 13053 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13054 in 13055 if Requests.Response.ok response then 13056 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13057 else 13058 let body = Requests.Response.text response in 13059 let parsed_body = 13060 match Json.of_string Json.Codec.Value.t body with 13061 | Ok json -> Some (Openapi.Runtime.Json json) 13062 | Error _ -> Some (Openapi.Runtime.Raw body) 13063 in 13064 raise (Openapi.Runtime.Api_error { 13065 operation = op_name; 13066 method_ = "POST"; 13067 url; 13068 status = Requests.Response.status_code response; 13069 body; 13070 parsed_body; 13071 }) 13072 13073 (** Unblock a video by its id 13074 @param id The object id, uuid or short uuid 13075 *) 13076 let del_video_block ~id client () = 13077 let op_name = "del_video_block" in 13078 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/blacklist" in 13079 let query = "" in 13080 let url = client.base_url ^ url_path ^ query in 13081 let response = 13082 try Requests.delete client.session url 13083 with Eio.Io _ as ex -> 13084 let bt = Printexc.get_raw_backtrace () in 13085 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13086 in 13087 if Requests.Response.ok response then 13088 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13089 else 13090 let body = Requests.Response.text response in 13091 let parsed_body = 13092 match Json.of_string Json.Codec.Value.t body with 13093 | Ok json -> Some (Openapi.Runtime.Json json) 13094 | Error _ -> Some (Openapi.Runtime.Raw body) 13095 in 13096 raise (Openapi.Runtime.Api_error { 13097 operation = op_name; 13098 method_ = "DELETE"; 13099 url; 13100 status = Requests.Response.status_code response; 13101 body; 13102 parsed_body; 13103 }) 13104 13105 (** List captions of a video 13106 @param id The object id, uuid or short uuid 13107 *) 13108 let get_video_captions ~id client () = 13109 let op_name = "get_video_captions" in 13110 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/captions" in 13111 let query = "" in 13112 let url = client.base_url ^ url_path ^ query in 13113 let response = 13114 try Requests.get client.session url 13115 with Eio.Io _ as ex -> 13116 let bt = Printexc.get_raw_backtrace () in 13117 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 13118 in 13119 if Requests.Response.ok response then 13120 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13121 else 13122 let body = Requests.Response.text response in 13123 let parsed_body = 13124 match Json.of_string Json.Codec.Value.t body with 13125 | Ok json -> Some (Openapi.Runtime.Json json) 13126 | Error _ -> Some (Openapi.Runtime.Raw body) 13127 in 13128 raise (Openapi.Runtime.Api_error { 13129 operation = op_name; 13130 method_ = "GET"; 13131 url; 13132 status = Requests.Response.status_code response; 13133 body; 13134 parsed_body; 13135 }) 13136 13137 (** Generate a video caption 13138 13139 **PeerTube >= 6.2** This feature has to be enabled by the administrator 13140 @param id The object id, uuid or short uuid 13141 *) 13142 let generate_video_caption ~id client () = 13143 let op_name = "generate_video_caption" in 13144 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/captions/generate" in 13145 let query = "" in 13146 let url = client.base_url ^ url_path ^ query in 13147 let response = 13148 try Requests.post client.session url 13149 with Eio.Io _ as ex -> 13150 let bt = Printexc.get_raw_backtrace () in 13151 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13152 in 13153 if Requests.Response.ok response then 13154 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13155 else 13156 let body = Requests.Response.text response in 13157 let parsed_body = 13158 match Json.of_string Json.Codec.Value.t body with 13159 | Ok json -> Some (Openapi.Runtime.Json json) 13160 | Error _ -> Some (Openapi.Runtime.Raw body) 13161 in 13162 raise (Openapi.Runtime.Api_error { 13163 operation = op_name; 13164 method_ = "POST"; 13165 url; 13166 status = Requests.Response.status_code response; 13167 body; 13168 parsed_body; 13169 }) 13170 13171 (** Add or replace a video caption 13172 @param id The object id, uuid or short uuid 13173 @param caption_language The caption language 13174 *) 13175 let add_video_caption ~id ~caption_language client () = 13176 let op_name = "add_video_caption" in 13177 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("captionLanguage", caption_language)] "/api/v1/videos/{id}/captions/{captionLanguage}" in 13178 let query = "" in 13179 let url = client.base_url ^ url_path ^ query in 13180 let response = 13181 try Requests.put client.session url 13182 with Eio.Io _ as ex -> 13183 let bt = Printexc.get_raw_backtrace () in 13184 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 13185 in 13186 if Requests.Response.ok response then 13187 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13188 else 13189 let body = Requests.Response.text response in 13190 let parsed_body = 13191 match Json.of_string Json.Codec.Value.t body with 13192 | Ok json -> Some (Openapi.Runtime.Json json) 13193 | Error _ -> Some (Openapi.Runtime.Raw body) 13194 in 13195 raise (Openapi.Runtime.Api_error { 13196 operation = op_name; 13197 method_ = "PUT"; 13198 url; 13199 status = Requests.Response.status_code response; 13200 body; 13201 parsed_body; 13202 }) 13203 13204 (** Delete a video caption 13205 @param id The object id, uuid or short uuid 13206 @param caption_language The caption language 13207 *) 13208 let del_video_caption ~id ~caption_language client () = 13209 let op_name = "del_video_caption" in 13210 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("captionLanguage", caption_language)] "/api/v1/videos/{id}/captions/{captionLanguage}" in 13211 let query = "" in 13212 let url = client.base_url ^ url_path ^ query in 13213 let response = 13214 try Requests.delete client.session url 13215 with Eio.Io _ as ex -> 13216 let bt = Printexc.get_raw_backtrace () in 13217 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13218 in 13219 if Requests.Response.ok response then 13220 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13221 else 13222 let body = Requests.Response.text response in 13223 let parsed_body = 13224 match Json.of_string Json.Codec.Value.t body with 13225 | Ok json -> Some (Openapi.Runtime.Json json) 13226 | Error _ -> Some (Openapi.Runtime.Raw body) 13227 in 13228 raise (Openapi.Runtime.Api_error { 13229 operation = op_name; 13230 method_ = "DELETE"; 13231 url; 13232 status = Requests.Response.status_code response; 13233 body; 13234 parsed_body; 13235 }) 13236 13237 (** Replace video chapters 13238 13239 **PeerTube >= 6.0** 13240 @param id The object id, uuid or short uuid 13241 *) 13242 let replace_video_chapters ~id client () = 13243 let op_name = "replace_video_chapters" in 13244 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/chapters" in 13245 let query = "" in 13246 let url = client.base_url ^ url_path ^ query in 13247 let response = 13248 try Requests.put client.session url 13249 with Eio.Io _ as ex -> 13250 let bt = Printexc.get_raw_backtrace () in 13251 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 13252 in 13253 if Requests.Response.ok response then 13254 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13255 else 13256 let body = Requests.Response.text response in 13257 let parsed_body = 13258 match Json.of_string Json.Codec.Value.t body with 13259 | Ok json -> Some (Openapi.Runtime.Json json) 13260 | Error _ -> Some (Openapi.Runtime.Raw body) 13261 in 13262 raise (Openapi.Runtime.Api_error { 13263 operation = op_name; 13264 method_ = "PUT"; 13265 url; 13266 status = Requests.Response.status_code response; 13267 body; 13268 parsed_body; 13269 }) 13270 13271 (** Delete a comment or a reply 13272 @param id The object id, uuid or short uuid 13273 @param comment_id The comment id 13274 *) 13275 let delete_api_v1_videos_comments ~id ~comment_id client () = 13276 let op_name = "delete_api_v1_videos_comments" in 13277 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("commentId", comment_id)] "/api/v1/videos/{id}/comments/{commentId}" in 13278 let query = "" in 13279 let url = client.base_url ^ url_path ^ query in 13280 let response = 13281 try Requests.delete client.session url 13282 with Eio.Io _ as ex -> 13283 let bt = Printexc.get_raw_backtrace () in 13284 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13285 in 13286 if Requests.Response.ok response then 13287 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13288 else 13289 let body = Requests.Response.text response in 13290 let parsed_body = 13291 match Json.of_string Json.Codec.Value.t body with 13292 | Ok json -> Some (Openapi.Runtime.Json json) 13293 | Error _ -> Some (Openapi.Runtime.Raw body) 13294 in 13295 raise (Openapi.Runtime.Api_error { 13296 operation = op_name; 13297 method_ = "DELETE"; 13298 url; 13299 status = Requests.Response.status_code response; 13300 body; 13301 parsed_body; 13302 }) 13303 13304 (** Approve a comment 13305 13306 **PeerTube >= 6.2** Approve a comment that requires a review 13307 @param id The object id, uuid or short uuid 13308 @param comment_id The comment id 13309 *) 13310 let post_api_v1_videos_comments_approve ~id ~comment_id client () = 13311 let op_name = "post_api_v1_videos_comments_approve" in 13312 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("commentId", comment_id)] "/api/v1/videos/{id}/comments/{commentId}/approve" in 13313 let query = "" in 13314 let url = client.base_url ^ url_path ^ query in 13315 let response = 13316 try Requests.post client.session url 13317 with Eio.Io _ as ex -> 13318 let bt = Printexc.get_raw_backtrace () in 13319 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13320 in 13321 if Requests.Response.ok response then 13322 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13323 else 13324 let body = Requests.Response.text response in 13325 let parsed_body = 13326 match Json.of_string Json.Codec.Value.t body with 13327 | Ok json -> Some (Openapi.Runtime.Json json) 13328 | Error _ -> Some (Openapi.Runtime.Raw body) 13329 in 13330 raise (Openapi.Runtime.Api_error { 13331 operation = op_name; 13332 method_ = "POST"; 13333 url; 13334 status = Requests.Response.status_code response; 13335 body; 13336 parsed_body; 13337 }) 13338 13339 (** Get complete video description 13340 @param id The object id, uuid or short uuid 13341 *) 13342 let get_video_desc ~id client () = 13343 let op_name = "get_video_desc" in 13344 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/description" in 13345 let query = "" in 13346 let url = client.base_url ^ url_path ^ query in 13347 let response = 13348 try Requests.get client.session url 13349 with Eio.Io _ as ex -> 13350 let bt = Printexc.get_raw_backtrace () in 13351 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 13352 in 13353 if Requests.Response.ok response then 13354 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13355 else 13356 let body = Requests.Response.text response in 13357 let parsed_body = 13358 match Json.of_string Json.Codec.Value.t body with 13359 | Ok json -> Some (Openapi.Runtime.Json json) 13360 | Error _ -> Some (Openapi.Runtime.Raw body) 13361 in 13362 raise (Openapi.Runtime.Api_error { 13363 operation = op_name; 13364 method_ = "GET"; 13365 url; 13366 status = Requests.Response.status_code response; 13367 body; 13368 parsed_body; 13369 }) 13370 13371 (** Request ownership change 13372 @param id The object id, uuid or short uuid 13373 *) 13374 let post_api_v1_videos_give_ownership ~id client () = 13375 let op_name = "post_api_v1_videos_give_ownership" in 13376 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/give-ownership" in 13377 let query = "" in 13378 let url = client.base_url ^ url_path ^ query in 13379 let response = 13380 try Requests.post client.session url 13381 with Eio.Io _ as ex -> 13382 let bt = Printexc.get_raw_backtrace () in 13383 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13384 in 13385 if Requests.Response.ok response then 13386 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13387 else 13388 let body = Requests.Response.text response in 13389 let parsed_body = 13390 match Json.of_string Json.Codec.Value.t body with 13391 | Ok json -> Some (Openapi.Runtime.Json json) 13392 | Error _ -> Some (Openapi.Runtime.Raw body) 13393 in 13394 raise (Openapi.Runtime.Api_error { 13395 operation = op_name; 13396 method_ = "POST"; 13397 url; 13398 status = Requests.Response.status_code response; 13399 body; 13400 parsed_body; 13401 }) 13402 13403 (** Delete video HLS files 13404 @param id The object id, uuid or short uuid 13405 *) 13406 let del_video_hls ~id client () = 13407 let op_name = "del_video_hls" in 13408 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/hls" in 13409 let query = "" in 13410 let url = client.base_url ^ url_path ^ query in 13411 let response = 13412 try Requests.delete client.session url 13413 with Eio.Io _ as ex -> 13414 let bt = Printexc.get_raw_backtrace () in 13415 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13416 in 13417 if Requests.Response.ok response then 13418 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13419 else 13420 let body = Requests.Response.text response in 13421 let parsed_body = 13422 match Json.of_string Json.Codec.Value.t body with 13423 | Ok json -> Some (Openapi.Runtime.Json json) 13424 | Error _ -> Some (Openapi.Runtime.Raw body) 13425 in 13426 raise (Openapi.Runtime.Api_error { 13427 operation = op_name; 13428 method_ = "DELETE"; 13429 url; 13430 status = Requests.Response.status_code response; 13431 body; 13432 parsed_body; 13433 }) 13434 13435 (** List video passwords 13436 13437 **PeerTube >= 6.0** 13438 @param id The object id, uuid or short uuid 13439 @param start Offset used to paginate results 13440 @param count Number of items to return 13441 @param sort Sort column 13442 *) 13443 let list_video_passwords ~id ?start ?count ?sort client () = 13444 let op_name = "list_video_passwords" in 13445 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/passwords" in 13446 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 13447 let url = client.base_url ^ url_path ^ query in 13448 let response = 13449 try Requests.get client.session url 13450 with Eio.Io _ as ex -> 13451 let bt = Printexc.get_raw_backtrace () in 13452 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 13453 in 13454 if Requests.Response.ok response then 13455 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13456 else 13457 let body = Requests.Response.text response in 13458 let parsed_body = 13459 match Json.of_string Json.Codec.Value.t body with 13460 | Ok json -> Some (Openapi.Runtime.Json json) 13461 | Error _ -> Some (Openapi.Runtime.Raw body) 13462 in 13463 raise (Openapi.Runtime.Api_error { 13464 operation = op_name; 13465 method_ = "GET"; 13466 url; 13467 status = Requests.Response.status_code response; 13468 body; 13469 parsed_body; 13470 }) 13471 13472 (** Add a video password 13473 13474 **PeerTube >= 8.0** 13475 @param id The object id, uuid or short uuid 13476 *) 13477 let add_video_password ~id client () = 13478 let op_name = "add_video_password" in 13479 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/passwords" in 13480 let query = "" in 13481 let url = client.base_url ^ url_path ^ query in 13482 let response = 13483 try Requests.post client.session url 13484 with Eio.Io _ as ex -> 13485 let bt = Printexc.get_raw_backtrace () in 13486 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13487 in 13488 if Requests.Response.ok response then 13489 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13490 else 13491 let body = Requests.Response.text response in 13492 let parsed_body = 13493 match Json.of_string Json.Codec.Value.t body with 13494 | Ok json -> Some (Openapi.Runtime.Json json) 13495 | Error _ -> Some (Openapi.Runtime.Raw body) 13496 in 13497 raise (Openapi.Runtime.Api_error { 13498 operation = op_name; 13499 method_ = "POST"; 13500 url; 13501 status = Requests.Response.status_code response; 13502 body; 13503 parsed_body; 13504 }) 13505 13506 (** Update video passwords 13507 13508 **PeerTube >= 6.0** 13509 @param id The object id, uuid or short uuid 13510 *) 13511 let update_video_password_list ~id client () = 13512 let op_name = "update_video_password_list" in 13513 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/passwords" in 13514 let query = "" in 13515 let url = client.base_url ^ url_path ^ query in 13516 let response = 13517 try Requests.put client.session url 13518 with Eio.Io _ as ex -> 13519 let bt = Printexc.get_raw_backtrace () in 13520 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 13521 in 13522 if Requests.Response.ok response then 13523 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13524 else 13525 let body = Requests.Response.text response in 13526 let parsed_body = 13527 match Json.of_string Json.Codec.Value.t body with 13528 | Ok json -> Some (Openapi.Runtime.Json json) 13529 | Error _ -> Some (Openapi.Runtime.Raw body) 13530 in 13531 raise (Openapi.Runtime.Api_error { 13532 operation = op_name; 13533 method_ = "PUT"; 13534 url; 13535 status = Requests.Response.status_code response; 13536 body; 13537 parsed_body; 13538 }) 13539 13540 (** Delete a video password 13541 13542 **PeerTube >= 6.0** 13543 @param id The object id, uuid or short uuid 13544 @param video_password_id The video password id 13545 *) 13546 let remove_video_password ~id ~video_password_id client () = 13547 let op_name = "remove_video_password" in 13548 let url_path = Openapi.Runtime.Path.render ~params:[("id", id); ("videoPasswordId", video_password_id)] "/api/v1/videos/{id}/passwords/{videoPasswordId}" in 13549 let query = "" in 13550 let url = client.base_url ^ url_path ^ query in 13551 let response = 13552 try Requests.delete client.session url 13553 with Eio.Io _ as ex -> 13554 let bt = Printexc.get_raw_backtrace () in 13555 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13556 in 13557 if Requests.Response.ok response then 13558 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13559 else 13560 let body = Requests.Response.text response in 13561 let parsed_body = 13562 match Json.of_string Json.Codec.Value.t body with 13563 | Ok json -> Some (Openapi.Runtime.Json json) 13564 | Error _ -> Some (Openapi.Runtime.Raw body) 13565 in 13566 raise (Openapi.Runtime.Api_error { 13567 operation = op_name; 13568 method_ = "DELETE"; 13569 url; 13570 status = Requests.Response.status_code response; 13571 body; 13572 parsed_body; 13573 }) 13574 13575 (** Like/dislike a video 13576 @param id The object id, uuid or short uuid 13577 *) 13578 let put_api_v1_videos_rate ~id client () = 13579 let op_name = "put_api_v1_videos_rate" in 13580 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/rate" in 13581 let query = "" in 13582 let url = client.base_url ^ url_path ^ query in 13583 let response = 13584 try Requests.put client.session url 13585 with Eio.Io _ as ex -> 13586 let bt = Printexc.get_raw_backtrace () in 13587 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 13588 in 13589 if Requests.Response.ok response then 13590 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13591 else 13592 let body = Requests.Response.text response in 13593 let parsed_body = 13594 match Json.of_string Json.Codec.Value.t body with 13595 | Ok json -> Some (Openapi.Runtime.Json json) 13596 | Error _ -> Some (Openapi.Runtime.Raw body) 13597 in 13598 raise (Openapi.Runtime.Api_error { 13599 operation = op_name; 13600 method_ = "PUT"; 13601 url; 13602 status = Requests.Response.status_code response; 13603 body; 13604 parsed_body; 13605 }) 13606 13607 (** Delete video source file 13608 @param id The object id, uuid or short uuid 13609 *) 13610 let delete_video_source_file ~id client () = 13611 let op_name = "delete_video_source_file" in 13612 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/source/file" in 13613 let query = "" in 13614 let url = client.base_url ^ url_path ^ query in 13615 let response = 13616 try Requests.delete client.session url 13617 with Eio.Io _ as ex -> 13618 let bt = Printexc.get_raw_backtrace () in 13619 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13620 in 13621 if Requests.Response.ok response then 13622 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13623 else 13624 let body = Requests.Response.text response in 13625 let parsed_body = 13626 match Json.of_string Json.Codec.Value.t body with 13627 | Ok json -> Some (Openapi.Runtime.Json json) 13628 | Error _ -> Some (Openapi.Runtime.Raw body) 13629 in 13630 raise (Openapi.Runtime.Api_error { 13631 operation = op_name; 13632 method_ = "DELETE"; 13633 url; 13634 status = Requests.Response.status_code response; 13635 body; 13636 parsed_body; 13637 }) 13638 13639 (** Initialize the resumable replacement of a video 13640 13641 **PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to initialize the replacement of a video 13642 @param id The object id, uuid or short uuid 13643 *) 13644 let replace_video_source_resumable_init ~id ~body client () = 13645 let op_name = "replace_video_source_resumable_init" in 13646 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/source/replace-resumable" in 13647 let query = "" in 13648 let url = client.base_url ^ url_path ^ query in 13649 let response = 13650 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string VideoReplaceSourceRequestResumable.T.jsont body)) url 13651 with Eio.Io _ as ex -> 13652 let bt = Printexc.get_raw_backtrace () in 13653 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13654 in 13655 if Requests.Response.ok response then 13656 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13657 else 13658 let body = Requests.Response.text response in 13659 let parsed_body = 13660 match Json.of_string Json.Codec.Value.t body with 13661 | Ok json -> Some (Openapi.Runtime.Json json) 13662 | Error _ -> Some (Openapi.Runtime.Raw body) 13663 in 13664 raise (Openapi.Runtime.Api_error { 13665 operation = op_name; 13666 method_ = "POST"; 13667 url; 13668 status = Requests.Response.status_code response; 13669 body; 13670 parsed_body; 13671 }) 13672 13673 (** Send chunk for the resumable replacement of a video 13674 13675 **PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to continue, pause or resume the replacement of a video 13676 @param id The object id, uuid or short uuid 13677 @param upload_id Created session id to proceed with. If you didn't send chunks in the last hour, it is 13678 not valid anymore and you need to initialize a new upload. 13679 13680 *) 13681 let replace_video_source_resumable ~id ~upload_id client () = 13682 let op_name = "replace_video_source_resumable" in 13683 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/source/replace-resumable" in 13684 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"upload_id" ~value:upload_id]) in 13685 let url = client.base_url ^ url_path ^ query in 13686 let response = 13687 try Requests.put client.session url 13688 with Eio.Io _ as ex -> 13689 let bt = Printexc.get_raw_backtrace () in 13690 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 13691 in 13692 if Requests.Response.ok response then 13693 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13694 else 13695 let body = Requests.Response.text response in 13696 let parsed_body = 13697 match Json.of_string Json.Codec.Value.t body with 13698 | Ok json -> Some (Openapi.Runtime.Json json) 13699 | Error _ -> Some (Openapi.Runtime.Raw body) 13700 in 13701 raise (Openapi.Runtime.Api_error { 13702 operation = op_name; 13703 method_ = "PUT"; 13704 url; 13705 status = Requests.Response.status_code response; 13706 body; 13707 parsed_body; 13708 }) 13709 13710 (** Cancel the resumable replacement of a video 13711 13712 **PeerTube >= 6.0** Uses [a resumable protocol](https://github.com/kukhariev/node-uploadx/blob/master/proto.md) to cancel the replacement of a video 13713 @param id The object id, uuid or short uuid 13714 @param upload_id Created session id to proceed with. If you didn't send chunks in the last hour, it is 13715 not valid anymore and you need to initialize a new upload. 13716 13717 *) 13718 let replace_video_source_resumable_cancel ~id ~upload_id client () = 13719 let op_name = "replace_video_source_resumable_cancel" in 13720 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/source/replace-resumable" in 13721 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"upload_id" ~value:upload_id]) in 13722 let url = client.base_url ^ url_path ^ query in 13723 let response = 13724 try Requests.delete client.session url 13725 with Eio.Io _ as ex -> 13726 let bt = Printexc.get_raw_backtrace () in 13727 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13728 in 13729 if Requests.Response.ok response then 13730 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13731 else 13732 let body = Requests.Response.text response in 13733 let parsed_body = 13734 match Json.of_string Json.Codec.Value.t body with 13735 | Ok json -> Some (Openapi.Runtime.Json json) 13736 | Error _ -> Some (Openapi.Runtime.Raw body) 13737 in 13738 raise (Openapi.Runtime.Api_error { 13739 operation = op_name; 13740 method_ = "DELETE"; 13741 url; 13742 status = Requests.Response.status_code response; 13743 body; 13744 parsed_body; 13745 }) 13746 13747 (** List storyboards of a video 13748 13749 **PeerTube >= 6.0** 13750 @param id The object id, uuid or short uuid 13751 *) 13752 let list_video_storyboards ~id client () = 13753 let op_name = "list_video_storyboards" in 13754 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/storyboards" in 13755 let query = "" in 13756 let url = client.base_url ^ url_path ^ query in 13757 let response = 13758 try Requests.get client.session url 13759 with Eio.Io _ as ex -> 13760 let bt = Printexc.get_raw_backtrace () in 13761 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 13762 in 13763 if Requests.Response.ok response then 13764 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13765 else 13766 let body = Requests.Response.text response in 13767 let parsed_body = 13768 match Json.of_string Json.Codec.Value.t body with 13769 | Ok json -> Some (Openapi.Runtime.Json json) 13770 | Error _ -> Some (Openapi.Runtime.Raw body) 13771 in 13772 raise (Openapi.Runtime.Api_error { 13773 operation = op_name; 13774 method_ = "GET"; 13775 url; 13776 status = Requests.Response.status_code response; 13777 body; 13778 parsed_body; 13779 }) 13780 13781 (** Create a studio task 13782 13783 Create a task to edit a video (cut, add intro/outro etc) 13784 @param id The object id, uuid or short uuid 13785 *) 13786 let post_api_v1_videos_studio_edit ~id client () = 13787 let op_name = "post_api_v1_videos_studio_edit" in 13788 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/studio/edit" in 13789 let query = "" in 13790 let url = client.base_url ^ url_path ^ query in 13791 let response = 13792 try Requests.post client.session url 13793 with Eio.Io _ as ex -> 13794 let bt = Printexc.get_raw_backtrace () in 13795 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13796 in 13797 if Requests.Response.ok response then 13798 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13799 else 13800 let body = Requests.Response.text response in 13801 let parsed_body = 13802 match Json.of_string Json.Codec.Value.t body with 13803 | Ok json -> Some (Openapi.Runtime.Json json) 13804 | Error _ -> Some (Openapi.Runtime.Raw body) 13805 in 13806 raise (Openapi.Runtime.Api_error { 13807 operation = op_name; 13808 method_ = "POST"; 13809 url; 13810 status = Requests.Response.status_code response; 13811 body; 13812 parsed_body; 13813 }) 13814 13815 (** Create a transcoding job 13816 @param id The object id, uuid or short uuid 13817 *) 13818 let create_video_transcoding ~id client () = 13819 let op_name = "create_video_transcoding" in 13820 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/transcoding" in 13821 let query = "" in 13822 let url = client.base_url ^ url_path ^ query in 13823 let response = 13824 try Requests.post client.session url 13825 with Eio.Io _ as ex -> 13826 let bt = Printexc.get_raw_backtrace () in 13827 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13828 in 13829 if Requests.Response.ok response then 13830 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13831 else 13832 let body = Requests.Response.text response in 13833 let parsed_body = 13834 match Json.of_string Json.Codec.Value.t body with 13835 | Ok json -> Some (Openapi.Runtime.Json json) 13836 | Error _ -> Some (Openapi.Runtime.Raw body) 13837 in 13838 raise (Openapi.Runtime.Api_error { 13839 operation = op_name; 13840 method_ = "POST"; 13841 url; 13842 status = Requests.Response.status_code response; 13843 body; 13844 parsed_body; 13845 }) 13846 13847 (** Notify user is watching a video 13848 13849 Call this endpoint regularly (every 5-10 seconds for example) to notify the server the user is watching the video. After a while, PeerTube will increase video's viewers counter. If the user is authenticated, PeerTube will also store the current player time. 13850 @param id The object id, uuid or short uuid 13851 *) 13852 let add_view ~id ~body client () = 13853 let op_name = "add_view" in 13854 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/views" in 13855 let query = "" in 13856 let url = client.base_url ^ url_path ^ query in 13857 let response = 13858 try Requests.post client.session ~body:(Requests.Body.of_string Requests.Mime.json (Openapi.Runtime.Json.encode_json_string UserViewingVideo.T.jsont body)) url 13859 with Eio.Io _ as ex -> 13860 let bt = Printexc.get_raw_backtrace () in 13861 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13862 in 13863 if Requests.Response.ok response then 13864 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13865 else 13866 let body = Requests.Response.text response in 13867 let parsed_body = 13868 match Json.of_string Json.Codec.Value.t body with 13869 | Ok json -> Some (Openapi.Runtime.Json json) 13870 | Error _ -> Some (Openapi.Runtime.Raw body) 13871 in 13872 raise (Openapi.Runtime.Api_error { 13873 operation = op_name; 13874 method_ = "POST"; 13875 url; 13876 status = Requests.Response.status_code response; 13877 body; 13878 parsed_body; 13879 }) 13880 13881 (** Delete video Web Video files 13882 13883 **PeerTube >= 6.0** 13884 @param id The object id, uuid or short uuid 13885 *) 13886 let del_video_web_videos ~id client () = 13887 let op_name = "del_video_web_videos" in 13888 let url_path = Openapi.Runtime.Path.render ~params:[("id", id)] "/api/v1/videos/{id}/web-videos" in 13889 let query = "" in 13890 let url = client.base_url ^ url_path ^ query in 13891 let response = 13892 try Requests.delete client.session url 13893 with Eio.Io _ as ex -> 13894 let bt = Printexc.get_raw_backtrace () in 13895 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 13896 in 13897 if Requests.Response.ok response then 13898 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13899 else 13900 let body = Requests.Response.text response in 13901 let parsed_body = 13902 match Json.of_string Json.Codec.Value.t body with 13903 | Ok json -> Some (Openapi.Runtime.Json json) 13904 | Error _ -> Some (Openapi.Runtime.Raw body) 13905 in 13906 raise (Openapi.Runtime.Api_error { 13907 operation = op_name; 13908 method_ = "DELETE"; 13909 url; 13910 status = Requests.Response.status_code response; 13911 body; 13912 parsed_body; 13913 }) 13914 13915 (** List account watched words 13916 13917 **PeerTube >= 6.2** 13918 @param account_name account name to list watched words 13919 *) 13920 let get_api_v1_watched_words_accounts_lists ~account_name client () = 13921 let op_name = "get_api_v1_watched_words_accounts_lists" in 13922 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name)] "/api/v1/watched-words/accounts/{accountName}/lists" in 13923 let query = "" in 13924 let url = client.base_url ^ url_path ^ query in 13925 let response = 13926 try Requests.get client.session url 13927 with Eio.Io _ as ex -> 13928 let bt = Printexc.get_raw_backtrace () in 13929 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 13930 in 13931 if Requests.Response.ok response then 13932 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13933 else 13934 let body = Requests.Response.text response in 13935 let parsed_body = 13936 match Json.of_string Json.Codec.Value.t body with 13937 | Ok json -> Some (Openapi.Runtime.Json json) 13938 | Error _ -> Some (Openapi.Runtime.Raw body) 13939 in 13940 raise (Openapi.Runtime.Api_error { 13941 operation = op_name; 13942 method_ = "GET"; 13943 url; 13944 status = Requests.Response.status_code response; 13945 body; 13946 parsed_body; 13947 }) 13948 13949 (** Add account watched words 13950 13951 **PeerTube >= 6.2** *) 13952 let post_api_v1_watched_words_accounts_lists ~account_name client () = 13953 let op_name = "post_api_v1_watched_words_accounts_lists" in 13954 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name)] "/api/v1/watched-words/accounts/{accountName}/lists" in 13955 let query = "" in 13956 let url = client.base_url ^ url_path ^ query in 13957 let response = 13958 try Requests.post client.session url 13959 with Eio.Io _ as ex -> 13960 let bt = Printexc.get_raw_backtrace () in 13961 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 13962 in 13963 if Requests.Response.ok response then 13964 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13965 else 13966 let body = Requests.Response.text response in 13967 let parsed_body = 13968 match Json.of_string Json.Codec.Value.t body with 13969 | Ok json -> Some (Openapi.Runtime.Json json) 13970 | Error _ -> Some (Openapi.Runtime.Raw body) 13971 in 13972 raise (Openapi.Runtime.Api_error { 13973 operation = op_name; 13974 method_ = "POST"; 13975 url; 13976 status = Requests.Response.status_code response; 13977 body; 13978 parsed_body; 13979 }) 13980 13981 (** Update account watched words 13982 13983 **PeerTube >= 6.2** 13984 @param list_id list of watched words to update 13985 *) 13986 let put_api_v1_watched_words_accounts_lists ~account_name ~list_id client () = 13987 let op_name = "put_api_v1_watched_words_accounts_lists" in 13988 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name); ("listId", list_id)] "/api/v1/watched-words/accounts/{accountName}/lists/{listId}" in 13989 let query = "" in 13990 let url = client.base_url ^ url_path ^ query in 13991 let response = 13992 try Requests.put client.session url 13993 with Eio.Io _ as ex -> 13994 let bt = Printexc.get_raw_backtrace () in 13995 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 13996 in 13997 if Requests.Response.ok response then 13998 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 13999 else 14000 let body = Requests.Response.text response in 14001 let parsed_body = 14002 match Json.of_string Json.Codec.Value.t body with 14003 | Ok json -> Some (Openapi.Runtime.Json json) 14004 | Error _ -> Some (Openapi.Runtime.Raw body) 14005 in 14006 raise (Openapi.Runtime.Api_error { 14007 operation = op_name; 14008 method_ = "PUT"; 14009 url; 14010 status = Requests.Response.status_code response; 14011 body; 14012 parsed_body; 14013 }) 14014 14015 (** Delete account watched words 14016 14017 **PeerTube >= 6.2** 14018 @param list_id list of watched words to delete 14019 *) 14020 let delete_api_v1_watched_words_accounts_lists ~account_name ~list_id client () = 14021 let op_name = "delete_api_v1_watched_words_accounts_lists" in 14022 let url_path = Openapi.Runtime.Path.render ~params:[("accountName", account_name); ("listId", list_id)] "/api/v1/watched-words/accounts/{accountName}/lists/{listId}" in 14023 let query = "" in 14024 let url = client.base_url ^ url_path ^ query in 14025 let response = 14026 try Requests.delete client.session url 14027 with Eio.Io _ as ex -> 14028 let bt = Printexc.get_raw_backtrace () in 14029 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 14030 in 14031 if Requests.Response.ok response then 14032 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14033 else 14034 let body = Requests.Response.text response in 14035 let parsed_body = 14036 match Json.of_string Json.Codec.Value.t body with 14037 | Ok json -> Some (Openapi.Runtime.Json json) 14038 | Error _ -> Some (Openapi.Runtime.Raw body) 14039 in 14040 raise (Openapi.Runtime.Api_error { 14041 operation = op_name; 14042 method_ = "DELETE"; 14043 url; 14044 status = Requests.Response.status_code response; 14045 body; 14046 parsed_body; 14047 }) 14048 14049 (** List server watched words 14050 14051 **PeerTube >= 6.2** *) 14052 let get_api_v1_watched_words_server_lists client () = 14053 let op_name = "get_api_v1_watched_words_server_lists" in 14054 let url_path = "/api/v1/watched-words/server/lists" in 14055 let query = "" in 14056 let url = client.base_url ^ url_path ^ query in 14057 let response = 14058 try Requests.get client.session url 14059 with Eio.Io _ as ex -> 14060 let bt = Printexc.get_raw_backtrace () in 14061 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14062 in 14063 if Requests.Response.ok response then 14064 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14065 else 14066 let body = Requests.Response.text response in 14067 let parsed_body = 14068 match Json.of_string Json.Codec.Value.t body with 14069 | Ok json -> Some (Openapi.Runtime.Json json) 14070 | Error _ -> Some (Openapi.Runtime.Raw body) 14071 in 14072 raise (Openapi.Runtime.Api_error { 14073 operation = op_name; 14074 method_ = "GET"; 14075 url; 14076 status = Requests.Response.status_code response; 14077 body; 14078 parsed_body; 14079 }) 14080 14081 (** Add server watched words 14082 14083 **PeerTube >= 6.2** *) 14084 let post_api_v1_watched_words_server_lists client () = 14085 let op_name = "post_api_v1_watched_words_server_lists" in 14086 let url_path = "/api/v1/watched-words/server/lists" in 14087 let query = "" in 14088 let url = client.base_url ^ url_path ^ query in 14089 let response = 14090 try Requests.post client.session url 14091 with Eio.Io _ as ex -> 14092 let bt = Printexc.get_raw_backtrace () in 14093 Eio.Exn.reraise_with_context ex bt "calling %s %s" "POST" url 14094 in 14095 if Requests.Response.ok response then 14096 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14097 else 14098 let body = Requests.Response.text response in 14099 let parsed_body = 14100 match Json.of_string Json.Codec.Value.t body with 14101 | Ok json -> Some (Openapi.Runtime.Json json) 14102 | Error _ -> Some (Openapi.Runtime.Raw body) 14103 in 14104 raise (Openapi.Runtime.Api_error { 14105 operation = op_name; 14106 method_ = "POST"; 14107 url; 14108 status = Requests.Response.status_code response; 14109 body; 14110 parsed_body; 14111 }) 14112 14113 (** Update server watched words 14114 14115 **PeerTube >= 6.2** 14116 @param list_id list of watched words to update 14117 *) 14118 let put_api_v1_watched_words_server_lists ~list_id client () = 14119 let op_name = "put_api_v1_watched_words_server_lists" in 14120 let url_path = Openapi.Runtime.Path.render ~params:[("listId", list_id)] "/api/v1/watched-words/server/lists/{listId}" in 14121 let query = "" in 14122 let url = client.base_url ^ url_path ^ query in 14123 let response = 14124 try Requests.put client.session url 14125 with Eio.Io _ as ex -> 14126 let bt = Printexc.get_raw_backtrace () in 14127 Eio.Exn.reraise_with_context ex bt "calling %s %s" "PUT" url 14128 in 14129 if Requests.Response.ok response then 14130 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14131 else 14132 let body = Requests.Response.text response in 14133 let parsed_body = 14134 match Json.of_string Json.Codec.Value.t body with 14135 | Ok json -> Some (Openapi.Runtime.Json json) 14136 | Error _ -> Some (Openapi.Runtime.Raw body) 14137 in 14138 raise (Openapi.Runtime.Api_error { 14139 operation = op_name; 14140 method_ = "PUT"; 14141 url; 14142 status = Requests.Response.status_code response; 14143 body; 14144 parsed_body; 14145 }) 14146 14147 (** Delete server watched words 14148 14149 **PeerTube >= 6.2** 14150 @param list_id list of watched words to delete 14151 *) 14152 let delete_api_v1_watched_words_server_lists ~list_id client () = 14153 let op_name = "delete_api_v1_watched_words_server_lists" in 14154 let url_path = Openapi.Runtime.Path.render ~params:[("listId", list_id)] "/api/v1/watched-words/server/lists/{listId}" in 14155 let query = "" in 14156 let url = client.base_url ^ url_path ^ query in 14157 let response = 14158 try Requests.delete client.session url 14159 with Eio.Io _ as ex -> 14160 let bt = Printexc.get_raw_backtrace () in 14161 Eio.Exn.reraise_with_context ex bt "calling %s %s" "DELETE" url 14162 in 14163 if Requests.Response.ok response then 14164 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14165 else 14166 let body = Requests.Response.text response in 14167 let parsed_body = 14168 match Json.of_string Json.Codec.Value.t body with 14169 | Ok json -> Some (Openapi.Runtime.Json json) 14170 | Error _ -> Some (Openapi.Runtime.Raw body) 14171 in 14172 raise (Openapi.Runtime.Api_error { 14173 operation = op_name; 14174 method_ = "DELETE"; 14175 url; 14176 status = Requests.Response.status_code response; 14177 body; 14178 parsed_body; 14179 }) 14180 14181 (** Download video file 14182 14183 Generate a mp4 container that contains at most 1 video stream and at most 1 audio stream. Mainly used to merge the HLS audio only video file and the HLS video only resolution file. 14184 @param video_id The video id 14185 @param video_file_ids streams of video files to mux in the output 14186 @param video_file_token Video file token [generated](#operation/requestVideoToken) by PeerTube so you don't need to provide an OAuth token in the request header. 14187 *) 14188 let get_download_videos_generate ~video_id ~video_file_ids ?video_file_token client () = 14189 let op_name = "get_download_videos_generate" in 14190 let url_path = Openapi.Runtime.Path.render ~params:[("videoId", video_id)] "/download/videos/generate/{videoId}" in 14191 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"videoFileIds" ~value:video_file_ids; Openapi.Runtime.Query.optional ~key:"videoFileToken" ~value:video_file_token]) in 14192 let url = client.base_url ^ url_path ^ query in 14193 let response = 14194 try Requests.get client.session url 14195 with Eio.Io _ as ex -> 14196 let bt = Printexc.get_raw_backtrace () in 14197 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14198 in 14199 if Requests.Response.ok response then 14200 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14201 else 14202 let body = Requests.Response.text response in 14203 let parsed_body = 14204 match Json.of_string Json.Codec.Value.t body with 14205 | Ok json -> Some (Openapi.Runtime.Json json) 14206 | Error _ -> Some (Openapi.Runtime.Raw body) 14207 in 14208 raise (Openapi.Runtime.Api_error { 14209 operation = op_name; 14210 method_ = "GET"; 14211 url; 14212 status = Requests.Response.status_code response; 14213 body; 14214 parsed_body; 14215 }) 14216 14217 (** Videos podcast feed 14218 @param video_channel_id Limit listing to a specific video channel 14219 *) 14220 let get_videos_podcast_feed ~video_channel_id client () = 14221 let op_name = "get_videos_podcast_feed" in 14222 let url_path = "/feeds/podcast/videos.xml" in 14223 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"videoChannelId" ~value:video_channel_id]) in 14224 let url = client.base_url ^ url_path ^ query in 14225 let response = 14226 try Requests.get client.session url 14227 with Eio.Io _ as ex -> 14228 let bt = Printexc.get_raw_backtrace () in 14229 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14230 in 14231 if Requests.Response.ok response then 14232 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14233 else 14234 let body = Requests.Response.text response in 14235 let parsed_body = 14236 match Json.of_string Json.Codec.Value.t body with 14237 | Ok json -> Some (Openapi.Runtime.Json json) 14238 | Error _ -> Some (Openapi.Runtime.Raw body) 14239 in 14240 raise (Openapi.Runtime.Api_error { 14241 operation = op_name; 14242 method_ = "GET"; 14243 url; 14244 status = Requests.Response.status_code response; 14245 body; 14246 parsed_body; 14247 }) 14248 14249 (** Videos of subscriptions feeds 14250 @param format format expected (we focus on making `rss` the most feature-rich ; it serves [Media RSS](https://www.rssboard.org/media-rss)) 14251 @param account_id limit listing to a specific account 14252 @param token private token allowing access 14253 @param sort Sort column 14254 @param nsfw whether to include nsfw videos, if any 14255 @param is_local **PeerTube >= 4.0** Display only local or remote objects 14256 @param include_ **Only administrators and moderators can use this parameter** 14257 14258 Include additional videos in results (can be combined using bitwise or operator) 14259 - `0` NONE 14260 - `1` NOT_PUBLISHED_STATE 14261 - `2` BLACKLISTED 14262 - `4` BLOCKED_OWNER 14263 - `8` FILES 14264 - `16` CAPTIONS 14265 - `32` VIDEO SOURCE 14266 14267 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 14268 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 14269 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 14270 *) 14271 let get_syndicated_subscription_videos ~format ~account_id ~token ?sort ?nsfw ?is_local ?include_ ?privacy_one_of ?has_hlsfiles ?has_web_video_files client () = 14272 let op_name = "get_syndicated_subscription_videos" in 14273 let url_path = Openapi.Runtime.Path.render ~params:[("format", format)] "/feeds/subscriptions.{format}" in 14274 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"accountId" ~value:account_id; Openapi.Runtime.Query.singleton ~key:"token" ~value:token; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files]) in 14275 let url = client.base_url ^ url_path ^ query in 14276 let response = 14277 try Requests.get client.session url 14278 with Eio.Io _ as ex -> 14279 let bt = Printexc.get_raw_backtrace () in 14280 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14281 in 14282 if Requests.Response.ok response then 14283 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14284 else 14285 let body = Requests.Response.text response in 14286 let parsed_body = 14287 match Json.of_string Json.Codec.Value.t body with 14288 | Ok json -> Some (Openapi.Runtime.Json json) 14289 | Error _ -> Some (Openapi.Runtime.Raw body) 14290 in 14291 raise (Openapi.Runtime.Api_error { 14292 operation = op_name; 14293 method_ = "GET"; 14294 url; 14295 status = Requests.Response.status_code response; 14296 body; 14297 parsed_body; 14298 }) 14299 14300 (** Comments on videos feeds 14301 @param format format expected (we focus on making `rss` the most feature-rich ; it serves [Media RSS](https://www.rssboard.org/media-rss)) 14302 @param video_id limit listing comments to a specific video 14303 @param account_id limit listing comments to videos of a specific account 14304 @param account_name limit listing comments to videos of a specific account 14305 @param video_channel_id limit listing comments to videos of a specific video channel 14306 @param video_channel_name limit listing comments to videos of a specific video channel 14307 *) 14308 let get_syndicated_comments ~format ?video_id ?account_id ?account_name ?video_channel_id ?video_channel_name client () = 14309 let op_name = "get_syndicated_comments" in 14310 let url_path = Openapi.Runtime.Path.render ~params:[("format", format)] "/feeds/video-comments.{format}" in 14311 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"videoId" ~value:video_id; Openapi.Runtime.Query.optional ~key:"accountId" ~value:account_id; Openapi.Runtime.Query.optional ~key:"accountName" ~value:account_name; Openapi.Runtime.Query.optional ~key:"videoChannelId" ~value:video_channel_id; Openapi.Runtime.Query.optional ~key:"videoChannelName" ~value:video_channel_name]) in 14312 let url = client.base_url ^ url_path ^ query in 14313 let response = 14314 try Requests.get client.session url 14315 with Eio.Io _ as ex -> 14316 let bt = Printexc.get_raw_backtrace () in 14317 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14318 in 14319 if Requests.Response.ok response then 14320 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14321 else 14322 let body = Requests.Response.text response in 14323 let parsed_body = 14324 match Json.of_string Json.Codec.Value.t body with 14325 | Ok json -> Some (Openapi.Runtime.Json json) 14326 | Error _ -> Some (Openapi.Runtime.Raw body) 14327 in 14328 raise (Openapi.Runtime.Api_error { 14329 operation = op_name; 14330 method_ = "GET"; 14331 url; 14332 status = Requests.Response.status_code response; 14333 body; 14334 parsed_body; 14335 }) 14336 14337 (** Common videos feeds 14338 @param format format expected (we focus on making `rss` the most feature-rich ; it serves [Media RSS](https://www.rssboard.org/media-rss)) 14339 @param account_id limit listing to a specific account 14340 @param account_name limit listing to a specific account 14341 @param video_channel_id limit listing to a specific video channel 14342 @param video_channel_name limit listing to a specific video channel 14343 @param sort Sort column 14344 @param nsfw whether to include nsfw videos, if any 14345 @param is_local **PeerTube >= 4.0** Display only local or remote objects 14346 @param include_ **Only administrators and moderators can use this parameter** 14347 14348 Include additional videos in results (can be combined using bitwise or operator) 14349 - `0` NONE 14350 - `1` NOT_PUBLISHED_STATE 14351 - `2` BLACKLISTED 14352 - `4` BLOCKED_OWNER 14353 - `8` FILES 14354 - `16` CAPTIONS 14355 - `32` VIDEO SOURCE 14356 14357 @param privacy_one_of **PeerTube >= 4.0** Display only videos in this specific privacy/privacies 14358 @param has_hlsfiles **PeerTube >= 4.0** Display only videos that have HLS files 14359 @param has_web_video_files **PeerTube >= 6.0** Display only videos that have Web Video files 14360 *) 14361 let get_syndicated_videos ~format ?account_id ?account_name ?video_channel_id ?video_channel_name ?sort ?nsfw ?is_local ?include_ ?privacy_one_of ?has_hlsfiles ?has_web_video_files client () = 14362 let op_name = "get_syndicated_videos" in 14363 let url_path = Openapi.Runtime.Path.render ~params:[("format", format)] "/feeds/videos.{format}" in 14364 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"accountId" ~value:account_id; Openapi.Runtime.Query.optional ~key:"accountName" ~value:account_name; Openapi.Runtime.Query.optional ~key:"videoChannelId" ~value:video_channel_id; Openapi.Runtime.Query.optional ~key:"videoChannelName" ~value:video_channel_name; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"nsfw" ~value:nsfw; Openapi.Runtime.Query.optional ~key:"isLocal" ~value:is_local; Openapi.Runtime.Query.optional ~key:"include" ~value:include_; Openapi.Runtime.Query.optional ~key:"privacyOneOf" ~value:privacy_one_of; Openapi.Runtime.Query.optional ~key:"hasHLSFiles" ~value:has_hlsfiles; Openapi.Runtime.Query.optional ~key:"hasWebVideoFiles" ~value:has_web_video_files]) in 14365 let url = client.base_url ^ url_path ^ query in 14366 let response = 14367 try Requests.get client.session url 14368 with Eio.Io _ as ex -> 14369 let bt = Printexc.get_raw_backtrace () in 14370 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14371 in 14372 if Requests.Response.ok response then 14373 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14374 else 14375 let body = Requests.Response.text response in 14376 let parsed_body = 14377 match Json.of_string Json.Codec.Value.t body with 14378 | Ok json -> Some (Openapi.Runtime.Json json) 14379 | Error _ -> Some (Openapi.Runtime.Raw body) 14380 in 14381 raise (Openapi.Runtime.Api_error { 14382 operation = op_name; 14383 method_ = "GET"; 14384 url; 14385 status = Requests.Response.status_code response; 14386 body; 14387 parsed_body; 14388 }) 14389 14390 (** Get private HLS video file 14391 @param filename Filename 14392 @param video_file_token Video file token [generated](#operation/requestVideoToken) by PeerTube so you don't need to provide an OAuth token in the request header. 14393 @param reinject_video_file_token Ask the server to reinject videoFileToken in URLs in m3u8 playlist 14394 *) 14395 let get_static_streaming_playlists_hls_private_ ~filename ?video_file_token ?reinject_video_file_token client () = 14396 let op_name = "get_static_streaming_playlists_hls_private_" in 14397 let url_path = Openapi.Runtime.Path.render ~params:[("filename", filename)] "/static/streaming-playlists/hls/private/{filename}" in 14398 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"videoFileToken" ~value:video_file_token; Openapi.Runtime.Query.optional ~key:"reinjectVideoFileToken" ~value:reinject_video_file_token]) in 14399 let url = client.base_url ^ url_path ^ query in 14400 let response = 14401 try Requests.get client.session url 14402 with Eio.Io _ as ex -> 14403 let bt = Printexc.get_raw_backtrace () in 14404 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14405 in 14406 if Requests.Response.ok response then 14407 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14408 else 14409 let body = Requests.Response.text response in 14410 let parsed_body = 14411 match Json.of_string Json.Codec.Value.t body with 14412 | Ok json -> Some (Openapi.Runtime.Json json) 14413 | Error _ -> Some (Openapi.Runtime.Raw body) 14414 in 14415 raise (Openapi.Runtime.Api_error { 14416 operation = op_name; 14417 method_ = "GET"; 14418 url; 14419 status = Requests.Response.status_code response; 14420 body; 14421 parsed_body; 14422 }) 14423 14424 (** Get public HLS video file 14425 @param filename Filename 14426 *) 14427 let get_static_streaming_playlists_hls ~filename client () = 14428 let op_name = "get_static_streaming_playlists_hls" in 14429 let url_path = Openapi.Runtime.Path.render ~params:[("filename", filename)] "/static/streaming-playlists/hls/{filename}" in 14430 let query = "" in 14431 let url = client.base_url ^ url_path ^ query in 14432 let response = 14433 try Requests.get client.session url 14434 with Eio.Io _ as ex -> 14435 let bt = Printexc.get_raw_backtrace () in 14436 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14437 in 14438 if Requests.Response.ok response then 14439 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14440 else 14441 let body = Requests.Response.text response in 14442 let parsed_body = 14443 match Json.of_string Json.Codec.Value.t body with 14444 | Ok json -> Some (Openapi.Runtime.Json json) 14445 | Error _ -> Some (Openapi.Runtime.Raw body) 14446 in 14447 raise (Openapi.Runtime.Api_error { 14448 operation = op_name; 14449 method_ = "GET"; 14450 url; 14451 status = Requests.Response.status_code response; 14452 body; 14453 parsed_body; 14454 }) 14455 14456 (** Get private Web Video file 14457 14458 **PeerTube >= 6.0** 14459 @param filename Filename 14460 @param video_file_token Video file token [generated](#operation/requestVideoToken) by PeerTube so you don't need to provide an OAuth token in the request header. 14461 *) 14462 let get_static_web_videos_private_ ~filename ?video_file_token client () = 14463 let op_name = "get_static_web_videos_private_" in 14464 let url_path = Openapi.Runtime.Path.render ~params:[("filename", filename)] "/static/web-videos/private/{filename}" in 14465 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"videoFileToken" ~value:video_file_token]) in 14466 let url = client.base_url ^ url_path ^ query in 14467 let response = 14468 try Requests.get client.session url 14469 with Eio.Io _ as ex -> 14470 let bt = Printexc.get_raw_backtrace () in 14471 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14472 in 14473 if Requests.Response.ok response then 14474 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14475 else 14476 let body = Requests.Response.text response in 14477 let parsed_body = 14478 match Json.of_string Json.Codec.Value.t body with 14479 | Ok json -> Some (Openapi.Runtime.Json json) 14480 | Error _ -> Some (Openapi.Runtime.Raw body) 14481 in 14482 raise (Openapi.Runtime.Api_error { 14483 operation = op_name; 14484 method_ = "GET"; 14485 url; 14486 status = Requests.Response.status_code response; 14487 body; 14488 parsed_body; 14489 }) 14490 14491 (** Get public Web Video file 14492 14493 **PeerTube >= 6.0** 14494 @param filename Filename 14495 *) 14496 let get_static_web_videos ~filename client () = 14497 let op_name = "get_static_web_videos" in 14498 let url_path = Openapi.Runtime.Path.render ~params:[("filename", filename)] "/static/web-videos/{filename}" in 14499 let query = "" in 14500 let url = client.base_url ^ url_path ^ query in 14501 let response = 14502 try Requests.get client.session url 14503 with Eio.Io _ as ex -> 14504 let bt = Printexc.get_raw_backtrace () in 14505 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14506 in 14507 if Requests.Response.ok response then 14508 Openapi.Runtime.Json.decode_json_exn Json.Codec.Value.t (Requests.Response.text response) 14509 else 14510 let body = Requests.Response.text response in 14511 let parsed_body = 14512 match Json.of_string Json.Codec.Value.t body with 14513 | Ok json -> Some (Openapi.Runtime.Json json) 14514 | Error _ -> Some (Openapi.Runtime.Raw body) 14515 in 14516 raise (Openapi.Runtime.Api_error { 14517 operation = op_name; 14518 method_ = "GET"; 14519 url; 14520 status = Requests.Response.status_code response; 14521 body; 14522 parsed_body; 14523 }) 14524end 14525 14526module VideoChannelList = struct 14527 module Types = struct 14528 module T = struct 14529 type t = { 14530 data : VideoChannel.T.t list option; 14531 total : int option; 14532 } 14533 end 14534 end 14535 14536 module T = struct 14537 include Types.T 14538 14539 let v ?data ?total () = { data; total } 14540 14541 let data t = t.data 14542 let total t = t.total 14543 14544 let jsont : t Json.codec = 14545 Json.Codec.Object.map ~kind:"VideoChannelList" 14546 (fun data total -> { data; total }) 14547 |> Json.Codec.Object.opt_member "data" (Json.Codec.list VideoChannel.T.jsont) ~enc:(fun r -> r.data) 14548 |> Json.Codec.Object.opt_member "total" Json.Codec.int ~enc:(fun r -> r.total) 14549 |> Json.Codec.Object.skip_unknown 14550 |> Json.Codec.Object.seal 14551 end 14552 14553 (** List video channels of an account 14554 @param name The username or handle of the account 14555 @param with_stats include daily view statistics for the last 30 days and total views (only if authenticated as the account user) 14556 @param start Offset used to paginate results 14557 @param count Number of items to return 14558 @param search Plain text search, applied to various parts of the model depending on endpoint 14559 @param sort Sort column 14560 @param include_collaborations **PeerTube >= 8.0** Include objects from collaborated channels 14561 *) 14562 let get_api_v1_accounts_video_channels ~name ?with_stats ?start ?count ?search ?sort ?include_collaborations client () = 14563 let op_name = "get_api_v1_accounts_video_channels" in 14564 let url_path = Openapi.Runtime.Path.render ~params:[("name", name)] "/api/v1/accounts/{name}/video-channels" in 14565 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"withStats" ~value:with_stats; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"includeCollaborations" ~value:include_collaborations]) in 14566 let url = client.base_url ^ url_path ^ query in 14567 let response = 14568 try Requests.get client.session url 14569 with Eio.Io _ as ex -> 14570 let bt = Printexc.get_raw_backtrace () in 14571 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14572 in 14573 if Requests.Response.ok response then 14574 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 14575 else 14576 let body = Requests.Response.text response in 14577 let parsed_body = 14578 match Json.of_string Json.Codec.Value.t body with 14579 | Ok json -> Some (Openapi.Runtime.Json json) 14580 | Error _ -> Some (Openapi.Runtime.Raw body) 14581 in 14582 raise (Openapi.Runtime.Api_error { 14583 operation = op_name; 14584 method_ = "GET"; 14585 url; 14586 status = Requests.Response.status_code response; 14587 body; 14588 parsed_body; 14589 }) 14590 14591 (** Search channels 14592 @param search String to search. If the user can make a remote URI search, and the string is an URI then the PeerTube instance will fetch the remote object and add it to its database. Then, you can use the REST API to fetch the complete channel information and interact with it. 14593 14594 @param start Offset used to paginate results 14595 @param count Number of items to return 14596 @param search_target If the administrator enabled search index support, you can override the default search target. 14597 14598 **Warning**: If you choose to make an index search, PeerTube will get results from a third party service. It means the instance may not yet know the objects you fetched. If you want to load video/channel information: 14599 * If the current user has the ability to make a remote URI search (this information is available in the config endpoint), 14600 then reuse the search API to make a search using the object URI so PeerTube instance fetches the remote object and fill its database. 14601 After that, you can use the classic REST API endpoints to fetch the complete object or interact with it 14602 * If the current user doesn't have the ability to make a remote URI search, then redirect the user on the origin instance or fetch 14603 the data from the origin instance API 14604 14605 @param sort Sort column 14606 @param host Find elements owned by this host 14607 @param handles Find elements with these handles 14608 *) 14609 let search_channels ~search ?start ?count ?search_target ?sort ?host ?handles client () = 14610 let op_name = "search_channels" in 14611 let url_path = "/api/v1/search/video-channels" in 14612 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.singleton ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"searchTarget" ~value:search_target; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort; Openapi.Runtime.Query.optional ~key:"host" ~value:host; Openapi.Runtime.Query.optional ~key:"handles" ~value:handles]) in 14613 let url = client.base_url ^ url_path ^ query in 14614 let response = 14615 try Requests.get client.session url 14616 with Eio.Io _ as ex -> 14617 let bt = Printexc.get_raw_backtrace () in 14618 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14619 in 14620 if Requests.Response.ok response then 14621 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 14622 else 14623 let body = Requests.Response.text response in 14624 let parsed_body = 14625 match Json.of_string Json.Codec.Value.t body with 14626 | Ok json -> Some (Openapi.Runtime.Json json) 14627 | Error _ -> Some (Openapi.Runtime.Raw body) 14628 in 14629 raise (Openapi.Runtime.Api_error { 14630 operation = op_name; 14631 method_ = "GET"; 14632 url; 14633 status = Requests.Response.status_code response; 14634 body; 14635 parsed_body; 14636 }) 14637 14638 (** List my user subscriptions 14639 @param start Offset used to paginate results 14640 @param count Number of items to return 14641 *) 14642 let get_api_v1_users_me_subscriptions ?start ?count ?sort client () = 14643 let op_name = "get_api_v1_users_me_subscriptions" in 14644 let url_path = "/api/v1/users/me/subscriptions" in 14645 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 14646 let url = client.base_url ^ url_path ^ query in 14647 let response = 14648 try Requests.get client.session url 14649 with Eio.Io _ as ex -> 14650 let bt = Printexc.get_raw_backtrace () in 14651 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14652 in 14653 if Requests.Response.ok response then 14654 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 14655 else 14656 let body = Requests.Response.text response in 14657 let parsed_body = 14658 match Json.of_string Json.Codec.Value.t body with 14659 | Ok json -> Some (Openapi.Runtime.Json json) 14660 | Error _ -> Some (Openapi.Runtime.Raw body) 14661 in 14662 raise (Openapi.Runtime.Api_error { 14663 operation = op_name; 14664 method_ = "GET"; 14665 url; 14666 status = Requests.Response.status_code response; 14667 body; 14668 parsed_body; 14669 }) 14670 14671 (** List video channels 14672 @param start Offset used to paginate results 14673 @param count Number of items to return 14674 @param sort Sort column 14675 *) 14676 let get_video_channels ?start ?count ?sort client () = 14677 let op_name = "get_video_channels" in 14678 let url_path = "/api/v1/video-channels" in 14679 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 14680 let url = client.base_url ^ url_path ^ query in 14681 let response = 14682 try Requests.get client.session url 14683 with Eio.Io _ as ex -> 14684 let bt = Printexc.get_raw_backtrace () in 14685 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14686 in 14687 if Requests.Response.ok response then 14688 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 14689 else 14690 let body = Requests.Response.text response in 14691 let parsed_body = 14692 match Json.of_string Json.Codec.Value.t body with 14693 | Ok json -> Some (Openapi.Runtime.Json json) 14694 | Error _ -> Some (Openapi.Runtime.Raw body) 14695 in 14696 raise (Openapi.Runtime.Api_error { 14697 operation = op_name; 14698 method_ = "GET"; 14699 url; 14700 status = Requests.Response.status_code response; 14701 body; 14702 parsed_body; 14703 }) 14704end 14705 14706module UserWithStats = struct 14707 module Types = struct 14708 module T = struct 14709 type t = { 14710 account : Account.T.t option; 14711 admin_flags : UserAdminFlags.T.t option; 14712 auto_play_next_video : bool option; (** Automatically start playing the upcoming video after the currently playing video *) 14713 auto_play_next_video_playlist : bool option; (** Automatically start playing the video on the playlist after the currently playing video *) 14714 auto_play_video : bool option; (** Automatically start playing the video on the watch page *) 14715 blocked : bool option; 14716 blocked_reason : string option; 14717 created_at : string option; 14718 email : string option; (** The user email *) 14719 email_public : bool option; (** Has the user accepted to display the email publicly? *) 14720 email_verified : bool option; (** Has the user confirmed their email address? *) 14721 id : Id.T.t option; 14722 language : string option; (** default language for this user *) 14723 last_login_date : Ptime.t option; 14724 new_features_info_read : float option; (** New features information the user has read *) 14725 no_account_setup_warning_modal : bool option; 14726 no_instance_config_warning_modal : bool option; 14727 no_welcome_modal : bool option; 14728 notification_settings : UserNotificationSettings.T.t option; 14729 nsfw_flags_blurred : Nsfwflag.T.t option; 14730 nsfw_flags_displayed : Nsfwflag.T.t option; 14731 nsfw_flags_hidden : Nsfwflag.T.t option; 14732 nsfw_flags_warned : Nsfwflag.T.t option; 14733 nsfw_policy : Nsfwpolicy.T.t option; 14734 p2p_enabled : bool option; (** whether to enable P2P in the player or not *) 14735 plugin_auth : string option; (** Auth plugin to use to authenticate the user *) 14736 role : Json.t option; 14737 theme : string option; (** Theme enabled by this user *) 14738 two_factor_enabled : bool option; (** Whether the user has enabled two-factor authentication or not *) 14739 username : Username.T.t option; 14740 video_channels : VideoChannel.T.t list option; 14741 video_languages : string list option; (** list of languages to filter videos down to *) 14742 video_quota : int option; (** The user video quota in bytes *) 14743 video_quota_daily : int option; (** The user daily video quota in bytes *) 14744 videos_history_enabled : bool option; (** whether to keep track of watched history or not *) 14745 videos_count : int option; (** Count of videos published *) 14746 abuses_count : int option; (** Count of reports/abuses of which the user is a target *) 14747 abuses_accepted_count : int option; (** Count of reports/abuses created by the user and accepted/acted upon by the moderation team *) 14748 abuses_created_count : int option; (** Count of reports/abuses created by the user *) 14749 video_comments_count : int option; (** Count of comments published *) 14750 } 14751 end 14752 end 14753 14754 module T = struct 14755 include Types.T 14756 14757 let v ?account ?admin_flags ?auto_play_next_video ?auto_play_next_video_playlist ?auto_play_video ?blocked ?blocked_reason ?created_at ?email ?email_public ?email_verified ?id ?language ?last_login_date ?new_features_info_read ?no_account_setup_warning_modal ?no_instance_config_warning_modal ?no_welcome_modal ?notification_settings ?nsfw_flags_blurred ?nsfw_flags_displayed ?nsfw_flags_hidden ?nsfw_flags_warned ?nsfw_policy ?p2p_enabled ?plugin_auth ?role ?theme ?two_factor_enabled ?username ?video_channels ?video_languages ?video_quota ?video_quota_daily ?videos_history_enabled ?videos_count ?abuses_count ?abuses_accepted_count ?abuses_created_count ?video_comments_count () = { account; admin_flags; auto_play_next_video; auto_play_next_video_playlist; auto_play_video; blocked; blocked_reason; created_at; email; email_public; email_verified; id; language; last_login_date; new_features_info_read; no_account_setup_warning_modal; no_instance_config_warning_modal; no_welcome_modal; notification_settings; nsfw_flags_blurred; nsfw_flags_displayed; nsfw_flags_hidden; nsfw_flags_warned; nsfw_policy; p2p_enabled; plugin_auth; role; theme; two_factor_enabled; username; video_channels; video_languages; video_quota; video_quota_daily; videos_history_enabled; videos_count; abuses_count; abuses_accepted_count; abuses_created_count; video_comments_count } 14758 14759 let account t = t.account 14760 let admin_flags t = t.admin_flags 14761 let auto_play_next_video t = t.auto_play_next_video 14762 let auto_play_next_video_playlist t = t.auto_play_next_video_playlist 14763 let auto_play_video t = t.auto_play_video 14764 let blocked t = t.blocked 14765 let blocked_reason t = t.blocked_reason 14766 let created_at t = t.created_at 14767 let email t = t.email 14768 let email_public t = t.email_public 14769 let email_verified t = t.email_verified 14770 let id t = t.id 14771 let language t = t.language 14772 let last_login_date t = t.last_login_date 14773 let new_features_info_read t = t.new_features_info_read 14774 let no_account_setup_warning_modal t = t.no_account_setup_warning_modal 14775 let no_instance_config_warning_modal t = t.no_instance_config_warning_modal 14776 let no_welcome_modal t = t.no_welcome_modal 14777 let notification_settings t = t.notification_settings 14778 let nsfw_flags_blurred t = t.nsfw_flags_blurred 14779 let nsfw_flags_displayed t = t.nsfw_flags_displayed 14780 let nsfw_flags_hidden t = t.nsfw_flags_hidden 14781 let nsfw_flags_warned t = t.nsfw_flags_warned 14782 let nsfw_policy t = t.nsfw_policy 14783 let p2p_enabled t = t.p2p_enabled 14784 let plugin_auth t = t.plugin_auth 14785 let role t = t.role 14786 let theme t = t.theme 14787 let two_factor_enabled t = t.two_factor_enabled 14788 let username t = t.username 14789 let video_channels t = t.video_channels 14790 let video_languages t = t.video_languages 14791 let video_quota t = t.video_quota 14792 let video_quota_daily t = t.video_quota_daily 14793 let videos_history_enabled t = t.videos_history_enabled 14794 let videos_count t = t.videos_count 14795 let abuses_count t = t.abuses_count 14796 let abuses_accepted_count t = t.abuses_accepted_count 14797 let abuses_created_count t = t.abuses_created_count 14798 let video_comments_count t = t.video_comments_count 14799 14800 let jsont : t Json.codec = 14801 Json.Codec.Object.map ~kind:"UserWithStats" 14802 (fun account admin_flags auto_play_next_video auto_play_next_video_playlist auto_play_video blocked blocked_reason created_at email email_public email_verified id language last_login_date new_features_info_read no_account_setup_warning_modal no_instance_config_warning_modal no_welcome_modal notification_settings nsfw_flags_blurred nsfw_flags_displayed nsfw_flags_hidden nsfw_flags_warned nsfw_policy p2p_enabled plugin_auth role theme two_factor_enabled username video_channels video_languages video_quota video_quota_daily videos_history_enabled videos_count abuses_count abuses_accepted_count abuses_created_count video_comments_count -> { account; admin_flags; auto_play_next_video; auto_play_next_video_playlist; auto_play_video; blocked; blocked_reason; created_at; email; email_public; email_verified; id; language; last_login_date; new_features_info_read; no_account_setup_warning_modal; no_instance_config_warning_modal; no_welcome_modal; notification_settings; nsfw_flags_blurred; nsfw_flags_displayed; nsfw_flags_hidden; nsfw_flags_warned; nsfw_policy; p2p_enabled; plugin_auth; role; theme; two_factor_enabled; username; video_channels; video_languages; video_quota; video_quota_daily; videos_history_enabled; videos_count; abuses_count; abuses_accepted_count; abuses_created_count; video_comments_count }) 14803 |> Json.Codec.Object.opt_member "account" Account.T.jsont ~enc:(fun r -> r.account) 14804 |> Json.Codec.Object.opt_member "adminFlags" UserAdminFlags.T.jsont ~enc:(fun r -> r.admin_flags) 14805 |> Json.Codec.Object.opt_member "autoPlayNextVideo" Json.Codec.bool ~enc:(fun r -> r.auto_play_next_video) 14806 |> Json.Codec.Object.opt_member "autoPlayNextVideoPlaylist" Json.Codec.bool ~enc:(fun r -> r.auto_play_next_video_playlist) 14807 |> Json.Codec.Object.opt_member "autoPlayVideo" Json.Codec.bool ~enc:(fun r -> r.auto_play_video) 14808 |> Json.Codec.Object.opt_member "blocked" Json.Codec.bool ~enc:(fun r -> r.blocked) 14809 |> Json.Codec.Object.opt_member "blockedReason" Json.Codec.string ~enc:(fun r -> r.blocked_reason) 14810 |> Json.Codec.Object.opt_member "createdAt" Json.Codec.string ~enc:(fun r -> r.created_at) 14811 |> Json.Codec.Object.opt_member "email" Json.Codec.string ~enc:(fun r -> r.email) 14812 |> Json.Codec.Object.opt_member "emailPublic" Json.Codec.bool ~enc:(fun r -> r.email_public) 14813 |> Json.Codec.Object.opt_member "emailVerified" Json.Codec.bool ~enc:(fun r -> r.email_verified) 14814 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 14815 |> Json.Codec.Object.opt_member "language" Json.Codec.string ~enc:(fun r -> r.language) 14816 |> Json.Codec.Object.opt_member "lastLoginDate" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.last_login_date) 14817 |> Json.Codec.Object.opt_member "newFeaturesInfoRead" Json.Codec.number ~enc:(fun r -> r.new_features_info_read) 14818 |> Json.Codec.Object.opt_member "noAccountSetupWarningModal" Json.Codec.bool ~enc:(fun r -> r.no_account_setup_warning_modal) 14819 |> Json.Codec.Object.opt_member "noInstanceConfigWarningModal" Json.Codec.bool ~enc:(fun r -> r.no_instance_config_warning_modal) 14820 |> Json.Codec.Object.opt_member "noWelcomeModal" Json.Codec.bool ~enc:(fun r -> r.no_welcome_modal) 14821 |> Json.Codec.Object.opt_member "notificationSettings" UserNotificationSettings.T.jsont ~enc:(fun r -> r.notification_settings) 14822 |> Json.Codec.Object.opt_member "nsfwFlagsBlurred" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_blurred) 14823 |> Json.Codec.Object.opt_member "nsfwFlagsDisplayed" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_displayed) 14824 |> Json.Codec.Object.opt_member "nsfwFlagsHidden" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_hidden) 14825 |> Json.Codec.Object.opt_member "nsfwFlagsWarned" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_warned) 14826 |> Json.Codec.Object.opt_member "nsfwPolicy" Nsfwpolicy.T.jsont ~enc:(fun r -> r.nsfw_policy) 14827 |> Json.Codec.Object.opt_member "p2pEnabled" Json.Codec.bool ~enc:(fun r -> r.p2p_enabled) 14828 |> Json.Codec.Object.opt_member "pluginAuth" Json.Codec.string ~enc:(fun r -> r.plugin_auth) 14829 |> Json.Codec.Object.opt_member "role" Json.Codec.Value.t ~enc:(fun r -> r.role) 14830 |> Json.Codec.Object.opt_member "theme" Json.Codec.string ~enc:(fun r -> r.theme) 14831 |> Json.Codec.Object.opt_member "twoFactorEnabled" Json.Codec.bool ~enc:(fun r -> r.two_factor_enabled) 14832 |> Json.Codec.Object.opt_member "username" Username.T.jsont ~enc:(fun r -> r.username) 14833 |> Json.Codec.Object.opt_member "videoChannels" (Json.Codec.list VideoChannel.T.jsont) ~enc:(fun r -> r.video_channels) 14834 |> Json.Codec.Object.opt_member "videoLanguages" (Json.Codec.list Json.Codec.string) ~enc:(fun r -> r.video_languages) 14835 |> Json.Codec.Object.opt_member "videoQuota" Json.Codec.int ~enc:(fun r -> r.video_quota) 14836 |> Json.Codec.Object.opt_member "videoQuotaDaily" Json.Codec.int ~enc:(fun r -> r.video_quota_daily) 14837 |> Json.Codec.Object.opt_member "videosHistoryEnabled" Json.Codec.bool ~enc:(fun r -> r.videos_history_enabled) 14838 |> Json.Codec.Object.opt_member "videosCount" Json.Codec.int ~enc:(fun r -> r.videos_count) 14839 |> Json.Codec.Object.opt_member "abusesCount" Json.Codec.int ~enc:(fun r -> r.abuses_count) 14840 |> Json.Codec.Object.opt_member "abusesAcceptedCount" Json.Codec.int ~enc:(fun r -> r.abuses_accepted_count) 14841 |> Json.Codec.Object.opt_member "abusesCreatedCount" Json.Codec.int ~enc:(fun r -> r.abuses_created_count) 14842 |> Json.Codec.Object.opt_member "videoCommentsCount" Json.Codec.int ~enc:(fun r -> r.video_comments_count) 14843 |> Json.Codec.Object.skip_unknown 14844 |> Json.Codec.Object.seal 14845 end 14846end 14847 14848module User = struct 14849 module Types = struct 14850 module T = struct 14851 type t = { 14852 account : Account.T.t option; 14853 admin_flags : UserAdminFlags.T.t option; 14854 auto_play_next_video : bool option; (** Automatically start playing the upcoming video after the currently playing video *) 14855 auto_play_next_video_playlist : bool option; (** Automatically start playing the video on the playlist after the currently playing video *) 14856 auto_play_video : bool option; (** Automatically start playing the video on the watch page *) 14857 blocked : bool option; 14858 blocked_reason : string option; 14859 created_at : string option; 14860 email : string option; (** The user email *) 14861 email_public : bool option; (** Has the user accepted to display the email publicly? *) 14862 email_verified : bool option; (** Has the user confirmed their email address? *) 14863 id : Id.T.t option; 14864 language : string option; (** default language for this user *) 14865 last_login_date : Ptime.t option; 14866 new_features_info_read : float option; (** New features information the user has read *) 14867 no_account_setup_warning_modal : bool option; 14868 no_instance_config_warning_modal : bool option; 14869 no_welcome_modal : bool option; 14870 notification_settings : UserNotificationSettings.T.t option; 14871 nsfw_flags_blurred : Nsfwflag.T.t option; 14872 nsfw_flags_displayed : Nsfwflag.T.t option; 14873 nsfw_flags_hidden : Nsfwflag.T.t option; 14874 nsfw_flags_warned : Nsfwflag.T.t option; 14875 nsfw_policy : Nsfwpolicy.T.t option; 14876 p2p_enabled : bool option; (** whether to enable P2P in the player or not *) 14877 plugin_auth : string option; (** Auth plugin to use to authenticate the user *) 14878 role : Json.t option; 14879 theme : string option; (** Theme enabled by this user *) 14880 two_factor_enabled : bool option; (** Whether the user has enabled two-factor authentication or not *) 14881 username : Username.T.t option; 14882 video_channels : VideoChannel.T.t list option; 14883 video_languages : string list option; (** list of languages to filter videos down to *) 14884 video_quota : int option; (** The user video quota in bytes *) 14885 video_quota_daily : int option; (** The user daily video quota in bytes *) 14886 videos_history_enabled : bool option; (** whether to keep track of watched history or not *) 14887 } 14888 end 14889 end 14890 14891 module T = struct 14892 include Types.T 14893 14894 let v ?account ?admin_flags ?auto_play_next_video ?auto_play_next_video_playlist ?auto_play_video ?blocked ?blocked_reason ?created_at ?email ?email_public ?email_verified ?id ?language ?last_login_date ?new_features_info_read ?no_account_setup_warning_modal ?no_instance_config_warning_modal ?no_welcome_modal ?notification_settings ?nsfw_flags_blurred ?nsfw_flags_displayed ?nsfw_flags_hidden ?nsfw_flags_warned ?nsfw_policy ?p2p_enabled ?plugin_auth ?role ?theme ?two_factor_enabled ?username ?video_channels ?video_languages ?video_quota ?video_quota_daily ?videos_history_enabled () = { account; admin_flags; auto_play_next_video; auto_play_next_video_playlist; auto_play_video; blocked; blocked_reason; created_at; email; email_public; email_verified; id; language; last_login_date; new_features_info_read; no_account_setup_warning_modal; no_instance_config_warning_modal; no_welcome_modal; notification_settings; nsfw_flags_blurred; nsfw_flags_displayed; nsfw_flags_hidden; nsfw_flags_warned; nsfw_policy; p2p_enabled; plugin_auth; role; theme; two_factor_enabled; username; video_channels; video_languages; video_quota; video_quota_daily; videos_history_enabled } 14895 14896 let account t = t.account 14897 let admin_flags t = t.admin_flags 14898 let auto_play_next_video t = t.auto_play_next_video 14899 let auto_play_next_video_playlist t = t.auto_play_next_video_playlist 14900 let auto_play_video t = t.auto_play_video 14901 let blocked t = t.blocked 14902 let blocked_reason t = t.blocked_reason 14903 let created_at t = t.created_at 14904 let email t = t.email 14905 let email_public t = t.email_public 14906 let email_verified t = t.email_verified 14907 let id t = t.id 14908 let language t = t.language 14909 let last_login_date t = t.last_login_date 14910 let new_features_info_read t = t.new_features_info_read 14911 let no_account_setup_warning_modal t = t.no_account_setup_warning_modal 14912 let no_instance_config_warning_modal t = t.no_instance_config_warning_modal 14913 let no_welcome_modal t = t.no_welcome_modal 14914 let notification_settings t = t.notification_settings 14915 let nsfw_flags_blurred t = t.nsfw_flags_blurred 14916 let nsfw_flags_displayed t = t.nsfw_flags_displayed 14917 let nsfw_flags_hidden t = t.nsfw_flags_hidden 14918 let nsfw_flags_warned t = t.nsfw_flags_warned 14919 let nsfw_policy t = t.nsfw_policy 14920 let p2p_enabled t = t.p2p_enabled 14921 let plugin_auth t = t.plugin_auth 14922 let role t = t.role 14923 let theme t = t.theme 14924 let two_factor_enabled t = t.two_factor_enabled 14925 let username t = t.username 14926 let video_channels t = t.video_channels 14927 let video_languages t = t.video_languages 14928 let video_quota t = t.video_quota 14929 let video_quota_daily t = t.video_quota_daily 14930 let videos_history_enabled t = t.videos_history_enabled 14931 14932 let jsont : t Json.codec = 14933 Json.Codec.Object.map ~kind:"User" 14934 (fun account admin_flags auto_play_next_video auto_play_next_video_playlist auto_play_video blocked blocked_reason created_at email email_public email_verified id language last_login_date new_features_info_read no_account_setup_warning_modal no_instance_config_warning_modal no_welcome_modal notification_settings nsfw_flags_blurred nsfw_flags_displayed nsfw_flags_hidden nsfw_flags_warned nsfw_policy p2p_enabled plugin_auth role theme two_factor_enabled username video_channels video_languages video_quota video_quota_daily videos_history_enabled -> { account; admin_flags; auto_play_next_video; auto_play_next_video_playlist; auto_play_video; blocked; blocked_reason; created_at; email; email_public; email_verified; id; language; last_login_date; new_features_info_read; no_account_setup_warning_modal; no_instance_config_warning_modal; no_welcome_modal; notification_settings; nsfw_flags_blurred; nsfw_flags_displayed; nsfw_flags_hidden; nsfw_flags_warned; nsfw_policy; p2p_enabled; plugin_auth; role; theme; two_factor_enabled; username; video_channels; video_languages; video_quota; video_quota_daily; videos_history_enabled }) 14935 |> Json.Codec.Object.opt_member "account" Account.T.jsont ~enc:(fun r -> r.account) 14936 |> Json.Codec.Object.opt_member "adminFlags" UserAdminFlags.T.jsont ~enc:(fun r -> r.admin_flags) 14937 |> Json.Codec.Object.opt_member "autoPlayNextVideo" Json.Codec.bool ~enc:(fun r -> r.auto_play_next_video) 14938 |> Json.Codec.Object.opt_member "autoPlayNextVideoPlaylist" Json.Codec.bool ~enc:(fun r -> r.auto_play_next_video_playlist) 14939 |> Json.Codec.Object.opt_member "autoPlayVideo" Json.Codec.bool ~enc:(fun r -> r.auto_play_video) 14940 |> Json.Codec.Object.opt_member "blocked" Json.Codec.bool ~enc:(fun r -> r.blocked) 14941 |> Json.Codec.Object.opt_member "blockedReason" Json.Codec.string ~enc:(fun r -> r.blocked_reason) 14942 |> Json.Codec.Object.opt_member "createdAt" Json.Codec.string ~enc:(fun r -> r.created_at) 14943 |> Json.Codec.Object.opt_member "email" Json.Codec.string ~enc:(fun r -> r.email) 14944 |> Json.Codec.Object.opt_member "emailPublic" Json.Codec.bool ~enc:(fun r -> r.email_public) 14945 |> Json.Codec.Object.opt_member "emailVerified" Json.Codec.bool ~enc:(fun r -> r.email_verified) 14946 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 14947 |> Json.Codec.Object.opt_member "language" Json.Codec.string ~enc:(fun r -> r.language) 14948 |> Json.Codec.Object.opt_member "lastLoginDate" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.last_login_date) 14949 |> Json.Codec.Object.opt_member "newFeaturesInfoRead" Json.Codec.number ~enc:(fun r -> r.new_features_info_read) 14950 |> Json.Codec.Object.opt_member "noAccountSetupWarningModal" Json.Codec.bool ~enc:(fun r -> r.no_account_setup_warning_modal) 14951 |> Json.Codec.Object.opt_member "noInstanceConfigWarningModal" Json.Codec.bool ~enc:(fun r -> r.no_instance_config_warning_modal) 14952 |> Json.Codec.Object.opt_member "noWelcomeModal" Json.Codec.bool ~enc:(fun r -> r.no_welcome_modal) 14953 |> Json.Codec.Object.opt_member "notificationSettings" UserNotificationSettings.T.jsont ~enc:(fun r -> r.notification_settings) 14954 |> Json.Codec.Object.opt_member "nsfwFlagsBlurred" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_blurred) 14955 |> Json.Codec.Object.opt_member "nsfwFlagsDisplayed" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_displayed) 14956 |> Json.Codec.Object.opt_member "nsfwFlagsHidden" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_hidden) 14957 |> Json.Codec.Object.opt_member "nsfwFlagsWarned" Nsfwflag.T.jsont ~enc:(fun r -> r.nsfw_flags_warned) 14958 |> Json.Codec.Object.opt_member "nsfwPolicy" Nsfwpolicy.T.jsont ~enc:(fun r -> r.nsfw_policy) 14959 |> Json.Codec.Object.opt_member "p2pEnabled" Json.Codec.bool ~enc:(fun r -> r.p2p_enabled) 14960 |> Json.Codec.Object.opt_member "pluginAuth" Json.Codec.string ~enc:(fun r -> r.plugin_auth) 14961 |> Json.Codec.Object.opt_member "role" Json.Codec.Value.t ~enc:(fun r -> r.role) 14962 |> Json.Codec.Object.opt_member "theme" Json.Codec.string ~enc:(fun r -> r.theme) 14963 |> Json.Codec.Object.opt_member "twoFactorEnabled" Json.Codec.bool ~enc:(fun r -> r.two_factor_enabled) 14964 |> Json.Codec.Object.opt_member "username" Username.T.jsont ~enc:(fun r -> r.username) 14965 |> Json.Codec.Object.opt_member "videoChannels" (Json.Codec.list VideoChannel.T.jsont) ~enc:(fun r -> r.video_channels) 14966 |> Json.Codec.Object.opt_member "videoLanguages" (Json.Codec.list Json.Codec.string) ~enc:(fun r -> r.video_languages) 14967 |> Json.Codec.Object.opt_member "videoQuota" Json.Codec.int ~enc:(fun r -> r.video_quota) 14968 |> Json.Codec.Object.opt_member "videoQuotaDaily" Json.Codec.int ~enc:(fun r -> r.video_quota_daily) 14969 |> Json.Codec.Object.opt_member "videosHistoryEnabled" Json.Codec.bool ~enc:(fun r -> r.videos_history_enabled) 14970 |> Json.Codec.Object.skip_unknown 14971 |> Json.Codec.Object.seal 14972 end 14973 14974 (** List users 14975 @param search Plain text search that will match with user usernames or emails 14976 @param blocked Filter results down to (un)banned users 14977 @param start Offset used to paginate results 14978 @param count Number of items to return 14979 @param sort Sort users by criteria 14980 *) 14981 let get_users ?search ?blocked ?start ?count ?sort client () = 14982 let op_name = "get_users" in 14983 let url_path = "/api/v1/users" in 14984 let query = Openapi.Runtime.Query.encode (List.concat [Openapi.Runtime.Query.optional ~key:"search" ~value:search; Openapi.Runtime.Query.optional ~key:"blocked" ~value:blocked; Openapi.Runtime.Query.optional ~key:"start" ~value:start; Openapi.Runtime.Query.optional ~key:"count" ~value:count; Openapi.Runtime.Query.optional ~key:"sort" ~value:sort]) in 14985 let url = client.base_url ^ url_path ^ query in 14986 let response = 14987 try Requests.get client.session url 14988 with Eio.Io _ as ex -> 14989 let bt = Printexc.get_raw_backtrace () in 14990 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 14991 in 14992 if Requests.Response.ok response then 14993 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 14994 else 14995 let body = Requests.Response.text response in 14996 let parsed_body = 14997 match Json.of_string Json.Codec.Value.t body with 14998 | Ok json -> Some (Openapi.Runtime.Json json) 14999 | Error _ -> Some (Openapi.Runtime.Raw body) 15000 in 15001 raise (Openapi.Runtime.Api_error { 15002 operation = op_name; 15003 method_ = "GET"; 15004 url; 15005 status = Requests.Response.status_code response; 15006 body; 15007 parsed_body; 15008 }) 15009 15010 (** Get my user information *) 15011 let get_user_info client () = 15012 let op_name = "get_user_info" in 15013 let url_path = "/api/v1/users/me" in 15014 let query = "" in 15015 let url = client.base_url ^ url_path ^ query in 15016 let response = 15017 try Requests.get client.session url 15018 with Eio.Io _ as ex -> 15019 let bt = Printexc.get_raw_backtrace () in 15020 Eio.Exn.reraise_with_context ex bt "calling %s %s" "GET" url 15021 in 15022 if Requests.Response.ok response then 15023 Openapi.Runtime.Json.decode_json_exn T.jsont (Requests.Response.text response) 15024 else 15025 let body = Requests.Response.text response in 15026 let parsed_body = 15027 match Json.of_string Json.Codec.Value.t body with 15028 | Ok json -> Some (Openapi.Runtime.Json json) 15029 | Error _ -> Some (Openapi.Runtime.Raw body) 15030 in 15031 raise (Openapi.Runtime.Api_error { 15032 operation = op_name; 15033 method_ = "GET"; 15034 url; 15035 status = Requests.Response.status_code response; 15036 body; 15037 parsed_body; 15038 }) 15039end 15040 15041module AbuseStateSet = struct 15042 module Types = struct 15043 module T = struct 15044 (** The abuse state (Pending = `1`, Rejected = `2`, Accepted = `3`) *) 15045 type t = string 15046 end 15047 end 15048 15049 module T = struct 15050 include Types.T 15051 let jsont = Json.Codec.string 15052 end 15053end 15054 15055module AbuseStateConstant = struct 15056 module Types = struct 15057 module T = struct 15058 type t = { 15059 id : AbuseStateSet.T.t option; 15060 label : string option; 15061 } 15062 end 15063 end 15064 15065 module T = struct 15066 include Types.T 15067 15068 let v ?id ?label () = { id; label } 15069 15070 let id t = t.id 15071 let label t = t.label 15072 15073 let jsont : t Json.codec = 15074 Json.Codec.Object.map ~kind:"AbuseStateConstant" 15075 (fun id label -> { id; label }) 15076 |> Json.Codec.Object.opt_member "id" AbuseStateSet.T.jsont ~enc:(fun r -> r.id) 15077 |> Json.Codec.Object.opt_member "label" Json.Codec.string ~enc:(fun r -> r.label) 15078 |> Json.Codec.Object.skip_unknown 15079 |> Json.Codec.Object.seal 15080 end 15081end 15082 15083module AbusePredefinedReasons = struct 15084 module Types = struct 15085 module T = struct 15086 type t = Json.t 15087 end 15088 end 15089 15090 module T = struct 15091 include Types.T 15092 let jsont = Json.Codec.Value.t 15093 let v () = Json.Null ((), Json.Meta.none) 15094 end 15095end 15096 15097module Abuse = struct 15098 module Types = struct 15099 module T = struct 15100 type t = { 15101 created_at : Ptime.t option; 15102 id : Id.T.t option; 15103 moderation_comment : string option; 15104 predefined_reasons : AbusePredefinedReasons.T.t option; 15105 reason : string option; 15106 reporter_account : Account.T.t option; 15107 state : AbuseStateConstant.T.t option; 15108 video : Json.t option; 15109 } 15110 end 15111 end 15112 15113 module T = struct 15114 include Types.T 15115 15116 let v ?created_at ?id ?moderation_comment ?predefined_reasons ?reason ?reporter_account ?state ?video () = { created_at; id; moderation_comment; predefined_reasons; reason; reporter_account; state; video } 15117 15118 let created_at t = t.created_at 15119 let id t = t.id 15120 let moderation_comment t = t.moderation_comment 15121 let predefined_reasons t = t.predefined_reasons 15122 let reason t = t.reason 15123 let reporter_account t = t.reporter_account 15124 let state t = t.state 15125 let video t = t.video 15126 15127 let jsont : t Json.codec = 15128 Json.Codec.Object.map ~kind:"Abuse" 15129 (fun created_at id moderation_comment predefined_reasons reason reporter_account state video -> { created_at; id; moderation_comment; predefined_reasons; reason; reporter_account; state; video }) 15130 |> Json.Codec.Object.opt_member "createdAt" Openapi.Runtime.ptime_jsont ~enc:(fun r -> r.created_at) 15131 |> Json.Codec.Object.opt_member "id" Id.T.jsont ~enc:(fun r -> r.id) 15132 |> Json.Codec.Object.opt_member "moderationComment" (Openapi.Runtime.validated_string ~min_length:2 ~max_length:3000 Json.Codec.string) ~enc:(fun r -> r.moderation_comment) 15133 |> Json.Codec.Object.opt_member "predefinedReasons" AbusePredefinedReasons.T.jsont ~enc:(fun r -> r.predefined_reasons) 15134 |> Json.Codec.Object.opt_member "reason" (Openapi.Runtime.validated_string ~min_length:2 ~max_length:3000 Json.Codec.string) ~enc:(fun r -> r.reason) 15135 |> Json.Codec.Object.opt_member "reporterAccount" Account.T.jsont ~enc:(fun r -> r.reporter_account) 15136 |> Json.Codec.Object.opt_member "state" AbuseStateConstant.T.jsont ~enc:(fun r -> r.state) 15137 |> Json.Codec.Object.opt_member "video" Json.Codec.Value.t ~enc:(fun r -> r.video) 15138 |> Json.Codec.Object.skip_unknown 15139 |> Json.Codec.Object.seal 15140 end 15141end