chore: ran v fmt for v 0.3.3 changes
							parent
							
								
									edd9e3fde9
								
							
						
					
					
						commit
						9550262603
					
				
							
								
								
									
										10
									
								
								client.v
								
								
								
								
							
							
						
						
									
										10
									
								
								client.v
								
								
								
								
							|  | @ -15,7 +15,7 @@ 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{ | 		return &Client{ | ||||||
| 			url: '$url/' | 			url: '${url}/' | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | @ -34,10 +34,10 @@ fn (c Client) request(params map[string][]string) ![]Package { | ||||||
| 	mut param_strings := []string{} | 	mut param_strings := []string{} | ||||||
| 
 | 
 | ||||||
| 	for k, v in params { | 	for k, v in params { | ||||||
| 		param_strings << v.map(urllib.query_escape(it)).map('$k=$it') | 		param_strings << v.map(urllib.query_escape(it)).map('${k}=${it}') | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	url := '$c.url?${param_strings.join('&')}' | 	url := '${c.url}?${param_strings.join('&')}' | ||||||
| 
 | 
 | ||||||
| 	res := http.get(url)! | 	res := http.get(url)! | ||||||
| 
 | 
 | ||||||
|  | @ -49,7 +49,7 @@ fn (c Client) request(params map[string][]string) ![]Package { | ||||||
| 	data := json.decode(Response, res.body)! | 	data := json.decode(Response, res.body)! | ||||||
| 
 | 
 | ||||||
| 	if data.@type == 'error' { | 	if data.@type == 'error' { | ||||||
| 		return error('Server responded with an error: $data.error') | 		return error('Server responded with an error: ${data.error}') | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	return data.results | 	return data.results | ||||||
|  | @ -59,7 +59,7 @@ pub fn (c Client) search_by(arg string, st SearchType) ![]Package { | ||||||
| 	params := { | 	params := { | ||||||
| 		'v':    ['5'] | 		'v':    ['5'] | ||||||
| 		'type': ['search'] | 		'type': ['search'] | ||||||
| 		'by':   ['$st'] | 		'by':   ['${st}'] | ||||||
| 		'arg':  [arg] | 		'arg':  [arg] | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue