https://github.com/lob/lob-dotnet
.NET Wrapper for Lob API
https://github.com/lob/lob-dotnet
Last synced: 25 days ago
JSON representation
.NET Wrapper for Lob API
- Host: GitHub
- URL: https://github.com/lob/lob-dotnet
- Owner: lob
- License: mit
- Created: 2018-05-11T16:25:41.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-05-08T15:53:53.000Z (about 1 year ago)
- Last Synced: 2025-04-28T18:04:59.861Z (about 1 month ago)
- Language: C#
- Size: 1.02 MB
- Stars: 1
- Watchers: 26
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# lob-dotnet
The Lob API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and uses HTTP response codes to indicate any API errors.
This C# SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
- API version: 1.3.0
- SDK version: 1.1.0
- Build package: org.openapitools.codegen.languages.CSharpNetCoreClientCodegenFor more information, please visit [our API documentation](https://docs.lob.com/)
## Requirements
[.NET](https://dotnet.microsoft.com/en-us/download)
## Getting Started
### Registration
First, you will need to first create an account at [Lob.com](https://dashboard.lob.com/#/register) and obtain your Test and Live API Keys.
Once you have created an account, you can access your API Keys from the [Settings Panel](https://dashboard.lob.com/#/settings).
### Installation
```bash
$ dotnet add package lob.dotnet
```## First API Call
To use the API client with a HTTP proxy, setup a `System.Net.WebProxy`
```csharp
Configuration c = new Configuration();
System.Net.WebProxy webProxy = new System.Net.WebProxy("http://myProxyUrl:80/");
webProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
c.Proxy = webProxy;
``````csharp
using System.Collections.Generic;
using System.Diagnostics;
using lob.dotnet.Api;
using lob.dotnet.Client;
using lob.dotnet.Model;namespace Example
{
public class Example
{
public static void Main()
{Configuration config = new Configuration();
config.BasePath = "https://api.lob.com/v1";
// Configure HTTP basic authorization: basicAuth
config.Username = "<>";var apiInstance = new AddressesApi(config);
var addressEditable = new AddressEditable();try
{
// create
Address result = apiInstance.create(addressEditable);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling AddressesApi.create: " + e.Message );
Debug.Print("Status Code: "+ e.ErrorCode);
Debug.Print(e.StackTrace);
}}
}
}
```## API Documentation
The full and comprehensive documentation of Lob's APIs is available [here](https://docs.lob.com/).
## Testing
### Unit Testing
```bash
$ dotnet test --filter Category=Unit
```### Integration Testing
Integration tests run against a live deployment of the Lob API and require multiple valid API keys with access to specific features. As such, it is not expected that these tests will pass for every user in every environment.
To run integration tests:
```bash
$ LOB_API_TEST_KEY=<> LOB_API_LIVE_KEY=<> dotnet test --filter Category=Integration
```#### A cleaner alternative if you are going to run integration tests frequently
Run this the first time:
```bash
$ echo "LOB_API_TEST_KEY=<> LOB_API_LIVE_KEY=<>" > LOCAL.env
```Then, to run the integration tests:
```bash
$ env $(cat LOCAL.env) dotnet test --filter Category=Integration
```## Documentation for Authorization
### basicAuth
- **Type**: HTTP basic authentication