Skip to content

Commit

Permalink
Release v0.0.9
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Apr 1, 2024
1 parent c088307 commit 20814c8
Show file tree
Hide file tree
Showing 16 changed files with 866 additions and 95 deletions.
68 changes: 68 additions & 0 deletions accounts.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// 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"
)

// Properties used to update an account
type AccountPatch struct {
DefaultAppId AppId `json:"defaultAppId" url:"defaultAppId"`

_rawJSON json.RawMessage
}

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

func (a *AccountPatch) 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 AccountResponse struct {
Data *Account `json:"data,omitempty" url:"data,omitempty"`

_rawJSON json.RawMessage
}

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

func (a *AccountResponse) 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)
}
103 changes: 103 additions & 0 deletions accounts/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
// This file was auto-generated by Fern from our API Definition.

package accounts

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(),
}
}

// Get the current account
func (c *Client) GetCurrent(
ctx context.Context,
opts ...option.RequestOption,
) (*flatfilego.AccountResponse, 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 + "/" + "accounts/current"

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

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

// Update the current account
func (c *Client) UpdateCurrent(
ctx context.Context,
request *flatfilego.AccountPatch,
opts ...option.RequestOption,
) (*flatfilego.AccountResponse, 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 + "/" + "accounts/current"

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

var response *flatfilego.AccountResponse
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,
},
); err != nil {
return nil, err
}
return response, nil
}
30 changes: 16 additions & 14 deletions apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@ import (

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

_rawJSON json.RawMessage
}
Expand Down Expand Up @@ -47,13 +48,14 @@ func (a *AppCreate) String() string {

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

_rawJSON json.RawMessage
}
Expand Down
135 changes: 135 additions & 0 deletions assistant.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
// 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"
)

type ListPromptsRequest struct {
// Number of prompts to return in a page (default 7)
PageSize *int `json:"-" url:"pageSize,omitempty"`
// Based on pageSize, which page of prompts to return
PageNumber *int `json:"-" url:"pageNumber,omitempty"`
}

// Create a prompts
type PromptCreate struct {
Prompt string `json:"prompt" url:"prompt"`

_rawJSON json.RawMessage
}

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

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

// Update a prompts
type PromptPatch struct {
Prompt *string `json:"prompt,omitempty" url:"prompt,omitempty"`

_rawJSON json.RawMessage
}

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

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

type PromptResponse struct {
Data *Prompt `json:"data,omitempty" url:"data,omitempty"`

_rawJSON json.RawMessage
}

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

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

type PromptsResponse struct {
Pagination *Pagination `json:"pagination,omitempty" url:"pagination,omitempty"`
Data []*Prompt `json:"data,omitempty" url:"data,omitempty"`

_rawJSON json.RawMessage
}

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

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

0 comments on commit 20814c8

Please sign in to comment.