GENDER API CSHARP

पहले कंपोजर के साथ हमारी लाइब्रेरी को इंस्टॉल करें:

यहां पूरे क्लाइंट दस्तावेज़ देखें

https://github.com/markus-perl/gender-api-client

पहले npm के साथ हमारी लाइब्रेरी इंस्टॉल करें:

यहां पूरे क्लाइंट दस्तावेज़ देखें

https://github.com/markus-perl/gender-api-client-npm

पहले npm के साथ हमारी लाइब्रेरी इंस्टॉल करें:

यहां पूरे क्लाइंट दस्तावेज़ देखें

https://github.com/markus-perl/gender-api-client-npm

यहां से एक नमूना प्रोजेक्ट डाउनलोड करें:

दस्तावेज़ीकरण:

https://github.com/microknights/Gender-API
// Contributed Client: https://github.com/microknights/Gender-API

using MicroKnights.Gender_API;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Net.Http;
using System.Threading.Tasks;

namespace GenderAPI
{
    class Program
    {
        public static async Task RunTests(GenderApiClient client)
        {
            var responseStats = await client.GetStatistics();
            if( responseStats.IsSuccess ) {
                Console.WriteLine($"IsLimitReached: {responseStats.IsLimitReached}");
                Console.WriteLine($"Remaning requests: {responseStats.RemaningRequests}");

                const string Name = "Frank Nielsen";
                var responseName = await client.GetByNameAndCountry2Alpha(Name, "DK");
                if( responseName.IsSuccess ) {
                    Console.WriteLine($"{Name} is {responseName.GenderType.DisplayName}");
                }
                else {
                    Console.WriteLine($"ERRORS: {responseName.ErrorCode}-{responseName.Exception.Message}");
                }
            }
            else {
                Console.WriteLine($"ERRORS: {responseStats.ErrorCode}-{responseStats.Exception.Message}");
            }
        }

        public static Task UsingServiceProvider(string apiKey){
            // client is thread-safe, and can be used static.
            var serviceProvider = new ServiceCollection()
                .UseGenderAPI(apiKey)
                .BuildServiceProvider();

            return RunTests(serviceProvider.GetRequiredService<GenderApiClient>());
        }

        public static Task PlainConsole(string apiKey){
            // client is thread-safe, and can be used static.
            var client = new GenderApiClient(
                new HttpClient
                {
                    BaseAddress = new Uri("https://gender-api.com")
                },
                new GenderApiConfiguration
                {
                    ApiKey = apiKey
                });
            return RunTests(client);
        }

        static async Task Main(string[] args)
        {
            var apiKey = "?";

            await PlainConsole(apiKey);
            await UsingServiceProvider(apiKey);
        }
    }
}
चैट
हमें आपकी सहमति चाहिए
हम हमारी वेबसाइट के आगंतुकों के उपयोग के बारे में जानकारी एकत्रित करने के लिए कुकीज़ (तीसरे पक्ष की कुकीज़ सहित) का उपयोग करते हैं। ये कुकीज़ आपको सबसे अच्छा ऑनलाइन अनुभव प्रदान करने में मदद करती हैं और हमारी वेबसाइट को लगातार सुधारने में मदद करती हैं। कुकीज़ के माध्यम से एकत्रित जानकारी का उपयोग यूरोपिय संघ के बाहर भी किया जा सकता है, जैसे कि संयुक्त राज्य अमेरिका में। "सभी स्वीकार करें" बटन पर क्लिक करके, आप कुकीज़ का उपयोग करने से सहमत होते हैं। अपनी सहमति वापस लेने के लिए, कुकीज़ के उपयोग के बारे में अधिक जानकारी के लिए नीचे “हीरे” या पृष्ठ के अंत में "कुकी सेटिंग" पर क्लिक करें।