Skip to content

Commit

Permalink
Merge pull request #227 from recurly/v3-v2021-02-25-12325353567
Browse files Browse the repository at this point in the history
Generated Latest Changes for v2021-02-25
  • Loading branch information
cbarton authored Dec 14, 2024
2 parents fe2ed76 + 4b77eb2 commit 626efb6
Show file tree
Hide file tree
Showing 20 changed files with 839 additions and 15 deletions.
13 changes: 13 additions & 0 deletions account_external_subscription.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// This file is automatically created by Recurly's OpenAPI generation process
// and thus any edits you make by hand will be lost. If you wish to make a
// change to this file, please create a Github issue explaining the changes you
// need and we will usher them to the appropriate places.
package recurly

import ()

type AccountExternalSubscription struct {

// The account code of a new or existing account to be used when creating the external subscription.
AccountCode *string `json:"account_code,omitempty"`
}
128 changes: 128 additions & 0 deletions business_entity_mini.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
// This file is automatically created by Recurly's OpenAPI generation process
// and thus any edits you make by hand will be lost. If you wish to make a
// change to this file, please create a Github issue explaining the changes you
// need and we will usher them to the appropriate places.
package recurly

import (
"context"
"net/http"
)

type BusinessEntityMini struct {
recurlyResponse *ResponseMetadata

// Business entity ID
Id string `json:"id,omitempty"`

// Object type
Object string `json:"object,omitempty"`

// The entity code of the business entity.
Code string `json:"code,omitempty"`

// This name describes your business entity and will appear on the invoice.
Name string `json:"name,omitempty"`
}

// GetResponse returns the ResponseMetadata that generated this resource
func (resource *BusinessEntityMini) GetResponse() *ResponseMetadata {
return resource.recurlyResponse
}

// setResponse sets the ResponseMetadata that generated this resource
func (resource *BusinessEntityMini) setResponse(res *ResponseMetadata) {
resource.recurlyResponse = res
}

// internal struct for deserializing accounts
type businessEntityMiniList struct {
ListMetadata
Data []BusinessEntityMini `json:"data"`
recurlyResponse *ResponseMetadata
}

// GetResponse returns the ResponseMetadata that generated this resource
func (resource *businessEntityMiniList) GetResponse() *ResponseMetadata {
return resource.recurlyResponse
}

// setResponse sets the ResponseMetadata that generated this resource
func (resource *businessEntityMiniList) setResponse(res *ResponseMetadata) {
resource.recurlyResponse = res
}

// BusinessEntityMiniList allows you to paginate BusinessEntityMini objects
type BusinessEntityMiniList struct {
client HTTPCaller
requestOptions *RequestOptions
nextPagePath string
hasMore bool
data []BusinessEntityMini
}

func NewBusinessEntityMiniList(client HTTPCaller, nextPagePath string, requestOptions *RequestOptions) *BusinessEntityMiniList {
return &BusinessEntityMiniList{
client: client,
requestOptions: requestOptions,
nextPagePath: nextPagePath,
hasMore: true,
}
}

type BusinessEntityMiniLister interface {
Fetch() error
FetchWithContext(ctx context.Context) error
Count() (*int64, error)
CountWithContext(ctx context.Context) (*int64, error)
Data() []BusinessEntityMini
HasMore() bool
Next() string
}

func (list *BusinessEntityMiniList) HasMore() bool {
return list.hasMore
}

func (list *BusinessEntityMiniList) Next() string {
return list.nextPagePath
}

func (list *BusinessEntityMiniList) Data() []BusinessEntityMini {
return list.data
}

// Fetch fetches the next page of data into the `Data` property
func (list *BusinessEntityMiniList) FetchWithContext(ctx context.Context) error {
resources := &businessEntityMiniList{}
err := list.client.Call(ctx, http.MethodGet, list.nextPagePath, nil, nil, list.requestOptions, resources)
if err != nil {
return err
}
// copy over properties from the response
list.nextPagePath = resources.Next
list.hasMore = resources.HasMore
list.data = resources.Data
return nil
}

// Fetch fetches the next page of data into the `Data` property
func (list *BusinessEntityMiniList) Fetch() error {
return list.FetchWithContext(context.Background())
}

// Count returns the count of items on the server that match this pager
func (list *BusinessEntityMiniList) CountWithContext(ctx context.Context) (*int64, error) {
resources := &businessEntityMiniList{}
err := list.client.Call(ctx, http.MethodHead, list.nextPagePath, nil, nil, list.requestOptions, resources)
if err != nil {
return nil, err
}
resp := resources.GetResponse()
return resp.TotalRecords, nil
}

// Count returns the count of items on the server that match this pager
func (list *BusinessEntityMiniList) Count() (*int64, error) {
return list.CountWithContext(context.Background())
}
78 changes: 77 additions & 1 deletion client_operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,17 @@ type ClientInterface interface {
DeactivateExternalProductExternalProductReference(externalProductId string, externalProductReferenceId string, opts ...Option) (*ExternalProductReferenceMini, error)
DeactivateExternalProductExternalProductReferenceWithContext(ctx context.Context, externalProductId string, externalProductReferenceId string, opts ...Option) (*ExternalProductReferenceMini, error)

CreateExternalSubscription(body *ExternalSubscriptionCreate, opts ...Option) (*ExternalSubscription, error)
CreateExternalSubscriptionWithContext(ctx context.Context, body *ExternalSubscriptionCreate, opts ...Option) (*ExternalSubscription, error)

ListExternalSubscriptions(params *ListExternalSubscriptionsParams, opts ...Option) (ExternalSubscriptionLister, error)

GetExternalSubscription(externalSubscriptionId string, opts ...Option) (*ExternalSubscription, error)
GetExternalSubscriptionWithContext(ctx context.Context, externalSubscriptionId string, opts ...Option) (*ExternalSubscription, error)

PutExternalSubscription(externalSubscriptionId string, params *PutExternalSubscriptionParams, opts ...Option) (*ExternalSubscription, error)
PutExternalSubscriptionWithContext(ctx context.Context, externalSubscriptionId string, params *PutExternalSubscriptionParams, opts ...Option) (*ExternalSubscription, error)

ListExternalSubscriptionExternalInvoices(externalSubscriptionId string, params *ListExternalSubscriptionExternalInvoicesParams, opts ...Option) (ExternalInvoiceLister, error)

ListInvoices(params *ListInvoicesParams, opts ...Option) (InvoiceLister, error)
Expand Down Expand Up @@ -4122,6 +4128,35 @@ func (c *Client) deactivateExternalProductExternalProductReference(ctx context.C
return result, err
}

// CreateExternalSubscription wraps CreateExternalSubscriptionWithContext using the background context
func (c *Client) CreateExternalSubscription(body *ExternalSubscriptionCreate, opts ...Option) (*ExternalSubscription, error) {
ctx := context.Background()
return c.createExternalSubscription(ctx, body, opts...)
}

// CreateExternalSubscriptionWithContext Create an external subscription
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/create_external_subscription
//
// Returns: Returns the external subscription
func (c *Client) CreateExternalSubscriptionWithContext(ctx context.Context, body *ExternalSubscriptionCreate, opts ...Option) (*ExternalSubscription, error) {
return c.createExternalSubscription(ctx, body, opts...)
}

func (c *Client) createExternalSubscription(ctx context.Context, body *ExternalSubscriptionCreate, opts ...Option) (*ExternalSubscription, error) {
path, err := c.InterpolatePath("/external_subscriptions")
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &ExternalSubscription{}
err = c.Call(ctx, http.MethodPost, path, body, nil, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

type ListExternalSubscriptionsParams struct {

// Sort - Sort field. You *really* only want to sort by `updated_at` in ascending
Expand All @@ -4140,7 +4175,7 @@ func (list *ListExternalSubscriptionsParams) URLParams() []KeyValue {
return options
}

// ListExternalSubscriptions List a site's external subscriptions
// ListExternalSubscriptions List the external subscriptions on a site
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscriptions
//
Expand Down Expand Up @@ -4184,6 +4219,47 @@ func (c *Client) getExternalSubscription(ctx context.Context, externalSubscripti
return result, err
}

type PutExternalSubscriptionParams struct {

// Body - The body of the request.
Body *ExternalSubscriptionUpdate
}

func (list *PutExternalSubscriptionParams) URLParams() []KeyValue {
var options []KeyValue

return options
}

// PutExternalSubscription wraps PutExternalSubscriptionWithContext using the background context
func (c *Client) PutExternalSubscription(externalSubscriptionId string, params *PutExternalSubscriptionParams, opts ...Option) (*ExternalSubscription, error) {
ctx := context.Background()
return c.putExternalSubscription(ctx, externalSubscriptionId, params, opts...)
}

// PutExternalSubscriptionWithContext Update an external subscription
//
// API Documentation: https://developers.recurly.com/api/v2021-02-25#operation/put_external_subscription
//
// Returns: Settings for an external subscription.
func (c *Client) PutExternalSubscriptionWithContext(ctx context.Context, externalSubscriptionId string, params *PutExternalSubscriptionParams, opts ...Option) (*ExternalSubscription, error) {
return c.putExternalSubscription(ctx, externalSubscriptionId, params, opts...)
}

func (c *Client) putExternalSubscription(ctx context.Context, externalSubscriptionId string, params *PutExternalSubscriptionParams, opts ...Option) (*ExternalSubscription, error) {
path, err := c.InterpolatePath("/external_subscriptions/{external_subscription_id}", externalSubscriptionId)
if err != nil {
return nil, err
}
requestOptions := NewRequestOptions(opts...)
result := &ExternalSubscription{}
err = c.Call(ctx, http.MethodPut, path, nil, params, requestOptions, result)
if err != nil {
return nil, err
}
return result, err
}

type ListExternalSubscriptionExternalInvoicesParams struct {

// Sort - Sort field. You *really* only want to sort by `updated_at` in ascending
Expand Down
2 changes: 1 addition & 1 deletion external_account_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ type ExternalAccountCreate struct {
// Represents the account code for the external account.
ExternalAccountCode *string `json:"external_account_code,omitempty"`

// Represents the connection type. `AppleAppStore` or `GooglePlayStore`
// Represents the connection type. One of the connection types of your enabled App Connectors
ExternalConnectionType *string `json:"external_connection_type,omitempty"`
}
2 changes: 1 addition & 1 deletion external_account_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ type ExternalAccountUpdate struct {
// Represents the account code for the external account.
ExternalAccountCode *string `json:"external_account_code,omitempty"`

// Represents the connection type. `AppleAppStore` or `GooglePlayStore`
// Represents the connection type. One of the connection types of your enabled App Connectors
ExternalConnectionType *string `json:"external_connection_type,omitempty"`
}
3 changes: 2 additions & 1 deletion external_product_reference_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ type ExternalProductReferenceBase struct {
// A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store.
ReferenceCode *string `json:"reference_code,omitempty"`

ExternalConnectionType *string `json:"external_connection_type,omitempty"`
// Represents the connection type. One of the connection types of your enabled App Connectors
ExternalConnectionType *ExternalProductReferenceConnectionType `json:"external_connection_type,omitempty"`
}
10 changes: 10 additions & 0 deletions external_product_reference_connection_type.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// This file is automatically created by Recurly's OpenAPI generation process
// and thus any edits you make by hand will be lost. If you wish to make a
// change to this file, please create a Github issue explaining the changes you
// need and we will usher them to the appropriate places.
package recurly

import ()

type ExternalProductReferenceConnectionType struct {
}
3 changes: 2 additions & 1 deletion external_product_reference_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ type ExternalProductReferenceCreate struct {
// A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store.
ReferenceCode *string `json:"reference_code,omitempty"`

ExternalConnectionType *string `json:"external_connection_type,omitempty"`
// Represents the connection type. One of the connection types of your enabled App Connectors
ExternalConnectionType *ExternalProductReferenceConnectionType `json:"external_connection_type,omitempty"`
}
16 changes: 16 additions & 0 deletions external_product_reference_update.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// This file is automatically created by Recurly's OpenAPI generation process
// and thus any edits you make by hand will be lost. If you wish to make a
// change to this file, please create a Github issue explaining the changes you
// need and we will usher them to the appropriate places.
package recurly

import ()

type ExternalProductReferenceUpdate struct {

// A code which associates the external product to a corresponding object or resource in an external platform like the Apple App Store or Google Play Store.
ReferenceCode *string `json:"reference_code,omitempty"`

// Represents the connection type. One of the connection types of your enabled App Connectors
ExternalConnectionType *ExternalProductReferenceConnectionType `json:"external_connection_type,omitempty"`
}
48 changes: 48 additions & 0 deletions external_subscription_create.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// This file is automatically created by Recurly's OpenAPI generation process
// and thus any edits you make by hand will be lost. If you wish to make a
// change to this file, please create a Github issue explaining the changes you
// need and we will usher them to the appropriate places.
package recurly

import (
"time"
)

type ExternalSubscriptionCreate struct {
Account *AccountExternalSubscription `json:"account,omitempty"`

ExternalProductReference *ExternalProductReferenceCreate `json:"external_product_reference,omitempty"`

// Id of the subscription in the external system, i.e. Apple App Store or Google Play Store.
ExternalId *string `json:"external_id,omitempty"`

// When a new billing event occurred on the external subscription in conjunction with a recent billing period, reactivation or upgrade/downgrade.
LastPurchased *time.Time `json:"last_purchased,omitempty"`

// An indication of whether or not the external subscription will auto-renew at the expiration date.
AutoRenew *bool `json:"auto_renew,omitempty"`

// External subscriptions can be active, canceled, expired, past_due, voided, revoked, or paused.
State *string `json:"state,omitempty"`

// Identifier of the app that generated the external subscription.
AppIdentifier *string `json:"app_identifier,omitempty"`

// An indication of the quantity of a subscribed item's quantity.
Quantity *int `json:"quantity,omitempty"`

// When the external subscription was activated in the external platform.
ActivatedAt *time.Time `json:"activated_at,omitempty"`

// When the external subscription expires in the external platform.
ExpiresAt *time.Time `json:"expires_at,omitempty"`

// When the external subscription trial period started in the external platform.
TrialStartedAt *time.Time `json:"trial_started_at,omitempty"`

// When the external subscription trial period ends in the external platform.
TrialEndsAt *time.Time `json:"trial_ends_at,omitempty"`

// An indication of whether or not the external subscription was being created by a historical data import.
Imported *bool `json:"imported,omitempty"`
}
Loading

0 comments on commit 626efb6

Please sign in to comment.