Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Latest commit

 

History

History
408 lines (325 loc) · 13.2 KB

SubscriptionsApi.md

File metadata and controls

408 lines (325 loc) · 13.2 KB

Org.OpenAPITools.Api.SubscriptionsApi

All URIs are relative to https://api.getlago.com/api/v1

Method HTTP request Description
CreateSubscription POST /subscriptions Assign a plan to a customer
DestroySubscription DELETE /subscriptions/{external_id} Terminate a subscription
FindAllSubscriptions GET /subscriptions Find subscriptions
UpdateSubscription PUT /subscriptions/{external_id} Update an existing subscription

CreateSubscription

Subscription CreateSubscription (SubscriptionCreateInput subscriptionCreateInput)

Assign a plan to a customer

Assign a plan to a customer

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class CreateSubscriptionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.getlago.com/api/v1";
            // Configure Bearer token for authorization: bearerAuth
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new SubscriptionsApi(config);
            var subscriptionCreateInput = new SubscriptionCreateInput(); // SubscriptionCreateInput | Subscription payload

            try
            {
                // Assign a plan to a customer
                Subscription result = apiInstance.CreateSubscription(subscriptionCreateInput);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SubscriptionsApi.CreateSubscription: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the CreateSubscriptionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Assign a plan to a customer
    ApiResponse<Subscription> response = apiInstance.CreateSubscriptionWithHttpInfo(subscriptionCreateInput);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SubscriptionsApi.CreateSubscriptionWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
subscriptionCreateInput SubscriptionCreateInput Subscription payload

Return type

Subscription

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response -
400 Bad Request error -
401 Unauthorized error -
404 Not Found error -
422 Unprocessable entity error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

DestroySubscription

Subscription DestroySubscription (string externalId)

Terminate a subscription

Terminate a subscription

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class DestroySubscriptionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.getlago.com/api/v1";
            // Configure Bearer token for authorization: bearerAuth
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new SubscriptionsApi(config);
            var externalId = example_id;  // string | External ID of the existing subscription

            try
            {
                // Terminate a subscription
                Subscription result = apiInstance.DestroySubscription(externalId);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SubscriptionsApi.DestroySubscription: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the DestroySubscriptionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Terminate a subscription
    ApiResponse<Subscription> response = apiInstance.DestroySubscriptionWithHttpInfo(externalId);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SubscriptionsApi.DestroySubscriptionWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
externalId string External ID of the existing subscription

Return type

Subscription

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response -
401 Unauthorized error -
404 Not Found error -
405 Not Allowed error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

FindAllSubscriptions

SubscriptionsPaginated FindAllSubscriptions (int? page = null, int? perPage = null, string externalCustomerId = null, string planCode = null)

Find subscriptions

Find all suscriptions for certain customer

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class FindAllSubscriptionsExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.getlago.com/api/v1";
            // Configure Bearer token for authorization: bearerAuth
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new SubscriptionsApi(config);
            var page = 2;  // int? | Number of page (optional) 
            var perPage = 20;  // int? | Number of records per page (optional) 
            var externalCustomerId = 12345;  // string | External customer ID (optional) 
            var planCode = example_code;  // string | Code of the plan attached to the subscription (optional) 

            try
            {
                // Find subscriptions
                SubscriptionsPaginated result = apiInstance.FindAllSubscriptions(page, perPage, externalCustomerId, planCode);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SubscriptionsApi.FindAllSubscriptions: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the FindAllSubscriptionsWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Find subscriptions
    ApiResponse<SubscriptionsPaginated> response = apiInstance.FindAllSubscriptionsWithHttpInfo(page, perPage, externalCustomerId, planCode);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SubscriptionsApi.FindAllSubscriptionsWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
page int? Number of page [optional]
perPage int? Number of records per page [optional]
externalCustomerId string External customer ID [optional]
planCode string Code of the plan attached to the subscription [optional]

Return type

SubscriptionsPaginated

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response -
401 Unauthorized error -
404 Not Found error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

UpdateSubscription

Subscription UpdateSubscription (string externalId, SubscriptionUpdateInput subscriptionUpdateInput)

Update an existing subscription

Update an existing subscription by external ID

Example

using System.Collections.Generic;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class UpdateSubscriptionExample
    {
        public static void Main()
        {
            Configuration config = new Configuration();
            config.BasePath = "https://api.getlago.com/api/v1";
            // Configure Bearer token for authorization: bearerAuth
            config.AccessToken = "YOUR_BEARER_TOKEN";

            var apiInstance = new SubscriptionsApi(config);
            var externalId = example_id;  // string | External ID of the existing subscription
            var subscriptionUpdateInput = new SubscriptionUpdateInput(); // SubscriptionUpdateInput | Update an existing subscription

            try
            {
                // Update an existing subscription
                Subscription result = apiInstance.UpdateSubscription(externalId, subscriptionUpdateInput);
                Debug.WriteLine(result);
            }
            catch (ApiException  e)
            {
                Debug.Print("Exception when calling SubscriptionsApi.UpdateSubscription: " + e.Message);
                Debug.Print("Status Code: " + e.ErrorCode);
                Debug.Print(e.StackTrace);
            }
        }
    }
}

Using the UpdateSubscriptionWithHttpInfo variant

This returns an ApiResponse object which contains the response data, status code and headers.

try
{
    // Update an existing subscription
    ApiResponse<Subscription> response = apiInstance.UpdateSubscriptionWithHttpInfo(externalId, subscriptionUpdateInput);
    Debug.Write("Status Code: " + response.StatusCode);
    Debug.Write("Response Headers: " + response.Headers);
    Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
    Debug.Print("Exception when calling SubscriptionsApi.UpdateSubscriptionWithHttpInfo: " + e.Message);
    Debug.Print("Status Code: " + e.ErrorCode);
    Debug.Print(e.StackTrace);
}

Parameters

Name Type Description Notes
externalId string External ID of the existing subscription
subscriptionUpdateInput SubscriptionUpdateInput Update an existing subscription

Return type

Subscription

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Successful response -
400 Bad Request error -
401 Unauthorized error -
404 Not Found error -
422 Unprocessable entity error -

[Back to top] [Back to API list] [Back to Model list] [Back to README]