(Contracts)
- Get - Get a contract
- List - List customer contracts
- Create - Create a contract
- Amend - Amend a contract
- Archive - Archive a contract
- SetUsageFilter - Set a contract usage filter
- AddManualBalanceEntry - Add a manual balance entry
- UpdateEndDate - Update the contract end date
- GetRateSchedule - Get the rate schedule for a contract
- ScheduleProServicesInvoice - Schedule ProService invoice
Get a specific contract
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.GetContractRequestBody = &operations.GetContractRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
ContractID: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
}
ctx := context.Background()
res, err := s.Contracts.Get(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.GetContractRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetContractResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
List all contracts for a customer
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.ListContractsRequestBody = &operations.ListContractsRequestBody{
CustomerID: "9b85c1c1-5238-4f2a-a409-61412905e1e1",
}
ctx := context.Background()
res, err := s.Contracts.List(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ListContractsRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ListContractsResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
Create a new contract
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"github.com/speakeasy-sdks/metronome-go-sdk/types"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.CreateContractRequestBody = &operations.CreateContractRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
RateCardID: metronomegosdk.String("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"),
StartingAt: types.MustTimeFromString("2020-01-01T00:00:00.000Z"),
}
ctx := context.Background()
res, err := s.Contracts.Create(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.CreateContractRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.CreateContractResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
Amend a contract
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"github.com/speakeasy-sdks/metronome-go-sdk/types"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.AmendContractRequestBody = &operations.AmendContractRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
ContractID: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
StartingAt: types.MustTimeFromString("2020-01-01T00:00:00.000Z"),
}
ctx := context.Background()
res, err := s.Contracts.Amend(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AmendContractRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AmendContractResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
Archive a contract
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.ArchiveContractRequestBody = &operations.ArchiveContractRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
ContractID: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
VoidInvoices: true,
}
ctx := context.Background()
res, err := s.Contracts.Archive(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ArchiveContractRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ArchiveContractResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
Set usage filter for a contract
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"github.com/speakeasy-sdks/metronome-go-sdk/types"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.SetUsageFilterRequestBody = &operations.SetUsageFilterRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
ContractID: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
GroupKey: "business_subscription_id",
GroupValues: []string{
"ID-1",
"ID-2",
},
StartingAt: types.MustTimeFromString("2020-01-01T00:00:00.000Z"),
}
ctx := context.Background()
res, err := s.Contracts.SetUsageFilter(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.SetUsageFilterRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.SetUsageFilterResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
Add a manual balance entry
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.AddManualBalanceLedgerEntryRequestBody = &operations.AddManualBalanceLedgerEntryRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
ContractID: metronomegosdk.String("d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc"),
ID: "6162d87b-e5db-4a33-b7f2-76ce6ead4e85",
SegmentID: "66368e29-3f97-4d15-a6e9-120897f0070a",
Amount: -1000,
Reason: "Reason for entry",
}
ctx := context.Background()
res, err := s.Contracts.AddManualBalanceEntry(ctx, request)
if err != nil {
log.Fatal(err)
}
if res != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.AddManualBalanceLedgerEntryRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.AddManualBalanceLedgerEntryResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
Update the end date of a contract
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"github.com/speakeasy-sdks/metronome-go-sdk/types"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var request *operations.UpdateContractEndDateRequestBody = &operations.UpdateContractEndDateRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
ContractID: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
EndingBefore: types.MustNewTimeFromString("2020-01-01T00:00:00.000Z"),
}
ctx := context.Background()
res, err := s.Contracts.UpdateEndDate(ctx, request)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.UpdateContractEndDateRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.UpdateContractEndDateResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.BadRequest | 400 | application/json |
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |
Get the rate schedule for the rate card on a given contract.
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"github.com/speakeasy-sdks/metronome-go-sdk/types"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
var requestBody *operations.GetContractRateScheduleRequestBody = &operations.GetContractRateScheduleRequestBody{
CustomerID: "13117714-3f05-48e5-a6e9-a66093f13b4d",
ContractID: "d7abd0cd-4ae9-4db7-8676-e986a4ebd8dc",
At: types.MustNewTimeFromString("2020-01-01T00:00:00.000Z"),
Selectors: []operations.GetContractRateScheduleSelectors{
operations.GetContractRateScheduleSelectors{
ProductID: metronomegosdk.String("d6300dbb-882e-4d2d-8dec-5125d16b65d0"),
PartialPricingGroupValues: map[string]string{
"region": "us-west-2",
"cloud": "aws",
},
},
},
}
ctx := context.Background()
res, err := s.Contracts.GetRateSchedule(ctx, nil, nil, requestBody)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
limit |
*int64 | ➖ | Max number of results that should be returned |
nextPage |
*string | ➖ | Cursor that indicates where the next page of results should start. |
requestBody |
*operations.GetContractRateScheduleRequestBody | ➖ | Contract rate schedule filter options. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.GetContractRateScheduleResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.SDKError | 4xx-5xx | / |
Create a new, scheduled invoice for Professional Services terms on a contract. This endpoint's availability is dependent on your client's configuration.
package main
import(
metronomegosdk "github.com/speakeasy-sdks/metronome-go-sdk"
"github.com/speakeasy-sdks/metronome-go-sdk/models/operations"
"context"
"log"
)
func main() {
s := metronomegosdk.New(
metronomegosdk.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
)
ctx := context.Background()
res, err := s.Contracts.ScheduleProServicesInvoice(ctx, nil)
if err != nil {
log.Fatal(err)
}
if res.Object != nil {
// handle response
}
}
Parameter | Type | Required | Description |
---|---|---|---|
ctx |
context.Context | ✔️ | The context to use for the request. |
request |
operations.ScheduleProServicesInvoiceRequestBody | ✔️ | The request object to use for the request. |
opts |
[]operations.Option | ➖ | The options for this request. |
*operations.ScheduleProServicesInvoiceResponse, error
Error Object | Status Code | Content Type |
---|---|---|
sdkerrors.NotFound | 404 | application/json |
sdkerrors.SDKError | 4xx-5xx | / |