<commit_before># Bandwidth C# IRIS Client

## Installing
Bandwidth C# SDK uses Nuget for Package Management

Run 
``` 
nuget install Bandwidth.Iris
```
Or install Bandwidth.Iris via UI in Visual Studio

## Getting Started
* Install Bandwidth.Iris
* Get an account ID, user name and password from Bandwidth for your account
* Configure the Client 

```csharp
var client = Client.GetInstance("accountId", "username", "password", "apiEndpoint")
//Or
// Configure System Environment Variables as detailed below:
public static Client GetInstance()
{
    return GetInstance(
        Environment.GetEnvironmentVariable(BandwidthApiAccountId),
        Environment.GetEnvironmentVariable(BandwidthApiUserName),
        Environment.GetEnvironmentVariable(BandwidthApiPassword),
        Environment.GetEnvironmentVariable(BandwidthApiEndpoint),
        Environment.GetEnvironmentVariable(BandwidthApiVersion));
}
var client = Client.GetInstance()
```

## Usage
All static functions support 2 ways to be called: With a client instance as the first arg or without the client instance (default client instance will then be used)

```csharp
var site = await Site.get(client, "siteId");
//Or
var site = await Site.get("siteId"); //This will use the default client where supported
```

## Examples
There is a Project in the solution called Bandwidth.Iris.Examples.  This project has working code examples for the most commonly used objects and methods.

To run the examples, from the Bandwidth Iris Project root folder:

```bash
copy Bandwidth.Iris.Examples\App.config.example Bandwidth.Iris.Examples\App.config
```
* Fill in the config file with the values from your account or credentials provided by Bandwidth
* Compile the project and run the Examples from Visual Studio or from the command line

## API Objects

### General Principles
When using the objects, there are generally static methods for Create, Get and List of each entity.  Once you have an instance of any entity, you can call the instance methods of that entity to perform additional operations.

```csharp
var sites = await Site.List(client);
var site = await Site.Get(client, "siteId");
var newSite = await Site.Create(client, new Site(){
  Name = "MyTest Site"

});
var sipPeers = await site.GetSipPeers();
site.Delete();
```

## Available NpaNxx
```csharp
var query = new Dictionary<string, object>();
query.Add("areaCode", "805");
query.Add("quantity", 3);
var items = await AvailableNpaNxx.List(_client, query);
foreach (AvailableNpaNxx npaNxx in items)
{
    Console.WriteLine(string.Format("NpaNxx: {0}",npaNxx.Npa + npaNxx.Nxx));
}
```

## Available Numbers
```csharp
var query = new Dictionary<string, object>();
query.Add("areaCode", "805");
query.Add("quantity", 3);
var result = await AvailableNumbers.List(_client, query);
foreach (string number in result.TelephoneNumberList)
{
    Console.WriteLine(string.Format("Number: {0}", number));
}

```

## Cities
```csharp
var query = new Dictionary<string, object>();
query.Add("state", "CA");
query.Add("available", true);
var result = await City.List(_client, query);
foreach (City city in result)
{
    Console.WriteLine("City Name: {0}", city.Name);
}
```
## Rate Centers
```csharp
var query = new Dictionary<string, object>();
query.Add("state", "CA");
query.Add("available", true);
var result = await RateCenter.List(query);
foreach (RateCenter rateCenter in result)
{
    Console.WriteLine("RateCenter Name: {0}", rateCenter.Name);
}
```


## Covered Rate Centers
```csharp
var query = new Dictionary<string, object>();
query.Add("zip", "27609");
var result = await CoveredRateCenter.List(_client, query);
foreach (CoveredRateCenter rateCenter in result)
{
    Console.WriteLine("RateCenter Name: {0}", rateCenter.Name);
}
```

## Orders

### Create Order
```csharp
var result = await Order.Create(_client, new Order
{
    Name = "Test Order",
    SiteId = "SiteId",
    CustomerOrderId = "SomeCustomerId",
    LataSearchAndOrderType = new LataSearchAndOrderType
    {
        Lata = "224",
        Quantity = 1
    }
});

```
### Get Order
```csharp
var order = await Order.Get("orderId");
```

### Order Instance Methods
```csharp
order.Update()
order.AddNote(var note);
order.GetNotes();
order.GetAreaCodes();
order.GetNpaNxx();
order.GetTotals();
order.GetTns();
order.GetHistory()
```

## Port Ins

### Port In Check
```csharp
var result = LnpChecker.Check(new string[]{"9195551212", true});
```

### Create PortIn
```csharp
var data = new PortIn
    {
        BillingTelephoneNumber = "+1-202-555-0158",
        Subscriber = new Subscriber
            {
                SubscriberType = "BUSINESS",
                BusinessName = "Company",
		FirstName = "John",
                LastName = "Doe",
                ServiceAddress = new Address
                    {
                        City = "City",<commit_msg>Tabs to spaces<commit_after># Bandwidth C# IRIS Client

## Installing
Bandwidth C# SDK uses Nuget for Package Management

Run 
``` 
nuget install Bandwidth.Iris
```
Or install Bandwidth.Iris via UI in Visual Studio

## Getting Started
* Install Bandwidth.Iris
* Get an account ID, user name and password from Bandwidth for your account
* Configure the Client 

```csharp
var client = Client.GetInstance("accountId", "username", "password", "apiEndpoint")
//Or
// Configure System Environment Variables as detailed below:
public static Client GetInstance()
{
    return GetInstance(
        Environment.GetEnvironmentVariable(BandwidthApiAccountId),
        Environment.GetEnvironmentVariable(BandwidthApiUserName),
        Environment.GetEnvironmentVariable(BandwidthApiPassword),
        Environment.GetEnvironmentVariable(BandwidthApiEndpoint),
        Environment.GetEnvironmentVariable(BandwidthApiVersion));
}
var client = Client.GetInstance()
```

## Usage
All static functions support 2 ways to be called: With a client instance as the first arg or without the client instance (default client instance will then be used)

```csharp
var site = await Site.get(client, "siteId");
//Or
var site = await Site.get("siteId"); //This will use the default client where supported
```

## Examples
There is a Project in the solution called Bandwidth.Iris.Examples.  This project has working code examples for the most commonly used objects and methods.

To run the examples, from the Bandwidth Iris Project root folder:

```bash
copy Bandwidth.Iris.Examples\App.config.example Bandwidth.Iris.Examples\App.config
```
* Fill in the config file with the values from your account or credentials provided by Bandwidth
* Compile the project and run the Examples from Visual Studio or from the command line

## API Objects

### General Principles
When using the objects, there are generally static methods for Create, Get and List of each entity.  Once you have an instance of any entity, you can call the instance methods of that entity to perform additional operations.

```csharp
var sites = await Site.List(client);
var site = await Site.Get(client, "siteId");
var newSite = await Site.Create(client, new Site(){
  Name = "MyTest Site"

});
var sipPeers = await site.GetSipPeers();
site.Delete();
```

## Available NpaNxx
```csharp
var query = new Dictionary<string, object>();
query.Add("areaCode", "805");
query.Add("quantity", 3);
var items = await AvailableNpaNxx.List(_client, query);
foreach (AvailableNpaNxx npaNxx in items)
{
    Console.WriteLine(string.Format("NpaNxx: {0}",npaNxx.Npa + npaNxx.Nxx));
}
```

## Available Numbers
```csharp
var query = new Dictionary<string, object>();
query.Add("areaCode", "805");
query.Add("quantity", 3);
var result = await AvailableNumbers.List(_client, query);
foreach (string number in result.TelephoneNumberList)
{
    Console.WriteLine(string.Format("Number: {0}", number));
}

```

## Cities
```csharp
var query = new Dictionary<string, object>();
query.Add("state", "CA");
query.Add("available", true);
var result = await City.List(_client, query);
foreach (City city in result)
{
    Console.WriteLine("City Name: {0}", city.Name);
}
```
## Rate Centers
```csharp
var query = new Dictionary<string, object>();
query.Add("state", "CA");
query.Add("available", true);
var result = await RateCenter.List(query);
foreach (RateCenter rateCenter in result)
{
    Console.WriteLine("RateCenter Name: {0}", rateCenter.Name);
}
```


## Covered Rate Centers
```csharp
var query = new Dictionary<string, object>();
query.Add("zip", "27609");
var result = await CoveredRateCenter.List(_client, query);
foreach (CoveredRateCenter rateCenter in result)
{
    Console.WriteLine("RateCenter Name: {0}", rateCenter.Name);
}
```

## Orders

### Create Order
```csharp
var result = await Order.Create(_client, new Order
{
    Name = "<NAME>",
    SiteId = "SiteId",
    CustomerOrderId = "SomeCustomerId",
    LataSearchAndOrderType = new LataSearchAndOrderType
    {
        Lata = "224",
        Quantity = 1
    }
});

```
### Get Order
```csharp
var order = await Order.Get("orderId");
```

### Order Instance Methods
```csharp
order.Update()
order.AddNote(var note);
order.GetNotes();
order.GetAreaCodes();
order.GetNpaNxx();
order.GetTotals();
order.GetTns();
order.GetHistory()
```

## Port Ins

### Port In Check
```csharp
var result = LnpChecker.Check(new string[]{"9195551212", true});
```

### Create PortIn
```csharp
var data = new PortIn
    {
        BillingTelephoneNumber = "+1-202-555-0158",
        Subscriber = new Subscriber
            {
                SubscriberType = "BUSINESS",
                BusinessName = "Company",
                FirstName = "John",
		LastName = "Doe",
                ServiceAddress = new Address
                    {
                        City = "City",
{'fraction_non_alphanumeric': 0.12465116279069767, 'fraction_numerical': 0.00909560723514212, 'mean_word_length': 4.247288503253796, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '548686', 'n_tokens_mistral': 2919, 'n_tokens_neox': 2726, 'n_words': 930}