Files
TransCaption/DeepLAPI.wdg

108 lines
3.7 KiB
Plaintext

#To edit and compare internal_properties, use WINDEV integrated tools.
#Internal properties refer to the properties of controls in windows, reports, etc.
info :
name : DeepLAPI
major_version : 30
minor_version : 0
type : 7
description : ""
subtype : 0
options : 256
procedure_set :
identifier : 0x180fe10f00622c0e
internal_properties : HwAAAB4AAADjksEavC8JwuEiHc63C+ul0ggS/BOiC8PJfOp/6aEkSKX4qEWcBw==
code_elements :
type_code : 31
p_codes :
-
code : |1+
/* Copyright 2025 Alexandre Leclerc. MPL 2.0. See https://mozilla.org/MPL/2.0/. */
STDeepLLanguages est une structure
language est une chaîne
name est une chaine
supportsFormality est un booléen
fin
type : 720896
procedures :
-
name : GetLanguages
internal_properties : HwAAAB4AAABbhvlnMqBipoYbs5BgJZVTuML70ljr/4dqsYCJvaaixeFzJQzW2iFhN8/rJRhqDBEzPWArwC8vKj0UgShjGaLOXw==
procedure_id : 1733851982149627907
type_code : 15
code : |1+
// Résumé : <indiquez ici ce que fait la procédure>
// Paramètres :
// t (tableau (STDeepLLanguages)) : Combo to fill
// sType (chaîne ANSI) : Can be "source" or "target".
// Valeur de retour :
// Aucune
//
procédure GetLanguages(t est un tableau de STDeepLLanguages, sType est une chaine)
// Build the HTTP request
cDeepL est un httpRequête
cDeepL.URL = ChargeParamètre(C_DeepL_Server) + "/languages?type="+sType
cDeepL.Entête["Authorization"] = ChaîneConstruit("DeepL-Auth-Key %1",ChargeParamètre(C_DeepL_APIKey))
// Send the request
cRes est un httpRéponse = HTTPEnvoie(cDeepL)
SI ErreurDétectée ALORS
Erreur(ErreurInfo(errComplet))
RETOUR
FIN
// Get results
lang est un JSON
lang..FormatJSON = cRes.Contenu
POUR i = 1 _À_ lang..Occurrence
TableauAjoute( t, [lang[i].language, lang[i].name, lang[i].supports_formality] )
FIN
type : 458752
-
name : GetUsage
internal_properties : HwAAAB4AAACSB/quWMdBwE/+OZebRZ7WEteNEF90HAHycTEqsTIvTKew2SLCgsA9uJjAuqlgD+N2vMvtaAI/+MSaGfnkCaPfoUfGW9iQq7f6x+eC25fd
procedure_id : 1733852003634758180
type_code : 15
code : |1+
// Résumé : Calls the API to get the account total character usage and limit for the API.
// Paramètres :
// nCount (entier) : Returns character_count from the API.
// nLimit (entier - valeur par défaut=0) : Returns character_limit from the API.
// Valeur de retour :
// booléen : If the API call succeded.
//
procédure GetUsage(nCount est un entier, nLimit est un entier = 0) : boolean
// Build the HTTP request
cDeepL est un httpRequête
cDeepL.URL = ChargeParamètre(C_DeepL_Server) + "/usage"
cDeepL.Entête["Authorization"] = ChaîneConstruit("DeepL-Auth-Key %1",ChargeParamètre(C_DeepL_APIKey))
// Send the request
cRes est un httpRéponse = HTTPEnvoie(cDeepL)
SI ErreurDétectée ALORS
Erreur(ErreurInfo(errComplet))
renvoyer faux
FIN
// Get results
lang est un JSON
lang..FormatJSON = cRes.Contenu
nCount = lang.character_count
nLimit = lang.character_limit
renvoyer vrai
type : 458752
procedure_templates : []
property_templates : []
code_parameters :
internal_properties : HwAAAB4AAAB7MB8NZB5rGUbyk77+IjQnJ74vm430Ar3yq0zmP05sGBBw0ur17uG6ZWry
original_name : COL_SansNom1
resources :
string_res :
identifier : 0x180fe1010060f435
internal_properties : HwAAAB4AAAA809Qj/IAi+r8QXyrnW7sarQeYORCUjKBkmMeTFexSj5AuvTfTUpN0Eg==
custom_note :
internal_properties : HwAAAB4AAADnl3uxgA6ylw4vtqUKEOJQD3VAAOKeNUmhPNojcRFoDpHEcUyYAw==