-
-
Notifications
You must be signed in to change notification settings - Fork 114
Expand file tree
/
Copy pathtypes.rs
More file actions
253 lines (237 loc) · 7.6 KB
/
types.rs
File metadata and controls
253 lines (237 loc) · 7.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
// This file is auto-generated. Do not edit by hand.
#![allow(non_snake_case)]
use pyo3::prelude::*;
use std::path::PathBuf;
use velopack::{locator::VelopackLocatorConfig, UpdateInfo, UpdateOptions, VelopackAsset};
#[pyclass(name = "VelopackLocatorConfig", from_py_object)]
#[derive(Debug, Clone, Default)]
pub struct PyVelopackLocatorConfig {
#[pyo3(get, set)]
pub RootAppDir: PathBuf,
#[pyo3(get, set)]
pub UpdateExePath: PathBuf,
#[pyo3(get, set)]
pub PackagesDir: PathBuf,
#[pyo3(get, set)]
pub ManifestPath: PathBuf,
#[pyo3(get, set)]
pub CurrentBinaryDir: PathBuf,
#[pyo3(get, set)]
pub IsPortable: bool,
}
#[pymethods]
impl PyVelopackLocatorConfig {
#[new]
#[pyo3(signature = (RootAppDir, UpdateExePath, PackagesDir, ManifestPath, CurrentBinaryDir, IsPortable))]
fn new(
RootAppDir: PathBuf,
UpdateExePath: PathBuf,
PackagesDir: PathBuf,
ManifestPath: PathBuf,
CurrentBinaryDir: PathBuf,
IsPortable: bool,
) -> Self {
Self {
RootAppDir: RootAppDir.into(),
UpdateExePath: UpdateExePath.into(),
PackagesDir: PackagesDir.into(),
ManifestPath: ManifestPath.into(),
CurrentBinaryDir: CurrentBinaryDir.into(),
IsPortable: IsPortable,
}
}
}
impl From<VelopackLocatorConfig> for PyVelopackLocatorConfig {
fn from(value: VelopackLocatorConfig) -> Self {
PyVelopackLocatorConfig {
RootAppDir: value.RootAppDir.into(),
UpdateExePath: value.UpdateExePath.into(),
PackagesDir: value.PackagesDir.into(),
ManifestPath: value.ManifestPath.into(),
CurrentBinaryDir: value.CurrentBinaryDir.into(),
IsPortable: value.IsPortable,
}
}
}
impl Into<VelopackLocatorConfig> for PyVelopackLocatorConfig {
fn into(self) -> VelopackLocatorConfig {
VelopackLocatorConfig {
RootAppDir: self.RootAppDir.into(),
UpdateExePath: self.UpdateExePath.into(),
PackagesDir: self.PackagesDir.into(),
ManifestPath: self.ManifestPath.into(),
CurrentBinaryDir: self.CurrentBinaryDir.into(),
IsPortable: self.IsPortable,
}
}
}
#[pyclass(name = "VelopackAsset", from_py_object)]
#[derive(Debug, Clone, Default)]
pub struct PyVelopackAsset {
#[pyo3(get, set)]
pub PackageId: String,
#[pyo3(get, set)]
pub Version: String,
#[pyo3(get, set)]
pub Type: String,
#[pyo3(get, set)]
pub FileName: String,
#[pyo3(get, set)]
pub SHA1: String,
#[pyo3(get, set)]
pub SHA256: String,
#[pyo3(get, set)]
pub Size: u64,
#[pyo3(get, set)]
pub NotesMarkdown: String,
#[pyo3(get, set)]
pub NotesHtml: String,
}
#[pymethods]
impl PyVelopackAsset {
#[new]
#[pyo3(signature = (PackageId, Version, Type, FileName, SHA1, SHA256, Size, NotesMarkdown, NotesHtml))]
fn new(
PackageId: String,
Version: String,
Type: String,
FileName: String,
SHA1: String,
SHA256: String,
Size: u64,
NotesMarkdown: String,
NotesHtml: String,
) -> Self {
Self {
PackageId: PackageId.into(),
Version: Version.into(),
Type: Type.into(),
FileName: FileName.into(),
SHA1: SHA1.into(),
SHA256: SHA256.into(),
Size: Size,
NotesMarkdown: NotesMarkdown.into(),
NotesHtml: NotesHtml.into(),
}
}
}
impl From<VelopackAsset> for PyVelopackAsset {
fn from(value: VelopackAsset) -> Self {
PyVelopackAsset {
PackageId: value.PackageId.into(),
Version: value.Version.into(),
Type: value.Type.into(),
FileName: value.FileName.into(),
SHA1: value.SHA1.into(),
SHA256: value.SHA256.into(),
Size: value.Size,
NotesMarkdown: value.NotesMarkdown.into(),
NotesHtml: value.NotesHtml.into(),
}
}
}
impl Into<VelopackAsset> for PyVelopackAsset {
fn into(self) -> VelopackAsset {
VelopackAsset {
PackageId: self.PackageId.into(),
Version: self.Version.into(),
Type: self.Type.into(),
FileName: self.FileName.into(),
SHA1: self.SHA1.into(),
SHA256: self.SHA256.into(),
Size: self.Size,
NotesMarkdown: self.NotesMarkdown.into(),
NotesHtml: self.NotesHtml.into(),
}
}
}
#[pyclass(name = "UpdateInfo", from_py_object)]
#[derive(Debug, Clone, Default)]
pub struct PyUpdateInfo {
#[pyo3(get, set)]
pub TargetFullRelease: PyVelopackAsset,
#[pyo3(get, set)]
pub BaseRelease: Option<PyVelopackAsset>,
#[pyo3(get, set)]
pub DeltasToTarget: Vec<PyVelopackAsset>,
#[pyo3(get, set)]
pub IsDowngrade: bool,
}
#[pymethods]
impl PyUpdateInfo {
#[new]
#[pyo3(signature = (TargetFullRelease, DeltasToTarget, IsDowngrade, BaseRelease = None))]
fn new(
TargetFullRelease: PyVelopackAsset,
DeltasToTarget: Vec<PyVelopackAsset>,
IsDowngrade: bool,
BaseRelease: Option<PyVelopackAsset>,
) -> Self {
Self {
TargetFullRelease: TargetFullRelease.into(),
BaseRelease: BaseRelease.map(Into::into),
DeltasToTarget: DeltasToTarget.into_iter().map(Into::into).collect(),
IsDowngrade: IsDowngrade,
}
}
}
impl From<UpdateInfo> for PyUpdateInfo {
fn from(value: UpdateInfo) -> Self {
PyUpdateInfo {
TargetFullRelease: value.TargetFullRelease.into(),
BaseRelease: value.BaseRelease.map(Into::into),
DeltasToTarget: value.DeltasToTarget.into_iter().map(Into::into).collect(),
IsDowngrade: value.IsDowngrade,
}
}
}
impl Into<UpdateInfo> for PyUpdateInfo {
fn into(self) -> UpdateInfo {
UpdateInfo {
TargetFullRelease: self.TargetFullRelease.into(),
BaseRelease: self.BaseRelease.map(Into::into),
DeltasToTarget: self.DeltasToTarget.into_iter().map(Into::into).collect(),
IsDowngrade: self.IsDowngrade,
}
}
}
#[pyclass(name = "UpdateOptions", from_py_object)]
#[derive(Debug, Clone, Default)]
pub struct PyUpdateOptions {
#[pyo3(get, set)]
pub AllowVersionDowngrade: bool,
#[pyo3(get, set)]
pub ExplicitChannel: Option<String>,
#[pyo3(get, set)]
pub MaximumDeltasBeforeFallback: i32,
}
#[pymethods]
impl PyUpdateOptions {
#[new]
#[pyo3(signature = (AllowVersionDowngrade, MaximumDeltasBeforeFallback, ExplicitChannel = None))]
fn new(AllowVersionDowngrade: bool, MaximumDeltasBeforeFallback: i32, ExplicitChannel: Option<String>) -> Self {
Self {
AllowVersionDowngrade: AllowVersionDowngrade,
ExplicitChannel: ExplicitChannel.map(Into::into),
MaximumDeltasBeforeFallback: MaximumDeltasBeforeFallback,
}
}
}
impl From<UpdateOptions> for PyUpdateOptions {
fn from(value: UpdateOptions) -> Self {
PyUpdateOptions {
AllowVersionDowngrade: value.AllowVersionDowngrade,
ExplicitChannel: value.ExplicitChannel.map(Into::into),
MaximumDeltasBeforeFallback: value.MaximumDeltasBeforeFallback,
}
}
}
impl Into<UpdateOptions> for PyUpdateOptions {
fn into(self) -> UpdateOptions {
UpdateOptions {
AllowVersionDowngrade: self.AllowVersionDowngrade,
ExplicitChannel: self.ExplicitChannel.map(Into::into),
MaximumDeltasBeforeFallback: self.MaximumDeltasBeforeFallback,
}
}
}