File tree Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Expand file tree Collapse file tree 2 files changed +64
-0
lines changed Original file line number Diff line number Diff line change @@ -180,6 +180,35 @@ impl PackagesSiteClient {
180
180
. json :: < Updates > ( )
181
181
. await ?)
182
182
}
183
+
184
+ pub async fn updates ( & self ) -> PResult < Updates > {
185
+ Ok ( self
186
+ . get_data ( format ! ( "{}/updates?type=json" , & self . url) )
187
+ . await ?
188
+ . json :: < Updates > ( )
189
+ . await ?)
190
+ }
191
+
192
+ pub async fn files (
193
+ & self ,
194
+ arch : & Arch ,
195
+ branch : & str ,
196
+ package : & str ,
197
+ version : & str ,
198
+ ) -> PResult < Files > {
199
+ Ok ( self
200
+ . get_data ( format ! (
201
+ "{}/files/{}/{}/{}/{}?type=json" ,
202
+ & self . url,
203
+ arch. to_string( ) ,
204
+ branch,
205
+ package,
206
+ version
207
+ ) )
208
+ . await ?
209
+ . json :: < Files > ( )
210
+ . await ?)
211
+ }
183
212
}
184
213
185
214
#[ cfg( test) ]
Original file line number Diff line number Diff line change
1
+ use serde:: { Deserialize , Serialize } ;
2
+
3
+ #[ derive( Serialize , Deserialize , Debug ) ]
4
+ struct File {
5
+ pub filename : Option < String > ,
6
+ pub size : i64 ,
7
+ pub ftype : i16 ,
8
+ pub perm : i32 ,
9
+ pub uid : i64 ,
10
+ pub gid : i64 ,
11
+ pub uname : String ,
12
+ pub gname : String ,
13
+ }
14
+
15
+ #[ derive( Serialize , Deserialize , Debug ) ]
16
+ struct Package {
17
+ pub package : String ,
18
+ pub version : String ,
19
+ pub architecture : String ,
20
+ pub repo : String ,
21
+ pub maintainer : String ,
22
+ pub installed_size : i64 ,
23
+ pub filename : String ,
24
+ pub size : i64 ,
25
+ pub sha256 : String ,
26
+ }
27
+
28
+ #[ derive( Serialize , Deserialize , Debug ) ]
29
+ pub struct Files {
30
+ pub files : Vec < File > ,
31
+ pub sodepends : Vec < String > ,
32
+ pub soprovides : Vec < String > ,
33
+ pub pkg_debtime : i32 ,
34
+ pub pkg : Package ,
35
+ }
You can’t perform that action at this time.
0 commit comments