diff --git a/pkg/github/app/installations_item_access_tokens_request_builder.go b/pkg/github/app/installations_item_access_tokens_request_builder.go index 295aadd4..12378017 100644 --- a/pkg/github/app/installations_item_access_tokens_request_builder.go +++ b/pkg/github/app/installations_item_access_tokens_request_builder.go @@ -23,7 +23,7 @@ func NewInstallationsItemAccess_tokensRequestBuilder(rawUrl string, requestAdapt urlParams["request-raw-url"] = rawUrl return NewInstallationsItemAccess_tokensRequestBuilderInternal(urlParams, requestAdapter) } -// Post creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner.Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted.When using the repository or permission parameters to reduce the access of the token, the complexity of the token is increased due to both the number of permissions in the request and the number of repositories the token will have access to. If the complexity is too large, the token will fail to be issued. If this occurs, the error message will indicate the maximum number of repositories that should be requested. For the average application requesting 8 permissions, this limit is around 5000 repositories. With fewer permissions requested, more repositories are supported. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. +// Post creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access.Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner.Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted.When using the repository or permission parameters to reduce the access of the token, the complexity of the token is increased due to both the number of permissions in the request and the number of repositories the token will have access to. If the complexity is too large, the token will fail to be issued. If this occurs, the error message will indicate the maximum number of repositories that should be requested. For the average application requesting 8 permissions, this limit is around 5000 repositories. With fewer permissions requested, more repositories are supported.You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. // returns a InstallationTokenable when successful // returns a BasicError error when the service returns a 401 status code // returns a BasicError error when the service returns a 403 status code @@ -52,7 +52,7 @@ func (m *InstallationsItemAccess_tokensRequestBuilder) Post(ctx context.Context, } return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.InstallationTokenable), nil } -// ToPostRequestInformation creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access. Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner.Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted.When using the repository or permission parameters to reduce the access of the token, the complexity of the token is increased due to both the number of permissions in the request and the number of repositories the token will have access to. If the complexity is too large, the token will fail to be issued. If this occurs, the error message will indicate the maximum number of repositories that should be requested. For the average application requesting 8 permissions, this limit is around 5000 repositories. With fewer permissions requested, more repositories are supported. You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. +// ToPostRequestInformation creates an installation access token that enables a GitHub App to make authenticated API requests for the app's installation on an organization or individual account. Installation tokens expire one hour from the time you create them. Using an expired token produces a status code of `401 - Unauthorized`, and requires creating a new installation token. By default the installation token has access to all repositories that the installation can access.Optionally, you can use the `repositories` or `repository_ids` body parameters to specify individual repositories that the installation access token can access. If you don't use `repositories` or `repository_ids` to grant access to specific repositories, the installation access token will have access to all repositories that the installation was granted access to. The installation access token cannot be granted access to repositories that the installation was not granted access to. Up to 500 repositories can be listed in this manner.Optionally, use the `permissions` body parameter to specify the permissions that the installation access token should have. If `permissions` is not specified, the installation access token will have all of the permissions that were granted to the app. The installation access token cannot be granted permissions that the app was not granted.When using the repository or permission parameters to reduce the access of the token, the complexity of the token is increased due to both the number of permissions in the request and the number of repositories the token will have access to. If the complexity is too large, the token will fail to be issued. If this occurs, the error message will indicate the maximum number of repositories that should be requested. For the average application requesting 8 permissions, this limit is around 5000 repositories. With fewer permissions requested, more repositories are supported.You must use a [JWT](https://docs.github.com/apps/building-github-apps/authenticating-with-github-apps/#authenticating-as-a-github-app) to access this endpoint. // returns a *RequestInformation when successful func (m *InstallationsItemAccess_tokensRequestBuilder) ToPostRequestInformation(ctx context.Context, body InstallationsItemAccess_tokensPostRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/enterprises/item_copilot_request_builder.go b/pkg/github/enterprises/item_copilot_request_builder.go new file mode 100644 index 00000000..f53b9942 --- /dev/null +++ b/pkg/github/enterprises/item_copilot_request_builder.go @@ -0,0 +1,28 @@ +package enterprises + +import ( + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// ItemCopilotRequestBuilder builds and executes requests for operations under \enterprises\{enterprise}\copilot +type ItemCopilotRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// NewItemCopilotRequestBuilderInternal instantiates a new ItemCopilotRequestBuilder and sets the default values. +func NewItemCopilotRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotRequestBuilder) { + m := &ItemCopilotRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot", pathParameters), + } + return m +} +// NewItemCopilotRequestBuilder instantiates a new ItemCopilotRequestBuilder and sets the default values. +func NewItemCopilotRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCopilotRequestBuilderInternal(urlParams, requestAdapter) +} +// Usage the usage property +// returns a *ItemCopilotUsageRequestBuilder when successful +func (m *ItemCopilotRequestBuilder) Usage()(*ItemCopilotUsageRequestBuilder) { + return NewItemCopilotUsageRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} diff --git a/pkg/github/enterprises/item_copilot_usage_request_builder.go b/pkg/github/enterprises/item_copilot_usage_request_builder.go new file mode 100644 index 00000000..d29326b4 --- /dev/null +++ b/pkg/github/enterprises/item_copilot_usage_request_builder.go @@ -0,0 +1,81 @@ +package enterprises + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemCopilotUsageRequestBuilder builds and executes requests for operations under \enterprises\{enterprise}\copilot\usage +type ItemCopilotUsageRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// ItemCopilotUsageRequestBuilderGetQueryParameters **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only the owners and billing managers of enterprises with a Copilot Business or Enterprise subscription can view Copilot usagemetrics for the enterprise.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +type ItemCopilotUsageRequestBuilderGetQueryParameters struct { + // The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Page *int32 `uriparametername:"page"` + // The number of days of metrics to display per page (max 28). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Per_page *int32 `uriparametername:"per_page"` + // Show usage metrics since this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`). Maximum value is 28 days ago. + Since *string `uriparametername:"since"` + // Show usage metrics until this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`) and should not preceed the `since` date if it is passed. + Until *string `uriparametername:"until"` +} +// NewItemCopilotUsageRequestBuilderInternal instantiates a new ItemCopilotUsageRequestBuilder and sets the default values. +func NewItemCopilotUsageRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotUsageRequestBuilder) { + m := &ItemCopilotUsageRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot/usage{?page*,per_page*,since*,until*}", pathParameters), + } + return m +} +// NewItemCopilotUsageRequestBuilder instantiates a new ItemCopilotUsageRequestBuilder and sets the default values. +func NewItemCopilotUsageRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotUsageRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCopilotUsageRequestBuilderInternal(urlParams, requestAdapter) +} +// Get **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only the owners and billing managers of enterprises with a Copilot Business or Enterprise subscription can view Copilot usagemetrics for the enterprise.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +// returns a []CopilotUsageMetricsable when successful +// returns a BasicError error when the service returns a 401 status code +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// returns a BasicError error when the service returns a 500 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-enterprise-members +func (m *ItemCopilotUsageRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotUsageRequestBuilderGetQueryParameters])([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "401": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "500": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCopilotUsageMetricsFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + val := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable, len(res)) + for i, v := range res { + if v != nil { + val[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable) + } + } + return val, nil +} +// ToGetRequestInformation **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor all users across organizations with access to Copilot within your enterprise, with a further breakdown of suggestions, acceptances,and number of active users by editor and language for each day. See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Only the owners and billing managers of enterprises with a Copilot Business or Enterprise subscription can view Copilot usagemetrics for the enterprise.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCopilotUsageRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotUsageRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCopilotUsageRequestBuilder when successful +func (m *ItemCopilotUsageRequestBuilder) WithUrl(rawUrl string)(*ItemCopilotUsageRequestBuilder) { + return NewItemCopilotUsageRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/enterprises/with_enterprise_item_request_builder.go b/pkg/github/enterprises/with_enterprise_item_request_builder.go index 604677ee..72c0de51 100644 --- a/pkg/github/enterprises/with_enterprise_item_request_builder.go +++ b/pkg/github/enterprises/with_enterprise_item_request_builder.go @@ -21,6 +21,11 @@ func NewWithEnterpriseItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f urlParams["request-raw-url"] = rawUrl return NewWithEnterpriseItemRequestBuilderInternal(urlParams, requestAdapter) } +// Copilot the copilot property +// returns a *ItemCopilotRequestBuilder when successful +func (m *WithEnterpriseItemRequestBuilder) Copilot()(*ItemCopilotRequestBuilder) { + return NewItemCopilotRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} // Dependabot the dependabot property // returns a *ItemDependabotRequestBuilder when successful func (m *WithEnterpriseItemRequestBuilder) Dependabot()(*ItemDependabotRequestBuilder) { diff --git a/pkg/github/kiota-lock.json b/pkg/github/kiota-lock.json index bebeb5bc..b7d6e67c 100644 --- a/pkg/github/kiota-lock.json +++ b/pkg/github/kiota-lock.json @@ -1,5 +1,5 @@ { - "descriptionHash": "AFCF9A80EB9B6AD1E3E33F4BF67BB542AB82568208F8A07BB3252145EC220B5F14540B367B6AB51C9FAF7317E5BBCB8A8DB58322D548646F65C5AEF396C68683", + "descriptionHash": "BD27C508C954F5550843E190C0723A085224F85958A33EA2309EAC88A1A2038C33E8BB4B3A579FB2B243133976FAE23A8DD8790C5C23C1B210DB16433937E6C4", "descriptionLocation": "../../../source-generator/schemas/downloaded.json", "lockFileVersion": "1.0.0", "kiotaVersion": "1.14.0-preview.202404180001", diff --git a/pkg/github/models/copilot_usage_metrics.go b/pkg/github/models/copilot_usage_metrics.go new file mode 100644 index 00000000..0cee13ef --- /dev/null +++ b/pkg/github/models/copilot_usage_metrics.go @@ -0,0 +1,335 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// CopilotUsageMetrics summary of Copilot usage. +type CopilotUsageMetrics struct { + // Breakdown of Copilot code completions usage by language and editor + breakdown []CopilotUsageMetrics_breakdownable + // The date for which the usage metrics are reported, in `YYYY-MM-DD` format. + day *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.DateOnly + // The total number of Copilot code completion suggestions accepted by users. + total_acceptances_count *int32 + // The total number of users who interacted with Copilot Chat in the IDE during the day specified. + total_active_chat_users *int32 + // The total number of users who were shown Copilot code completion suggestions during the day specified. + total_active_users *int32 + // The total instances of users who accepted code suggested by Copilot Chat in the IDE (panel and inline). + total_chat_acceptances *int32 + // The total number of chat turns (prompt and response pairs) sent between users and Copilot Chat in the IDE. + total_chat_turns *int32 + // The total number of lines of code completions accepted by users. + total_lines_accepted *int32 + // The total number of lines of code completions suggested by Copilot. + total_lines_suggested *int32 + // The total number of Copilot code completion suggestions shown to users. + total_suggestions_count *int32 +} +// NewCopilotUsageMetrics instantiates a new CopilotUsageMetrics and sets the default values. +func NewCopilotUsageMetrics()(*CopilotUsageMetrics) { + m := &CopilotUsageMetrics{ + } + return m +} +// CreateCopilotUsageMetricsFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateCopilotUsageMetricsFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewCopilotUsageMetrics(), nil +} +// GetBreakdown gets the breakdown property value. Breakdown of Copilot code completions usage by language and editor +// returns a []CopilotUsageMetrics_breakdownable when successful +func (m *CopilotUsageMetrics) GetBreakdown()([]CopilotUsageMetrics_breakdownable) { + return m.breakdown +} +// GetDay gets the day property value. The date for which the usage metrics are reported, in `YYYY-MM-DD` format. +// returns a *DateOnly when successful +func (m *CopilotUsageMetrics) GetDay()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.DateOnly) { + return m.day +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *CopilotUsageMetrics) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["breakdown"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetCollectionOfObjectValues(CreateCopilotUsageMetrics_breakdownFromDiscriminatorValue) + if err != nil { + return err + } + if val != nil { + res := make([]CopilotUsageMetrics_breakdownable, len(val)) + for i, v := range val { + if v != nil { + res[i] = v.(CopilotUsageMetrics_breakdownable) + } + } + m.SetBreakdown(res) + } + return nil + } + res["day"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetDateOnlyValue() + if err != nil { + return err + } + if val != nil { + m.SetDay(val) + } + return nil + } + res["total_acceptances_count"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalAcceptancesCount(val) + } + return nil + } + res["total_active_chat_users"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalActiveChatUsers(val) + } + return nil + } + res["total_active_users"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalActiveUsers(val) + } + return nil + } + res["total_chat_acceptances"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalChatAcceptances(val) + } + return nil + } + res["total_chat_turns"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalChatTurns(val) + } + return nil + } + res["total_lines_accepted"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalLinesAccepted(val) + } + return nil + } + res["total_lines_suggested"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalLinesSuggested(val) + } + return nil + } + res["total_suggestions_count"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetTotalSuggestionsCount(val) + } + return nil + } + return res +} +// GetTotalAcceptancesCount gets the total_acceptances_count property value. The total number of Copilot code completion suggestions accepted by users. +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalAcceptancesCount()(*int32) { + return m.total_acceptances_count +} +// GetTotalActiveChatUsers gets the total_active_chat_users property value. The total number of users who interacted with Copilot Chat in the IDE during the day specified. +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalActiveChatUsers()(*int32) { + return m.total_active_chat_users +} +// GetTotalActiveUsers gets the total_active_users property value. The total number of users who were shown Copilot code completion suggestions during the day specified. +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalActiveUsers()(*int32) { + return m.total_active_users +} +// GetTotalChatAcceptances gets the total_chat_acceptances property value. The total instances of users who accepted code suggested by Copilot Chat in the IDE (panel and inline). +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalChatAcceptances()(*int32) { + return m.total_chat_acceptances +} +// GetTotalChatTurns gets the total_chat_turns property value. The total number of chat turns (prompt and response pairs) sent between users and Copilot Chat in the IDE. +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalChatTurns()(*int32) { + return m.total_chat_turns +} +// GetTotalLinesAccepted gets the total_lines_accepted property value. The total number of lines of code completions accepted by users. +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalLinesAccepted()(*int32) { + return m.total_lines_accepted +} +// GetTotalLinesSuggested gets the total_lines_suggested property value. The total number of lines of code completions suggested by Copilot. +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalLinesSuggested()(*int32) { + return m.total_lines_suggested +} +// GetTotalSuggestionsCount gets the total_suggestions_count property value. The total number of Copilot code completion suggestions shown to users. +// returns a *int32 when successful +func (m *CopilotUsageMetrics) GetTotalSuggestionsCount()(*int32) { + return m.total_suggestions_count +} +// Serialize serializes information the current object +func (m *CopilotUsageMetrics) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + if m.GetBreakdown() != nil { + cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetBreakdown())) + for i, v := range m.GetBreakdown() { + if v != nil { + cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable) + } + } + err := writer.WriteCollectionOfObjectValues("breakdown", cast) + if err != nil { + return err + } + } + { + err := writer.WriteDateOnlyValue("day", m.GetDay()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_acceptances_count", m.GetTotalAcceptancesCount()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_active_chat_users", m.GetTotalActiveChatUsers()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_active_users", m.GetTotalActiveUsers()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_chat_acceptances", m.GetTotalChatAcceptances()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_chat_turns", m.GetTotalChatTurns()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_lines_accepted", m.GetTotalLinesAccepted()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_lines_suggested", m.GetTotalLinesSuggested()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("total_suggestions_count", m.GetTotalSuggestionsCount()) + if err != nil { + return err + } + } + return nil +} +// SetBreakdown sets the breakdown property value. Breakdown of Copilot code completions usage by language and editor +func (m *CopilotUsageMetrics) SetBreakdown(value []CopilotUsageMetrics_breakdownable)() { + m.breakdown = value +} +// SetDay sets the day property value. The date for which the usage metrics are reported, in `YYYY-MM-DD` format. +func (m *CopilotUsageMetrics) SetDay(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.DateOnly)() { + m.day = value +} +// SetTotalAcceptancesCount sets the total_acceptances_count property value. The total number of Copilot code completion suggestions accepted by users. +func (m *CopilotUsageMetrics) SetTotalAcceptancesCount(value *int32)() { + m.total_acceptances_count = value +} +// SetTotalActiveChatUsers sets the total_active_chat_users property value. The total number of users who interacted with Copilot Chat in the IDE during the day specified. +func (m *CopilotUsageMetrics) SetTotalActiveChatUsers(value *int32)() { + m.total_active_chat_users = value +} +// SetTotalActiveUsers sets the total_active_users property value. The total number of users who were shown Copilot code completion suggestions during the day specified. +func (m *CopilotUsageMetrics) SetTotalActiveUsers(value *int32)() { + m.total_active_users = value +} +// SetTotalChatAcceptances sets the total_chat_acceptances property value. The total instances of users who accepted code suggested by Copilot Chat in the IDE (panel and inline). +func (m *CopilotUsageMetrics) SetTotalChatAcceptances(value *int32)() { + m.total_chat_acceptances = value +} +// SetTotalChatTurns sets the total_chat_turns property value. The total number of chat turns (prompt and response pairs) sent between users and Copilot Chat in the IDE. +func (m *CopilotUsageMetrics) SetTotalChatTurns(value *int32)() { + m.total_chat_turns = value +} +// SetTotalLinesAccepted sets the total_lines_accepted property value. The total number of lines of code completions accepted by users. +func (m *CopilotUsageMetrics) SetTotalLinesAccepted(value *int32)() { + m.total_lines_accepted = value +} +// SetTotalLinesSuggested sets the total_lines_suggested property value. The total number of lines of code completions suggested by Copilot. +func (m *CopilotUsageMetrics) SetTotalLinesSuggested(value *int32)() { + m.total_lines_suggested = value +} +// SetTotalSuggestionsCount sets the total_suggestions_count property value. The total number of Copilot code completion suggestions shown to users. +func (m *CopilotUsageMetrics) SetTotalSuggestionsCount(value *int32)() { + m.total_suggestions_count = value +} +type CopilotUsageMetricsable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetBreakdown()([]CopilotUsageMetrics_breakdownable) + GetDay()(*i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.DateOnly) + GetTotalAcceptancesCount()(*int32) + GetTotalActiveChatUsers()(*int32) + GetTotalActiveUsers()(*int32) + GetTotalChatAcceptances()(*int32) + GetTotalChatTurns()(*int32) + GetTotalLinesAccepted()(*int32) + GetTotalLinesSuggested()(*int32) + GetTotalSuggestionsCount()(*int32) + SetBreakdown(value []CopilotUsageMetrics_breakdownable)() + SetDay(value *i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.DateOnly)() + SetTotalAcceptancesCount(value *int32)() + SetTotalActiveChatUsers(value *int32)() + SetTotalActiveUsers(value *int32)() + SetTotalChatAcceptances(value *int32)() + SetTotalChatTurns(value *int32)() + SetTotalLinesAccepted(value *int32)() + SetTotalLinesSuggested(value *int32)() + SetTotalSuggestionsCount(value *int32)() +} diff --git a/pkg/github/models/copilot_usage_metrics_breakdown.go b/pkg/github/models/copilot_usage_metrics_breakdown.go new file mode 100644 index 00000000..9924ca1f --- /dev/null +++ b/pkg/github/models/copilot_usage_metrics_breakdown.go @@ -0,0 +1,255 @@ +package models + +import ( + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization" +) + +// CopilotUsageMetrics_breakdown breakdown of Copilot usage by editor for this language +type CopilotUsageMetrics_breakdown struct { + // The number of Copilot suggestions accepted by users in the editor specified during the day specified. + acceptances_count *int32 + // The number of users who were shown Copilot completion suggestions in the editor specified during the day specified. + active_users *int32 + // Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. + additionalData map[string]any + // The editor in which Copilot suggestions were shown to users for the specified language. + editor *string + // The language in which Copilot suggestions were shown to users in the specified editor. + language *string + // The number of lines of code accepted by users in the editor specified during the day specified. + lines_accepted *int32 + // The number of lines of code suggested by Copilot in the editor specified during the day specified. + lines_suggested *int32 + // The number of Copilot suggestions shown to users in the editor specified during the day specified. + suggestions_count *int32 +} +// NewCopilotUsageMetrics_breakdown instantiates a new CopilotUsageMetrics_breakdown and sets the default values. +func NewCopilotUsageMetrics_breakdown()(*CopilotUsageMetrics_breakdown) { + m := &CopilotUsageMetrics_breakdown{ + } + m.SetAdditionalData(make(map[string]any)) + return m +} +// CreateCopilotUsageMetrics_breakdownFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value +// returns a Parsable when successful +func CreateCopilotUsageMetrics_breakdownFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) { + return NewCopilotUsageMetrics_breakdown(), nil +} +// GetAcceptancesCount gets the acceptances_count property value. The number of Copilot suggestions accepted by users in the editor specified during the day specified. +// returns a *int32 when successful +func (m *CopilotUsageMetrics_breakdown) GetAcceptancesCount()(*int32) { + return m.acceptances_count +} +// GetActiveUsers gets the active_users property value. The number of users who were shown Copilot completion suggestions in the editor specified during the day specified. +// returns a *int32 when successful +func (m *CopilotUsageMetrics_breakdown) GetActiveUsers()(*int32) { + return m.active_users +} +// GetAdditionalData gets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +// returns a map[string]any when successful +func (m *CopilotUsageMetrics_breakdown) GetAdditionalData()(map[string]any) { + return m.additionalData +} +// GetEditor gets the editor property value. The editor in which Copilot suggestions were shown to users for the specified language. +// returns a *string when successful +func (m *CopilotUsageMetrics_breakdown) GetEditor()(*string) { + return m.editor +} +// GetFieldDeserializers the deserialization information for the current model +// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful +func (m *CopilotUsageMetrics_breakdown) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) { + res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) + res["acceptances_count"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetAcceptancesCount(val) + } + return nil + } + res["active_users"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetActiveUsers(val) + } + return nil + } + res["editor"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetEditor(val) + } + return nil + } + res["language"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetStringValue() + if err != nil { + return err + } + if val != nil { + m.SetLanguage(val) + } + return nil + } + res["lines_accepted"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetLinesAccepted(val) + } + return nil + } + res["lines_suggested"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetLinesSuggested(val) + } + return nil + } + res["suggestions_count"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error { + val, err := n.GetInt32Value() + if err != nil { + return err + } + if val != nil { + m.SetSuggestionsCount(val) + } + return nil + } + return res +} +// GetLanguage gets the language property value. The language in which Copilot suggestions were shown to users in the specified editor. +// returns a *string when successful +func (m *CopilotUsageMetrics_breakdown) GetLanguage()(*string) { + return m.language +} +// GetLinesAccepted gets the lines_accepted property value. The number of lines of code accepted by users in the editor specified during the day specified. +// returns a *int32 when successful +func (m *CopilotUsageMetrics_breakdown) GetLinesAccepted()(*int32) { + return m.lines_accepted +} +// GetLinesSuggested gets the lines_suggested property value. The number of lines of code suggested by Copilot in the editor specified during the day specified. +// returns a *int32 when successful +func (m *CopilotUsageMetrics_breakdown) GetLinesSuggested()(*int32) { + return m.lines_suggested +} +// GetSuggestionsCount gets the suggestions_count property value. The number of Copilot suggestions shown to users in the editor specified during the day specified. +// returns a *int32 when successful +func (m *CopilotUsageMetrics_breakdown) GetSuggestionsCount()(*int32) { + return m.suggestions_count +} +// Serialize serializes information the current object +func (m *CopilotUsageMetrics_breakdown) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) { + { + err := writer.WriteInt32Value("acceptances_count", m.GetAcceptancesCount()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("active_users", m.GetActiveUsers()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("editor", m.GetEditor()) + if err != nil { + return err + } + } + { + err := writer.WriteStringValue("language", m.GetLanguage()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("lines_accepted", m.GetLinesAccepted()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("lines_suggested", m.GetLinesSuggested()) + if err != nil { + return err + } + } + { + err := writer.WriteInt32Value("suggestions_count", m.GetSuggestionsCount()) + if err != nil { + return err + } + } + { + err := writer.WriteAdditionalData(m.GetAdditionalData()) + if err != nil { + return err + } + } + return nil +} +// SetAcceptancesCount sets the acceptances_count property value. The number of Copilot suggestions accepted by users in the editor specified during the day specified. +func (m *CopilotUsageMetrics_breakdown) SetAcceptancesCount(value *int32)() { + m.acceptances_count = value +} +// SetActiveUsers sets the active_users property value. The number of users who were shown Copilot completion suggestions in the editor specified during the day specified. +func (m *CopilotUsageMetrics_breakdown) SetActiveUsers(value *int32)() { + m.active_users = value +} +// SetAdditionalData sets the AdditionalData property value. Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well. +func (m *CopilotUsageMetrics_breakdown) SetAdditionalData(value map[string]any)() { + m.additionalData = value +} +// SetEditor sets the editor property value. The editor in which Copilot suggestions were shown to users for the specified language. +func (m *CopilotUsageMetrics_breakdown) SetEditor(value *string)() { + m.editor = value +} +// SetLanguage sets the language property value. The language in which Copilot suggestions were shown to users in the specified editor. +func (m *CopilotUsageMetrics_breakdown) SetLanguage(value *string)() { + m.language = value +} +// SetLinesAccepted sets the lines_accepted property value. The number of lines of code accepted by users in the editor specified during the day specified. +func (m *CopilotUsageMetrics_breakdown) SetLinesAccepted(value *int32)() { + m.lines_accepted = value +} +// SetLinesSuggested sets the lines_suggested property value. The number of lines of code suggested by Copilot in the editor specified during the day specified. +func (m *CopilotUsageMetrics_breakdown) SetLinesSuggested(value *int32)() { + m.lines_suggested = value +} +// SetSuggestionsCount sets the suggestions_count property value. The number of Copilot suggestions shown to users in the editor specified during the day specified. +func (m *CopilotUsageMetrics_breakdown) SetSuggestionsCount(value *int32)() { + m.suggestions_count = value +} +type CopilotUsageMetrics_breakdownable interface { + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder + i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable + GetAcceptancesCount()(*int32) + GetActiveUsers()(*int32) + GetEditor()(*string) + GetLanguage()(*string) + GetLinesAccepted()(*int32) + GetLinesSuggested()(*int32) + GetSuggestionsCount()(*int32) + SetAcceptancesCount(value *int32)() + SetActiveUsers(value *int32)() + SetEditor(value *string)() + SetLanguage(value *string)() + SetLinesAccepted(value *int32)() + SetLinesSuggested(value *int32)() + SetSuggestionsCount(value *int32)() +} diff --git a/pkg/github/orgs/item_copilot_request_builder.go b/pkg/github/orgs/item_copilot_request_builder.go index 058103da..a9a8889a 100644 --- a/pkg/github/orgs/item_copilot_request_builder.go +++ b/pkg/github/orgs/item_copilot_request_builder.go @@ -26,3 +26,8 @@ func NewItemCopilotRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee26 urlParams["request-raw-url"] = rawUrl return NewItemCopilotRequestBuilderInternal(urlParams, requestAdapter) } +// Usage the usage property +// returns a *ItemCopilotUsageRequestBuilder when successful +func (m *ItemCopilotRequestBuilder) Usage()(*ItemCopilotUsageRequestBuilder) { + return NewItemCopilotUsageRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} diff --git a/pkg/github/orgs/item_copilot_usage_request_builder.go b/pkg/github/orgs/item_copilot_usage_request_builder.go new file mode 100644 index 00000000..6c55de1d --- /dev/null +++ b/pkg/github/orgs/item_copilot_usage_request_builder.go @@ -0,0 +1,81 @@ +package orgs + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemCopilotUsageRequestBuilder builds and executes requests for operations under \orgs\{org}\copilot\usage +type ItemCopilotUsageRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// ItemCopilotUsageRequestBuilderGetQueryParameters **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEacross an organization, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Copilot Business or Copilot Enterprise organization owners, and owners and billing managers of their parent enterprises, can viewCopilot usage metrics.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:org`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +type ItemCopilotUsageRequestBuilderGetQueryParameters struct { + // The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Page *int32 `uriparametername:"page"` + // The number of days of metrics to display per page (max 28). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Per_page *int32 `uriparametername:"per_page"` + // Show usage metrics since this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`). Maximum value is 28 days ago. + Since *string `uriparametername:"since"` + // Show usage metrics until this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`) and should not preceed the `since` date if it is passed. + Until *string `uriparametername:"until"` +} +// NewItemCopilotUsageRequestBuilderInternal instantiates a new ItemCopilotUsageRequestBuilder and sets the default values. +func NewItemCopilotUsageRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotUsageRequestBuilder) { + m := &ItemCopilotUsageRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/copilot/usage{?page*,per_page*,since*,until*}", pathParameters), + } + return m +} +// NewItemCopilotUsageRequestBuilder instantiates a new ItemCopilotUsageRequestBuilder and sets the default values. +func NewItemCopilotUsageRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotUsageRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemCopilotUsageRequestBuilderInternal(urlParams, requestAdapter) +} +// Get **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEacross an organization, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Copilot Business or Copilot Enterprise organization owners, and owners and billing managers of their parent enterprises, can viewCopilot usage metrics.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:org`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +// returns a []CopilotUsageMetricsable when successful +// returns a BasicError error when the service returns a 401 status code +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// returns a BasicError error when the service returns a 500 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-organization-members +func (m *ItemCopilotUsageRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotUsageRequestBuilderGetQueryParameters])([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "401": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "500": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCopilotUsageMetricsFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + val := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable, len(res)) + for i, v := range res { + if v != nil { + val[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable) + } + } + return val, nil +} +// ToGetRequestInformation **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEacross an organization, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.Copilot Business or Copilot Enterprise organization owners, and owners and billing managers of their parent enterprises, can viewCopilot usage metrics.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:org`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemCopilotUsageRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotUsageRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemCopilotUsageRequestBuilder when successful +func (m *ItemCopilotUsageRequestBuilder) WithUrl(rawUrl string)(*ItemCopilotUsageRequestBuilder) { + return NewItemCopilotUsageRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_hooks_item_config_request_builder.go b/pkg/github/orgs/item_hooks_item_config_request_builder.go index b0191a77..0777ea93 100644 --- a/pkg/github/orgs/item_hooks_item_config_request_builder.go +++ b/pkg/github/orgs/item_hooks_item_config_request_builder.go @@ -23,7 +23,7 @@ func NewItemHooksItemConfigRequestBuilder(rawUrl string, requestAdapter i2ae4187 urlParams["request-raw-url"] = rawUrl return NewItemHooksItemConfigRequestBuilderInternal(urlParams, requestAdapter) } -// Get returns the webhook configuration for an organization. To get more information about the webhook, including the `active` state and `events`, use "[Get an organization webhook ](/rest/orgs/webhooks#get-an-organization-webhook)."You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Get returns the webhook configuration for an organization. To get more information about the webhook, including the `active` state and `events`, use "[Get an organization webhook ](/rest/orgs/webhooks#get-an-organization-webhook)."You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a WebhookConfigable when successful // [API method documentation] // @@ -42,7 +42,7 @@ func (m *ItemHooksItemConfigRequestBuilder) Get(ctx context.Context, requestConf } return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.WebhookConfigable), nil } -// Patch updates the webhook configuration for an organization. To update more information about the webhook, including the `active` state and `events`, use "[Update an organization webhook ](/rest/orgs/webhooks#update-an-organization-webhook)."You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Patch updates the webhook configuration for an organization. To update more information about the webhook, including the `active` state and `events`, use "[Update an organization webhook ](/rest/orgs/webhooks#update-an-organization-webhook)."You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a WebhookConfigable when successful // [API method documentation] // @@ -61,7 +61,7 @@ func (m *ItemHooksItemConfigRequestBuilder) Patch(ctx context.Context, body Item } return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.WebhookConfigable), nil } -// ToGetRequestInformation returns the webhook configuration for an organization. To get more information about the webhook, including the `active` state and `events`, use "[Get an organization webhook ](/rest/orgs/webhooks#get-an-organization-webhook)."You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToGetRequestInformation returns the webhook configuration for an organization. To get more information about the webhook, including the `active` state and `events`, use "[Get an organization webhook ](/rest/orgs/webhooks#get-an-organization-webhook)."You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksItemConfigRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) @@ -69,7 +69,7 @@ func (m *ItemHooksItemConfigRequestBuilder) ToGetRequestInformation(ctx context. requestInfo.Headers.TryAdd("Accept", "application/json") return requestInfo, nil } -// ToPatchRequestInformation updates the webhook configuration for an organization. To update more information about the webhook, including the `active` state and `events`, use "[Update an organization webhook ](/rest/orgs/webhooks#update-an-organization-webhook)."You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToPatchRequestInformation updates the webhook configuration for an organization. To update more information about the webhook, including the `active` state and `events`, use "[Update an organization webhook ](/rest/orgs/webhooks#update-an-organization-webhook)."You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksItemConfigRequestBuilder) ToPatchRequestInformation(ctx context.Context, body ItemHooksItemConfigPatchRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/orgs/item_hooks_item_deliveries_item_attempts_request_builder.go b/pkg/github/orgs/item_hooks_item_deliveries_item_attempts_request_builder.go index fb38be9e..d1e9a5a2 100644 --- a/pkg/github/orgs/item_hooks_item_deliveries_item_attempts_request_builder.go +++ b/pkg/github/orgs/item_hooks_item_deliveries_item_attempts_request_builder.go @@ -23,7 +23,7 @@ func NewItemHooksItemDeliveriesItemAttemptsRequestBuilder(rawUrl string, request urlParams["request-raw-url"] = rawUrl return NewItemHooksItemDeliveriesItemAttemptsRequestBuilderInternal(urlParams, requestAdapter) } -// Post redeliver a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Post redeliver a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a ItemHooksItemDeliveriesItemAttemptsPostResponseable when successful // returns a BasicError error when the service returns a 400 status code // returns a ValidationError error when the service returns a 422 status code @@ -48,7 +48,7 @@ func (m *ItemHooksItemDeliveriesItemAttemptsRequestBuilder) Post(ctx context.Con } return res.(ItemHooksItemDeliveriesItemAttemptsPostResponseable), nil } -// ToPostRequestInformation redeliver a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToPostRequestInformation redeliver a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksItemDeliveriesItemAttemptsRequestBuilder) ToPostRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/orgs/item_hooks_item_deliveries_request_builder.go b/pkg/github/orgs/item_hooks_item_deliveries_request_builder.go index d2939fe4..f68ee436 100644 --- a/pkg/github/orgs/item_hooks_item_deliveries_request_builder.go +++ b/pkg/github/orgs/item_hooks_item_deliveries_request_builder.go @@ -11,7 +11,7 @@ import ( type ItemHooksItemDeliveriesRequestBuilder struct { i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder } -// ItemHooksItemDeliveriesRequestBuilderGetQueryParameters returns a list of webhook deliveries for a webhook configured in an organization.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ItemHooksItemDeliveriesRequestBuilderGetQueryParameters returns a list of webhook deliveries for a webhook configured in an organization.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. type ItemHooksItemDeliveriesRequestBuilderGetQueryParameters struct { // Used for pagination: the starting delivery from which the page of deliveries is fetched. Refer to the `link` header for the next and previous page cursors. Cursor *string `uriparametername:"cursor"` @@ -42,7 +42,7 @@ func NewItemHooksItemDeliveriesRequestBuilder(rawUrl string, requestAdapter i2ae urlParams["request-raw-url"] = rawUrl return NewItemHooksItemDeliveriesRequestBuilderInternal(urlParams, requestAdapter) } -// Get returns a list of webhook deliveries for a webhook configured in an organization.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Get returns a list of webhook deliveries for a webhook configured in an organization.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a []HookDeliveryItemable when successful // returns a BasicError error when the service returns a 400 status code // returns a ValidationError error when the service returns a 422 status code @@ -70,7 +70,7 @@ func (m *ItemHooksItemDeliveriesRequestBuilder) Get(ctx context.Context, request } return val, nil } -// ToGetRequestInformation returns a list of webhook deliveries for a webhook configured in an organization.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToGetRequestInformation returns a list of webhook deliveries for a webhook configured in an organization.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksItemDeliveriesRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemHooksItemDeliveriesRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/orgs/item_hooks_item_deliveries_with_delivery_item_request_builder.go b/pkg/github/orgs/item_hooks_item_deliveries_with_delivery_item_request_builder.go index ac1b439b..403eb78c 100644 --- a/pkg/github/orgs/item_hooks_item_deliveries_with_delivery_item_request_builder.go +++ b/pkg/github/orgs/item_hooks_item_deliveries_with_delivery_item_request_builder.go @@ -28,7 +28,7 @@ func NewItemHooksItemDeliveriesWithDelivery_ItemRequestBuilder(rawUrl string, re urlParams["request-raw-url"] = rawUrl return NewItemHooksItemDeliveriesWithDelivery_ItemRequestBuilderInternal(urlParams, requestAdapter) } -// Get returns a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Get returns a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a HookDeliveryable when successful // returns a BasicError error when the service returns a 400 status code // returns a ValidationError error when the service returns a 422 status code @@ -53,7 +53,7 @@ func (m *ItemHooksItemDeliveriesWithDelivery_ItemRequestBuilder) Get(ctx context } return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.HookDeliveryable), nil } -// ToGetRequestInformation returns a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToGetRequestInformation returns a delivery for a webhook configured in an organization.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksItemDeliveriesWithDelivery_ItemRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/orgs/item_hooks_item_pings_request_builder.go b/pkg/github/orgs/item_hooks_item_pings_request_builder.go index c497aafb..bb632744 100644 --- a/pkg/github/orgs/item_hooks_item_pings_request_builder.go +++ b/pkg/github/orgs/item_hooks_item_pings_request_builder.go @@ -23,7 +23,7 @@ func NewItemHooksItemPingsRequestBuilder(rawUrl string, requestAdapter i2ae4187f urlParams["request-raw-url"] = rawUrl return NewItemHooksItemPingsRequestBuilderInternal(urlParams, requestAdapter) } -// Post this will trigger a [ping event](https://docs.github.com/webhooks/#ping-event)to be sent to the hook.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Post this will trigger a [ping event](https://docs.github.com/webhooks/#ping-event)to be sent to the hook.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a BasicError error when the service returns a 404 status code // [API method documentation] // @@ -42,7 +42,7 @@ func (m *ItemHooksItemPingsRequestBuilder) Post(ctx context.Context, requestConf } return nil } -// ToPostRequestInformation this will trigger a [ping event](https://docs.github.com/webhooks/#ping-event)to be sent to the hook.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToPostRequestInformation this will trigger a [ping event](https://docs.github.com/webhooks/#ping-event)to be sent to the hook.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksItemPingsRequestBuilder) ToPostRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/orgs/item_hooks_request_builder.go b/pkg/github/orgs/item_hooks_request_builder.go index 2fd9b660..641c1049 100644 --- a/pkg/github/orgs/item_hooks_request_builder.go +++ b/pkg/github/orgs/item_hooks_request_builder.go @@ -11,7 +11,7 @@ import ( type ItemHooksRequestBuilder struct { i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder } -// ItemHooksRequestBuilderGetQueryParameters you must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ItemHooksRequestBuilderGetQueryParameters you must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. type ItemHooksRequestBuilderGetQueryParameters struct { // The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." Page *int32 `uriparametername:"page"` @@ -41,7 +41,7 @@ func NewItemHooksRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee2633 urlParams["request-raw-url"] = rawUrl return NewItemHooksRequestBuilderInternal(urlParams, requestAdapter) } -// Get you must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Get you must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a []OrgHookable when successful // returns a BasicError error when the service returns a 404 status code // [API method documentation] @@ -67,7 +67,7 @@ func (m *ItemHooksRequestBuilder) Get(ctx context.Context, requestConfiguration } return val, nil } -// Post create a hook that posts payloads in JSON format.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Post create a hook that posts payloads in JSON format.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, oredit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a OrgHookable when successful // returns a BasicError error when the service returns a 404 status code // returns a ValidationError error when the service returns a 422 status code @@ -92,7 +92,7 @@ func (m *ItemHooksRequestBuilder) Post(ctx context.Context, body ItemHooksPostRe } return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.OrgHookable), nil } -// ToGetRequestInformation you must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToGetRequestInformation you must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemHooksRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) @@ -100,7 +100,7 @@ func (m *ItemHooksRequestBuilder) ToGetRequestInformation(ctx context.Context, r requestInfo.Headers.TryAdd("Accept", "application/json") return requestInfo, nil } -// ToPostRequestInformation create a hook that posts payloads in JSON format.You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToPostRequestInformation create a hook that posts payloads in JSON format.You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, oredit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksRequestBuilder) ToPostRequestInformation(ctx context.Context, body ItemHooksPostRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.POST, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/orgs/item_hooks_with_hook_item_request_builder.go b/pkg/github/orgs/item_hooks_with_hook_item_request_builder.go index 6fceff62..213293bd 100644 --- a/pkg/github/orgs/item_hooks_with_hook_item_request_builder.go +++ b/pkg/github/orgs/item_hooks_with_hook_item_request_builder.go @@ -28,7 +28,7 @@ func NewItemHooksWithHook_ItemRequestBuilder(rawUrl string, requestAdapter i2ae4 urlParams["request-raw-url"] = rawUrl return NewItemHooksWithHook_ItemRequestBuilderInternal(urlParams, requestAdapter) } -// Delete you must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Delete you must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a BasicError error when the service returns a 404 status code // [API method documentation] // @@ -52,7 +52,7 @@ func (m *ItemHooksWithHook_ItemRequestBuilder) Delete(ctx context.Context, reque func (m *ItemHooksWithHook_ItemRequestBuilder) Deliveries()(*ItemHooksItemDeliveriesRequestBuilder) { return NewItemHooksItemDeliveriesRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) } -// Get returns a webhook configured in an organization. To get only the webhook`config` properties, see "[Get a webhook configuration for an organization](/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization). You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Get returns a webhook configured in an organization. To get only the webhook`config` properties, see "[Get a webhook configuration for an organization](/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization).You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a OrgHookable when successful // returns a BasicError error when the service returns a 404 status code // [API method documentation] @@ -75,7 +75,7 @@ func (m *ItemHooksWithHook_ItemRequestBuilder) Get(ctx context.Context, requestC } return res.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.OrgHookable), nil } -// Patch updates a webhook configured in an organization. When you update a webhook,the `secret` will be overwritten. If you previously had a `secret` set, you mustprovide the same `secret` or set a new `secret` or the secret will be removed. Ifyou are only updating individual webhook `config` properties, use "[Update a webhookconfiguration for an organization](/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization)". You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// Patch updates a webhook configured in an organization. When you update a webhook,the `secret` will be overwritten. If you previously had a `secret` set, you mustprovide the same `secret` or set a new `secret` or the secret will be removed. Ifyou are only updating individual webhook `config` properties, use "[Update a webhookconfiguration for an organization](/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization)".You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a OrgHookable when successful // returns a BasicError error when the service returns a 404 status code // returns a ValidationError error when the service returns a 422 status code @@ -105,7 +105,7 @@ func (m *ItemHooksWithHook_ItemRequestBuilder) Patch(ctx context.Context, body I func (m *ItemHooksWithHook_ItemRequestBuilder) Pings()(*ItemHooksItemPingsRequestBuilder) { return NewItemHooksItemPingsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) } -// ToDeleteRequestInformation you must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToDeleteRequestInformation you must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksWithHook_ItemRequestBuilder) ToDeleteRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DELETE, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) @@ -113,7 +113,7 @@ func (m *ItemHooksWithHook_ItemRequestBuilder) ToDeleteRequestInformation(ctx co requestInfo.Headers.TryAdd("Accept", "application/json") return requestInfo, nil } -// ToGetRequestInformation returns a webhook configured in an organization. To get only the webhook`config` properties, see "[Get a webhook configuration for an organization](/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization). You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToGetRequestInformation returns a webhook configured in an organization. To get only the webhook`config` properties, see "[Get a webhook configuration for an organization](/rest/orgs/webhooks#get-a-webhook-configuration-for-an-organization).You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksWithHook_ItemRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) @@ -121,7 +121,7 @@ func (m *ItemHooksWithHook_ItemRequestBuilder) ToGetRequestInformation(ctx conte requestInfo.Headers.TryAdd("Accept", "application/json") return requestInfo, nil } -// ToPatchRequestInformation updates a webhook configured in an organization. When you update a webhook,the `secret` will be overwritten. If you previously had a `secret` set, you mustprovide the same `secret` or set a new `secret` or the secret will be removed. Ifyou are only updating individual webhook `config` properties, use "[Update a webhookconfiguration for an organization](/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization)". You must be an organization owner to use this endpoint. OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or edit webhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. +// ToPatchRequestInformation updates a webhook configured in an organization. When you update a webhook,the `secret` will be overwritten. If you previously had a `secret` set, you mustprovide the same `secret` or set a new `secret` or the secret will be removed. Ifyou are only updating individual webhook `config` properties, use "[Update a webhookconfiguration for an organization](/rest/orgs/webhooks#update-a-webhook-configuration-for-an-organization)".You must be an organization owner to use this endpoint.OAuth app tokens and personal access tokens (classic) need `admin:org_hook` scope. OAuth apps cannot list, view, or editwebhooks that they did not create and users cannot list, view, or edit webhooks that were created by OAuth apps. // returns a *RequestInformation when successful func (m *ItemHooksWithHook_ItemRequestBuilder) ToPatchRequestInformation(ctx context.Context, body ItemHooksItemWithHook_PatchRequestBodyable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PATCH, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) diff --git a/pkg/github/orgs/item_team_item_copilot_request_builder.go b/pkg/github/orgs/item_team_item_copilot_request_builder.go new file mode 100644 index 00000000..184e910c --- /dev/null +++ b/pkg/github/orgs/item_team_item_copilot_request_builder.go @@ -0,0 +1,28 @@ +package orgs + +import ( + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// ItemTeamItemCopilotRequestBuilder builds and executes requests for operations under \orgs\{org}\team\{team_slug}\copilot +type ItemTeamItemCopilotRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// NewItemTeamItemCopilotRequestBuilderInternal instantiates a new ItemTeamItemCopilotRequestBuilder and sets the default values. +func NewItemTeamItemCopilotRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamItemCopilotRequestBuilder) { + m := &ItemTeamItemCopilotRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/team/{team_slug}/copilot", pathParameters), + } + return m +} +// NewItemTeamItemCopilotRequestBuilder instantiates a new ItemTeamItemCopilotRequestBuilder and sets the default values. +func NewItemTeamItemCopilotRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamItemCopilotRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemTeamItemCopilotRequestBuilderInternal(urlParams, requestAdapter) +} +// Usage the usage property +// returns a *ItemTeamItemCopilotUsageRequestBuilder when successful +func (m *ItemTeamItemCopilotRequestBuilder) Usage()(*ItemTeamItemCopilotUsageRequestBuilder) { + return NewItemTeamItemCopilotUsageRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} diff --git a/pkg/github/orgs/item_team_item_copilot_usage_request_builder.go b/pkg/github/orgs/item_team_item_copilot_usage_request_builder.go new file mode 100644 index 00000000..b885199b --- /dev/null +++ b/pkg/github/orgs/item_team_item_copilot_usage_request_builder.go @@ -0,0 +1,81 @@ +package orgs + +import ( + "context" + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" + i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models" +) + +// ItemTeamItemCopilotUsageRequestBuilder builds and executes requests for operations under \orgs\{org}\team\{team_slug}\copilot\usage +type ItemTeamItemCopilotUsageRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// ItemTeamItemCopilotUsageRequestBuilderGetQueryParameters **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor users within a team, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.**Note**: This endpoint will only return results for a given day if the team had five or more members on that day.Copilot Business or Copilot Enterprise organization owners for the organization that contains this team,and owners and billing managers of their parent enterprises, can view Copilot usage metrics for a team.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:org`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +type ItemTeamItemCopilotUsageRequestBuilderGetQueryParameters struct { + // The page number of the results to fetch. For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Page *int32 `uriparametername:"page"` + // The number of days of metrics to display per page (max 28). For more information, see "[Using pagination in the REST API](https://docs.github.com/rest/using-the-rest-api/using-pagination-in-the-rest-api)." + Per_page *int32 `uriparametername:"per_page"` + // Show usage metrics since this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`). Maximum value is 28 days ago. + Since *string `uriparametername:"since"` + // Show usage metrics until this date. This is a timestamp in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format (`YYYY-MM-DDTHH:MM:SSZ`) and should not preceed the `since` date if it is passed. + Until *string `uriparametername:"until"` +} +// NewItemTeamItemCopilotUsageRequestBuilderInternal instantiates a new ItemTeamItemCopilotUsageRequestBuilder and sets the default values. +func NewItemTeamItemCopilotUsageRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamItemCopilotUsageRequestBuilder) { + m := &ItemTeamItemCopilotUsageRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/team/{team_slug}/copilot/usage{?page*,per_page*,since*,until*}", pathParameters), + } + return m +} +// NewItemTeamItemCopilotUsageRequestBuilder instantiates a new ItemTeamItemCopilotUsageRequestBuilder and sets the default values. +func NewItemTeamItemCopilotUsageRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamItemCopilotUsageRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemTeamItemCopilotUsageRequestBuilderInternal(urlParams, requestAdapter) +} +// Get **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor users within a team, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.**Note**: This endpoint will only return results for a given day if the team had five or more members on that day.Copilot Business or Copilot Enterprise organization owners for the organization that contains this team,and owners and billing managers of their parent enterprises, can view Copilot usage metrics for a team.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:org`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +// returns a []CopilotUsageMetricsable when successful +// returns a BasicError error when the service returns a 401 status code +// returns a BasicError error when the service returns a 403 status code +// returns a BasicError error when the service returns a 404 status code +// returns a BasicError error when the service returns a 500 status code +// [API method documentation] +// +// [API method documentation]: https://docs.github.com/rest/copilot/copilot-usage#get-a-summary-of-copilot-usage-for-a-team +func (m *ItemTeamItemCopilotUsageRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemTeamItemCopilotUsageRequestBuilderGetQueryParameters])([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable, error) { + requestInfo, err := m.ToGetRequestInformation(ctx, requestConfiguration); + if err != nil { + return nil, err + } + errorMapping := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ErrorMappings { + "401": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "403": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "404": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + "500": i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateBasicErrorFromDiscriminatorValue, + } + res, err := m.BaseRequestBuilder.RequestAdapter.SendCollection(ctx, requestInfo, i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCopilotUsageMetricsFromDiscriminatorValue, errorMapping) + if err != nil { + return nil, err + } + val := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable, len(res)) + for i, v := range res { + if v != nil { + val[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotUsageMetricsable) + } + } + return val, nil +} +// ToGetRequestInformation **Note**: This endpoint is in beta and is subject to change.You can use this endpoint to see a daily breakdown of aggregated usage metrics for Copilot completions and Copilot Chat in the IDEfor users within a team, with a further breakdown of suggestions, acceptances, and number of active users by editor and language for each day.See the response schema tab for detailed metrics definitions.The response contains metrics for the prior 28 days. Usage metrics are processed once per day for the previous day,and the response will only include data up until yesterday. In order for an end user to be counted towards these metrics,they must have telemetry enabled in their IDE.**Note**: This endpoint will only return results for a given day if the team had five or more members on that day.Copilot Business or Copilot Enterprise organization owners for the organization that contains this team,and owners and billing managers of their parent enterprises, can view Copilot usage metrics for a team.OAuth app tokens and personal access tokens (classic) need the `copilot`, `manage_billing:copilot`, `admin:org`, `admin:enterprise`, or `manage_billing:enterprise` scope to use this endpoint. +// returns a *RequestInformation when successful +func (m *ItemTeamItemCopilotUsageRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemTeamItemCopilotUsageRequestBuilderGetQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) { + requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.GET, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters) + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration) + requestInfo.Headers.TryAdd("Accept", "application/json") + return requestInfo, nil +} +// WithUrl returns a request builder with the provided arbitrary URL. Using this method means any other path or query parameters are ignored. +// returns a *ItemTeamItemCopilotUsageRequestBuilder when successful +func (m *ItemTeamItemCopilotUsageRequestBuilder) WithUrl(rawUrl string)(*ItemTeamItemCopilotUsageRequestBuilder) { + return NewItemTeamItemCopilotUsageRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter); +} diff --git a/pkg/github/orgs/item_team_request_builder.go b/pkg/github/orgs/item_team_request_builder.go new file mode 100644 index 00000000..173b4f23 --- /dev/null +++ b/pkg/github/orgs/item_team_request_builder.go @@ -0,0 +1,35 @@ +package orgs + +import ( + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// ItemTeamRequestBuilder builds and executes requests for operations under \orgs\{org}\team +type ItemTeamRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// ByTeam_slug gets an item from the github.com/octokit/go-sdk/pkg/github/.orgs.item.team.item collection +// returns a *ItemTeamWithTeam_slugItemRequestBuilder when successful +func (m *ItemTeamRequestBuilder) ByTeam_slug(team_slug string)(*ItemTeamWithTeam_slugItemRequestBuilder) { + urlTplParams := make(map[string]string) + for idx, item := range m.BaseRequestBuilder.PathParameters { + urlTplParams[idx] = item + } + if team_slug != "" { + urlTplParams["team_slug"] = team_slug + } + return NewItemTeamWithTeam_slugItemRequestBuilderInternal(urlTplParams, m.BaseRequestBuilder.RequestAdapter) +} +// NewItemTeamRequestBuilderInternal instantiates a new ItemTeamRequestBuilder and sets the default values. +func NewItemTeamRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamRequestBuilder) { + m := &ItemTeamRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/team", pathParameters), + } + return m +} +// NewItemTeamRequestBuilder instantiates a new ItemTeamRequestBuilder and sets the default values. +func NewItemTeamRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemTeamRequestBuilderInternal(urlParams, requestAdapter) +} diff --git a/pkg/github/orgs/item_team_with_team_slug_item_request_builder.go b/pkg/github/orgs/item_team_with_team_slug_item_request_builder.go new file mode 100644 index 00000000..744397dd --- /dev/null +++ b/pkg/github/orgs/item_team_with_team_slug_item_request_builder.go @@ -0,0 +1,28 @@ +package orgs + +import ( + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go" +) + +// ItemTeamWithTeam_slugItemRequestBuilder builds and executes requests for operations under \orgs\{org}\team\{team_slug} +type ItemTeamWithTeam_slugItemRequestBuilder struct { + i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder +} +// NewItemTeamWithTeam_slugItemRequestBuilderInternal instantiates a new ItemTeamWithTeam_slugItemRequestBuilder and sets the default values. +func NewItemTeamWithTeam_slugItemRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamWithTeam_slugItemRequestBuilder) { + m := &ItemTeamWithTeam_slugItemRequestBuilder{ + BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/orgs/{org}/team/{team_slug}", pathParameters), + } + return m +} +// NewItemTeamWithTeam_slugItemRequestBuilder instantiates a new ItemTeamWithTeam_slugItemRequestBuilder and sets the default values. +func NewItemTeamWithTeam_slugItemRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemTeamWithTeam_slugItemRequestBuilder) { + urlParams := make(map[string]string) + urlParams["request-raw-url"] = rawUrl + return NewItemTeamWithTeam_slugItemRequestBuilderInternal(urlParams, requestAdapter) +} +// Copilot the copilot property +// returns a *ItemTeamItemCopilotRequestBuilder when successful +func (m *ItemTeamWithTeam_slugItemRequestBuilder) Copilot()(*ItemTeamItemCopilotRequestBuilder) { + return NewItemTeamItemCopilotRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} diff --git a/pkg/github/orgs/with_org_item_request_builder.go b/pkg/github/orgs/with_org_item_request_builder.go index e4a68c1b..20315215 100644 --- a/pkg/github/orgs/with_org_item_request_builder.go +++ b/pkg/github/orgs/with_org_item_request_builder.go @@ -271,6 +271,11 @@ func (m *WithOrgItemRequestBuilder) SecurityManagers()(*ItemSecurityManagersRequ func (m *WithOrgItemRequestBuilder) Settings()(*ItemSettingsRequestBuilder) { return NewItemSettingsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) } +// Team the team property +// returns a *ItemTeamRequestBuilder when successful +func (m *WithOrgItemRequestBuilder) Team()(*ItemTeamRequestBuilder) { + return NewItemTeamRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter) +} // Teams the teams property // returns a *ItemTeamsRequestBuilder when successful func (m *WithOrgItemRequestBuilder) Teams()(*ItemTeamsRequestBuilder) {