@@ -6,7 +6,7 @@ The Merge Go library provides convenient access to the Merge API from Go.
66
77## Requirements
88
9- This module requires Go version >= 1.19 .
9+ This module requires Go version >= 1.13 .
1010
1111## Installation
1212
@@ -28,8 +28,8 @@ import (
2828)
2929
3030client := mergeclient.NewClient (
31- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
32- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
31+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
32+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
3333)
3434```
3535
@@ -39,15 +39,15 @@ This SDK contains the ATS, HRIS, CRM, Ticketing, Accounting, and File Storage ca
3939
4040Each category is namespaced:
4141
42- ``` python
42+ ``` go
4343client := mergeclient.NewClient (
44- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
45- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
44+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
45+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
4646)
4747
48- client.Ats() . # APIs specific to the ATS Category
48+ client.Ats . # APIs specific to the ATS Category
4949
50- client.Hris() . # APIs specific to the HRIS Category
50+ client.Hris . # APIs specific to the HRIS Category
5151```
5252
5353## Categories
@@ -60,13 +60,13 @@ Each category is namespaced:
6060
6161``` go
6262client := mergeclient.NewClient (
63- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
64- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
63+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
64+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
6565)
6666
67- client.Ats () . // APIs specific to the ATS category
67+ client.Ats . // APIs specific to the ATS category
6868
69- client.Hris () . // APIs specific to the HRIS category
69+ client.Hris . // APIs specific to the HRIS category
7070```
7171
7272## Usage
@@ -84,10 +84,10 @@ import (
8484)
8585
8686client := mergeclient.NewClient (
87- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
88- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
87+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
88+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
8989)
90- linkTokenResponse , err := client.Ats () .LinkToken () .Create (
90+ linkTokenResponse , err := client.Ats .LinkToken .Create (
9191 context.TODO (),
9292 &ats.EndUserDetailsRequest {
9393 EndUserEmailAddress :
" [email protected] " ,
@@ -116,10 +116,10 @@ import (
116116)
117117
118118client := mergeclient.NewClient (
119- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
120- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
119+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
120+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
121121)
122- employee , err := client.Hris () .Employees () .Retrieve (
122+ employee , err := client.Hris .Employees .Retrieve (
123123 context.TODO (),
124124 " 0958cbc6-6040-430a-848e-aafacbadf4ae" ,
125125 &hris.EmployeesRetrieveRequest {
@@ -145,10 +145,10 @@ import (
145145)
146146
147147client := mergeclient.NewClient (
148- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
149- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
148+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
149+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
150150)
151- candidate , err := client.Ats () .Candidates () .Retrieve (
151+ candidate , err := client.Ats .Candidates .Retrieve (
152152 context.TODO (),
153153 " 521b18c2-4d01-4297-b451-19858d07c133" ,
154154 &ats.CandidatesRetrieveRequest {
@@ -175,10 +175,10 @@ import (
175175)
176176
177177client := mergeclient.NewClient (
178- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
179- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
178+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
179+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
180180)
181- candidateList , err := client.Ats () .Candidates () .List (
181+ candidateList , err := client.Ats .Candidates .List (
182182 context.TODO (),
183183 &ats.CandidatesListRequest {
184184 CreatedBefore : merge.Time (time.Now ()),
@@ -204,10 +204,10 @@ import (
204204)
205205
206206client := mergeclient.NewClient (
207- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
208- mergeclient.ClientWithHeaderAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
207+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
208+ mergeclient.WithAccountToken (" <YOUR_ACCOUNT_TOKEN>" ),
209209)
210- ticketResponse , err := client.Ticketing () .Tickets () .Create (
210+ ticketResponse , err := client.Ticketing .Tickets .Create (
211211 context.TODO (),
212212 &ticketing.TicketEndpointRequest {
213213 Model : &ticketing.TicketRequest {
@@ -236,7 +236,7 @@ like the following:
236236``` go
237237ctx , cancel := context.WithTimeout (context.TODO (), time.Second )
238238defer cancel ()
239- employeeList , err := client.Hris () .Employees () .List (
239+ employeeList , err := client.Hris .Employees .List (
240240 ctx,
241241 &hris.EmployeesListRequest {
242242 CreatedBefore : merge.Time (time.Now ()),
@@ -255,8 +255,8 @@ configuring authorization tokens to be sent on every request, or providing your
255255
256256``` go
257257client := mergeclient.NewClient (
258- mergeclient.ClientWithAuthApiKey (" <YOUR_API_KEY>" ),
259- mergeclient.ClientWithHTTPClient (
258+ mergeclient.WithApiKey (" <YOUR_API_KEY>" ),
259+ mergeclient.WithHTTPClient (
260260 &http.Client {
261261 Timeout : 5 * time.Second ,
262262 },
@@ -274,7 +274,7 @@ Structured error types are returned from API calls that return non-success statu
274274you can check if the error was due to a bad request (i.e. status code 400) with the following:
275275
276276``` go
277- employeeList , err := client.Hris () .Employees () .List (
277+ employeeList , err := client.Hris .Employees .List (
278278 context.TODO (),
279279 &hris.EmployeesListRequest {
280280 CreatedBefore : merge.Time (time.Now ()),
@@ -292,7 +292,7 @@ These errors are also compatible with the `errors.Is` and `errors.As` APIs, so y
292292like so:
293293
294294``` go
295- employeeList , err := client.Hris () .Employees () .List (
295+ employeeList , err := client.Hris .Employees .List (
296296 context.TODO (),
297297 &hris.EmployeesListRequest {
298298 CreatedBefore : merge.Time (time.Now ()),
@@ -314,7 +314,7 @@ If you'd like to wrap the errors with additional information and still retain th
314314with ` errors.Is ` and ` errors.As ` , you can use the ` %w ` directive:
315315
316316``` go
317- employeeList , err := client.Hris () .Employees () .List (
317+ employeeList , err := client.Hris .Employees .List (
318318 context.TODO (),
319319 &hris.EmployeesListRequest {
320320 CreatedBefore : merge.Time (time.Now ()),
0 commit comments