-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Octokit Bot
committed
Apr 24, 2024
1 parent
48c0de2
commit 6df966e
Showing
13 changed files
with
968 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |
81 changes: 81 additions & 0 deletions
81
pkg/github/enterprises/item_copilot_usage_request_builder.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.