mirror of
				https://github.com/TeamPiped/piped-rust-sdk.git
				synced 2024-08-14 23:56:06 +00:00 
			
		
		
		
	Add support for search suggestions.
This commit is contained in:
		
							parent
							
								
									d81633205f
								
							
						
					
					
						commit
						dacbdab7d6
					
				
					 3 changed files with 41 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -24,3 +24,7 @@ path = "trending.rs"
 | 
			
		|||
[[example]]
 | 
			
		||||
name = "video"
 | 
			
		||||
path = "video.rs"
 | 
			
		||||
 | 
			
		||||
[[example]]
 | 
			
		||||
name = "search_suggestions"
 | 
			
		||||
path = "search_suggestions.rs"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										21
									
								
								examples/search_suggestions.rs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								examples/search_suggestions.rs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,21 @@
 | 
			
		|||
use piped::piped::PipedClient;
 | 
			
		||||
use reqwest::ClientBuilder;
 | 
			
		||||
 | 
			
		||||
#[tokio::main]
 | 
			
		||||
async fn main() {
 | 
			
		||||
    let httpclient = ClientBuilder::new()
 | 
			
		||||
        .user_agent("Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0")
 | 
			
		||||
        .build()
 | 
			
		||||
        .unwrap();
 | 
			
		||||
 | 
			
		||||
    let instance = "https://pipedapi.kavin.rocks".to_string();
 | 
			
		||||
 | 
			
		||||
    let client = PipedClient::new(httpclient, instance);
 | 
			
		||||
 | 
			
		||||
    let suggestions = client
 | 
			
		||||
        .get_search_suggestions("techlore".to_string())
 | 
			
		||||
        .await
 | 
			
		||||
        .unwrap();
 | 
			
		||||
 | 
			
		||||
    println!("{:?}", suggestions);
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue