private DaDataClient(string token, string secret, string hostname, string protocol) { _token = token; _secret = secret; _urlClean = String.Format("{0}://{1}/api/v2/clean", protocol, hostname); _converter = new CleanResponseConverter(); }
public CleanClientAsync(string token, string secret, string baseUrl = BASE_URL) : base(token, secret, baseUrl) { // all response data entities look the same (IDadataEntity), // need to manually convert them to specific types (address, phone etc) this.converter = new CleanResponseConverter(); // need to serialize StructureType as string, not int serializer.Converters.Add(new StringEnumConverter()); }
/// <summary> /// Creates an instance to interact with DaData clean API (https://dadata.ru/api/clean/). /// </summary> /// <param name="token">API key.</param> /// <param name="secret">API secret.</param> /// <param name="hostname">DaData server hostname.</param> /// <param name="protocol">HTTP protocol (http or https, defaut http).</param> public CleanClient(string token, string secret, string hostname, string protocol = "http") { this.token = token; this.secret = secret; this.url = String.Format(CLEAN_URL, protocol, hostname); // all response data entities look the same (IDadataEntity), // need to manually convert them to specific types (address, phone etc) this.converter = new CleanResponseConverter(); this.serializer = new JsonSerializer(); // need to serialize StructureType as string, not int serializer.Converters.Add(new StringEnumConverter()); }