Fix priority parameter for filePrio
This commit is contained in:
parent
3d6e1cb567
commit
66a0ecf5c1
|
@ -2170,12 +2170,21 @@ Parameter | Type | Description
|
||||||
----------------------------------|---------|------------
|
----------------------------------|---------|------------
|
||||||
`hash` | string | The hash of the torrent
|
`hash` | string | The hash of the torrent
|
||||||
`id` | string | File ids, separated by `\|`
|
`id` | string | File ids, separated by `\|`
|
||||||
`priority` | number | File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)
|
`priority` | object | priority object see table below. File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)
|
||||||
|
|
||||||
`id` values correspond to file position inside the array returned by [torrent contents API](#get-torrent-contents), e.g. `id=0` for first file, `id=1` for second file, etc.
|
`id` values correspond to file position inside the array returned by [torrent contents API](#get-torrent-contents), e.g. `id=0` for first file, `id=1` for second file, etc.
|
||||||
|
|
||||||
Since 2.8.2 it is reccomended to use `index` field returned by [torrent contents API](#get-torrent-contents) (since the files can be filtered and the `index` value may differ from the position inside the response array).
|
Since 2.8.2 it is reccomended to use `index` field returned by [torrent contents API](#get-torrent-contents) (since the files can be filtered and the `index` value may differ from the position inside the response array).
|
||||||
|
|
||||||
|
Possible values of `priority`:
|
||||||
|
|
||||||
|
Value | Description
|
||||||
|
-----------|------------
|
||||||
|
`0` | Do not download
|
||||||
|
`1` | Normal priority
|
||||||
|
`6` | High priority
|
||||||
|
`7` | Maximal priority
|
||||||
|
|
||||||
**Returns:**
|
**Returns:**
|
||||||
|
|
||||||
HTTP Status Code | Scenario
|
HTTP Status Code | Scenario
|
||||||
|
|
|
@ -5196,20 +5196,60 @@
|
||||||
is_list: false,
|
is_list: false,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
Number(
|
Object(
|
||||||
TypeInfo {
|
Object {
|
||||||
name: "priority",
|
type_info: TypeInfo {
|
||||||
description: Some(
|
name: "priority",
|
||||||
"File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)",
|
description: Some(
|
||||||
|
"priority object see table below. File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)",
|
||||||
|
),
|
||||||
|
is_optional: false,
|
||||||
|
is_list: false,
|
||||||
|
},
|
||||||
|
ref_type: String(
|
||||||
|
"Priority",
|
||||||
),
|
),
|
||||||
is_optional: false,
|
|
||||||
is_list: false,
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
is_list: false,
|
is_list: false,
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
Enum(
|
||||||
|
Enum {
|
||||||
|
name: "Priority",
|
||||||
|
values: [
|
||||||
|
EnumValue {
|
||||||
|
description: Some(
|
||||||
|
"Do not download",
|
||||||
|
),
|
||||||
|
value: "DoNotDownload",
|
||||||
|
original_value: "0",
|
||||||
|
},
|
||||||
|
EnumValue {
|
||||||
|
description: Some(
|
||||||
|
"Normal priority",
|
||||||
|
),
|
||||||
|
value: "NormalPriority",
|
||||||
|
original_value: "1",
|
||||||
|
},
|
||||||
|
EnumValue {
|
||||||
|
description: Some(
|
||||||
|
"High priority",
|
||||||
|
),
|
||||||
|
value: "HighPriority",
|
||||||
|
original_value: "6",
|
||||||
|
},
|
||||||
|
EnumValue {
|
||||||
|
description: Some(
|
||||||
|
"Maximal priority",
|
||||||
|
),
|
||||||
|
value: "MaximalPriority",
|
||||||
|
original_value: "7",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -131,11 +131,12 @@ impl<'a> GroupGeneration<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn all_derives(&self, derives: &'a [&'a str]) -> impl Iterator<Item = &'a str> {
|
fn all_derives(&self, derives: &'a [&'a str]) -> impl Iterator<Item = &'a str> {
|
||||||
let base = vec!["serde::Deserialize", "Debug"].into_iter();
|
let base = vec!["serde::Deserialize", "serde::Serialize", "Debug"].into_iter();
|
||||||
let additional = derives
|
let additional = derives
|
||||||
.iter()
|
.iter()
|
||||||
.copied()
|
.copied()
|
||||||
.filter(|item| item != &"serde::Deserialize")
|
.filter(|item| item != &"serde::Deserialize")
|
||||||
|
.filter(|item| item != &"serde::Serialize")
|
||||||
.filter(|item| item != &"Debug");
|
.filter(|item| item != &"Debug");
|
||||||
|
|
||||||
base.chain(additional)
|
base.chain(additional)
|
||||||
|
|
|
@ -199,9 +199,13 @@ impl types::Type {
|
||||||
let name_str = self.name();
|
let name_str = self.name();
|
||||||
let name_snake = self.name_snake();
|
let name_snake = self.name_snake();
|
||||||
|
|
||||||
quote! {
|
let serialized = if self.is_object() {
|
||||||
#add_to = #add_to.text(#name_str, #name_snake.to_string());
|
quote! { serde_json::to_string(#name_snake).unwrap() }
|
||||||
}
|
} else {
|
||||||
|
quote! { #name_snake.to_string() }
|
||||||
|
};
|
||||||
|
|
||||||
|
quote! { #add_to = #add_to.text(#name_str, #serialized); }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn generate_optional_builder_method(&self) -> TokenStream {
|
fn generate_optional_builder_method(&self) -> TokenStream {
|
||||||
|
|
|
@ -76,10 +76,17 @@ impl Type {
|
||||||
Type::Bool(_) => "bool".into(),
|
Type::Bool(_) => "bool".into(),
|
||||||
Type::String(_) => "str".into(),
|
Type::String(_) => "str".into(),
|
||||||
Type::StringArray(_) => "&[str]".into(),
|
Type::StringArray(_) => "&[str]".into(),
|
||||||
Type::Object(_) => todo!(),
|
Type::Object(t) => match &t.ref_type {
|
||||||
|
RefType::String(s) => s.clone(),
|
||||||
|
_ => todo!(),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_object(&self) -> bool {
|
||||||
|
matches!(self, Type::Object(_))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn should_borrow(&self) -> bool {
|
pub fn should_borrow(&self) -> bool {
|
||||||
matches!(self, Type::String(_) | Type::Object(_))
|
matches!(self, Type::String(_) | Type::Object(_))
|
||||||
}
|
}
|
||||||
|
|
|
@ -10235,11 +10235,11 @@ TokenTree {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
TableRow {
|
TableRow {
|
||||||
raw: "`priority` | number | File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)",
|
raw: "`priority` | object | priority object see table below. File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)",
|
||||||
columns: [
|
columns: [
|
||||||
"priority",
|
"priority",
|
||||||
"number",
|
"object",
|
||||||
"File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)",
|
"priority object see table below. File priority to set (consult [torrent contents API](#get-torrent-contents) for possible values)",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@ -10260,6 +10260,57 @@ TokenTree {
|
||||||
Text(
|
Text(
|
||||||
"",
|
"",
|
||||||
),
|
),
|
||||||
|
Text(
|
||||||
|
"Possible values of `priority`:",
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"",
|
||||||
|
),
|
||||||
|
Table(
|
||||||
|
Table {
|
||||||
|
header: TableRow {
|
||||||
|
raw: "Value | Description",
|
||||||
|
columns: [
|
||||||
|
"Value",
|
||||||
|
"Description",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
split: "-----------|------------",
|
||||||
|
rows: [
|
||||||
|
TableRow {
|
||||||
|
raw: "`0` | Do not download",
|
||||||
|
columns: [
|
||||||
|
"0",
|
||||||
|
"Do not download",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
TableRow {
|
||||||
|
raw: "`1` | Normal priority",
|
||||||
|
columns: [
|
||||||
|
"1",
|
||||||
|
"Normal priority",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
TableRow {
|
||||||
|
raw: "`6` | High priority",
|
||||||
|
columns: [
|
||||||
|
"6",
|
||||||
|
"High priority",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
TableRow {
|
||||||
|
raw: "`7` | Maximal priority",
|
||||||
|
columns: [
|
||||||
|
"7",
|
||||||
|
"Maximal priority",
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"",
|
||||||
|
),
|
||||||
Asterisk(
|
Asterisk(
|
||||||
"Returns:",
|
"Returns:",
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user