Skip to content

Commit

Permalink
Release v0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Aug 1, 2024
1 parent 14d71e8 commit efde026
Show file tree
Hide file tree
Showing 11 changed files with 98 additions and 15 deletions.
2 changes: 1 addition & 1 deletion core/request_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *RequestOptions) cloneHeader() http.Header {
headers := r.HTTPHeader.Clone()
headers.Set("X-Fern-Language", "Go")
headers.Set("X-Fern-SDK-Name", "github.com/mercoa-finance/go")
headers.Set("X-Fern-SDK-Version", "v0.4.49")
headers.Set("X-Fern-SDK-Version", "v0.5.0")
return headers
}

Expand Down
20 changes: 14 additions & 6 deletions entity/invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ type EntityGetInvoicesRequest struct {
ExcludePayables *bool `json:"-" url:"excludePayables,omitempty"`
// Return only invoices that are payable by the entity.
ExcludeReceivables *bool `json:"-" url:"excludeReceivables,omitempty"`
// Start date for invoice created on date filter.
// Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
StartDate *time.Time `json:"-" url:"startDate,omitempty"`
// End date for invoice created date filter.
// End date filter. Defaults to CREATED_AT unless specified the dateType is specified
EndDate *time.Time `json:"-" url:"endDate,omitempty"`
// Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
DateType *mercoafinancego.InvoiceDateFilter `json:"-" url:"dateType,omitempty"`
// Field to order invoices by. Defaults to CREATED_AT.
OrderBy *mercoafinancego.InvoiceOrderByField `json:"-" url:"orderBy,omitempty"`
// Direction to order invoices by. Defaults to asc.
Expand Down Expand Up @@ -65,13 +67,19 @@ type InvoiceMetricsRequest struct {
InvoiceID []*mercoafinancego.InvoiceID `json:"-" url:"invoiceId,omitempty"`
// Invoice status to filter on
Status []*mercoafinancego.InvoiceStatus `json:"-" url:"status,omitempty"`
// Start date for invoice dueDate filter.
// Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
StartDate *time.Time `json:"-" url:"startDate,omitempty"`
// End date filter. Defaults to CREATED_AT unless specified the dateType is specified
EndDate *time.Time `json:"-" url:"endDate,omitempty"`
// Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
DateType *mercoafinancego.InvoiceDateFilter `json:"-" url:"dateType,omitempty"`
// DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
DueDateStart *time.Time `json:"-" url:"dueDateStart,omitempty"`
// End date for invoice dueDate filter.
// DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
DueDateEnd *time.Time `json:"-" url:"dueDateEnd,omitempty"`
// Start date for invoice created on date filter.
// DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
CreatedDateStart *time.Time `json:"-" url:"createdDateStart,omitempty"`
// End date for invoice created date filter.
// DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
CreatedDateEnd *time.Time `json:"-" url:"createdDateEnd,omitempty"`
// Currency to filter on
Currency []*mercoafinancego.CurrencyCode `json:"-" url:"currency,omitempty"`
Expand Down
6 changes: 6 additions & 0 deletions entity/paymentmethod/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ func (c *Client) Get(
ctx context.Context,
// Entity ID or Entity ForeignID
entityID mercoafinancego.EntityID,
// Payment Method ID or Payment Method ForeignID
paymentMethodID mercoafinancego.PaymentMethodID,
opts ...option.RequestOption,
) (*mercoafinancego.PaymentMethodResponse, error) {
Expand Down Expand Up @@ -371,6 +372,7 @@ func (c *Client) Update(
ctx context.Context,
// Entity ID or Entity ForeignID
entityID mercoafinancego.EntityID,
// Payment Method ID or Payment Method ForeignID
paymentMethodID mercoafinancego.PaymentMethodID,
request *mercoafinancego.PaymentMethodUpdateRequest,
opts ...option.RequestOption,
Expand Down Expand Up @@ -484,6 +486,7 @@ func (c *Client) Delete(
ctx context.Context,
// Entity ID or Entity ForeignID
entityID mercoafinancego.EntityID,
// Payment Method ID or Payment Method ForeignID
paymentMethodID mercoafinancego.PaymentMethodID,
opts ...option.RequestOption,
) error {
Expand Down Expand Up @@ -593,6 +596,7 @@ func (c *Client) InitiateMicroDeposits(
ctx context.Context,
// Entity ID or Entity ForeignID
entityID mercoafinancego.EntityID,
// Payment Method ID or Payment Method ForeignID
paymentMethodID mercoafinancego.PaymentMethodID,
opts ...option.RequestOption,
) (*mercoafinancego.PaymentMethodResponse, error) {
Expand Down Expand Up @@ -704,6 +708,7 @@ func (c *Client) CompleteMicroDeposits(
ctx context.Context,
// Entity ID or Entity ForeignID
entityID mercoafinancego.EntityID,
// Payment Method ID or Payment Method ForeignID
paymentMethodID mercoafinancego.PaymentMethodID,
request *entity.CompleteMicroDepositsRequest,
opts ...option.RequestOption,
Expand Down Expand Up @@ -817,6 +822,7 @@ func (c *Client) GetBalance(
ctx context.Context,
// Entity ID or Entity ForeignID
entityID mercoafinancego.EntityID,
// Payment Method ID or Payment Method ForeignID
paymentMethodID mercoafinancego.PaymentMethodID,
opts ...option.RequestOption,
) (*mercoafinancego.PaymentMethodBalanceResponse, error) {
Expand Down
16 changes: 12 additions & 4 deletions entitygroup/invoice.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ type EntityGetInvoicesRequest struct {
StartDate *time.Time `json:"-" url:"startDate,omitempty"`
// End date for invoice created date filter.
EndDate *time.Time `json:"-" url:"endDate,omitempty"`
// Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
DateType *mercoafinancego.InvoiceDateFilter `json:"-" url:"dateType,omitempty"`
// Field to order invoices by. Defaults to CREATED_AT.
OrderBy *mercoafinancego.InvoiceOrderByField `json:"-" url:"orderBy,omitempty"`
// Direction to order invoices by. Defaults to asc.
Expand Down Expand Up @@ -61,13 +63,19 @@ type GroupInvoiceMetricsRequest struct {
InvoiceID []*mercoafinancego.InvoiceID `json:"-" url:"invoiceId,omitempty"`
// Invoice status to filter on
Status []*mercoafinancego.InvoiceStatus `json:"-" url:"status,omitempty"`
// Start date for invoice dueDate filter.
// Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
StartDate *time.Time `json:"-" url:"startDate,omitempty"`
// End date filter. Defaults to CREATED_AT unless specified the dateType is specified
EndDate *time.Time `json:"-" url:"endDate,omitempty"`
// Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
DateType *mercoafinancego.InvoiceDateFilter `json:"-" url:"dateType,omitempty"`
// DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice dueDate filter.
DueDateStart *time.Time `json:"-" url:"dueDateStart,omitempty"`
// End date for invoice dueDate filter.
// DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice dueDate filter.
DueDateEnd *time.Time `json:"-" url:"dueDateEnd,omitempty"`
// Start date for invoice created on date filter.
// DEPRECATED. Use startDate, endDate, and dateType instead. Start date for invoice created on date filter.
CreatedDateStart *time.Time `json:"-" url:"createdDateStart,omitempty"`
// End date for invoice created date filter.
// DEPRECATED. Use startDate, endDate, and dateType instead. End date for invoice created date filter.
CreatedDateEnd *time.Time `json:"-" url:"createdDateEnd,omitempty"`
// Currency to filter on
Currency []*mercoafinancego.CurrencyCode `json:"-" url:"currency,omitempty"`
Expand Down
3 changes: 3 additions & 0 deletions invoice/approval/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func NewClient(opts ...option.RequestOption) *Client {
// Adds an approver to the invoice. Will select the first available approver slot that is not already filled and assign the approver to it. If no approver slots are available, an error will be returned. An explicit approver slot can be specified by setting the `approverSlot` field.
func (c *Client) AddApprover(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
request *mercoafinancego.AddApproverRequest,
opts ...option.RequestOption,
Expand Down Expand Up @@ -141,6 +142,7 @@ func (c *Client) AddApprover(

func (c *Client) Approve(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
request *mercoafinancego.ApprovalRequest,
opts ...option.RequestOption,
Expand Down Expand Up @@ -245,6 +247,7 @@ func (c *Client) Approve(

func (c *Client) Reject(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
request *mercoafinancego.ApprovalRequest,
opts ...option.RequestOption,
Expand Down
3 changes: 3 additions & 0 deletions invoice/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ func (c *Client) Create(

func (c *Client) Get(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) (*mercoafinancego.InvoiceResponse, error) {
Expand Down Expand Up @@ -375,6 +376,7 @@ func (c *Client) Get(

func (c *Client) Update(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
request *mercoafinancego.InvoiceUpdateRequest,
opts ...option.RequestOption,
Expand Down Expand Up @@ -482,6 +484,7 @@ func (c *Client) Update(
// Only invoices in the DRAFT and NEW status can be deleted.
func (c *Client) Delete(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) error {
Expand Down
5 changes: 5 additions & 0 deletions invoice/comment/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ func NewClient(opts ...option.RequestOption) *Client {
// Get all comments associated with this invoice
func (c *Client) GetAll(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) ([]*mercoafinancego.CommentResponse, error) {
Expand Down Expand Up @@ -142,6 +143,7 @@ func (c *Client) GetAll(
// Add a comment to this invoice
func (c *Client) Create(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
request *mercoafinancego.CommentRequest,
opts ...option.RequestOption,
Expand Down Expand Up @@ -248,6 +250,7 @@ func (c *Client) Create(

func (c *Client) Get(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
commentID mercoafinancego.CommentID,
opts ...option.RequestOption,
Expand Down Expand Up @@ -358,6 +361,7 @@ func (c *Client) Get(
// Edit a comment on this invoice
func (c *Client) Update(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
commentID mercoafinancego.CommentID,
request *mercoafinancego.CommentRequest,
Expand Down Expand Up @@ -470,6 +474,7 @@ func (c *Client) Update(
// Delete a comment on this invoice
func (c *Client) Delete(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
commentID mercoafinancego.CommentID,
opts ...option.RequestOption,
Expand Down
6 changes: 6 additions & 0 deletions invoice/document/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func NewClient(opts ...option.RequestOption) *Client {
// Get attachments (scanned/uploaded PDFs and images) associated with this invoice
func (c *Client) GetAll(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) ([]*mercoafinancego.DocumentResponse, error) {
Expand Down Expand Up @@ -143,6 +144,7 @@ func (c *Client) GetAll(
// Upload documents (scanned/uploaded PDFs and images) associated with this Invoice
func (c *Client) Upload(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
request *invoice.UploadDocumentRequest,
opts ...option.RequestOption,
Expand Down Expand Up @@ -248,6 +250,7 @@ func (c *Client) Upload(
// Delete an attachment (scanned/uploaded PDFs and images) associated with this invoice
func (c *Client) Delete(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
documentID string,
opts ...option.RequestOption,
Expand Down Expand Up @@ -356,6 +359,7 @@ func (c *Client) Delete(
// Generate a PDF of the invoice. This PDF is generated from the data in the invoice, not from the uploaded documents.
func (c *Client) GenerateInvoicePdf(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) (*mercoafinancego.DocumentResponse, error) {
Expand Down Expand Up @@ -461,6 +465,7 @@ func (c *Client) GenerateInvoicePdf(
// Get a PDF of the check for the invoice. If the invoice does not have check as the disbursement method, an error will be returned. If the disbursement option for the check is set to 'MAIL', a void copy of the check will be returned. If the disbursement option for the check is set to 'PRINT', a printable check will be returned. If the invoice is NOT marked as PAID, the check will be a void copy.
func (c *Client) GenerateCheckPdf(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) (*mercoafinancego.DocumentResponse, error) {
Expand Down Expand Up @@ -566,6 +571,7 @@ func (c *Client) GenerateCheckPdf(
// Get the email subject and body that was used to create this invoice.
func (c *Client) GetSourceEmail(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) (*mercoafinancego.EmailLogResponse, error) {
Expand Down
4 changes: 4 additions & 0 deletions invoice/paymentlinks/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ func NewClient(opts ...option.RequestOption) *Client {
// Get temporary link for payer to send payment
func (c *Client) GetPayerLink(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) (string, error) {
Expand Down Expand Up @@ -143,6 +144,7 @@ func (c *Client) GetPayerLink(
// Trigger email to payer inviting them to make payment
func (c *Client) SendPayerEmail(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
request *invoice.SendPayerEmail,
opts ...option.RequestOption,
Expand Down Expand Up @@ -255,6 +257,7 @@ func (c *Client) SendPayerEmail(
// Get temporary link for vendor to accept payment
func (c *Client) GetVendorLink(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) (string, error) {
Expand Down Expand Up @@ -360,6 +363,7 @@ func (c *Client) GetVendorLink(
// Trigger email to vendor inviting them into the vendor portal
func (c *Client) SendVendorEmail(
ctx context.Context,
// Invoice ID or Invoice ForeignID
invoiceID mercoafinancego.InvoiceID,
opts ...option.RequestOption,
) error {
Expand Down
6 changes: 4 additions & 2 deletions invoice/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import (
type GetAllInvoicesRequest struct {
// Filter invoices by the ID of the entity that created the invoice.
EntityID []*mercoafinancego.EntityID `json:"-" url:"entityId,omitempty"`
// Start date for invoice created on date filter.
// Start date filter. Defaults to CREATED_AT unless specified the dateType is specified
StartDate *time.Time `json:"-" url:"startDate,omitempty"`
// End date for invoice created date filter.
// End date filter. Defaults to CREATED_AT unless specified the dateType is specified
EndDate *time.Time `json:"-" url:"endDate,omitempty"`
// Type of date to filter by if startDate and endDate filters are provided. Defaults to CREATED_AT.
DateType *mercoafinancego.InvoiceDateFilter `json:"-" url:"dateType,omitempty"`
// Field to order invoices by. Defaults to CREATED_AT.
OrderBy *mercoafinancego.InvoiceOrderByField `json:"-" url:"orderBy,omitempty"`
// Direction to order invoices by. Defaults to asc.
Expand Down
42 changes: 40 additions & 2 deletions types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2917,6 +2917,8 @@ type NotificationPolicyRequest struct {
Disabled *bool `json:"disabled,omitempty" url:"disabled,omitempty"`
// List of user roles that should receive notifications in addition to the default users for this notification type
AdditionalRoles []string `json:"additionalRoles,omitempty" url:"additionalRoles,omitempty"`
// Set to true if the selected notification type should be sent to the counterparty
NotifyCounterparty *bool `json:"notifyCounterparty,omitempty" url:"notifyCounterparty,omitempty"`

extraProperties map[string]interface{}
_rawJSON json.RawMessage
Expand Down Expand Up @@ -2960,8 +2962,10 @@ type NotificationPolicyResponse struct {
// True if the selected notification type is disabled for this entity
Disabled bool `json:"disabled" url:"disabled"`
// List of user roles that should receive notifications in addition to the default users for this notification type
AdditionalRoles []string `json:"additionalRoles,omitempty" url:"additionalRoles,omitempty"`
Type NotificationType `json:"type" url:"type"`
AdditionalRoles []string `json:"additionalRoles,omitempty" url:"additionalRoles,omitempty"`
// True if the selected notification type is sent to the counterparty
NotifyCounterparty bool `json:"notifyCounterparty" url:"notifyCounterparty"`
Type NotificationType `json:"type" url:"type"`

extraProperties map[string]interface{}
_rawJSON json.RawMessage
Expand Down Expand Up @@ -4739,6 +4743,40 @@ func (i *InvoiceCreationRequest) String() string {
return fmt.Sprintf("%#v", i)
}

type InvoiceDateFilter string

const (
InvoiceDateFilterInvoiceDate InvoiceDateFilter = "INVOICE_DATE"
InvoiceDateFilterDeductionDate InvoiceDateFilter = "DEDUCTION_DATE"
InvoiceDateFilterDueDate InvoiceDateFilter = "DUE_DATE"
InvoiceDateFilterSettlementDate InvoiceDateFilter = "SETTLEMENT_DATE"
InvoiceDateFilterCreatedAt InvoiceDateFilter = "CREATED_AT"
InvoiceDateFilterUpdatedAt InvoiceDateFilter = "UPDATED_AT"
)

func NewInvoiceDateFilterFromString(s string) (InvoiceDateFilter, error) {
switch s {
case "INVOICE_DATE":
return InvoiceDateFilterInvoiceDate, nil
case "DEDUCTION_DATE":
return InvoiceDateFilterDeductionDate, nil
case "DUE_DATE":
return InvoiceDateFilterDueDate, nil
case "SETTLEMENT_DATE":
return InvoiceDateFilterSettlementDate, nil
case "CREATED_AT":
return InvoiceDateFilterCreatedAt, nil
case "UPDATED_AT":
return InvoiceDateFilterUpdatedAt, nil
}
var t InvoiceDateFilter
return "", fmt.Errorf("%s is not a valid %T", s, t)
}

func (i InvoiceDateFilter) Ptr() *InvoiceDateFilter {
return &i
}

type InvoiceFailureType string

const (
Expand Down

0 comments on commit efde026

Please sign in to comment.