Exemplo n.º 1
0
        static void DemoSynchronousCalls(LoginClient login, EmployesClient rh)
        {
            Console.WriteLine("Synchronous calls demo");
            //Example of Sync conde
            //Call Login api. This call will also set up necessary cookie
            UpdateResultWithId loginResult = login.ApiLogin(apiKey);

            if (!CheckLogin(loginResult))
            {
                return;
            }
            //getting list of actives (not deleted) users
            var employyes = rh.GetAllRessources(true);

            PrintUsers(employyes);
            //logining out. This is for demo purpose only
            _ = login.LogOut();
        }
Exemplo n.º 2
0
        static async Task DemoAsyncCalls(LoginClient login, EmployesClient rh)
        {
            Console.WriteLine(Environment.NewLine + "Async calls demo");
            //getting http response
            //Call Login api. This call will also set up necessary cookie
            var loginResponse = await login.ApiLoginAsync(apiKey);

            //Converting response into object.
            var loginResult = await loginResponse.Content.ReadAsAsync <UpdateResultWithId>();

            if (!CheckLogin(loginResult))
            {
                return;
            }
            //getting list of actives (not deleted) users
            var employeesResponse = await rh.GetAllRessourcesAsync(true);

            var employyes = await employeesResponse.Content.ReadAsAsync <IEnumerable <EmployeJS__> >();

            PrintUsers(employyes);
            _ = login.LogOut();
        }