Skip to content

Commit

Permalink
Release v0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jan 23, 2024
1 parent cd1d8b8 commit 70f397d
Show file tree
Hide file tree
Showing 15 changed files with 2,420 additions and 187 deletions.
140 changes: 140 additions & 0 deletions apps.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
// This file was auto-generated by Fern from our API Definition.

package api

import (
json "encoding/json"
fmt "fmt"
core "github.com/FlatFilers/flatfile-go/core"
time "time"
)

// Create an app
type AppCreate struct {
Name string `json:"name"`
Namespace string `json:"namespace"`
Type AppType `json:"type,omitempty"`
Entity *string `json:"entity,omitempty"`
EntityPlural *string `json:"entityPlural,omitempty"`
Icon *string `json:"icon,omitempty"`
Metadata interface{} `json:"metadata,omitempty"`

_rawJSON json.RawMessage
}

func (a *AppCreate) UnmarshalJSON(data []byte) error {
type unmarshaler AppCreate
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AppCreate(value)
a._rawJSON = json.RawMessage(data)
return nil
}

func (a *AppCreate) String() string {
if len(a._rawJSON) > 0 {
if value, err := core.StringifyJSON(a._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}

// Update an app
type AppPatch struct {
Name *string `json:"name,omitempty"`
Namespace *string `json:"namespace,omitempty"`
Entity *string `json:"entity,omitempty"`
EntityPlural *string `json:"entityPlural,omitempty"`
Icon *string `json:"icon,omitempty"`
Metadata interface{} `json:"metadata,omitempty"`
ActivatedAt *time.Time `json:"activatedAt,omitempty"`

_rawJSON json.RawMessage
}

func (a *AppPatch) UnmarshalJSON(data []byte) error {
type unmarshaler AppPatch
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AppPatch(value)
a._rawJSON = json.RawMessage(data)
return nil
}

func (a *AppPatch) String() string {
if len(a._rawJSON) > 0 {
if value, err := core.StringifyJSON(a._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}

type AppResponse struct {
Data *App `json:"data,omitempty"`

_rawJSON json.RawMessage
}

func (a *AppResponse) UnmarshalJSON(data []byte) error {
type unmarshaler AppResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AppResponse(value)
a._rawJSON = json.RawMessage(data)
return nil
}

func (a *AppResponse) String() string {
if len(a._rawJSON) > 0 {
if value, err := core.StringifyJSON(a._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}

type AppsResponse struct {
Data []*App `json:"data,omitempty"`

_rawJSON json.RawMessage
}

func (a *AppsResponse) UnmarshalJSON(data []byte) error {
type unmarshaler AppsResponse
var value unmarshaler
if err := json.Unmarshal(data, &value); err != nil {
return err
}
*a = AppsResponse(value)
a._rawJSON = json.RawMessage(data)
return nil
}

func (a *AppsResponse) String() string {
if len(a._rawJSON) > 0 {
if value, err := core.StringifyJSON(a._rawJSON); err == nil {
return value
}
}
if value, err := core.StringifyJSON(a); err == nil {
return value
}
return fmt.Sprintf("%#v", a)
}
127 changes: 127 additions & 0 deletions apps/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
// This file was auto-generated by Fern from our API Definition.

package apps

import (
context "context"
fmt "fmt"
flatfilego "github.com/FlatFilers/flatfile-go"
core "github.com/FlatFilers/flatfile-go/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(),
}
}

// Returns apps in an account
func (c *Client) List(ctx context.Context) (*flatfilego.AppsResponse, error) {
baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "apps"

var response *flatfilego.AppsResponse
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
}

// Returns an app
//
// ID of app
func (c *Client) Get(ctx context.Context, appId flatfilego.AppId) (*flatfilego.AppResponse, error) {
baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"apps/%v", appId)

var response *flatfilego.AppResponse
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
}

// Updates an app
//
// ID of app
func (c *Client) Update(ctx context.Context, appId flatfilego.AppId, request *flatfilego.AppPatch) (*flatfilego.AppResponse, error) {
baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := fmt.Sprintf(baseURL+"/"+"apps/%v", appId)

var response *flatfilego.AppResponse
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
}

// Creates an app
func (c *Client) Create(ctx context.Context, request *flatfilego.AppCreate) (*flatfilego.AppResponse, error) {
baseURL := "https://api.x.flatfile.com/v1"
if c.baseURL != "" {
baseURL = c.baseURL
}
endpointURL := baseURL + "/" + "apps"

var response *flatfilego.AppResponse
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
}
83 changes: 46 additions & 37 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ package client

import (
agents "github.com/FlatFilers/flatfile-go/agents"
apps "github.com/FlatFilers/flatfile-go/apps"
commits "github.com/FlatFilers/flatfile-go/commits"
core "github.com/FlatFilers/flatfile-go/core"
dataretentionpolicies "github.com/FlatFilers/flatfile-go/dataretentionpolicies"
documents "github.com/FlatFilers/flatfile-go/documents"
environments "github.com/FlatFilers/flatfile-go/environments"
events "github.com/FlatFilers/flatfile-go/events"
files "github.com/FlatFilers/flatfile-go/files"
guests "github.com/FlatFilers/flatfile-go/guests"
jobs "github.com/FlatFilers/flatfile-go/jobs"
mapping "github.com/FlatFilers/flatfile-go/mapping"
records "github.com/FlatFilers/flatfile-go/records"
roles "github.com/FlatFilers/flatfile-go/roles"
secrets "github.com/FlatFilers/flatfile-go/secrets"
Expand All @@ -29,23 +32,26 @@ type Client struct {
caller *core.Caller
header http.Header

Agents *agents.Client
Commits *commits.Client
Documents *documents.Client
Environments *environments.Client
Events *events.Client
Files *files.Client
Guests *guests.Client
Jobs *jobs.Client
Records *records.Client
Roles *roles.Client
Secrets *secrets.Client
Sheets *sheets.Client
Snapshots *snapshots.Client
Spaces *spaces.Client
Users *users.Client
Versions *versions.Client
Workbooks *workbooks.Client
Agents *agents.Client
Apps *apps.Client
Commits *commits.Client
DataRetentionPolicies *dataretentionpolicies.Client
Documents *documents.Client
Environments *environments.Client
Events *events.Client
Files *files.Client
Guests *guests.Client
Jobs *jobs.Client
Mapping *mapping.Client
Records *records.Client
Roles *roles.Client
Secrets *secrets.Client
Sheets *sheets.Client
Snapshots *snapshots.Client
Spaces *spaces.Client
Users *users.Client
Versions *versions.Client
Workbooks *workbooks.Client
}

func NewClient(opts ...core.ClientOption) *Client {
Expand All @@ -54,25 +60,28 @@ func NewClient(opts ...core.ClientOption) *Client {
opt(options)
}
return &Client{
baseURL: options.BaseURL,
caller: core.NewCaller(options.HTTPClient),
header: options.ToHeader(),
Agents: agents.NewClient(opts...),
Commits: commits.NewClient(opts...),
Documents: documents.NewClient(opts...),
Environments: environments.NewClient(opts...),
Events: events.NewClient(opts...),
Files: files.NewClient(opts...),
Guests: guests.NewClient(opts...),
Jobs: jobs.NewClient(opts...),
Records: records.NewClient(opts...),
Roles: roles.NewClient(opts...),
Secrets: secrets.NewClient(opts...),
Sheets: sheets.NewClient(opts...),
Snapshots: snapshots.NewClient(opts...),
Spaces: spaces.NewClient(opts...),
Users: users.NewClient(opts...),
Versions: versions.NewClient(opts...),
Workbooks: workbooks.NewClient(opts...),
baseURL: options.BaseURL,
caller: core.NewCaller(options.HTTPClient),
header: options.ToHeader(),
Agents: agents.NewClient(opts...),
Apps: apps.NewClient(opts...),
Commits: commits.NewClient(opts...),
DataRetentionPolicies: dataretentionpolicies.NewClient(opts...),
Documents: documents.NewClient(opts...),
Environments: environments.NewClient(opts...),
Events: events.NewClient(opts...),
Files: files.NewClient(opts...),
Guests: guests.NewClient(opts...),
Jobs: jobs.NewClient(opts...),
Mapping: mapping.NewClient(opts...),
Records: records.NewClient(opts...),
Roles: roles.NewClient(opts...),
Secrets: secrets.NewClient(opts...),
Sheets: sheets.NewClient(opts...),
Snapshots: snapshots.NewClient(opts...),
Spaces: spaces.NewClient(opts...),
Users: users.NewClient(opts...),
Versions: versions.NewClient(opts...),
Workbooks: workbooks.NewClient(opts...),
}
}
2 changes: 1 addition & 1 deletion core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ func (c *ClientOptions) cloneHeader() http.Header {
headers := c.HTTPHeader.Clone()
headers.Set("X-Fern-Language", "Go")
headers.Set("X-Fern-SDK-Name", "github.com/FlatFilers/flatfile-go")
headers.Set("X-Fern-SDK-Version", "v0.0.5")
headers.Set("X-Fern-SDK-Version", "v0.0.6")
return headers
}
Loading

0 comments on commit 70f397d

Please sign in to comment.