Skip to content

Commit

Permalink
New updates to generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
octokitbot committed Jul 27, 2024
1 parent a9ee6f0 commit 425e8a0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions pkg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ import (
// Client (wrapper of *github.ApiClient) with the provided option functions.
// By default, it includes a rate limiting middleware.
func NewApiClient(optionFuncs ...ClientOptionFunc) (*Client, error) {
options := GetDefaultClientOptions()
options, err := GetDefaultClientOptions()
if err != nil {
return nil, fmt.Errorf("failed to get default client options: %v", err)
}
for _, optionFunc := range optionFuncs {
optionFunc(options)
}
Expand Down Expand Up @@ -118,12 +121,17 @@ type ClientOptions struct {

// GetDefaultClientOptions returns a new instance of ClientOptions with default values.
// This is used in the NewApiClient constructor before applying user-defined custom options.
func GetDefaultClientOptions() *ClientOptions {
func GetDefaultClientOptions() (*ClientOptions, error) {
turnOffCompression := kiotaHttp.NewCompressionOptions(false)
middlewares, err := kiotaHttp.GetDefaultMiddlewaresWithOptions(&turnOffCompression)
if err != nil {
return nil, fmt.Errorf("failed to get middleware with compression turned off: %v", err)
}
return &ClientOptions{
UserAgent: "octokit/go-sdk",
APIVersion: "2022-11-28",
Middleware: kiotaHttp.GetDefaultMiddlewares(),
}
Middleware: middlewares,
}, nil
}

// ClientOptionFunc provides a functional pattern for client configuration
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/kiota-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"descriptionHash": "A9B113041EADA2541D3B59E31CF23870FA0A7627482597017CC50A2D390ACC44D4912594E27929B8F5F5412430B8482043A0FB536C5B2DD2CCEA0E941FCAC416",
"descriptionHash": "145BCDC18ADD0C8E2EC561562308D43480017AD06C35365B09A27C83A9E6AAA51A6AF94048AF9F372388146007325C1DB4ED2E86F5CBFCEAD3625FBFBE1F9D51",
"descriptionLocation": "../../../../../schemas/api.github.com.json",
"lockFileVersion": "1.0.0",
"kiotaVersion": "1.14.0",
Expand Down

0 comments on commit 425e8a0

Please sign in to comment.