package
1.0.0
Repository: https://github.com/arexio/factorial-go.git
Documentation: pkg.go.dev

# README

Server example

This example will run a server on port 3000 with the given .env configuration. It will give you a quick view about how to handle the OAuth2 process as well an overview of all the different endpoints you can consume from Factorial app.

How it works

We recommend you to start by reading the official documentation from Factorial https://docs.factorialhr.com/docs/getting-started and then start creating your own OAuth App in Factorial (https://docs.factorialhr.com/docs/create-a-new-oauth-application).

During the creation process you will be asked to introduce a callback url, that it should be https. In our case we use ngrok in order to expose our local server to the internet. If you want to download and play with ngrok please refer to the official documentation https://ngrok.com/.

Once you have your OAuth application correctly created in Factorial, you will need to create and fill a new .env file with the following information.

CLIENT_ID="---- Your client ID ----"
CLIENT_SECRET="--- Your client secret ---"
SCOPES="read,write"
REDIRECT_URL="--- Your redirect url, sample (https://7cad0b374498.ngrok.io/auth/factorial/callback) ----"

Once you have this set up, you can start the server using

go run *.go

Then open your browser and navigate to http://localhost:3000, you should see the Factorial button, if you click it the OAuth2 handling process will start.

# Functions

ClockInHandler is the handler used for clock_in to Factorial and print the result.
ClockOutHandler is the handler used for clock_out to Factorial and print the result.
ClocksHandler is the handler used for test the clock_in and clock_out and print the result.
CompanyHolidaysHandler is the handler for get all the company holidays and print them on a list template.
DocumentsHandler is the handler used for get all the documents and print them on a list template.
EmployeesHandler is the handler used for get all the employees and print them on a list template.
FactorialOAuthCallbackHandler is the handler in where we are going to receive a successful callback with a code that can we use to get our user token.
FoldersHandler is the handler used for get all the folders and print them on a list template.
HiringVersionsHandler is the handler used for get all the hiring versions and print them on a list template.
HomeHandler will be the base handler in where we will show information about token and different actions you can do.
LeavesHandler is the handler used for get all the leaves and print them on a list template.
LeaveTypesHandler is the handler used for get all the leave types and print them on a list template.
LocationsHandler is the handler used for get all the locations and print them on a list template.
PayslipsHandler is the handler used for get all the payslips and print them on a list template.
ShiftsHandler is the handler used for get all the shifts and print them on a list template.
StartFactorialOAuthHandler is the handler that will start the process of Auth with the Factorial platform.
TeamsHandler is the handler used for get all the teams and print them on a list template.
WebhooksHandler is the handler used for get all the webhooks and print them on a list template.