Skip to content

Commit

Permalink
Release 0.0.22
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Jul 12, 2023
1 parent 688b3ea commit 739990e
Show file tree
Hide file tree
Showing 72 changed files with 199 additions and 193 deletions.
2 changes: 1 addition & 1 deletion alert_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (a *AlertRule) MarshalJSON() ([]byte, error) {
type embed AlertRule
var marshaler = struct {
embed
Type string `json:"type,omitempty"`
Type string `json:"type"`
}{
embed: embed(*a),
Type: "alert",
Expand Down
6 changes: 3 additions & 3 deletions api_error_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ package api
// Error response model
type ApiErrorResponse struct {
// Error code
Code string `json:"code,omitempty"`
Code string `json:"code"`
// Status code
Status float64 `json:"status,omitempty"`
Status float64 `json:"status"`
// Error description
Message string `json:"message,omitempty"`
Message string `json:"message"`
Data *ApiErrorResponseData `json:"data,omitempty"`
}
4 changes: 2 additions & 2 deletions api_key_integration_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
package api

type ApiKeyIntegrationConfigs struct {
HeaderKey string `json:"header_key,omitempty"`
ApiKey string `json:"api_key,omitempty"`
HeaderKey string `json:"header_key"`
ApiKey string `json:"api_key"`
}
2 changes: 1 addition & 1 deletion attached_integration_to_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
package api

type AttachedIntegrationToSource struct {
Success bool `json:"success,omitempty"`
Success bool `json:"success"`
}
4 changes: 2 additions & 2 deletions basic_auth_integration_configs.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
package api

type BasicAuthIntegrationConfigs struct {
Name string `json:"name,omitempty"`
Password string `json:"password,omitempty"`
Name string `json:"name"`
Password string `json:"password"`
}
10 changes: 5 additions & 5 deletions batch_operation.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ package api

type BatchOperation struct {
// ID of the bulk retry
Id string `json:"id,omitempty"`
Id string `json:"id"`
// ID of the workspace
TeamId string `json:"team_id,omitempty"`
TeamId string `json:"team_id"`
// Query object to filter records
Query *BatchOperationQuery `json:"query,omitempty"`
// Date the bulk retry was created
CreatedAt string `json:"created_at,omitempty"`
CreatedAt string `json:"created_at"`
// Last time the bulk retry was updated
UpdatedAt string `json:"updated_at,omitempty"`
UpdatedAt string `json:"updated_at"`
// Date the bulk retry was cancelled
CancelledAt *string `json:"cancelled_at,omitempty"`
// Date the bulk retry was completed
Expand All @@ -26,7 +26,7 @@ type BatchOperation struct {
// Number of events that were successfully delivered
CompletedCount *int `json:"completed_count,omitempty"`
// Indicates if the bulk retry is currently in progress
InProgress bool `json:"in_progress,omitempty"`
InProgress bool `json:"in_progress"`
// Progression of the batch operations, values 0 - 1
Progress *float64 `json:"progress,omitempty"`
// Number of events that failed to be delivered
Expand Down
14 changes: 7 additions & 7 deletions bookmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ package api

type Bookmark struct {
// ID of the bookmark
Id string `json:"id,omitempty"`
Id string `json:"id"`
// ID of the workspace
TeamId string `json:"team_id,omitempty"`
TeamId string `json:"team_id"`
// ID of the associated connection
WebhookId string `json:"webhook_id,omitempty"`
WebhookId string `json:"webhook_id"`
// ID of the bookmarked event data
EventDataId string `json:"event_data_id,omitempty"`
EventDataId string `json:"event_data_id"`
// Descriptive name of the bookmark
Label string `json:"label,omitempty"`
Label string `json:"label"`
// Alternate alias for the bookmark
Alias *string `json:"alias,omitempty"`
Data *ShortEventData `json:"data,omitempty"`
// Date the bookmark was last manually triggered
LastUsedAt *string `json:"last_used_at,omitempty"`
// Date the bookmark was last updated
UpdatedAt string `json:"updated_at,omitempty"`
UpdatedAt string `json:"updated_at"`
// Date the bookmark was created
CreatedAt string `json:"created_at,omitempty"`
CreatedAt string `json:"created_at"`
}
10 changes: 5 additions & 5 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ package api

type Connection struct {
// ID of the connection
Id string `json:"id,omitempty"`
Id string `json:"id"`
// Unique name of the connection for this source
Name string `json:"name,omitempty"`
Name string `json:"name"`
// ID of the workspace
TeamId string `json:"team_id,omitempty"`
TeamId string `json:"team_id"`
Destination *Destination `json:"destination,omitempty"`
Source *Source `json:"source,omitempty"`
Ruleset *Ruleset `json:"ruleset,omitempty"`
Expand All @@ -21,7 +21,7 @@ type Connection struct {
// Date the connection was paused
PausedAt *string `json:"paused_at,omitempty"`
// Date the connection was last updated
UpdatedAt string `json:"updated_at,omitempty"`
UpdatedAt string `json:"updated_at"`
// Date the connection was created
CreatedAt string `json:"created_at,omitempty"`
CreatedAt string `json:"created_at"`
}
2 changes: 1 addition & 1 deletion console_line.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ package api

type ConsoleLine struct {
Type ConsoleLineType `json:"type,omitempty"`
Message string `json:"message,omitempty"`
Message string `json:"message"`
}
2 changes: 1 addition & 1 deletion core/client_option.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewClientOptions() *ClientOptions {
// ToHeader maps the configured client options into a http.Header issued
// on every request.
func (c *ClientOptions) ToHeader() http.Header {
header := c.HTTPHeader
header := c.HTTPHeader.Clone()
if c.Bearer != "" {
header.Set("Authorization", "Bearer "+c.Bearer)
}
Expand Down
28 changes: 17 additions & 11 deletions core/core.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@ import (
)

const (
// acceptHeader is the Accept header.
acceptHeader = "Accept"

// contentType specifies the JSON Content-Type header value.
contentType = "application/json"
contentTypeHeader = "Content-Type"
Expand All @@ -34,7 +31,6 @@ const (
// fernHeaders specifies all of the standard Fern headers in
// a set so that they're easier to access and reference.
var fernHeaders = map[string]string{
acceptHeader: contentType,
contentTypeHeader: contentType,
fernLanguageHeader: fernLanguage,
fernSDKNameHeader: fernSDKName,
Expand Down Expand Up @@ -98,11 +94,15 @@ func DoRequest(
) error {
var requestBody io.Reader
if request != nil {
requestBytes, err := json.Marshal(request)
if err != nil {
return err
if body, ok := request.(io.Reader); ok {
requestBody = body
} else {
requestBytes, err := json.Marshal(request)
if err != nil {
return err
}
requestBody = bytes.NewReader(requestBytes)
}
requestBody = bytes.NewReader(requestBytes)
}
req, err := newRequest(ctx, url, method, endpointHeaders, requestBody)
if err != nil {
Expand Down Expand Up @@ -146,9 +146,15 @@ func DoRequest(

// Mutate the response parameter in-place.
if response != nil {
decoder := json.NewDecoder(resp.Body)
if err := decoder.Decode(response); err != nil {
return err
if writer, ok := response.(io.Writer); ok {
if _, err := io.Copy(writer, resp.Body); err != nil {
return err
}
} else {
decoder := json.NewDecoder(resp.Body)
if err := decoder.Decode(response); err != nil {
return err
}
}
}

Expand Down
6 changes: 3 additions & 3 deletions create_bookmark_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ package api
// CreateBookmarkRequest is an in-lined request used by the CreateBookmark endpoint.
type CreateBookmarkRequest struct {
// ID of the event data to bookmark <span style="white-space: nowrap">`<= 255 characters`</span>
EventDataId string `json:"event_data_id,omitempty"`
EventDataId string `json:"event_data_id"`
// ID of the associated connection <span style="white-space: nowrap">`<= 255 characters`</span>
WebhookId string `json:"webhook_id,omitempty"`
WebhookId string `json:"webhook_id"`
// Descriptive name of the bookmark <span style="white-space: nowrap">`<= 255 characters`</span>
Label string `json:"label,omitempty"`
Label string `json:"label"`
// A unique, human-friendly name for the bookmark <span style="white-space: nowrap">`<= 155 characters`</span>
Name *string `json:"name,omitempty"`
}
2 changes: 1 addition & 1 deletion create_connection_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package api
// CreateConnectionRequest is an in-lined request used by the CreateConnection endpoint.
type CreateConnectionRequest struct {
// A unique name of the connection for the source <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
// ID of a destination to bind to the connection
DestinationId *string `json:"destination_id,omitempty"`
// ID of a source to bind to the connection
Expand Down
2 changes: 1 addition & 1 deletion create_connection_request_destination.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package api
// Destination input object
type CreateConnectionRequestDestination struct {
// Name for the destination <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
// Endpoint of the destination
Url *string `json:"url,omitempty"`
// Path for the CLI destination
Expand Down
2 changes: 1 addition & 1 deletion create_connection_request_ruleset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package api
// Ruleset input object
type CreateConnectionRequestRuleset struct {
// Name for the ruleset <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
// Array of rules to apply
Rules *[]*Rule `json:"rules,omitempty"`
IsTeamDefault *bool `json:"is_team_default,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion create_connection_request_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package api
// Source input object
type CreateConnectionRequestSource struct {
// A unique name for the source <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
}
2 changes: 1 addition & 1 deletion create_destination_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package api
// CreateDestinationRequest is an in-lined request used by the CreateDestination endpoint.
type CreateDestinationRequest struct {
// Name for the destination <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
// Endpoint of the destination
Url *string `json:"url,omitempty"`
// Path for the CLI destination
Expand Down
2 changes: 1 addition & 1 deletion create_integration_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package api
// CreateIntegrationRequest is an in-lined request used by the CreateIntegration endpoint.
type CreateIntegrationRequest struct {
// Label of the integration
Label string `json:"label,omitempty"`
Label string `json:"label"`
// Decrypted Key/Value object of the associated configuration for that provider
Configs *CreateIntegrationRequestConfigs `json:"configs,omitempty"`
Provider IntegrationProvider `json:"provider,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion create_ruleset_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package api
// CreateRulesetRequest is an in-lined request used by the CreateRuleset endpoint.
type CreateRulesetRequest struct {
// Name for the ruleset <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
// Array of rules to apply
Rules *[]*Rule `json:"rules,omitempty"`
IsTeamDefault *bool `json:"is_team_default,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion create_source_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package api
// CreateSourceRequest is an in-lined request used by the CreateSource endpoint.
type CreateSourceRequest struct {
// A unique name for the source <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
}
4 changes: 2 additions & 2 deletions create_transformation_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ package api
// CreateTransformationRequest is an in-lined request used by the CreateTransformation endpoint.
type CreateTransformationRequest struct {
// A unique, human-friendly name for the transformation <span style="white-space: nowrap">`<= 155 characters`</span>
Name string `json:"name,omitempty"`
Name string `json:"name"`
// JavaScript code to be executed
Code string `json:"code,omitempty"`
Code string `json:"code"`
// Key-value environment variables to be passed to the transformation
Env *map[string]*CreateTransformationRequestEnvValue `json:"env,omitempty"`
}
4 changes: 2 additions & 2 deletions delay_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

type DelayRule struct {
// Delay to introduce in MS
Delay int `json:"delay,omitempty"`
Delay int `json:"delay"`
type_ string
}

Expand All @@ -31,7 +31,7 @@ func (d *DelayRule) MarshalJSON() ([]byte, error) {
type embed DelayRule
var marshaler = struct {
embed
Type string `json:"type,omitempty"`
Type string `json:"type"`
}{
embed: embed(*d),
Type: "delay",
Expand Down
2 changes: 1 addition & 1 deletion deleted_bookmark_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ package api

type DeletedBookmarkResponse struct {
// Bookmark ID
Id string `json:"id,omitempty"`
Id string `json:"id"`
}
2 changes: 1 addition & 1 deletion deleted_integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
package api

type DeletedIntegration struct {
Id string `json:"id,omitempty"`
Id string `json:"id"`
}
2 changes: 1 addition & 1 deletion deleted_issue_trigger_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
package api

type DeletedIssueTriggerResponse struct {
Id string `json:"id,omitempty"`
Id string `json:"id"`
}
16 changes: 8 additions & 8 deletions delivery_issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,26 @@ import (
// Delivery issue
type DeliveryIssue struct {
// Issue ID
Id string `json:"id,omitempty"`
Id string `json:"id"`
// ID of the workspace
TeamId string `json:"team_id,omitempty"`
TeamId string `json:"team_id"`
Status IssueStatus `json:"status,omitempty"`
// ISO timestamp for when the issue was last opened
OpenedAt string `json:"opened_at,omitempty"`
OpenedAt string `json:"opened_at"`
// ISO timestamp for when the issue was first opened
FirstSeenAt string `json:"first_seen_at,omitempty"`
FirstSeenAt string `json:"first_seen_at"`
// ISO timestamp for when the issue last occured
LastSeenAt string `json:"last_seen_at,omitempty"`
LastSeenAt string `json:"last_seen_at"`
// ID of the team member who last updated the issue status
LastUpdatedBy *string `json:"last_updated_by,omitempty"`
// ISO timestamp for when the issue was dismissed
DismissedAt *string `json:"dismissed_at,omitempty"`
AutoResolvedAt *string `json:"auto_resolved_at,omitempty"`
MergedWith *string `json:"merged_with,omitempty"`
// ISO timestamp for when the issue was last updated
UpdatedAt string `json:"updated_at,omitempty"`
UpdatedAt string `json:"updated_at"`
// ISO timestamp for when the issue was created
CreatedAt string `json:"created_at,omitempty"`
CreatedAt string `json:"created_at"`
AggregationKeys *DeliveryIssueAggregationKeys `json:"aggregation_keys,omitempty"`
Reference *DeliveryIssueReference `json:"reference,omitempty"`
type_ string
Expand All @@ -53,7 +53,7 @@ func (d *DeliveryIssue) MarshalJSON() ([]byte, error) {
type embed DeliveryIssue
var marshaler = struct {
embed
Type string `json:"type,omitempty"`
Type string `json:"type"`
}{
embed: embed(*d),
Type: "delivery",
Expand Down
4 changes: 2 additions & 2 deletions delivery_issue_reference.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ package api

// Reference to the event and attempt an issue is being created for.
type DeliveryIssueReference struct {
EventId string `json:"event_id,omitempty"`
AttemptId string `json:"attempt_id,omitempty"`
EventId string `json:"event_id"`
AttemptId string `json:"attempt_id"`
}
Loading

0 comments on commit 739990e

Please sign in to comment.