Skip to content

Commit

Permalink
fix: fix header parameter value (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Jan 3, 2025
1 parent d728bcc commit d52699a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions betamessage.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewBetaMessageService(opts ...option.RequestOption) (r *BetaMessageService)
// Note: If you choose to set a timeout for this request, we recommend 10 minutes.
func (r *BetaMessageService) New(ctx context.Context, params BetaMessageNewParams, opts ...option.RequestOption) (res *BetaMessage, err error) {
for _, v := range params.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
path := "v1/messages?beta=true"
Expand All @@ -67,7 +67,7 @@ func (r *BetaMessageService) NewStreaming(ctx context.Context, params BetaMessag
err error
)
for _, v := range params.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithJSONSet("stream", true)}, opts...)
Expand All @@ -82,7 +82,7 @@ func (r *BetaMessageService) NewStreaming(ctx context.Context, params BetaMessag
// including tools, images, and documents, without creating it.
func (r *BetaMessageService) CountTokens(ctx context.Context, params BetaMessageCountTokensParams, opts ...option.RequestOption) (res *BetaMessageTokensCount, err error) {
for _, v := range params.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
path := "v1/messages/count_tokens?beta=true"
Expand Down
12 changes: 6 additions & 6 deletions betamessagebatch.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func NewBetaMessageBatchService(opts ...option.RequestOption) (r *BetaMessageBat
// can take up to 24 hours to complete.
func (r *BetaMessageBatchService) New(ctx context.Context, params BetaMessageBatchNewParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error) {
for _, v := range params.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...)
Expand All @@ -60,7 +60,7 @@ func (r *BetaMessageBatchService) New(ctx context.Context, params BetaMessageBat
// `results_url` field in the response.
func (r *BetaMessageBatchService) Get(ctx context.Context, messageBatchID string, query BetaMessageBatchGetParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error) {
for _, v := range query.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...)
Expand All @@ -78,7 +78,7 @@ func (r *BetaMessageBatchService) Get(ctx context.Context, messageBatchID string
func (r *BetaMessageBatchService) List(ctx context.Context, params BetaMessageBatchListParams, opts ...option.RequestOption) (res *pagination.Page[BetaMessageBatch], err error) {
var raw *http.Response
for _, v := range params.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24"), option.WithResponseInto(&raw)}, opts...)
Expand Down Expand Up @@ -106,7 +106,7 @@ func (r *BetaMessageBatchService) ListAutoPaging(ctx context.Context, params Bet
// `results_url` field in the response.
func (r *BetaMessageBatchService) Delete(ctx context.Context, messageBatchID string, body BetaMessageBatchDeleteParams, opts ...option.RequestOption) (res *BetaDeletedMessageBatch, err error) {
for _, v := range body.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...)
Expand All @@ -130,7 +130,7 @@ func (r *BetaMessageBatchService) Delete(ctx context.Context, messageBatchID str
// non-interruptible.
func (r *BetaMessageBatchService) Cancel(ctx context.Context, messageBatchID string, body BetaMessageBatchCancelParams, opts ...option.RequestOption) (res *BetaMessageBatch, err error) {
for _, v := range body.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24")}, opts...)
Expand All @@ -150,7 +150,7 @@ func (r *BetaMessageBatchService) Cancel(ctx context.Context, messageBatchID str
// requests. Use the `custom_id` field to match results to requests.
func (r *BetaMessageBatchService) Results(ctx context.Context, messageBatchID string, query BetaMessageBatchResultsParams, opts ...option.RequestOption) (res *http.Response, err error) {
for _, v := range query.Betas.Value {
opts = append(opts, option.WithHeaderAdd("betas", fmt.Sprintf("%s", v)))
opts = append(opts, option.WithHeaderAdd("anthropic-beta", fmt.Sprintf("%s", v)))
}
opts = append(r.Options[:], opts...)
opts = append([]option.RequestOption{option.WithHeader("anthropic-beta", "message-batches-2024-09-24"), option.WithHeader("Accept", "application/binary")}, opts...)
Expand Down

0 comments on commit d52699a

Please sign in to comment.