Skip to content

Commit

Permalink
Merge pull request #175 from getlago/feat/small-fixes
Browse files Browse the repository at this point in the history
chore: Fix type and missing properties
  • Loading branch information
julienbourdeau authored May 14, 2024
2 parents c920740 + e9253dc commit d3fff09
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 45 deletions.
18 changes: 9 additions & 9 deletions add_on.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ type AddOnParams struct {
}

type AddOnInput struct {
Name string `json:"name,omitempty"`
InvoiceDisplayName string `json:"invoice_display_name,omitempty"`
Code string `json:"code,omitempty"`
Description string `json:"description,omitempty"`
Name string `json:"name,omitempty"`
InvoiceDisplayName string `json:"invoice_display_name,omitempty"`
Code string `json:"code,omitempty"`
Description string `json:"description,omitempty"`

AmountCents int `json:"amount_cents,omitempty"`
AmountCurrency Currency `json:"amount_currency,omitempty"`
Expand All @@ -41,11 +41,11 @@ type AddOnResult struct {
}

type AddOn struct {
LagoID uuid.UUID `json:"lago_id,omitempty"`
Name string `json:"name,omitempty"`
InvoiceDisplayName string `json:"invoice_display_name,omitempty"`
Code string `json:"code,omitempty"`
Description string `json:"description,omitempty"`
LagoID uuid.UUID `json:"lago_id,omitempty"`
Name string `json:"name,omitempty"`
InvoiceDisplayName string `json:"invoice_display_name,omitempty"`
Code string `json:"code,omitempty"`
Description string `json:"description,omitempty"`

AmountCents int `json:"amount_cents,omitempty"`
AmountCurrency Currency `json:"amount_currency,omitempty"`
Expand Down
3 changes: 2 additions & 1 deletion coupon.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ type AppliedCoupon struct {
LagoCustomerID uuid.UUID `json:"lago_customer_id,omitempty"`
Status AppliedCouponStatus `json:"status,omitempty"`

CouponName string `json:"coupon_name,omitempty"`
CouponName string `json:"coupon_name,omitempty"`
CouponCode string `json:"coupon_code,omitempty"`
AmountCents int `json:"amount_cents,omitempty"`
AmountCurrency Currency `json:"amount_currency,omitempty"`

ExpirationDate string `json:"expiration_date,omitempty"`
ExpirationAt time.Time `json:"expiration_at,omitempty"`
TerminatedAt time.Time `json:"terminated_at,omitempty"`

PercentageRate float64 `json:"percentage_rate,omitempty,string"`
Expand Down
10 changes: 5 additions & 5 deletions gross_revenue.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ type GrossRevenueRequest struct {
}

type GrossRevenueListInput struct {
AmountCurrency string `json:"currency,omitempty,string"`
ExternalCustomerId string `json:"external_customer_id,omitempty,string"`
Months int `json:"months,omitempty,string"`
AmountCurrency string `json:"currency,omitempty,string"`
ExternalCustomerId string `json:"external_customer_id,omitempty,string"`
Months int `json:"months,omitempty,string"`
}

type GrossRevenueResult struct {
GrossRevenue *GrossRevenue `json:"gross_revenue,omitempty"`
GrossRevenues []GrossRevenue `json:"gross_revenues,omitempty"`
GrossRevenue *GrossRevenue `json:"gross_revenue,omitempty"`
GrossRevenues []GrossRevenue `json:"gross_revenues,omitempty"`
}

type GrossRevenue struct {
Expand Down
18 changes: 9 additions & 9 deletions invoice_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ type InvoiceCollectionRequest struct {
}

type InvoiceCollectionListInput struct {
AmountCurrency string `json:"currency,omitempty,string"`
Months int `json:"months,omitempty,string"`
AmountCurrency string `json:"currency,omitempty,string"`
Months int `json:"months,omitempty,string"`
}

type InvoiceCollectionResult struct {
InvoiceCollection *InvoiceCollection `json:"invoice_collection,omitempty"`
InvoiceCollections []InvoiceCollection `json:"invoice_collections,omitempty"`
InvoiceCollection *InvoiceCollection `json:"invoice_collection,omitempty"`
InvoiceCollections []InvoiceCollection `json:"invoice_collections,omitempty"`
}

type InvoiceCollection struct {
Month string `json:"month,omitempty"`
PaymentStatus InvoicePaymentStatus `json:"payment_status,omitempty"`
InvoicesCount int `json:"invoices_count,omitempty"`
AmountCents int `json:"amount_cents,omitempty"`
AmountCurrency Currency `json:"currency,omitempty"`
Month string `json:"month,omitempty"`
PaymentStatus InvoicePaymentStatus `json:"payment_status,omitempty"`
InvoicesCount int `json:"invoices_count,omitempty"`
AmountCents int `json:"amount_cents,omitempty"`
AmountCurrency Currency `json:"currency,omitempty"`
}

func (c *Client) InvoiceCollection() *InvoiceCollectionRequest {
Expand Down
28 changes: 14 additions & 14 deletions invoiced_usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ type InvoicedUsageRequest struct {
}

type InvoicedUsageListInput struct {
AmountCurrency string `json:"currency,omitempty,string"`
Months int `json:"months,omitempty,string"`
AmountCurrency string `json:"currency,omitempty,string"`
Months int `json:"months,omitempty,string"`
}

type InvoicedUsageResult struct {
InvoicedUsage *InvoicedUsage `json:"invoiced_usage,omitempty"`
InvoicedUsages []InvoicedUsage `json:"invoiced_usages,omitempty"`
InvoicedUsage *InvoicedUsage `json:"invoiced_usage,omitempty"`
InvoicedUsages []InvoicedUsage `json:"invoiced_usages,omitempty"`
}

type InvoicedUsage struct {
Expand All @@ -28,26 +28,26 @@ type InvoicedUsage struct {

func (c *Client) InvoicedUsage() *InvoicedUsageRequest {
return &InvoicedUsageRequest{
client: c,
}
client: c,
}
}

func (adr *InvoicedUsageRequest) GetList(ctx context.Context, InvoicedUsageListInput *InvoicedUsageListInput) (*InvoicedUsageResult, *Error) {
jsonQueryparams, err := json.Marshal(InvoicedUsageListInput)
if err != nil {
return nil, &Error{Err: err}
}
return nil, &Error{Err: err}
}

queryParams := make(map[string]string)
if err = json.Unmarshal(jsonQueryparams, &queryParams); err != nil {
return nil, &Error{Err: err}
}

clientRequest := &ClientRequest{
Path: "analytics/invoiced_usage",
QueryParams: queryParams,
Result: &InvoicedUsageResult{},
}
clientRequest := &ClientRequest{
Path: "analytics/invoiced_usage",
QueryParams: queryParams,
Result: &InvoicedUsageResult{},
}

result, clientErr := adr.client.Get(ctx, clientRequest)
if clientErr != nil {
Expand All @@ -59,5 +59,5 @@ func (adr *InvoicedUsageRequest) GetList(ctx context.Context, InvoicedUsageListI
return nil, &ErrorTypeAssert
}

return InvoicedUsageResult, nil
return InvoicedUsageResult, nil
}
8 changes: 4 additions & 4 deletions mrr.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ type MrrRequest struct {
}

type MrrListInput struct {
AmountCurrency string `json:"currency,omitempty,string"`
Months int `json:"months,omitempty,string"`
AmountCurrency string `json:"currency,omitempty,string"`
Months int `json:"months,omitempty,string"`
}

type MrrResult struct {
Mrr *Mrr `json:"mrr,omitempty"`
Mrrs []Mrr `json:"mrrs,omitempty"`
Mrr *Mrr `json:"mrr,omitempty"`
Mrrs []Mrr `json:"mrrs,omitempty"`
}

type Mrr struct {
Expand Down
6 changes: 3 additions & 3 deletions wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ type WalletInput struct {
}

type WalletListInput struct {
PerPage int `json:"per_page,omitempty,string"`
Page int `json:"page,omitempty,string"`
ExternalCustomerID int `json:"external_customer_id,omitempty,string"`
PerPage int `json:"per_page,omitempty,string"`
Page int `json:"page,omitempty,string"`
ExternalCustomerID string `json:"external_customer_id,omitempty,string"`
}

type WalletResult struct {
Expand Down

0 comments on commit d3fff09

Please sign in to comment.