Documentation ¶
Index ¶
- func EncodePatchAsJSON[T any](patchRequest PatchItemsRequest[T]) (bodyBuf *bytes.Buffer, err error)
- func EncodePostAsJSON[T AirtableFields](req CreateRecordsRequest[T]) (bodyBuf *bytes.Buffer, err error)
- func GetOAuthEndpoint() oauth2.Endpoint
- func UpdateRecordsRequest(baseID string, tableName string, patchBody *bytes.Buffer, ctx context.Context) (*http.Request, error)
- type AirtableFields
- type AirtableRecord
- func CreateRecord[Tin AirtableFields, T AirtableFields](httpClient *http.Client, record *Tin, baseID string, tableName string, ...) ([]*AirtableRecord[T], error)
- func ListRecords[T AirtableFields](httpClient *http.Client, baseID string, tableName string, viewName string, ...) ([]*AirtableRecord[T], error)
- func UpdateRecords[T AirtableFields](httpClient *http.Client, request *http.Request) ([]*AirtableRecord[T], error)
- type AirtableRecords
- type CreateRecordRequest
- type CreateRecordsRequest
- type ErrorDetail
- type ErrorResponse
- type PatchBooleanBody
- type PatchItemRequest
- type PatchItemsRequest
- type PatchStringArrayBody
- type PatchStringBody
- type PatchTimeBody
- type SimpleErrorResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EncodePatchAsJSON ¶
func EncodePatchAsJSON[T any](patchRequest PatchItemsRequest[T]) (bodyBuf *bytes.Buffer, err error)
EncodePatchAsJSON returns bytes of JSON encoded patch request
func EncodePostAsJSON ¶ added in v0.0.66
func EncodePostAsJSON[T AirtableFields](req CreateRecordsRequest[T]) (bodyBuf *bytes.Buffer, err error)
EncodePostAsJSON returns bytes of JSON encoded patch request
func GetOAuthEndpoint ¶
GetOAuthEndpoint returns the OAuth endpoint for Airtable
Types ¶
type AirtableFields ¶
type AirtableFields interface { }
AirtableFields a marker interface where any struct would work
type AirtableRecord ¶
type AirtableRecord[T AirtableFields] struct { Id string `json:"id"` CreatedTime time.Time `json:"createdTime"` Fields T `json:"fields"` }
AirtableRecord represents a record of Airtable
func CreateRecord ¶ added in v0.0.66
func CreateRecord[Tin AirtableFields, T AirtableFields](httpClient *http.Client, record *Tin, baseID string, tableName string, ctx context.Context) ([]*AirtableRecord[T], error)
func ListRecords ¶
func ListRecords[T AirtableFields](httpClient *http.Client, baseID string, tableName string, viewName string, ctx context.Context, maxRecords int) ([]*AirtableRecord[T], error)
ListRecords returns a list of records from Airtable
func UpdateRecords ¶
func UpdateRecords[T AirtableFields](httpClient *http.Client, request *http.Request) ([]*AirtableRecord[T], error)
UpdateRecords updates records of Airtable and returns the records updated
type AirtableRecords ¶
type AirtableRecords[T AirtableFields] struct { Records []AirtableRecord[T] `json:"records"` Offset string `json:"offset"` }
AirtableRecords represents a list of records of Airtable
type CreateRecordRequest ¶ added in v0.0.66
type CreateRecordRequest[T AirtableFields] struct { Fields T `json:"fields"` }
CreateRecordRequest represents a request to create a record
type CreateRecordsRequest ¶ added in v0.0.66
type CreateRecordsRequest[T AirtableFields] struct { Records []CreateRecordRequest[T] `json:"records"` Typecast bool `json:"typecast"` }
CreateRecordsRequest represents a request to create a list of records
type ErrorDetail ¶
ErrorDetail represents an error detail from Airtable
type ErrorResponse ¶
type ErrorResponse struct {
Error ErrorDetail `json:"error"`
}
ErrorResponse represents an error response from Airtable
type PatchBooleanBody ¶
PatchBooleanBody returns bytes of a request body to patch a boolean field
type PatchItemRequest ¶
type PatchItemRequest[T AirtableFields] struct { Id string `json:"id"` Fields T `json:"fields"` }
PatchItemRequest represents a request to patch an item
type PatchItemsRequest ¶
type PatchItemsRequest[T AirtableFields] struct { Records []PatchItemRequest[T] `json:"records"` Typecast bool `json:"typecast"` }
PatchItemsRequest represents a request to patch a list of items
type PatchStringArrayBody ¶
PatchStringArrayBody returns bytes of a request body to patch a string array field
type PatchStringBody ¶
PatchStringBody returns bytes of a request body to patch a string field
type PatchTimeBody ¶
PatchTimeBody returns bytes of a request body to patch a time field
type SimpleErrorResponse ¶
type SimpleErrorResponse struct {
Error string `json:"error"`
}
SimpleErrorResponse represents a simple error response from Airtable