add pode and api scripts
This commit is contained in:
		
							parent
							
								
									30a3d7711e
								
							
						
					
					
						commit
						94bc297ea1
					
				
					 20 changed files with 783 additions and 3 deletions
				
			
		
							
								
								
									
										18
									
								
								API/Get-GoogleTranslate.psm1
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								API/Get-GoogleTranslate.psm1
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | |||
| function Get-Translate ($data) { | ||||
|     $Key = "KEY" # Get https://cloud.google.com/translate/docs/reference/rest | ||||
|     $url = "https://translation.googleapis.com/language/translate/v2?key=$Key" | ||||
|     $body = @{ | ||||
|         q = $data | ||||
|         target = "ru" | ||||
|         source = "en" | ||||
|     } | ConvertTo-Json | ||||
|     try { | ||||
|         $response = Invoke-RestMethod -Uri $url -Method POST -ContentType "application/json" -Body $body | ||||
|         $translation = $response.data.translations[0].translatedText | ||||
|         return $translation | ||||
|     } catch { | ||||
|         Write-Output "Error: $($_.Exception.Message)" | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| # Get-Translate $("What is your name") | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue