From 07e825bcd405b9e5ae1542cc3378a47a61cfe84d Mon Sep 17 00:00:00 2001 From: Joel Wachsler Date: Fri, 22 Jul 2022 14:34:47 +0000 Subject: [PATCH] Fix warnings --- qbittorrent-web-api-gen/groups.txt | 396 ------------------ .../src/generate/group/mod.rs | 12 - .../method/method_tests/search_result.check | 26 -- .../src/parser/group/method/mod.rs | 13 +- qbittorrent-web-api-gen/src/types.rs | 40 +- 5 files changed, 11 insertions(+), 476 deletions(-) diff --git a/qbittorrent-web-api-gen/groups.txt b/qbittorrent-web-api-gen/groups.txt index 4984ab4..7e19da5 100644 --- a/qbittorrent-web-api-gen/groups.txt +++ b/qbittorrent-web-api-gen/groups.txt @@ -17,22 +17,18 @@ TypeInfo { name: "username", is_optional: false, - is_list: false, description: Some( "Username used to access the WebUI", ), - type_description: None, }, ), String( TypeInfo { name: "password", is_optional: false, - is_list: false, description: Some( "Password used to access the WebUI", ), - type_description: None, }, ), ], @@ -93,55 +89,45 @@ TypeInfo { name: "qt", is_optional: false, - is_list: false, description: Some( "QT version", ), - type_description: None, }, ), String( TypeInfo { name: "libtorrent", is_optional: false, - is_list: false, description: Some( "libtorrent version", ), - type_description: None, }, ), String( TypeInfo { name: "boost", is_optional: false, - is_list: false, description: Some( "Boost version", ), - type_description: None, }, ), String( TypeInfo { name: "openssl", is_optional: false, - is_list: false, description: Some( "OpenSSL version", ), - type_description: None, }, ), Number( TypeInfo { name: "bitness", is_optional: false, - is_list: false, description: Some( "Application bitness (e.g. 64-bit)", ), - type_description: None, }, ), ], @@ -535,55 +521,45 @@ TypeInfo { name: "normal", is_optional: true, - is_list: false, description: Some( "Include normal messages (default: true)", ), - type_description: None, }, ), Bool( TypeInfo { name: "info", is_optional: true, - is_list: false, description: Some( "Include info messages (default: true)", ), - type_description: None, }, ), Bool( TypeInfo { name: "warning", is_optional: true, - is_list: false, description: Some( "Include warning messages (default: true)", ), - type_description: None, }, ), Bool( TypeInfo { name: "critical", is_optional: true, - is_list: false, description: Some( "Include critical messages (default: true)", ), - type_description: None, }, ), Number( TypeInfo { name: "last_known_id", is_optional: true, - is_list: false, description: Some( "Exclude messages with \"message id\" <= last_known_id (default: -1)", ), - type_description: None, }, ), ], @@ -607,11 +583,9 @@ TypeInfo { name: "last_known_id", is_optional: true, - is_list: false, description: Some( "Exclude messages with \"message id\" <= last_known_id (default: -1)", ), - type_description: None, }, ), ], @@ -644,11 +618,9 @@ TypeInfo { name: "rid", is_optional: false, - is_list: false, description: Some( "Response ID. If not provided, rid=0 will be assumed. If the given rid is different from the one of last server reply, full_update will be true (see the server reply details for more info)", ), - type_description: None, }, ), ], @@ -661,22 +633,18 @@ TypeInfo { name: "rid", is_optional: false, - is_list: false, description: Some( "Response ID", ), - type_description: None, }, ), Bool( TypeInfo { name: "full_update", is_optional: false, - is_list: false, description: Some( "Whether the response contains all the data or partial data", ), - type_description: None, }, ), Object( @@ -684,11 +652,9 @@ type_info: TypeInfo { name: "torrents", is_optional: false, - is_list: false, description: Some( "Property: torrent hash, value: same as [torrent list](#get-torrent-list)", ), - type_description: None, }, ref_type: "Object", }, @@ -697,11 +663,9 @@ TypeInfo { name: "torrents_removed", is_optional: false, - is_list: false, description: Some( "List of hashes of torrents removed since last request", ), - type_description: None, }, ), Object( @@ -709,11 +673,9 @@ type_info: TypeInfo { name: "categories", is_optional: false, - is_list: false, description: Some( "Info for categories added since last request", ), - type_description: None, }, ref_type: "Object", }, @@ -722,33 +684,27 @@ TypeInfo { name: "categories_removed", is_optional: false, - is_list: false, description: Some( "List of categories removed since last request", ), - type_description: None, }, ), StringArray( TypeInfo { name: "tags", is_optional: false, - is_list: false, description: Some( "List of tags added since last request", ), - type_description: None, }, ), StringArray( TypeInfo { name: "tags_removed", is_optional: false, - is_list: false, description: Some( "List of tags removed since last request", ), - type_description: None, }, ), Object( @@ -756,11 +712,9 @@ type_info: TypeInfo { name: "server_state", is_optional: false, - is_list: false, description: Some( "Global transfer info", ), - type_description: None, }, ref_type: "Object", }, @@ -786,22 +740,18 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "Torrent hash", ), - type_description: None, }, ), Number( TypeInfo { name: "rid", is_optional: false, - is_list: false, description: Some( "Response ID. If not provided, rid=0 will be assumed. If the given rid is different from the one of last server reply, full_update will be true (see the server reply details for more info)", ), - type_description: None, }, ), ], @@ -834,88 +784,72 @@ TypeInfo { name: "dl_info_speed", is_optional: false, - is_list: false, description: Some( "Global download rate (bytes/s)", ), - type_description: None, }, ), Number( TypeInfo { name: "dl_info_data", is_optional: false, - is_list: false, description: Some( "Data downloaded this session (bytes)", ), - type_description: None, }, ), Number( TypeInfo { name: "up_info_speed", is_optional: false, - is_list: false, description: Some( "Global upload rate (bytes/s)", ), - type_description: None, }, ), Number( TypeInfo { name: "up_info_data", is_optional: false, - is_list: false, description: Some( "Data uploaded this session (bytes)", ), - type_description: None, }, ), Number( TypeInfo { name: "dl_rate_limit", is_optional: false, - is_list: false, description: Some( "Download rate limit (bytes/s)", ), - type_description: None, }, ), Number( TypeInfo { name: "up_rate_limit", is_optional: false, - is_list: false, description: Some( "Upload rate limit (bytes/s)", ), - type_description: None, }, ), Number( TypeInfo { name: "dht_nodes", is_optional: false, - is_list: false, description: Some( "DHT nodes connected to", ), - type_description: None, }, ), String( TypeInfo { name: "connection_status", is_optional: false, - is_list: false, description: Some( "Connection status. See possible values here below", ), - type_description: None, }, ), ], @@ -965,11 +899,9 @@ TypeInfo { name: "limit", is_optional: false, - is_list: false, description: Some( "The global download speed limit to set in bytes/second", ), - type_description: None, }, ), ], @@ -1001,11 +933,9 @@ TypeInfo { name: "limit", is_optional: false, - is_list: false, description: Some( "The global upload speed limit to set in bytes/second", ), - type_description: None, }, ), ], @@ -1027,11 +957,9 @@ TypeInfo { name: "peers", is_optional: false, - is_list: false, description: Some( "The peer to ban, or multiple peers separated by a pipe \\", ), - type_description: None, }, ), ], @@ -1064,88 +992,72 @@ TypeInfo { name: "filter", is_optional: true, - is_list: false, description: Some( "Filter torrent list by state. Allowed state filters: all, downloading, seeding, completed, paused, active, inactive, resumed, stalled, stalled_uploading, stalled_downloading, errored", ), - type_description: None, }, ), String( TypeInfo { name: "category", is_optional: true, - is_list: false, description: Some( "Get torrents with the given category (empty string means \"without category\"; no \"category\" parameter means \"any category\" <- broken until [#11748](https://github.com/qbittorrent/qBittorrent/issues/11748) is resolved). Remember to URL-encode the category name. For example, My category becomes My%20category", ), - type_description: None, }, ), String( TypeInfo { name: "tag", is_optional: true, - is_list: false, description: Some( "Get torrents with the given tag (empty string means \"without tag\"; no \"tag\" parameter means \"any tag\". Remember to URL-encode the category name. For example, My tag becomes My%20tag", ), - type_description: None, }, ), String( TypeInfo { name: "sort", is_optional: true, - is_list: false, description: Some( "Sort torrents by given key. They can be sorted using any field of the response's JSON array (which are documented below) as the sort key.", ), - type_description: None, }, ), Bool( TypeInfo { name: "reverse", is_optional: true, - is_list: false, description: Some( "Enable reverse sorting. Defaults to false", ), - type_description: None, }, ), Number( TypeInfo { name: "limit", is_optional: true, - is_list: false, description: Some( "Limit the number of torrents returned", ), - type_description: None, }, ), Number( TypeInfo { name: "offset", is_optional: true, - is_list: false, description: Some( "Set offset (if less than 0, offset from end)", ), - type_description: None, }, ), String( TypeInfo { name: "hashes", is_optional: true, - is_list: false, description: Some( "Filter by hashes. Can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -1298,495 +1210,405 @@ TypeInfo { name: "added_on", is_optional: false, - is_list: false, description: Some( "Time (Unix Epoch) when the torrent was added to the client", ), - type_description: None, }, ), Number( TypeInfo { name: "amount_left", is_optional: false, - is_list: false, description: Some( "Amount of data left to download (bytes)", ), - type_description: None, }, ), Bool( TypeInfo { name: "auto_tmm", is_optional: false, - is_list: false, description: Some( "Whether this torrent is managed by Automatic Torrent Management", ), - type_description: None, }, ), Float( TypeInfo { name: "availability", is_optional: false, - is_list: false, description: Some( "Percentage of file pieces currently available", ), - type_description: None, }, ), String( TypeInfo { name: "category", is_optional: false, - is_list: false, description: Some( "Category of the torrent", ), - type_description: None, }, ), Number( TypeInfo { name: "completed", is_optional: false, - is_list: false, description: Some( "Amount of transfer data completed (bytes)", ), - type_description: None, }, ), Number( TypeInfo { name: "completion_on", is_optional: false, - is_list: false, description: Some( "Time (Unix Epoch) when the torrent completed", ), - type_description: None, }, ), String( TypeInfo { name: "content_path", is_optional: false, - is_list: false, description: Some( "Absolute path of torrent content (root path for multifile torrents, absolute file path for singlefile torrents)", ), - type_description: None, }, ), Number( TypeInfo { name: "dl_limit", is_optional: false, - is_list: false, description: Some( "Torrent download speed limit (bytes/s). -1 if ulimited.", ), - type_description: None, }, ), Number( TypeInfo { name: "dlspeed", is_optional: false, - is_list: false, description: Some( "Torrent download speed (bytes/s)", ), - type_description: None, }, ), Number( TypeInfo { name: "downloaded", is_optional: false, - is_list: false, description: Some( "Amount of data downloaded", ), - type_description: None, }, ), Number( TypeInfo { name: "downloaded_session", is_optional: false, - is_list: false, description: Some( "Amount of data downloaded this session", ), - type_description: None, }, ), Number( TypeInfo { name: "eta", is_optional: false, - is_list: false, description: Some( "Torrent ETA (seconds)", ), - type_description: None, }, ), Bool( TypeInfo { name: "f_l_piece_prio", is_optional: false, - is_list: false, description: Some( "True if first last piece are prioritized", ), - type_description: None, }, ), Bool( TypeInfo { name: "force_start", is_optional: false, - is_list: false, description: Some( "True if force start is enabled for this torrent", ), - type_description: None, }, ), String( TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "Torrent hash", ), - type_description: None, }, ), Number( TypeInfo { name: "last_activity", is_optional: false, - is_list: false, description: Some( "Last time (Unix Epoch) when a chunk was downloaded/uploaded", ), - type_description: None, }, ), String( TypeInfo { name: "magnet_uri", is_optional: false, - is_list: false, description: Some( "Magnet URI corresponding to this torrent", ), - type_description: None, }, ), Float( TypeInfo { name: "max_ratio", is_optional: false, - is_list: false, description: Some( "Maximum share ratio until torrent is stopped from seeding/uploading", ), - type_description: None, }, ), Number( TypeInfo { name: "max_seeding_time", is_optional: false, - is_list: false, description: Some( "Maximum seeding time (seconds) until torrent is stopped from seeding", ), - type_description: None, }, ), String( TypeInfo { name: "name", is_optional: false, - is_list: false, description: Some( "Torrent name", ), - type_description: None, }, ), Number( TypeInfo { name: "num_complete", is_optional: false, - is_list: false, description: Some( "Number of seeds in the swarm", ), - type_description: None, }, ), Number( TypeInfo { name: "num_incomplete", is_optional: false, - is_list: false, description: Some( "Number of leechers in the swarm", ), - type_description: None, }, ), Number( TypeInfo { name: "num_leechs", is_optional: false, - is_list: false, description: Some( "Number of leechers connected to", ), - type_description: None, }, ), Number( TypeInfo { name: "num_seeds", is_optional: false, - is_list: false, description: Some( "Number of seeds connected to", ), - type_description: None, }, ), Number( TypeInfo { name: "priority", is_optional: false, - is_list: false, description: Some( "Torrent priority. Returns -1 if queuing is disabled or torrent is in seed mode", ), - type_description: None, }, ), Float( TypeInfo { name: "progress", is_optional: false, - is_list: false, description: Some( "Torrent progress (percentage/100)", ), - type_description: None, }, ), Float( TypeInfo { name: "ratio", is_optional: false, - is_list: false, description: Some( "Torrent share ratio. Max ratio value: 9999.", ), - type_description: None, }, ), Float( TypeInfo { name: "ratio_limit", is_optional: false, - is_list: false, description: Some( "TODO (what is different from max_ratio?)", ), - type_description: None, }, ), String( TypeInfo { name: "save_path", is_optional: false, - is_list: false, description: Some( "Path where this torrent's data is stored", ), - type_description: None, }, ), Number( TypeInfo { name: "seeding_time", is_optional: false, - is_list: false, description: Some( "Torrent elapsed time while complete (seconds)", ), - type_description: None, }, ), Number( TypeInfo { name: "seeding_time_limit", is_optional: false, - is_list: false, description: Some( "TODO (what is different from max_seeding_time?) seeding_time_limit is a per torrent setting, when Automatic Torrent Management is disabled, furthermore then max_seeding_time is set to seeding_time_limit for this torrent. If Automatic Torrent Management is enabled, the value is -2. And if max_seeding_time is unset it have a default value -1.", ), - type_description: None, }, ), Number( TypeInfo { name: "seen_complete", is_optional: false, - is_list: false, description: Some( "Time (Unix Epoch) when this torrent was last seen complete", ), - type_description: None, }, ), Bool( TypeInfo { name: "seq_dl", is_optional: false, - is_list: false, description: Some( "True if sequential download is enabled", ), - type_description: None, }, ), Number( TypeInfo { name: "size", is_optional: false, - is_list: false, description: Some( "Total size (bytes) of files selected for download", ), - type_description: None, }, ), String( TypeInfo { name: "state", is_optional: false, - is_list: false, description: Some( "Torrent state. See table here below for the possible values", ), - type_description: None, }, ), Bool( TypeInfo { name: "super_seeding", is_optional: false, - is_list: false, description: Some( "True if super seeding is enabled", ), - type_description: None, }, ), String( TypeInfo { name: "tags", is_optional: false, - is_list: false, description: Some( "Comma-concatenated tag list of the torrent", ), - type_description: None, }, ), Number( TypeInfo { name: "time_active", is_optional: false, - is_list: false, description: Some( "Total active time (seconds)", ), - type_description: None, }, ), Number( TypeInfo { name: "total_size", is_optional: false, - is_list: false, description: Some( "Total size (bytes) of all file in this torrent (including unselected ones)", ), - type_description: None, }, ), String( TypeInfo { name: "tracker", is_optional: false, - is_list: false, description: Some( "The first tracker with working status. Returns empty string if no tracker is working.", ), - type_description: None, }, ), Number( TypeInfo { name: "up_limit", is_optional: false, - is_list: false, description: Some( "Torrent upload speed limit (bytes/s). -1 if ulimited.", ), - type_description: None, }, ), Number( TypeInfo { name: "uploaded", is_optional: false, - is_list: false, description: Some( "Amount of data uploaded", ), - type_description: None, }, ), Number( TypeInfo { name: "uploaded_session", is_optional: false, - is_list: false, description: Some( "Amount of data uploaded this session", ), - type_description: None, }, ), Number( TypeInfo { name: "upspeed", is_optional: false, - is_list: false, description: Some( "Torrent upload speed (bytes/s)", ), - type_description: None, }, ), ], @@ -1810,11 +1632,9 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent you want to get the generic properties of", ), - type_description: None, }, ), ], @@ -1838,11 +1658,9 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent you want to get the trackers of", ), - type_description: None, }, ), ], @@ -1897,88 +1715,72 @@ TypeInfo { name: "url", is_optional: false, - is_list: false, description: Some( "Tracker url", ), - type_description: None, }, ), Number( TypeInfo { name: "status", is_optional: false, - is_list: false, description: Some( "Tracker status. See the table below for possible values", ), - type_description: None, }, ), Number( TypeInfo { name: "tier", is_optional: false, - is_list: false, description: Some( "Tracker priority tier. Lower tier trackers are tried before higher tiers. Tier numbers are valid when >= 0, < 0 is used as placeholder when tier does not exist for special entries (such as DHT).", ), - type_description: None, }, ), Number( TypeInfo { name: "num_peers", is_optional: false, - is_list: false, description: Some( "Number of peers for current torrent, as reported by the tracker", ), - type_description: None, }, ), Number( TypeInfo { name: "num_seeds", is_optional: false, - is_list: false, description: Some( "Number of seeds for current torrent, asreported by the tracker", ), - type_description: None, }, ), Number( TypeInfo { name: "num_leeches", is_optional: false, - is_list: false, description: Some( "Number of leeches for current torrent, as reported by the tracker", ), - type_description: None, }, ), Number( TypeInfo { name: "num_downloaded", is_optional: false, - is_list: false, description: Some( "Number of completed downlods for current torrent, as reported by the tracker", ), - type_description: None, }, ), String( TypeInfo { name: "msg", is_optional: false, - is_list: false, description: Some( "Tracker message (there is no way of knowing what this message is - it's up to tracker admins)", ), - type_description: None, }, ), ], @@ -2002,11 +1804,9 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent you want to get the webseeds of", ), - type_description: None, }, ), ], @@ -2019,11 +1819,9 @@ TypeInfo { name: "url", is_optional: false, - is_list: false, description: Some( "URL of the web seed", ), - type_description: None, }, ), ], @@ -2047,22 +1845,18 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent you want to get the contents of", ), - type_description: None, }, ), String( TypeInfo { name: "indexes", is_optional: true, - is_list: false, description: Some( "The indexes of the files you want to retrieve. indexes can contain multiple values separated by \\", ), - type_description: None, }, ), ], @@ -2121,11 +1915,9 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent you want to get the pieces' states of", ), - type_description: None, }, ), ], @@ -2149,11 +1941,9 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent you want to get the pieces' hashes of", ), - type_description: None, }, ), ], @@ -2175,11 +1965,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to pause. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2201,11 +1989,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to resume. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2227,11 +2013,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to delete. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), Object( @@ -2239,9 +2023,7 @@ type_info: TypeInfo { name: "deleteFiles", is_optional: false, - is_list: false, description: None, - type_description: None, }, ref_type: "If set to true, the downloaded data will also be deleted, otherwise has no effect.", }, @@ -2265,11 +2047,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to recheck. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2291,11 +2071,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to reannounce. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2317,11 +2095,9 @@ TypeInfo { name: "urls", is_optional: false, - is_list: false, description: Some( "URLs separated with newlines", ), - type_description: None, }, ), Object( @@ -2329,11 +2105,9 @@ type_info: TypeInfo { name: "torrents", is_optional: false, - is_list: false, description: Some( "Raw data of torrent file. torrents can be presented multiple times.", ), - type_description: None, }, ref_type: "Raw", }, @@ -2342,165 +2116,135 @@ TypeInfo { name: "savepath", is_optional: true, - is_list: false, description: Some( "Download folder", ), - type_description: None, }, ), String( TypeInfo { name: "cookie", is_optional: true, - is_list: false, description: Some( "Cookie sent to download the .torrent file", ), - type_description: None, }, ), String( TypeInfo { name: "category", is_optional: true, - is_list: false, description: Some( "Category for the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "tags", is_optional: true, - is_list: false, description: Some( "Tags for the torrent, split by ','", ), - type_description: None, }, ), String( TypeInfo { name: "skip_checking", is_optional: true, - is_list: false, description: Some( "Skip hash checking. Possible values are true, false (default)", ), - type_description: None, }, ), String( TypeInfo { name: "paused", is_optional: true, - is_list: false, description: Some( "Add torrents in the paused state. Possible values are true, false (default)", ), - type_description: None, }, ), String( TypeInfo { name: "root_folder", is_optional: true, - is_list: false, description: Some( "Create the root folder. Possible values are true, false, unset (default)", ), - type_description: None, }, ), String( TypeInfo { name: "rename", is_optional: true, - is_list: false, description: Some( "Rename torrent", ), - type_description: None, }, ), Number( TypeInfo { name: "upLimit", is_optional: true, - is_list: false, description: Some( "Set torrent upload speed limit. Unit in bytes/second", ), - type_description: None, }, ), Number( TypeInfo { name: "dlLimit", is_optional: true, - is_list: false, description: Some( "Set torrent download speed limit. Unit in bytes/second", ), - type_description: None, }, ), Float( TypeInfo { name: "ratioLimit", is_optional: true, - is_list: false, description: Some( "Set torrent share ratio limit", ), - type_description: None, }, ), Number( TypeInfo { name: "seedingTimeLimit", is_optional: true, - is_list: false, description: Some( "Set torrent seeding time limit. Unit in seconds", ), - type_description: None, }, ), Bool( TypeInfo { name: "autoTMM", is_optional: true, - is_list: false, description: Some( "Whether Automatic Torrent Management should be used", ), - type_description: None, }, ), String( TypeInfo { name: "sequentialDownload", is_optional: true, - is_list: false, description: Some( "Enable sequential download. Possible values are true, false (default)", ), - type_description: None, }, ), String( TypeInfo { name: "firstLastPiecePrio", is_optional: true, - is_list: false, description: Some( "Prioritize download first last piece. Possible values are true, false (default)", ), - type_description: None, }, ), ], @@ -2530,33 +2274,27 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "origUrl", is_optional: false, - is_list: false, description: Some( "The tracker URL you want to edit", ), - type_description: None, }, ), String( TypeInfo { name: "newUrl", is_optional: false, - is_list: false, description: Some( "The new URL to replace the origUrl", ), - type_description: None, }, ), ], @@ -2578,22 +2316,18 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "urls", is_optional: false, - is_list: false, description: Some( "URLs to remove, separated by \\", ), - type_description: None, }, ), ], @@ -2615,22 +2349,18 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hash of the torrent, or multiple hashes separated by a pipe \\", ), - type_description: None, }, ), String( TypeInfo { name: "peers", is_optional: false, - is_list: false, description: Some( "The peer to add, or multiple peers separated by a pipe \\", ), - type_description: None, }, ), ], @@ -2652,11 +2382,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to increase the priority of. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2678,11 +2406,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to decrease the priority of. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2704,11 +2430,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to set to the maximum priority. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2730,11 +2454,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to set to the minimum priority. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2756,33 +2478,27 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "id", is_optional: false, - is_list: false, description: Some( "File ids, separated by \\", ), - type_description: None, }, ), Number( TypeInfo { name: "priority", is_optional: false, - is_list: false, description: Some( "File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)", ), - type_description: None, }, ), ], @@ -2940,11 +2656,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to toggle sequential download for. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -2966,11 +2680,9 @@ TypeInfo { name: "hashes", is_optional: false, - is_list: false, description: Some( "The hashes of the torrents you want to toggle the first/last piece priority for. hashes can contain multiple hashes separated by \\", ), - type_description: None, }, ), ], @@ -3008,33 +2720,27 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "oldPath", is_optional: false, - is_list: false, description: Some( "The old path of the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "newPath", is_optional: false, - is_list: false, description: Some( "The new path to use for the file", ), - type_description: None, }, ), ], @@ -3056,33 +2762,27 @@ TypeInfo { name: "hash", is_optional: false, - is_list: false, description: Some( "The hash of the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "oldPath", is_optional: false, - is_list: false, description: Some( "The old path of the torrent", ), - type_description: None, }, ), String( TypeInfo { name: "newPath", is_optional: false, - is_list: false, description: Some( "The new path to use for the file", ), - type_description: None, }, ), ], @@ -3113,11 +2813,9 @@ TypeInfo { name: "path", is_optional: false, - is_list: false, description: Some( "Full path of added folder (e.g. \"The Pirate Bay\\Top100\")", ), - type_description: None, }, ), ], @@ -3139,22 +2837,18 @@ TypeInfo { name: "url", is_optional: false, - is_list: false, description: Some( "URL of RSS feed (e.g. \"[http://thepiratebay.org/rss//top100/200](http://thepiratebay.org/rss//top100/200)\")", ), - type_description: None, }, ), String( TypeInfo { name: "path", is_optional: true, - is_list: false, description: Some( "Full path of added folder (e.g. \"The Pirate Bay\\Top100\\Video\")", ), - type_description: None, }, ), ], @@ -3176,11 +2870,9 @@ TypeInfo { name: "path", is_optional: false, - is_list: false, description: Some( "Full path of removed item (e.g. \"The Pirate Bay\\Top100\")", ), - type_description: None, }, ), ], @@ -3202,22 +2894,18 @@ TypeInfo { name: "itemPath", is_optional: false, - is_list: false, description: Some( "Current full path of item (e.g. \"The Pirate Bay\\Top100\")", ), - type_description: None, }, ), String( TypeInfo { name: "destPath", is_optional: false, - is_list: false, description: Some( "New full path of item (e.g. \"The Pirate Bay\")", ), - type_description: None, }, ), ], @@ -3239,11 +2927,9 @@ TypeInfo { name: "withData", is_optional: true, - is_list: false, description: Some( "True if you need current feed articles", ), - type_description: None, }, ), ], @@ -3265,22 +2951,18 @@ TypeInfo { name: "itemPath", is_optional: false, - is_list: false, description: Some( "Current full path of item (e.g. \"The Pirate Bay\\Top100\")", ), - type_description: None, }, ), String( TypeInfo { name: "articleId", is_optional: true, - is_list: false, description: Some( "ID of article", ), - type_description: None, }, ), ], @@ -3302,11 +2984,9 @@ TypeInfo { name: "itemPath", is_optional: false, - is_list: false, description: Some( "Current full path of item (e.g. \"The Pirate Bay\\Top100\")", ), - type_description: None, }, ), ], @@ -3328,22 +3008,18 @@ TypeInfo { name: "ruleName", is_optional: false, - is_list: false, description: Some( "Rule name (e.g. \"Punisher\")", ), - type_description: None, }, ), String( TypeInfo { name: "ruleDef", is_optional: false, - is_list: false, description: Some( "JSON encoded rule definition", ), - type_description: None, }, ), ], @@ -3365,22 +3041,18 @@ TypeInfo { name: "ruleName", is_optional: false, - is_list: false, description: Some( "Rule name (e.g. \"Punisher\")", ), - type_description: None, }, ), String( TypeInfo { name: "newRuleName", is_optional: false, - is_list: false, description: Some( "New rule name (e.g. \"The Punisher\")", ), - type_description: None, }, ), ], @@ -3402,11 +3074,9 @@ TypeInfo { name: "ruleName", is_optional: false, - is_list: false, description: Some( "Rule name (e.g. \"Punisher\")", ), - type_description: None, }, ), ], @@ -3455,33 +3125,27 @@ TypeInfo { name: "pattern", is_optional: false, - is_list: false, description: Some( "Pattern to search for (e.g. \"Ubuntu 18.04\")", ), - type_description: None, }, ), String( TypeInfo { name: "plugins", is_optional: false, - is_list: false, description: Some( "Plugins to use for searching (e.g. \"legittorrents\"). Supports multiple plugins separated by \\", ), - type_description: None, }, ), String( TypeInfo { name: "category", is_optional: false, - is_list: false, description: Some( "Categories to limit your search to (e.g. \"legittorrents\"). Available categories depend on the specified plugins. Also supports all", ), - type_description: None, }, ), ], @@ -3494,11 +3158,9 @@ TypeInfo { name: "id", is_optional: false, - is_list: false, description: Some( "ID of the search job", ), - type_description: None, }, ), ], @@ -3520,11 +3182,9 @@ TypeInfo { name: "id", is_optional: false, - is_list: false, description: Some( "ID of the search job", ), - type_description: None, }, ), ], @@ -3548,11 +3208,9 @@ TypeInfo { name: "id", is_optional: true, - is_list: false, description: Some( "ID of the search job. If not specified, all search jobs are returned", ), - type_description: None, }, ), ], @@ -3565,33 +3223,27 @@ TypeInfo { name: "id", is_optional: false, - is_list: false, description: Some( "ID of the search job", ), - type_description: None, }, ), String( TypeInfo { name: "status", is_optional: false, - is_list: false, description: Some( "Current status of the search job (either Running or Stopped)", ), - type_description: None, }, ), Number( TypeInfo { name: "total", is_optional: false, - is_list: false, description: Some( "Total number of results. If the status is Running this number may contineu to increase", ), - type_description: None, }, ), ], @@ -3615,33 +3267,27 @@ TypeInfo { name: "id", is_optional: false, - is_list: false, description: Some( "ID of the search job", ), - type_description: None, }, ), Number( TypeInfo { name: "limit", is_optional: true, - is_list: false, description: Some( "max number of results to return. 0 or negative means no limit", ), - type_description: None, }, ), Number( TypeInfo { name: "offset", is_optional: true, - is_list: false, description: Some( "result to start at. A negative number means count backwards (e.g. -2 returns the 2 most recent results)", ), - type_description: None, }, ), ], @@ -3655,77 +3301,63 @@ TypeInfo { name: "descrLink", is_optional: false, - is_list: false, description: Some( "URL of the torrent's description page", ), - type_description: None, }, ), String( TypeInfo { name: "fileName", is_optional: false, - is_list: false, description: Some( "Name of the file", ), - type_description: None, }, ), Number( TypeInfo { name: "fileSize", is_optional: false, - is_list: false, description: Some( "Size of the file in Bytes", ), - type_description: None, }, ), String( TypeInfo { name: "fileUrl", is_optional: false, - is_list: false, description: Some( "Torrent download link (usually either .torrent file or magnet link)", ), - type_description: None, }, ), Number( TypeInfo { name: "nbLeechers", is_optional: false, - is_list: false, description: Some( "Number of leechers", ), - type_description: None, }, ), Number( TypeInfo { name: "nbSeeders", is_optional: false, - is_list: false, description: Some( "Number of seeders", ), - type_description: None, }, ), String( TypeInfo { name: "siteUrl", is_optional: false, - is_list: false, description: Some( "URL of the torrent site", ), - type_description: None, }, ), ], @@ -3739,11 +3371,9 @@ type_info: TypeInfo { name: "results", is_optional: false, - is_list: false, description: Some( "Array of result objects- see table below", ), - type_description: None, }, ref_type: "Result", }, @@ -3752,22 +3382,18 @@ TypeInfo { name: "status", is_optional: false, - is_list: false, description: Some( "Current status of the search job (either Running or Stopped)", ), - type_description: None, }, ), Number( TypeInfo { name: "total", is_optional: false, - is_list: false, description: Some( "Total number of results. If the status is Running this number may continue to increase", ), - type_description: None, }, ), ], @@ -3789,11 +3415,9 @@ TypeInfo { name: "id", is_optional: false, - is_list: false, description: Some( "ID of the search job", ), - type_description: None, }, ), ], @@ -3817,66 +3441,54 @@ TypeInfo { name: "enabled", is_optional: false, - is_list: false, description: Some( "Whether the plugin is enabled", ), - type_description: None, }, ), String( TypeInfo { name: "fullName", is_optional: false, - is_list: false, description: Some( "Full name of the plugin", ), - type_description: None, }, ), String( TypeInfo { name: "name", is_optional: false, - is_list: false, description: Some( "Short name of the plugin", ), - type_description: None, }, ), StringArray( TypeInfo { name: "supportedCategories", is_optional: false, - is_list: false, description: Some( "List of category objects", ), - type_description: None, }, ), String( TypeInfo { name: "url", is_optional: false, - is_list: false, description: Some( "URL of the torrent site", ), - type_description: None, }, ), String( TypeInfo { name: "version", is_optional: false, - is_list: false, description: Some( "Installed version of the plugin", ), - type_description: None, }, ), ], @@ -3898,11 +3510,9 @@ TypeInfo { name: "sources", is_optional: false, - is_list: false, description: Some( "Url or file path of the plugin to install (e.g. \"[https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/legittorrents.py](https://raw.githubusercontent.com/qbittorrent/search-plugins/master/nova3/engines/legittorrents.py)\"). Supports multiple sources separated by \\", ), - type_description: None, }, ), ], @@ -3924,11 +3534,9 @@ TypeInfo { name: "names", is_optional: false, - is_list: false, description: Some( "Name of the plugin to uninstall (e.g. \"legittorrents\"). Supports multiple names separated by \\", ), - type_description: None, }, ), ], @@ -3950,22 +3558,18 @@ TypeInfo { name: "names", is_optional: false, - is_list: false, description: Some( "Name of the plugin to enable/disable (e.g. \"legittorrents\"). Supports multiple names separated by \\", ), - type_description: None, }, ), Bool( TypeInfo { name: "enable", is_optional: false, - is_list: false, description: Some( "Whether the plugins should be enabled", ), - type_description: None, }, ), ], diff --git a/qbittorrent-web-api-gen/src/generate/group/mod.rs b/qbittorrent-web-api-gen/src/generate/group/mod.rs index d4bb2f0..5a392eb 100644 --- a/qbittorrent-web-api-gen/src/generate/group/mod.rs +++ b/qbittorrent-web-api-gen/src/generate/group/mod.rs @@ -127,10 +127,6 @@ impl parser::ApiMethod { } } - fn name_camel(&self) -> Ident { - util::to_ident(&self.name.to_camel()) - } - fn name_snake(&self) -> Ident { util::to_ident(&self.name.to_snake()) } @@ -169,10 +165,6 @@ impl types::Type { self.get_type_info().name.clone() } - fn name_camel(&self) -> Ident { - util::to_ident(&self.name().to_camel()) - } - fn name_snake(&self) -> Ident { util::to_ident(&self.name().to_snake()) } @@ -218,10 +210,6 @@ impl parser::EnumValue { fn name_camel(&self) -> Ident { util::to_ident(&self.value.to_camel()) } - - fn name_snake(&self) -> Ident { - util::to_ident(&self.value.to_snake()) - } } #[derive(Debug)] diff --git a/qbittorrent-web-api-gen/src/parser/group/method/method_tests/search_result.check b/qbittorrent-web-api-gen/src/parser/group/method/method_tests/search_result.check index 72dd726..1f2c06b 100644 --- a/qbittorrent-web-api-gen/src/parser/group/method/method_tests/search_result.check +++ b/qbittorrent-web-api-gen/src/parser/group/method/method_tests/search_result.check @@ -13,33 +13,27 @@ ApiMethod { TypeInfo { name: "id", is_optional: false, - is_list: false, description: Some( "ID of the search job", ), - type_description: None, }, ), Number( TypeInfo { name: "limit", is_optional: true, - is_list: false, description: Some( "max number of results to return. 0 or negative means no limit", ), - type_description: None, }, ), Number( TypeInfo { name: "offset", is_optional: true, - is_list: false, description: Some( "result to start at. A negative number means count backwards (e.g. -2 returns the 2 most recent results)", ), - type_description: None, }, ), ], @@ -53,77 +47,63 @@ ApiMethod { TypeInfo { name: "descrLink", is_optional: false, - is_list: false, description: Some( "URL of the torrent's description page", ), - type_description: None, }, ), String( TypeInfo { name: "fileName", is_optional: false, - is_list: false, description: Some( "Name of the file", ), - type_description: None, }, ), Number( TypeInfo { name: "fileSize", is_optional: false, - is_list: false, description: Some( "Size of the file in Bytes", ), - type_description: None, }, ), String( TypeInfo { name: "fileUrl", is_optional: false, - is_list: false, description: Some( "Torrent download link (usually either .torrent file or magnet link)", ), - type_description: None, }, ), Number( TypeInfo { name: "nbLeechers", is_optional: false, - is_list: false, description: Some( "Number of leechers", ), - type_description: None, }, ), Number( TypeInfo { name: "nbSeeders", is_optional: false, - is_list: false, description: Some( "Number of seeders", ), - type_description: None, }, ), String( TypeInfo { name: "siteUrl", is_optional: false, - is_list: false, description: Some( "URL of the torrent site", ), - type_description: None, }, ), ], @@ -137,11 +117,9 @@ ApiMethod { type_info: TypeInfo { name: "results", is_optional: false, - is_list: false, description: Some( "Array of result objects- see table below", ), - type_description: None, }, ref_type: "Result", }, @@ -150,22 +128,18 @@ ApiMethod { TypeInfo { name: "status", is_optional: false, - is_list: false, description: Some( "Current status of the search job (either Running or Stopped)", ), - type_description: None, }, ), Number( TypeInfo { name: "total", is_optional: false, - is_list: false, description: Some( "Total number of results. If the status is Running this number may continue to increase", ), - type_description: None, }, ), ], diff --git a/qbittorrent-web-api-gen/src/parser/group/method/mod.rs b/qbittorrent-web-api-gen/src/parser/group/method/mod.rs index 5f03a1a..49d96ec 100644 --- a/qbittorrent-web-api-gen/src/parser/group/method/mod.rs +++ b/qbittorrent-web-api-gen/src/parser/group/method/mod.rs @@ -5,7 +5,7 @@ mod url; use crate::{md_parser, types}; use case::CaseExt; use regex::Regex; -use std::collections::{BTreeMap, HashMap}; +use std::collections::BTreeMap; #[derive(Debug)] pub struct ApiMethod { @@ -312,13 +312,6 @@ impl md_parser::Table { impl md_parser::TableRow { fn to_type(&self) -> Option { - self.to_types_with_types(&HashMap::new()) - } - - fn to_types_with_types( - &self, - type_map: &HashMap, - ) -> Option { let columns = &self.columns; let description = columns.get(2).cloned(); @@ -327,9 +320,9 @@ impl md_parser::TableRow { Some(desc) if desc.contains("default: ") => { // type defines a variable as default if it contains: _optional_ let name_with_optional = format!("{} {}", columns[0], types::OPTIONAL); - types::Type::from(&columns[1], &name_with_optional, description, type_map) + types::Type::from(&columns[1], &name_with_optional, description) } - _ => types::Type::from(&columns[1], &columns[0], description, type_map), + _ => types::Type::from(&columns[1], &columns[0], description), } } } diff --git a/qbittorrent-web-api-gen/src/types.rs b/qbittorrent-web-api-gen/src/types.rs index b216cc2..b56561f 100644 --- a/qbittorrent-web-api-gen/src/types.rs +++ b/qbittorrent-web-api-gen/src/types.rs @@ -1,5 +1,3 @@ -use std::collections::HashMap; - use case::CaseExt; use regex::RegexBuilder; @@ -18,25 +16,17 @@ pub struct TypeDescription { pub struct TypeInfo { pub name: String, pub is_optional: bool, - is_list: bool, + // is_list: bool, pub description: Option, - pub type_description: Option, } impl TypeInfo { - pub fn new( - name: &str, - is_optional: bool, - is_list: bool, - description: Option, - type_description: Option, - ) -> Self { + pub fn new(name: &str, is_optional: bool, description: Option) -> Self { Self { name: name.into(), is_optional, - is_list, + // is_list, description, - type_description, } } } @@ -84,9 +74,9 @@ impl Type { } } - pub fn is_list(&self) -> bool { - self.get_type_info().is_list || matches!(self, Type::StringArray(_)) - } + // pub fn is_list(&self) -> bool { + // self.get_type_info().is_list || matches!(self, Type::StringArray(_)) + // } pub fn to_borrowed_type(&self) -> String { match self { @@ -118,13 +108,7 @@ impl Type { } } - pub fn from( - type_as_str: &str, - name: &str, - description: Option, - types: &HashMap, - ) -> Option { - let available_types = types.get(name).cloned(); + pub fn from(type_as_str: &str, name: &str, description: Option) -> Option { let type_name = match name.split_once(OPTIONAL) { Some((split, _)) => split, None => name, @@ -132,15 +116,7 @@ impl Type { .trim(); let is_optional = name.contains(OPTIONAL); - let create_type_info = || { - TypeInfo::new( - type_name, - is_optional, - false, - description.clone(), - available_types.clone(), - ) - }; + let create_type_info = || TypeInfo::new(type_name, is_optional, description.clone()); let create_object_type = |name: &str| { Some(Type::Object(Object {