Skip to content

Commit b933827

Browse files
committed
SDK regeneration
1 parent b285c2a commit b933827

File tree

146 files changed

+24338
-821
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+24338
-821
lines changed

README.md

+58-46
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,32 @@
1-
# Merge .NET Library
1+
# Merge C# Library
22

3-
The official Merge C# library, supporting .NET Standard, .NET Core, and .NET Framework.
3+
[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
4+
[![nuget shield](https://img.shields.io/nuget/v/Merge.Client)](https://nuget.org/packages/Merge.Client)
5+
6+
The Merge C# library provides convenient access to the Merge API from C#.
47

58
## Documentation
69

710
API reference documentation is available [here](https://docs.merge.dev/basics/authentication/).
811

912
## Installation
1013

11-
Using the .NET Core command-line interface (CLI) tools:
12-
1314
```sh
14-
dotnet add package Merge.Client
15+
nuget install Merge.Client
1516
```
1617

17-
Using the NuGet Command Line Interface (CLI):
18+
## Usage
1819

19-
```sh
20-
nuget install Merge.Client
20+
Instantiate and use the client with the following:
21+
22+
```csharp
23+
using Merge.Client.Ats;
24+
using Merge.Client;
25+
26+
var client = new Merge("API_KEY");
27+
await client.Ats.Activities.CreateAsync(
28+
new ActivityEndpointRequest { Model = new ActivityRequest(), RemoteUserId = "remote_user_id" }
29+
);
2130
```
2231

2332
## Instantiation
@@ -61,55 +70,68 @@ var merge = new MergeClient("YOUR_API_KEY", "YOUR_ACCOUNT_ID", new ClientOptions
6170
```
6271

6372
## Exception Handling
64-
When the API returns a non-zero status code, (4xx or 5xx response),
65-
a subclass of MergeException will be thrown:
73+
74+
When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
75+
will be thrown.
6676

6777
```csharp
6878
using Merge.Client;
6979

7080
try {
71-
merge.Ats.Candidates.Retrieve(...);
72-
} catch (MergeException e) {
73-
System.Console.WriteLine(e.Message)
74-
System.Console.WriteLine(e.StatusCode)
81+
var response = await client.Ats.Activities.CreateAsync(...);
82+
} catch (MergeApiException e) {
83+
System.Console.WriteLine(e.Body);
84+
System.Console.WriteLine(e.StatusCode);
7585
}
7686
```
7787

78-
## Usage
88+
## Advanced
7989

80-
Below are code snippets of how you can use the C# SDK.
90+
### Retries
8191

82-
### Create Link Token
92+
The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
93+
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
94+
retry limit (default: 2).
8395

84-
```c#
85-
using Merge.Client;
86-
using Merge.Client.Ats;
96+
A request is deemed retriable when any of the following HTTP status codes is returned:
8797

88-
var merge = new MergeClient("YOUR_API_KEY", "YOUR_ACCOUNT_TOKEN")
98+
- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
99+
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
100+
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)
89101

90-
merge.Ats.LinkToken.Create(new EndUserDetailsRequest{
91-
EndUserEmailAddress = "[email protected]",
92-
EndUserOrganizationName = "acme",
93-
EndUserOriginId = "1234",
94-
})
102+
Use the `MaxRetries` request option to configure this behavior.
103+
104+
```csharp
105+
var response = await client.Ats.Activities.CreateAsync(
106+
...,
107+
new RequestOptions {
108+
MaxRetries: 0 // Override MaxRetries at the request level
109+
}
110+
);
95111
```
96112

97-
### Get Employee
113+
### Timeouts
98114

99-
```c#
100-
using Merge.Client;
101-
using Merge.Client.Hris;
115+
The SDK defaults to a 30 second timeout. Use the `Timeout` option to configure this behavior.
102116

103-
var merge = new MergeClient(
104-
"YOUR_API_KEY", "YOUR_ACCOUNT_ID"
105-
)
106-
Employee employee = merge.Hris.Employees.RetrieveAsync("0958cbc6-6040-430a-848e-aafacbadf4ae",
107-
new EmployeesRetrieveRequest{
108-
IncludeRemoteData = true
117+
```csharp
118+
var response = await client.Ats.Activities.CreateAsync(
119+
...,
120+
new RequestOptions {
121+
Timeout: TimeSpan.FromSeconds(3) // Override timeout to 3s
109122
}
110123
);
111124
```
112125

126+
## Contributing
127+
128+
While we value open-source contributions to this SDK, this library is generated programmatically.
129+
Additions made directly to this library would have to be moved over to our generation code,
130+
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
131+
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
132+
an issue first to discuss with us!
133+
134+
On the other hand, contributions to the README are always very welcome!
113135
## Retries
114136
429 Rate Limit, and >=500 Internal errors will all be
115137
retried twice with exponential backoff. You can override this behavior
@@ -130,13 +152,3 @@ var merge = new MergeClient("...", new ClientOptions{
130152
TimeoutInSeconds = 20 // Lower timeout
131153
});
132154
```
133-
134-
## Contributing
135-
While we value open-source contributions to this SDK, this library
136-
is generated programmatically. Additions made directly to this library
137-
would have to be moved over to our generation code, otherwise they would
138-
be overwritten upon the next generated release. Feel free to open a PR as a
139-
proof of concept, but know that we will not be able to merge it as-is.
140-
We suggest opening an issue first to discuss with us!
141-
142-
On the other hand, contributions to the README are always very welcome!

0 commit comments

Comments
 (0)