Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes in generated code #95

Merged
merged 4 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ You may also want:
- [dotnet-sdk-enterprise-cloud repository](https://github.com/octokit/dotnet-sdk-enterprise-cloud)
- For GitHub Enterprise Server
- [dotnet-sdk-enterprise-server repository](https://github.com/octokit/dotnet-sdk-enterprise-server)
- For our classic non-generated, hand-maintained Octokit.net project
- [Octokit.net repository](https://github.com/octokit/octokit.net)
- For why we're building generative SDKs, see [Why a generated SDK?](#why-a-generated-sdk) below
- [source-generator](https://github.com/octokit/source-generator) (the repository that creates these generated SDKs)
- Contributions to this repository should take place in source-generator instead, as they'll be distributed here through mechanisms there.

Expand Down
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": "261F60DD494AFFB56F930D3042ADFA27120D57684490956B6C18FAFBF91CDB3656E3898CCC41269A2D4B4664B15FF40D37A3BCD066927006DA56031E07F14802",
"descriptionHash": "145BCDC18ADD0C8E2EC561562308D43480017AD06C35365B09A27C83A9E6AAA51A6AF94048AF9F372388146007325C1DB4ED2E86F5CBFCEAD3625FBFBE1F9D51",
"descriptionLocation": "../../../../../schemas/api.github.com.json",
"lockFileVersion": "1.0.0",
"kiotaVersion": "1.14.0",
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/models/file_extension_restriction.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)

// File_extension_restriction note: file_extension_restriction is in beta and subject to change.Prevent commits that include files with specified file extensions from being pushed to the commit graph.
// File_extension_restriction > [!NOTE]> `file_extension_restriction` is in beta and subject to change.Prevent commits that include files with specified file extensions from being pushed to the commit graph.
type File_extension_restriction struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
additionalData map[string]any
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/models/file_path_restriction.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)

// File_path_restriction note: file_path_restriction is in beta and subject to change.Prevent commits that include changes in specified file paths from being pushed to the commit graph.
// File_path_restriction > [!NOTE]> `file_path_restriction` is in beta and subject to change.Prevent commits that include changes in specified file paths from being pushed to the commit graph.
type File_path_restriction struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
additionalData map[string]any
Expand Down
18 changes: 9 additions & 9 deletions pkg/github/models/label.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ type Label struct {
additionalData map[string]any
// 6-character hex code, without the leading #, identifying the color
color *string
// The default property
// Whether this label comes by default in a new repository.
defaultEscaped *bool
// The description property
// Optional description of the label, such as its purpose.
description *string
// The id property
// Unique identifier for the label.
id *int64
// The name of the label.
name *string
Expand Down Expand Up @@ -45,12 +45,12 @@ func (m *Label) GetAdditionalData()(map[string]any) {
func (m *Label) GetColor()(*string) {
return m.color
}
// GetDefaultEscaped gets the default property value. The default property
// GetDefaultEscaped gets the default property value. Whether this label comes by default in a new repository.
// returns a *bool when successful
func (m *Label) GetDefaultEscaped()(*bool) {
return m.defaultEscaped
}
// GetDescription gets the description property value. The description property
// GetDescription gets the description property value. Optional description of the label, such as its purpose.
// returns a *string when successful
func (m *Label) GetDescription()(*string) {
return m.description
Expand Down Expand Up @@ -131,7 +131,7 @@ func (m *Label) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388
}
return res
}
// GetId gets the id property value. The id property
// GetId gets the id property value. Unique identifier for the label.
// returns a *int64 when successful
func (m *Label) GetId()(*int64) {
return m.id
Expand Down Expand Up @@ -211,15 +211,15 @@ func (m *Label) SetAdditionalData(value map[string]any)() {
func (m *Label) SetColor(value *string)() {
m.color = value
}
// SetDefaultEscaped sets the default property value. The default property
// SetDefaultEscaped sets the default property value. Whether this label comes by default in a new repository.
func (m *Label) SetDefaultEscaped(value *bool)() {
m.defaultEscaped = value
}
// SetDescription sets the description property value. The description property
// SetDescription sets the description property value. Optional description of the label, such as its purpose.
func (m *Label) SetDescription(value *string)() {
m.description = value
}
// SetId sets the id property value. The id property
// SetId sets the id property value. Unique identifier for the label.
func (m *Label) SetId(value *int64)() {
m.id = value
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/models/max_file_path_length.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)

// Max_file_path_length note: max_file_path_length is in beta and subject to change.Prevent commits that include file paths that exceed a specified character limit from being pushed to the commit graph.
// Max_file_path_length > [!NOTE]> `max_file_path_length` is in beta and subject to change.Prevent commits that include file paths that exceed a specified character limit from being pushed to the commit graph.
type Max_file_path_length struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
additionalData map[string]any
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/models/max_file_size.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
)

// Max_file_size note: max_file_size is in beta and subject to change.Prevent commits that exceed a specified file size limit from being pushed to the commit.
// Max_file_size > [!NOTE]> `max_file_size` is in beta and subject to change.Prevent commits that exceed a specified file size limit from being pushed to the commit.
type Max_file_size struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
additionalData map[string]any
Expand Down
Loading
Loading