Skip to content

Commit

Permalink
Release v0.0.17
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Nov 7, 2024
1 parent 72b10cf commit b924b53
Show file tree
Hide file tree
Showing 39 changed files with 4,332 additions and 1,522 deletions.
30 changes: 17 additions & 13 deletions accounts/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,14 @@ func (c *Client) GetCurrent(
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
MaxAttempts: options.MaxAttempts,
Headers: headers,
Client: options.HTTPClient,
Response: &response,
URL: endpointURL,
Method: http.MethodGet,
MaxAttempts: options.MaxAttempts,
Headers: headers,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Response: &response,
},
); err != nil {
return nil, err
Expand Down Expand Up @@ -88,13 +90,15 @@ func (c *Client) UpdateCurrent(
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPatch,
MaxAttempts: options.MaxAttempts,
Headers: headers,
Client: options.HTTPClient,
Request: request,
Response: &response,
URL: endpointURL,
Method: http.MethodPatch,
MaxAttempts: options.MaxAttempts,
Headers: headers,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Request: request,
Response: &response,
},
); err != nil {
return nil, err
Expand Down
9 changes: 9 additions & 0 deletions actions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// This file was auto-generated by Fern from our API Definition.

package api

type ActionResponse = *ApiAction

type Actions = []*Action

type ActionsResponse = []*ApiAction
223 changes: 223 additions & 0 deletions actions/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
// This file was auto-generated by Fern from our API Definition.

package actions

import (
context "context"
flatfilego "github.com/FlatFilers/flatfile-go"
core "github.com/FlatFilers/flatfile-go/core"
option "github.com/FlatFilers/flatfile-go/option"
http "net/http"
)

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

func NewClient(opts ...option.RequestOption) *Client {
options := core.NewRequestOptions(opts...)
return &Client{
baseURL: options.BaseURL,
caller: core.NewCaller(
&core.CallerParams{
Client: options.HTTPClient,
MaxAttempts: options.MaxAttempts,
},
),
header: options.ToHeader(),
}
}

func (c *Client) Create(
ctx context.Context,
request *flatfilego.Action,
opts ...option.RequestOption,
) (flatfilego.ActionResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := baseURL + "/actions"

headers := core.MergeHeaders(c.header.Clone(), options.ToHeader())

var response flatfilego.ActionResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPost,
MaxAttempts: options.MaxAttempts,
Headers: headers,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Request: request,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

func (c *Client) BulkCreate(
ctx context.Context,
request flatfilego.Actions,
opts ...option.RequestOption,
) (flatfilego.ActionsResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := baseURL + "/actions/bulk"

headers := core.MergeHeaders(c.header.Clone(), options.ToHeader())

var response flatfilego.ActionsResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPost,
MaxAttempts: options.MaxAttempts,
Headers: headers,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Request: request,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

func (c *Client) Get(
ctx context.Context,
// The id of the action to return
actionId flatfilego.ActionId,
opts ...option.RequestOption,
) (flatfilego.ActionResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := core.EncodeURL(baseURL+"/actions/%v", actionId)

headers := core.MergeHeaders(c.header.Clone(), options.ToHeader())

var response flatfilego.ActionResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodGet,
MaxAttempts: options.MaxAttempts,
Headers: headers,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

func (c *Client) Update(
ctx context.Context,
// The id of the action to patch
actionId flatfilego.ActionId,
request *flatfilego.ActionUpdate,
opts ...option.RequestOption,
) (flatfilego.ActionResponse, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := core.EncodeURL(baseURL+"/actions/%v", actionId)

headers := core.MergeHeaders(c.header.Clone(), options.ToHeader())

var response flatfilego.ActionResponse
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodPatch,
MaxAttempts: options.MaxAttempts,
Headers: headers,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Request: request,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}

func (c *Client) Delete(
ctx context.Context,
// The id of the action to delete
actionId flatfilego.ActionId,
opts ...option.RequestOption,
) (*flatfilego.Success, error) {
options := core.NewRequestOptions(opts...)

baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
if options.BaseURL != "" {
baseURL = options.BaseURL
}
endpointURL := core.EncodeURL(baseURL+"/actions/%v", actionId)

headers := core.MergeHeaders(c.header.Clone(), options.ToHeader())

var response *flatfilego.Success
if err := c.caller.Call(
ctx,
&core.CallParams{
URL: endpointURL,
Method: http.MethodDelete,
MaxAttempts: options.MaxAttempts,
Headers: headers,
BodyProperties: options.BodyProperties,
QueryParameters: options.QueryParameters,
Client: options.HTTPClient,
Response: &response,
},
); err != nil {
return nil, err
}
return response, nil
}
Loading

0 comments on commit b924b53

Please sign in to comment.