feat: completed Package struct

main
Jef Roosens 2022-06-22 11:51:03 +02:00
parent 442e01c53f
commit 3d39132646
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
3 changed files with 77 additions and 48 deletions

20
aur.v
View File

@ -7,4 +7,24 @@ pub:
id u32 [json: ID] id u32 [json: ID]
name string [json: Name] name string [json: Name]
package_base_id u32 [json: PackageBaseID] package_base_id u32 [json: PackageBaseID]
version string [json: Version]
description string [json: Description]
url string [json: URL]
num_votes u32 [json: NumVotes]
popularity f64 [json: Popularity]
out_of_date i64 [json: OutOfDate]
maintainer string [json: Maintainer]
first_submitted i64 [json: FirstSubmitted]
last_modified i64 [json: LastModified]
url_path string [json: URLPath]
groups []string [json: Groups]
depends []string [json: Depends]
make_depends []string [json: MakeDepends]
opt_depends []string [json: OptDepends]
check_depends []string [json: CheckDepends]
conflicts []string [json: Conflicts]
replaces []string [json: Replaces]
provides []string [json: Provides]
license []string [json: License]
keywords []string [json: Keywords]
} }

View File

@ -14,10 +14,14 @@ pub fn new() &Client {
pub fn new_with_url(url string) &Client { pub fn new_with_url(url string) &Client {
if !url.ends_with('/') { if !url.ends_with('/') {
return &Client{url: '$url/'} return &Client{
url: '$url/'
}
} }
return &Client{url: url} return &Client{
url: url
}
} }
struct SuccessResponse { struct SuccessResponse {

View File

@ -32,3 +32,8 @@ pub fn (c Client) search_by(arg string, st SearchType) ?[]Package {
return c.request(params) return c.request(params)
} }
// search performs a search by name_desc.
pub fn (c Client) search(arg string) ?[]Package {
return c.search_by(arg, .name_desc)
}