Skip to content

Commit

Permalink
feat: CoPilot billing seats and code security configuration (#80)
Browse files Browse the repository at this point in the history
* New updates to generated code

* New updates to generated code

---------

Co-authored-by: Octokit Bot <octokitbot@martynus.net>
  • Loading branch information
octokitbot and Octokit Bot committed Jun 21, 2024
1 parent 8df3016 commit 7210feb
Show file tree
Hide file tree
Showing 53 changed files with 3,219 additions and 1 deletion.
28 changes: 28 additions & 0 deletions pkg/github/enterprises/item_copilot_billing_request_builder.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package enterprises

import (
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
)

// ItemCopilotBillingRequestBuilder builds and executes requests for operations under \enterprises\{enterprise}\copilot\billing
type ItemCopilotBillingRequestBuilder struct {
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder
}
// NewItemCopilotBillingRequestBuilderInternal instantiates a new ItemCopilotBillingRequestBuilder and sets the default values.
func NewItemCopilotBillingRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingRequestBuilder) {
m := &ItemCopilotBillingRequestBuilder{
BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot/billing", pathParameters),
}
return m
}
// NewItemCopilotBillingRequestBuilder instantiates a new ItemCopilotBillingRequestBuilder and sets the default values.
func NewItemCopilotBillingRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingRequestBuilder) {
urlParams := make(map[string]string)
urlParams["request-raw-url"] = rawUrl
return NewItemCopilotBillingRequestBuilderInternal(urlParams, requestAdapter)
}
// Seats the seats property
// returns a *ItemCopilotBillingSeatsRequestBuilder when successful
func (m *ItemCopilotBillingRequestBuilder) Seats()(*ItemCopilotBillingSeatsRequestBuilder) {
return NewItemCopilotBillingSeatsRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
}
122 changes: 122 additions & 0 deletions pkg/github/enterprises/item_copilot_billing_seats_get_response.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
package enterprises

import (
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91 "github.com/microsoft/kiota-abstractions-go/serialization"
i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models"
)

type ItemCopilotBillingSeatsGetResponse struct {
// Stores additional data not described in the OpenAPI description found when deserializing. Can be used for serialization as well.
additionalData map[string]any
// The seats property
seats []i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable
// Total number of Copilot seats for the organization currently being billed.
total_seats *int32
}
// NewItemCopilotBillingSeatsGetResponse instantiates a new ItemCopilotBillingSeatsGetResponse and sets the default values.
func NewItemCopilotBillingSeatsGetResponse()(*ItemCopilotBillingSeatsGetResponse) {
m := &ItemCopilotBillingSeatsGetResponse{
}
m.SetAdditionalData(make(map[string]any))
return m
}
// CreateItemCopilotBillingSeatsGetResponseFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreateItemCopilotBillingSeatsGetResponseFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewItemCopilotBillingSeatsGetResponse(), nil
}
// 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 *ItemCopilotBillingSeatsGetResponse) GetAdditionalData()(map[string]any) {
return m.additionalData
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *ItemCopilotBillingSeatsGetResponse) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))
res["seats"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CreateCopilotSeatDetailsFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable, len(val))
for i, v := range val {
if v != nil {
res[i] = v.(i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable)
}
}
m.SetSeats(res)
}
return nil
}
res["total_seats"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetInt32Value()
if err != nil {
return err
}
if val != nil {
m.SetTotalSeats(val)
}
return nil
}
return res
}
// GetSeats gets the seats property value. The seats property
// returns a []CopilotSeatDetailsable when successful
func (m *ItemCopilotBillingSeatsGetResponse) GetSeats()([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable) {
return m.seats
}
// GetTotalSeats gets the total_seats property value. Total number of Copilot seats for the organization currently being billed.
// returns a *int32 when successful
func (m *ItemCopilotBillingSeatsGetResponse) GetTotalSeats()(*int32) {
return m.total_seats
}
// Serialize serializes information the current object
func (m *ItemCopilotBillingSeatsGetResponse) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
if m.GetSeats() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetSeats()))
for i, v := range m.GetSeats() {
if v != nil {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
}
err := writer.WriteCollectionOfObjectValues("seats", cast)
if err != nil {
return err
}
}
{
err := writer.WriteInt32Value("total_seats", m.GetTotalSeats())
if err != nil {
return err
}
}
{
err := writer.WriteAdditionalData(m.GetAdditionalData())
if err != nil {
return err
}
}
return nil
}
// 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 *ItemCopilotBillingSeatsGetResponse) SetAdditionalData(value map[string]any)() {
m.additionalData = value
}
// SetSeats sets the seats property value. The seats property
func (m *ItemCopilotBillingSeatsGetResponse) SetSeats(value []i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable)() {
m.seats = value
}
// SetTotalSeats sets the total_seats property value. Total number of Copilot seats for the organization currently being billed.
func (m *ItemCopilotBillingSeatsGetResponse) SetTotalSeats(value *int32)() {
m.total_seats = value
}
type ItemCopilotBillingSeatsGetResponseable interface {
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
GetSeats()([]i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable)
GetTotalSeats()(*int32)
SetSeats(value []i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6.CopilotSeatDetailsable)()
SetTotalSeats(value *int32)()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package enterprises

import (
"context"
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f "github.com/microsoft/kiota-abstractions-go"
i59ea7d99994c6a4bb9ef742ed717844297d055c7fd3742131406eea67a6404b6 "github.com/octokit/go-sdk/pkg/github/models"
)

// ItemCopilotBillingSeatsRequestBuilder builds and executes requests for operations under \enterprises\{enterprise}\copilot\billing\seats
type ItemCopilotBillingSeatsRequestBuilder struct {
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder
}
// ItemCopilotBillingSeatsRequestBuilderGetQueryParameters **Note**: This endpoint is in beta and is subject to change.Lists all active Copilot seats across organizations or enterprise teams for an enterprise with a Copilot Business or Copilot Enterprise subscription.Only enterprise owners and billing managers can view assigned Copilot seats across their child organizations or enterprise teams.Personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
type ItemCopilotBillingSeatsRequestBuilderGetQueryParameters 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 results per page (max 100). 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"`
}
// NewItemCopilotBillingSeatsRequestBuilderInternal instantiates a new ItemCopilotBillingSeatsRequestBuilder and sets the default values.
func NewItemCopilotBillingSeatsRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingSeatsRequestBuilder) {
m := &ItemCopilotBillingSeatsRequestBuilder{
BaseRequestBuilder: *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewBaseRequestBuilder(requestAdapter, "{+baseurl}/enterprises/{enterprise}/copilot/billing/seats{?page*,per_page*}", pathParameters),
}
return m
}
// NewItemCopilotBillingSeatsRequestBuilder instantiates a new ItemCopilotBillingSeatsRequestBuilder and sets the default values.
func NewItemCopilotBillingSeatsRequestBuilder(rawUrl string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotBillingSeatsRequestBuilder) {
urlParams := make(map[string]string)
urlParams["request-raw-url"] = rawUrl
return NewItemCopilotBillingSeatsRequestBuilderInternal(urlParams, requestAdapter)
}
// Get **Note**: This endpoint is in beta and is subject to change.Lists all active Copilot seats across organizations or enterprise teams for an enterprise with a Copilot Business or Copilot Enterprise subscription.Only enterprise owners and billing managers can view assigned Copilot seats across their child organizations or enterprise teams.Personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
// returns a ItemCopilotBillingSeatsGetResponseable 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-user-management#list-all-copilot-seat-assignments-for-an-enterprise
func (m *ItemCopilotBillingSeatsRequestBuilder) Get(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotBillingSeatsRequestBuilderGetQueryParameters])(ItemCopilotBillingSeatsGetResponseable, 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.Send(ctx, requestInfo, CreateItemCopilotBillingSeatsGetResponseFromDiscriminatorValue, errorMapping)
if err != nil {
return nil, err
}
if res == nil {
return nil, nil
}
return res.(ItemCopilotBillingSeatsGetResponseable), nil
}
// ToGetRequestInformation **Note**: This endpoint is in beta and is subject to change.Lists all active Copilot seats across organizations or enterprise teams for an enterprise with a Copilot Business or Copilot Enterprise subscription.Only enterprise owners and billing managers can view assigned Copilot seats across their child organizations or enterprise teams.Personal access tokens (classic) need either the `manage_billing:copilot` or `read:enterprise` scopes to use this endpoint.
// returns a *RequestInformation when successful
func (m *ItemCopilotBillingSeatsRequestBuilder) ToGetRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[ItemCopilotBillingSeatsRequestBuilderGetQueryParameters])(*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 *ItemCopilotBillingSeatsRequestBuilder when successful
func (m *ItemCopilotBillingSeatsRequestBuilder) WithUrl(rawUrl string)(*ItemCopilotBillingSeatsRequestBuilder) {
return NewItemCopilotBillingSeatsRequestBuilder(rawUrl, m.BaseRequestBuilder.RequestAdapter);
}
5 changes: 5 additions & 0 deletions pkg/github/enterprises/item_copilot_request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import (
type ItemCopilotRequestBuilder struct {
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.BaseRequestBuilder
}
// Billing the billing property
// returns a *ItemCopilotBillingRequestBuilder when successful
func (m *ItemCopilotRequestBuilder) Billing()(*ItemCopilotBillingRequestBuilder) {
return NewItemCopilotBillingRequestBuilderInternal(m.BaseRequestBuilder.PathParameters, m.BaseRequestBuilder.RequestAdapter)
}
// NewItemCopilotRequestBuilderInternal instantiates a new ItemCopilotRequestBuilder and sets the default values.
func NewItemCopilotRequestBuilderInternal(pathParameters map[string]string, requestAdapter i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestAdapter)(*ItemCopilotRequestBuilder) {
m := &ItemCopilotRequestBuilder{
Expand Down
2 changes: 1 addition & 1 deletion pkg/github/kiota-lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"descriptionHash": "CC651E4ACEA89E310D94E680A9C5DA642585F6E64A62690EF521FEC32645CFF020BE50EDD35878C18D66BD61A8E735804C69FA02094A6F459E02BBFC1AF46C6E",
"descriptionHash": "524B7995C3F724FBD5311CE721AFE148291ACD56B5B0A77B7A38BD87C4ABB7861406A0A812CBC457F589E9F17D1493533C0EDCA1A7CC6A587DADAB2A2E2BF9DE",
"descriptionLocation": "../../../../schemas/downloaded.json",
"lockFileVersion": "1.0.0",
"kiotaVersion": "1.14.0",
Expand Down
Loading

0 comments on commit 7210feb

Please sign in to comment.