endpoints/Customers.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81

<#
  .Synopsis
  Get a list of customers from the API
   
#>

function Get-AteraCustomers {
  return New-AteraGetRequest -Endpoint "/customers"
}

<#
  .Synopsis
  Get a single customer from the API
 
  .Parameter CustomerID
#>

function Get-AteraCustomer {
  param(
    [Parameter(Mandatory=$true)]
    [int] $CustomerID
  )
  return New-AteraGetRequest -Endpoint "/customers/$CustomerID"
}

<#
  .Synopsis
  Creates a new Customer
   
  .Parameter CustomerName
  .Parameter BusinessNumber
  .Parameter Domain
  Semi-colon delimited list of domains used by customer. Should include both email domains and ActiveDirectory domains
  .Parameter Address
  .Parameter City
  .Parameter State
  .Parameter ZipCodeStr
  .Parameter Country
  .Parameter Phone
  .Parameter Fax
  .Parameter Notes
  .Parameter Links
  .Parameter Longitude
  Longitude used to generate dot on the dashboard map of customers
  .Parameter Latitude
  Latitude used to generate dot on the dashboard map of customers
#>

function New-AteraCustomer {
  [CmdletBinding()]
  param (
    [Parameter(Mandatory)]
    [string] $CustomerName,
    [Parameter()]
    [string] $BusinessNumber,
    [Parameter()]
    [string] $Domain,
    [Parameter()]
    [string] $Address,
    [Parameter()]
    [string] $City,
    [Parameter()]
    [string] $State,
    [Parameter()]
    [string] $ZipCodeStr,
    [Parameter()]
    [string] $Country,
    [Parameter()]
    [string] $Phone,
    [Parameter()]
    [string] $Fax,
    [Parameter()]
    [string] $Notes,
    [Parameter()]
    [string] $Links,
    [Parameter()]
    [string] $Longitude,
    [Parameter()]
    [string] $Latitude
  )
  New-AteraPostRequest -Endpoint "/customers" -Body $PSBoundParameters
}