コード例 #1
0
ファイル: DaDataClient.cs プロジェクト: Sellec/OnWeb
 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();
 }
コード例 #2
0
 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());
 }
コード例 #3
0
ファイル: CleanClient.cs プロジェクト: mryabets/dadata-csharp
 /// <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());
 }