{"openapi":"3.1.0","info":{"title":"\"Hello World\" app API","version":"1.0.0","description":"API for \"Hello World\" app hosted at https:\/\/hello-world.vovk.dev\/. Source code is available on Github https:\/\/github.com\/finom\/vovk-hello-world. For more information about this app, visit the documentation page https:\/\/vovk.dev\/hello-world.","license":{"name":"MIT","url":"https:\/\/opensource.org\/licenses\/MIT"}},"servers":[{"url":"https:\/\/hello-world.vovk.dev","description":"Production"},{"url":"http:\/\/localhost:3000","description":"Localhost"}],"components":{"schemas":{"HttpStatus":{"type":"integer","description":"HTTP status code","enum":[100,101,102,103,200,201,202,203,204,205,206,300,301,302,303,304,307,308,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,421,422,424,428,429,500,501,502,503,504,505]},"VovkErrorResponse":{"type":"object","description":"Vovk error response","properties":{"cause":{"description":"Error cause of any shape"},"statusCode":{"$ref":"#\/components\/schemas\/HttpStatus"},"message":{"type":"string","description":"Error message"},"isError":{"type":"boolean","const":true,"description":"Indicates that this object represents an error"}},"required":["statusCode","message","isError"],"additionalProperties":false}}},"paths":{"\/api\/users\/{id}":{"post":{"summary":"Update user","description":"Update user by ID","x-codeSamples":[{"label":"TypeScript RPC","lang":"typescript","source":"import { UserRPC } from 'vovk-hello-world';\n\nconst response = await UserRPC.updateUser({\n    body: {\n        \/\/ -----\n        \/\/ User data object\n        \/\/ -----\n        \/\/ User email\n        email: \"john@example.com\",\n        \/\/ User profile object\n        profile: {\n            \/\/ User full name\n            name: \"John Doe\",\n            \/\/ User age\n            age: 25\n        }\n    },\n    query: {\n        \/\/ -----\n        \/\/ Query parameters\n        \/\/ -----\n        \/\/ Notification type\n        notify: \"email\"\n    },\n    params: {\n        \/\/ -----\n        \/\/ Path parameters\n        \/\/ -----\n        \/\/ User ID\n        id: \"123e4567-e89b-12d3-a456-426614174000\"\n    },\n});\n\nconsole.log(response); \n\/* \n{\n    \/\/ -----\n    \/\/ Response object\n    \/\/ -----\n    \/\/ Success status\n    success: true,\n    \/\/ User ID\n    id: \"00000000-0000-0000-0000-000000000000\",\n    \/\/ Notification type\n    notify: \"email\"\n}\n*\/"},{"label":"Python RPC","lang":"python","source":"from vovk_hello_world import UserRPC\n\nresponse = UserRPC.update_user(\n    body={\n        # -----\n        # User data object\n        # -----\n        # User email\n        \"email\": \"john@example.com\",\n        # User profile object\n        \"profile\": {\n            # User full name\n            \"name\": \"John Doe\",\n            # User age\n            \"age\": 25\n        }\n    },\n    query={\n        # -----\n        # Query parameters\n        # -----\n        # Notification type\n        \"notify\": \"email\"\n    },\n    params={\n        # -----\n        # Path parameters\n        # -----\n        # User ID\n        \"id\": \"123e4567-e89b-12d3-a456-426614174000\"\n    },\n)\n\nprint(response)\n{\n    # -----\n    # Response object\n    # -----\n    # Success status\n    \"success\": true,\n    # User ID\n    \"id\": \"00000000-0000-0000-0000-000000000000\",\n    # Notification type\n    \"notify\": \"email\"\n}"},{"label":"Rust RPC","lang":"rust","source":"use vovk_hello_world::user_rpc;\nuse serde_json::{ \n  from_value, \n  json \n};\n#[tokio::main]\nasync fn main() {\n  let response = user_rpc::update_user(\n    from_value(json!({\n        \/\/ -----\n        \/\/ User data object\n        \/\/ -----\n        \/\/ User email\n        \"email\": \"john@example.com\",\n        \/\/ User profile object\n        \"profile\": {\n            \/\/ User full name\n            \"name\": \"John Doe\",\n            \/\/ User age\n            \"age\": 25\n        }\n    })).unwrap(), \/* body *\/ \n    from_value(json!({\n        \/\/ -----\n        \/\/ Query parameters\n        \/\/ -----\n        \/\/ Notification type\n        \"notify\": \"email\"\n    })).unwrap(), \/* query *\/ \n    from_value(json!({\n        \/\/ -----\n        \/\/ Path parameters\n        \/\/ -----\n        \/\/ User ID\n        \"id\": \"123e4567-e89b-12d3-a456-426614174000\"\n    })).unwrap(), \/* params *\/ \n    None, \/* headers (HashMap) *\/ \n    None, \/* api_root *\/\n    false, \/* disable_client_validation *\/\n  ).await;\n\nmatch response {\n    Ok(output) => println!(\"{:?}\", output),\n    \/* \n    output {\n        \/\/ -----\n        \/\/ Response object\n        \/\/ -----\n        \/\/ Success status\n        success: true,\n        \/\/ User ID\n        id: \"00000000-0000-0000-0000-000000000000\",\n        \/\/ Notification type\n        notify: \"email\"\n    } \n    *\/\n    Err(e) => println!(\"error: {:?}\", e),\n  }\n}"}],"parameters":[{"name":"notify","in":"query","required":true,"schema":{"type":"string","enum":["email","push","none"],"description":"Notification type"}},{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"User ID","examples":["123e4567-e89b-12d3-a456-426614174000"]}}],"responses":{"200":{"description":"Response object","content":{"application\/json":{"schema":{"$schema":"https:\/\/json-schema.org\/draft\/2020-12\/schema","type":"object","properties":{"success":{"type":"boolean","description":"Success status"},"id":{"type":"string","format":"uuid","pattern":"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$","description":"User ID"},"notify":{"type":"string","enum":["email","push","none"],"description":"Notification type"}},"required":["success","id","notify"],"description":"Response object"}}}}},"requestBody":{"description":"User data object","required":true,"content":{"application\/json":{"schema":{"$schema":"https:\/\/json-schema.org\/draft\/2020-12\/schema","type":"object","properties":{"email":{"type":"string","format":"email","pattern":"^(?!\\.)(?!.*\\.\\.)([A-Za-z0-9_'+\\-\\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\\-]*\\.)+[A-Za-z]{2,}$","description":"User email","examples":["john@example.com","jane@example.com"]},"profile":{"type":"object","properties":{"name":{"type":"string","minLength":2,"description":"User full name","examples":["John Doe","Jane Smith"]},"age":{"type":"integer","minimum":16,"maximum":120,"description":"User age","examples":[25,30]}},"required":["name","age"],"description":"User profile object"}},"required":["email","profile"],"description":"User data object"}}}}}},"\/api\/streams\/tokens":{"get":{"summary":"Stream tokens","description":"Stream tokens to the client","x-codeSamples":[{"label":"TypeScript RPC","lang":"typescript","source":"import { StreamRPC } from 'vovk-hello-world';\n\nusing response = await StreamRPC.streamTokens();\n\nfor await (const item of response) {\n    console.log(item); \n    \/*\n    {\n        \/\/ -----\n        \/\/ Streamed token object\n        \/\/ -----\n        \/\/ Message from the token\n        message: \"string\"\n    }\n    *\/\n}"},{"label":"Python RPC","lang":"python","source":"from vovk_hello_world import StreamRPC\n\nresponse = StreamRPC.stream_tokens()\n\nfor i, item in enumerate(response):\n    print(f\"iteration #{i}:\\n {item}\")\n    # iteration #0:\n    {\n        # -----\n        # Streamed token object\n        # -----\n        # Message from the token\n        \"message\": \"string\"\n    }"},{"label":"Rust RPC","lang":"rust","source":"use vovk_hello_world::stream_rpc;\nuse serde_json::{ \n  from_value, \n  json \n};\nuse futures_util::StreamExt;\n#[tokio::main]\nasync fn main() {\n  let response = stream_rpc::stream_tokens(\n    (), \/* body *\/ \n    (), \/* query *\/ \n    (), \/* params *\/ \n    None, \/* headers (HashMap) *\/ \n    None, \/* api_root *\/\n    false, \/* disable_client_validation *\/\n  ).await;\n\nmatch response {\n    Ok(mut stream) => {\n      let mut i = 0;\n      while let Some(item) = stream.next().await {\n        match item {\n          Ok(value) => {\n            println!(\"#{}: {:?}\", i, value);\n            \/*\n            #0: iteration {\n            \/\/ -----\n            \/\/ Streamed token object\n            \/\/ -----\n            \/\/ Message from the token\n            message: \"string\"\n        }\n            *\/\n            i += 1;\n          }\n          Err(e) => {\n            eprintln!(\"stream error: {:?}\", e);\n            break;\n          }\n        }\n      }\n    },\n    Err(e) => println!(\"Error initiating stream: {:?}\", e),\n  }\n}"}],"responses":{"200":{"description":"Streamed token object","content":{"application\/jsonl":{"schema":{"$schema":"https:\/\/json-schema.org\/draft\/2020-12\/schema","type":"object","properties":{"message":{"type":"string","description":"Message from the token"}},"required":["message"],"description":"Streamed token object","examples":["{\"message\":\"string\"}\n{\"message\":\"string\"}\n{\"message\":\"string\"}"]}}}}}}},"\/api\/static\/openapi.json":{"get":{"summary":"OpenAPI spec","description":"Get the OpenAPI spec for the \"Hello World\" app API","x-codeSamples":[{"label":"TypeScript RPC","lang":"typescript","source":"import { OpenApiRPC } from 'vovk-hello-world';\n\nconst response = await OpenApiRPC.getSpec();"},{"label":"Python RPC","lang":"python","source":"from vovk_hello_world import OpenApiRPC\n\nresponse = OpenApiRPC.get_spec()"},{"label":"Rust RPC","lang":"rust","source":"use vovk_hello_world::open_api_rpc;\nuse serde_json::{ \n  from_value, \n  json \n};\n#[tokio::main]\nasync fn main() {\n  let response = open_api_rpc::get_spec(\n    (), \/* body *\/ \n    (), \/* query *\/ \n    (), \/* params *\/ \n    None, \/* headers (HashMap) *\/ \n    None, \/* api_root *\/\n    false, \/* disable_client_validation *\/\n  ).await;\n}"}]}}}}