﻿RestNETClient
-------------------------

The purpose of this application is to provide sample code to show how to make various requests of the Dayforce HCM RESTful Web Services.

This application is intentionally simple and lacking robust error handling and security logic to allow you to see the code needed
to make requests of the Dayforce HCM web services.  This is a console application which will run stand-alone in a console window, 
but it is expected that you would use the debugger and step through the logic to better understand it.

This sample application is coded to work when making requests of the Dayforce Developer Test environment using the client namespace of DDN.
Many items in the application are client specific, such as the employee XRefCode contained in the configuration information, as well as
the Post and Patch requests which use client specific XRefCodes.  The Post example is formatted to specifically meet the business
validation rules enabled by the configuration of the DDN client.

Prerequisites
---------------
* Visual Studio 2022 or similar.
* Web Services feature enabled on your Dayforce HCM application.

NuGet Dependencies
------------------
* Newtonsoft.Json 13.0.1 - Used for serialization and deserialization of JSON
* RestSharp 111.4.1 - A client library for making REST calls.

Configuration
---------------
The following environment specific configuration items are located in the appsettings.json file the RestNetClient sample program.
* Base Url - URL to the Dayforce HCM REST Web Services. 
* Current Version - The version of REST services to call.  Currently only V1 is supported. 
* Client Name - This is your client name.
* Employee XRef Code - The samples use a specific employee XRefCode that will be unique for each environment
* User Name/Password - User name and password of a user that has the Web Services feature enabled in Dayforce HCM.

The logic
---------------
Like all console applications, there is a Main method which is found in the Program.cs source file.  The Main method makes calls
to various methods which exercise different functions of the web services.  The method names closely resemble the web service
methods that are exercised in the underlying methods.  The methods are not at all dependent on each other, you can comment out the ones
you are not interested in, and the remainder will compile and run without issue.

The EmployeeApi class and DocumentApi class are proxy classes which abstracts away most of the interaction with the HTTP protocol and the REST service
calls. These classes are utilized from the main application to perform various actions on the REST service.

There are various request classes which can be instantiated and populated as needed, and then passed to the EmployeeApi class
to be processed.

The Model folder contains a representation of the entities which our REST service can act on.  These model classes can be used to construct
a properly formated JSON request or as target objects to deserialize the JSON response. 