Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion accounting/audit_trail.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type AuditTrailListRequest struct {
Cursor *string `json:"-"`
// If included, will only include audit trail events that occurred before this time
EndDate *string `json:"-"`
// If included, will only include events with the given event type. Possible values include: `CREATED_REMOTE_PRODUCTION_API_KEY`, `DELETED_REMOTE_PRODUCTION_API_KEY`, `CREATED_TEST_API_KEY`, `DELETED_TEST_API_KEY`, `REGENERATED_PRODUCTION_API_KEY`, `INVITED_USER`, `TWO_FACTOR_AUTH_ENABLED`, `TWO_FACTOR_AUTH_DISABLED`, `DELETED_LINKED_ACCOUNT`, `CREATED_DESTINATION`, `DELETED_DESTINATION`, `CHANGED_SCOPES`, `CHANGED_PERSONAL_INFORMATION`, `CHANGED_ORGANIZATION_SETTINGS`, `ENABLED_INTEGRATION`, `DISABLED_INTEGRATION`, `ENABLED_CATEGORY`, `DISABLED_CATEGORY`, `CHANGED_PASSWORD`, `RESET_PASSWORD`, `ENABLED_REDACT_UNMAPPED_DATA_FOR_ORGANIZATION`, `ENABLED_REDACT_UNMAPPED_DATA_FOR_LINKED_ACCOUNT`, `DISABLED_REDACT_UNMAPPED_DATA_FOR_ORGANIZATION`, `DISABLED_REDACT_UNMAPPED_DATA_FOR_LINKED_ACCOUNT`, `CREATED_INTEGRATION_WIDE_FIELD_MAPPING`, `CREATED_LINKED_ACCOUNT_FIELD_MAPPING`, `CHANGED_INTEGRATION_WIDE_FIELD_MAPPING`, `CHANGED_LINKED_ACCOUNT_FIELD_MAPPING`, `DELETED_INTEGRATION_WIDE_FIELD_MAPPING`, `DELETED_LINKED_ACCOUNT_FIELD_MAPPING`
// If included, will only include events with the given event type. Possible values include: `CREATED_REMOTE_PRODUCTION_API_KEY`, `DELETED_REMOTE_PRODUCTION_API_KEY`, `CREATED_TEST_API_KEY`, `DELETED_TEST_API_KEY`, `REGENERATED_PRODUCTION_API_KEY`, `INVITED_USER`, `TWO_FACTOR_AUTH_ENABLED`, `TWO_FACTOR_AUTH_DISABLED`, `DELETED_LINKED_ACCOUNT`, `CREATED_DESTINATION`, `DELETED_DESTINATION`, `CHANGED_DESTINATION`, `CHANGED_SCOPES`, `CHANGED_PERSONAL_INFORMATION`, `CHANGED_ORGANIZATION_SETTINGS`, `ENABLED_INTEGRATION`, `DISABLED_INTEGRATION`, `ENABLED_CATEGORY`, `DISABLED_CATEGORY`, `CHANGED_PASSWORD`, `RESET_PASSWORD`, `ENABLED_REDACT_UNMAPPED_DATA_FOR_ORGANIZATION`, `ENABLED_REDACT_UNMAPPED_DATA_FOR_LINKED_ACCOUNT`, `DISABLED_REDACT_UNMAPPED_DATA_FOR_ORGANIZATION`, `DISABLED_REDACT_UNMAPPED_DATA_FOR_LINKED_ACCOUNT`, `CREATED_INTEGRATION_WIDE_FIELD_MAPPING`, `CREATED_LINKED_ACCOUNT_FIELD_MAPPING`, `CHANGED_INTEGRATION_WIDE_FIELD_MAPPING`, `CHANGED_LINKED_ACCOUNT_FIELD_MAPPING`, `DELETED_INTEGRATION_WIDE_FIELD_MAPPING`, `DELETED_LINKED_ACCOUNT_FIELD_MAPPING`
EventType *string `json:"-"`
// Number of results to return per page.
PageSize *int `json:"-"`
Expand Down
6 changes: 6 additions & 0 deletions accounting/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
creditnotes "github.com/merge-api/merge-go-client/accounting/creditnotes"
deleteaccount "github.com/merge-api/merge-go-client/accounting/deleteaccount"
expenses "github.com/merge-api/merge-go-client/accounting/expenses"
fieldmapping "github.com/merge-api/merge-go-client/accounting/fieldmapping"
forceresync "github.com/merge-api/merge-go-client/accounting/forceresync"
generatekey "github.com/merge-api/merge-go-client/accounting/generatekey"
incomestatements "github.com/merge-api/merge-go-client/accounting/incomestatements"
Expand All @@ -33,6 +34,7 @@ import (
phonenumbers "github.com/merge-api/merge-go-client/accounting/phonenumbers"
purchaseorders "github.com/merge-api/merge-go-client/accounting/purchaseorders"
regeneratekey "github.com/merge-api/merge-go-client/accounting/regeneratekey"
scopes "github.com/merge-api/merge-go-client/accounting/scopes"
selectivesync "github.com/merge-api/merge-go-client/accounting/selectivesync"
syncstatus "github.com/merge-api/merge-go-client/accounting/syncstatus"
taxrates "github.com/merge-api/merge-go-client/accounting/taxrates"
Expand Down Expand Up @@ -63,8 +65,10 @@ type Client struct {
CompanyInfo *companyinfo.Client
Contacts *contacts.Client
CreditNotes *creditnotes.Client
Scopes *scopes.Client
DeleteAccount *deleteaccount.Client
Expenses *expenses.Client
FieldMapping *fieldmapping.Client
GenerateKey *generatekey.Client
IncomeStatements *incomestatements.Client
Invoices *invoices.Client
Expand Down Expand Up @@ -111,8 +115,10 @@ func NewClient(opts ...core.ClientOption) *Client {
CompanyInfo: companyinfo.NewClient(opts...),
Contacts: contacts.NewClient(opts...),
CreditNotes: creditnotes.NewClient(opts...),
Scopes: scopes.NewClient(opts...),
DeleteAccount: deleteaccount.NewClient(opts...),
Expenses: expenses.NewClient(opts...),
FieldMapping: fieldmapping.NewClient(opts...),
GenerateKey: generatekey.NewClient(opts...),
IncomeStatements: incomestatements.NewClient(opts...),
Invoices: invoices.NewClient(opts...),
Expand Down
34 changes: 34 additions & 0 deletions accounting/field_mapping.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This file was auto-generated by Fern from our API Definition.

package accounting

type CreateFieldMappingRequest struct {
// The name of the target field you want this remote field to map to.
TargetFieldName string `json:"target_field_name"`
// The description of the target field you want this remote field to map to.
TargetFieldDescription string `json:"target_field_description"`
// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint.
RemoteFieldTraversalPath []interface{} `json:"remote_field_traversal_path,omitempty"`
// The method of the remote endpoint where the remote field is coming from.
RemoteMethod string `json:"remote_method"`
// The path of the remote endpoint where the remote field is coming from.
RemoteUrlPath string `json:"remote_url_path"`
// The name of the Common Model that the remote field corresponds to in a given category.
CommonModelName string `json:"common_model_name"`
}

type PatchedEditFieldMappingRequest struct {
// The field traversal path of the remote field listed when you hit the GET /remote-fields endpoint.
RemoteFieldTraversalPath []interface{} `json:"remote_field_traversal_path,omitempty"`
// The method of the remote endpoint where the remote field is coming from.
RemoteMethod *string `json:"remote_method,omitempty"`
// The path of the remote endpoint where the remote field is coming from.
RemoteUrlPath *string `json:"remote_url_path,omitempty"`
}

type RemoteFieldsRetrieveRequest struct {
// A comma seperated list of Common Model names. If included, will only return Remote Fields for those Common Models.
CommonModels *string `json:"-"`
// If true, will include example values, where available, for remote fields in the 3rd party platform. These examples come from active data from your customers.
IncludeExampleValues *string `json:"-"`
}
181 changes: 181 additions & 0 deletions accounting/fieldmapping/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
// This file was auto-generated by Fern from our API Definition.

package fieldmapping

import (
context "context"
fmt "fmt"
accounting "github.com/merge-api/merge-go-client/accounting"
core "github.com/merge-api/merge-go-client/core"
http "net/http"
url "net/url"
)

type Client struct {
baseURL string
caller *core.Caller
header http.Header
}

func NewClient(opts ...core.ClientOption) *Client {
options := core.NewClientOptions()
for _, opt := range opts {
opt(options)
}
return &Client{
baseURL: options.BaseURL,
caller: core.NewCaller(options.HTTPClient),
header: options.ToHeader(),
}
}

// Get all Field Mappings for this Linked Account. Field Mappings are mappings between third-party Remote Fields and user defined Merge fields. [Learn more](https://docs.merge.dev/supplemental-data/field-mappings/overview/).
func (c *Client) FieldMappingsRetrieve(ctx context.Context) (*accounting.FieldMappingApiInstanceResponse, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "api/accounting/v1/field-mappings"

var response *accounting.FieldMappingApiInstanceResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
Headers: c.header,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Create new Field Mappings that will be available after the next scheduled sync. This will cause the next sync for this Linked Account to sync **ALL** data from start.
func (c *Client) FieldMappingsCreate(ctx context.Context, request *accounting.CreateFieldMappingRequest) (*accounting.FieldMappingInstanceResponse, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "api/accounting/v1/field-mappings"

var response *accounting.FieldMappingInstanceResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPost,
Headers: c.header,
Request: request,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Deletes Field Mappings for a Linked Account. All data related to this Field Mapping will be deleted and these changes will be reflected after the next scheduled sync. This will cause the next sync for this Linked Account to sync **ALL** data from start.
func (c *Client) FieldMappingsDestroy(ctx context.Context, fieldMappingId string) (*accounting.FieldMappingInstanceResponse, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"api/accounting/v1/field-mappings/%v", fieldMappingId)

var response *accounting.FieldMappingInstanceResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodDelete,
Headers: c.header,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Create or update existing Field Mappings for a Linked Account. Changes will be reflected after the next scheduled sync. This will cause the next sync for this Linked Account to sync **ALL** data from start.
func (c *Client) FieldMappingsPartialUpdate(ctx context.Context, fieldMappingId string, request *accounting.PatchedEditFieldMappingRequest) (*accounting.FieldMappingInstanceResponse, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"api/accounting/v1/field-mappings/%v", fieldMappingId)

var response *accounting.FieldMappingInstanceResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPatch,
Headers: c.header,
Request: request,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Get all remote fields for a Linked Account. Remote fields are third-party fields that are accessible after initial sync if remote_data is enabled. You can use remote fields to override existing Merge fields or map a new Merge field. [Learn more](https://docs.merge.dev/supplemental-data/field-mappings/overview/).
func (c *Client) RemoteFieldsRetrieve(ctx context.Context, request *accounting.RemoteFieldsRetrieveRequest) (*accounting.RemoteFieldApiResponse, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "api/accounting/v1/remote-fields"

queryParams := make(url.Values)
if request.CommonModels != nil {
queryParams.Add("common_models", fmt.Sprintf("%v", *request.CommonModels))
}
if request.IncludeExampleValues != nil {
queryParams.Add("include_example_values", fmt.Sprintf("%v", *request.IncludeExampleValues))
}
if len(queryParams) > 0 {
endpointURL += "?" + queryParams.Encode()
}

var response *accounting.RemoteFieldApiResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
Headers: c.header,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Get all organization-wide Target Fields, this will not include any Linked Account specific Target Fields. Organization-wide Target Fields are additional fields appended to the Merge Common Model for all Linked Accounts in a category. [Learn more](https://docs.merge.dev/supplemental-data/field-mappings/target-fields/).
func (c *Client) TargetFieldsRetrieve(ctx context.Context) (*accounting.ExternalTargetFieldApiResponse, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "api/accounting/v1/target-fields"

var response *accounting.ExternalTargetFieldApiResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
Headers: c.header,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}
2 changes: 1 addition & 1 deletion accounting/forceresync/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func NewClient(opts ...core.ClientOption) *Client {
}
}

// Force re-sync of all models. This is available for all organizations via the dashboard. Force re-sync is also available programmatically via API for monthly, quarterly, and highest sync frequency customers on the Core, Professional, or Enterprise plans. Doing so will consume a sync credit for the relevant linked account.
// Force re-sync of all models. This is available for all organizations via the dashboard. Force re-sync is also available programmatically via API for monthly, quarterly, and highest sync frequency customers on the Launch, Professional, or Enterprise plans. Doing so will consume a sync credit for the relevant linked account.
func (c *Client) SyncStatusResyncCreate(ctx context.Context) ([]*accounting.SyncStatus, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
Expand Down
2 changes: 1 addition & 1 deletion accounting/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type IssuesListRequest struct {
FirstIncidentTimeAfter *time.Time `json:"-"`
// If provided, will only return issues whose first incident time was before this datetime.
FirstIncidentTimeBefore *time.Time `json:"-"`
// If True, will include muted issues
// If true, will include muted issues
IncludeMuted *string `json:"-"`
IntegrationName *string `json:"-"`
// If provided, will only return issues whose last incident time was after this datetime.
Expand Down
2 changes: 2 additions & 0 deletions accounting/link_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,6 @@ type EndUserDetailsRequest struct {
ShouldCreateMagicLinkUrl *bool `json:"should_create_magic_link_url,omitempty"`
// An array of objects to specify the models and fields that will be disabled for a given Linked Account. Each object uses model_id, enabled_actions, and disabled_fields to specify the model, method, and fields that are scoped for a given Linked Account.
CommonModels []*CommonModelScopesBodyRequest `json:"common_models,omitempty"`
// When creating a Link Token, you can set permissions for Common Models that will apply to the account that is going to be linked. Any model or field not specified in link token payload will default to existing settings.
CategoryCommonModelScopes map[string][]*IndividualCommonModelScopeDeserializerRequest `json:"category_common_model_scopes,omitempty"`
}
8 changes: 8 additions & 0 deletions accounting/scopes.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// This file was auto-generated by Fern from our API Definition.

package accounting

type LinkedAccountCommonModelScopeDeserializerRequest struct {
// The common models you want to update the scopes for
CommonModels []*IndividualCommonModelScopeDeserializerRequest `json:"common_models,omitempty"`
}
98 changes: 98 additions & 0 deletions accounting/scopes/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// This file was auto-generated by Fern from our API Definition.

package scopes

import (
context "context"
accounting "github.com/merge-api/merge-go-client/accounting"
core "github.com/merge-api/merge-go-client/core"
http "net/http"
)

type Client struct {
baseURL string
caller *core.Caller
header http.Header
}

func NewClient(opts ...core.ClientOption) *Client {
options := core.NewClientOptions()
for _, opt := range opts {
opt(options)
}
return &Client{
baseURL: options.BaseURL,
caller: core.NewCaller(options.HTTPClient),
header: options.ToHeader(),
}
}

// Get the default permissions for Merge Common Models and fields across all Linked Accounts of a given category. [Learn More](https://help.merge.dev/en/articles/8828211-common-model-and-field-scopes).
func (c *Client) DefaultScopesRetrieve(ctx context.Context) (*accounting.CommonModelScopeApi, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "api/accounting/v1/default-scopes"

var response *accounting.CommonModelScopeApi
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
Headers: c.header,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Get all available permissions for Merge Common Models and fields for a single Linked Account. [Learn More](https://help.merge.dev/en/articles/8828211-common-model-and-field-scopes).
func (c *Client) LinkedAccountScopesRetrieve(ctx context.Context) (*accounting.CommonModelScopeApi, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "api/accounting/v1/linked-account-scopes"

var response *accounting.CommonModelScopeApi
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
Headers: c.header,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

// Update permissions for any Common Model or field for a single Linked Account. Any Scopes not set in this POST request will inherit the default Scopes. [Learn More](https://help.merge.dev/en/articles/8828211-common-model-and-field-scopes)
func (c *Client) LinkedAccountScopesCreate(ctx context.Context, request *accounting.LinkedAccountCommonModelScopeDeserializerRequest) (*accounting.CommonModelScopeApi, error) {
baseURL := "https://api.merge.dev"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "api/accounting/v1/linked-account-scopes"

var response *accounting.CommonModelScopeApi
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPost,
Headers: c.header,
Request: request,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}
Loading