Skip to content

Commit

Permalink
New updates to generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
octokitbot committed Dec 12, 2024
1 parent 82d67e3 commit d75347c
Show file tree
Hide file tree
Showing 35 changed files with 4,611 additions and 2,737 deletions.
4,856 changes: 2,465 additions & 2,391 deletions pkg/github/.kiota.log

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package item
// The target of the ruleset
type WithRuleset_PutRequestBody_target int

const (
BRANCH_WITHRULESET_PUTREQUESTBODY_TARGET WithRuleset_PutRequestBody_target = iota
TAG_WITHRULESET_PUTREQUESTBODY_TARGET
PUSH_WITHRULESET_PUTREQUESTBODY_TARGET
REPOSITORY_WITHRULESET_PUTREQUESTBODY_TARGET
)

func (i WithRuleset_PutRequestBody_target) String() string {
return []string{"branch", "tag", "push", "repository"}[i]
}
func ParseWithRuleset_PutRequestBody_target(v string) (any, error) {
result := BRANCH_WITHRULESET_PUTREQUESTBODY_TARGET
switch v {
case "branch":
result = BRANCH_WITHRULESET_PUTREQUESTBODY_TARGET
case "tag":
result = TAG_WITHRULESET_PUTREQUESTBODY_TARGET
case "push":
result = PUSH_WITHRULESET_PUTREQUESTBODY_TARGET
case "repository":
result = REPOSITORY_WITHRULESET_PUTREQUESTBODY_TARGET
default:
return nil, nil
}
return &result, nil
}
func SerializeWithRuleset_PutRequestBody_target(values []WithRuleset_PutRequestBody_target) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i WithRuleset_PutRequestBody_target) isMultiValue() bool {
return false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package rulesets
// The target of the ruleset
type RulesetsPostRequestBody_target int

const (
BRANCH_RULESETSPOSTREQUESTBODY_TARGET RulesetsPostRequestBody_target = iota
TAG_RULESETSPOSTREQUESTBODY_TARGET
PUSH_RULESETSPOSTREQUESTBODY_TARGET
REPOSITORY_RULESETSPOSTREQUESTBODY_TARGET
)

func (i RulesetsPostRequestBody_target) String() string {
return []string{"branch", "tag", "push", "repository"}[i]
}
func ParseRulesetsPostRequestBody_target(v string) (any, error) {
result := BRANCH_RULESETSPOSTREQUESTBODY_TARGET
switch v {
case "branch":
result = BRANCH_RULESETSPOSTREQUESTBODY_TARGET
case "tag":
result = TAG_RULESETSPOSTREQUESTBODY_TARGET
case "push":
result = PUSH_RULESETSPOSTREQUESTBODY_TARGET
case "repository":
result = REPOSITORY_RULESETSPOSTREQUESTBODY_TARGET
default:
return nil, nil
}
return &result, nil
}
func SerializeRulesetsPostRequestBody_target(values []RulesetsPostRequestBody_target) []string {
result := make([]string, len(values))
for i, v := range values {
result[i] = v.String()
}
return result
}
func (i RulesetsPostRequestBody_target) isMultiValue() bool {
return false
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ func (m *ItemPropertiesSchemaWithCustom_property_nameItemRequestBuilder) Get(ctx
// [API method documentation]
//
// [API method documentation]: https://docs.github.com/enterprise-cloud@latest//rest/enterprise-admin/custom-properties#create-or-update-a-custom-property-for-an-enterprise
func (m *ItemPropertiesSchemaWithCustom_property_nameItemRequestBuilder) Put(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.CustomPropertyable, error) {
requestInfo, err := m.ToPutRequestInformation(ctx, requestConfiguration);
func (m *ItemPropertiesSchemaWithCustom_property_nameItemRequestBuilder) Put(ctx context.Context, body i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.CustomPropertySetPayloadable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.CustomPropertyable, error) {
requestInfo, err := m.ToPutRequestInformation(ctx, body, requestConfiguration);
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -112,10 +112,14 @@ func (m *ItemPropertiesSchemaWithCustom_property_nameItemRequestBuilder) ToGetRe
}
// ToPutRequestInformation > [!NOTE]> This endpoint is in public preview and is subject to change.Creates a new or updates an existing custom property that is defined for an enterprise.To use this endpoint, the authenticated user must be an administrator for the enterprise.
// returns a *RequestInformation when successful
func (m *ItemPropertiesSchemaWithCustom_property_nameItemRequestBuilder) ToPutRequestInformation(ctx context.Context, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {
func (m *ItemPropertiesSchemaWithCustom_property_nameItemRequestBuilder) ToPutRequestInformation(ctx context.Context, body i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.CustomPropertySetPayloadable, requestConfiguration *i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestConfiguration[i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.DefaultQueryParameters])(*i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.RequestInformation, error) {
requestInfo := i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.NewRequestInformationWithMethodAndUrlTemplateAndPathParameters(i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.PUT, m.BaseRequestBuilder.UrlTemplate, m.BaseRequestBuilder.PathParameters)
i2ae4187f7daee263371cb1c977df639813ab50ffa529013b7437480d1ec0158f.ConfigureRequestInformation(requestInfo, requestConfiguration)
requestInfo.Headers.TryAdd("Accept", "application/json")
err := requestInfo.SetContentFromParsable(ctx, m.BaseRequestBuilder.RequestAdapter, "application/json", body)
if err != nil {
return nil, err
}
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.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
package enterprises

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

type ItemRulesetsItemWithRuleset_PutRequestBody 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 actors that can bypass the rules in this ruleset
bypass_actors []i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRulesetBypassActorable
// Conditions for an enterprise ruleset. The conditions object should contain either the `organization_id` or `organization_name` property and the `repository_name` or `repository_property` property. For branch and tag rulesets, the conditions object should also contain the `ref_name` property.
conditions i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.EnterpriseRulesetConditionsable
// The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page. `evaluate` is not available for the `repository` target.
enforcement *i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleEnforcement
// The name of the ruleset.
name *string
// An array of rules within the ruleset.
rules []i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleable
}
// NewItemRulesetsItemWithRuleset_PutRequestBody instantiates a new ItemRulesetsItemWithRuleset_PutRequestBody and sets the default values.
func NewItemRulesetsItemWithRuleset_PutRequestBody()(*ItemRulesetsItemWithRuleset_PutRequestBody) {
m := &ItemRulesetsItemWithRuleset_PutRequestBody{
}
m.SetAdditionalData(make(map[string]any))
return m
}
// CreateItemRulesetsItemWithRuleset_PutRequestBodyFromDiscriminatorValue creates a new instance of the appropriate class based on discriminator value
// returns a Parsable when successful
func CreateItemRulesetsItemWithRuleset_PutRequestBodyFromDiscriminatorValue(parseNode i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, error) {
return NewItemRulesetsItemWithRuleset_PutRequestBody(), 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 *ItemRulesetsItemWithRuleset_PutRequestBody) GetAdditionalData()(map[string]any) {
return m.additionalData
}
// GetBypassActors gets the bypass_actors property value. The actors that can bypass the rules in this ruleset
// returns a []RepositoryRulesetBypassActorable when successful
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) GetBypassActors()([]i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRulesetBypassActorable) {
return m.bypass_actors
}
// GetConditions gets the conditions property value. Conditions for an enterprise ruleset. The conditions object should contain either the `organization_id` or `organization_name` property and the `repository_name` or `repository_property` property. For branch and tag rulesets, the conditions object should also contain the `ref_name` property.
// returns a EnterpriseRulesetConditionsable when successful
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) GetConditions()(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.EnterpriseRulesetConditionsable) {
return m.conditions
}
// GetEnforcement gets the enforcement property value. The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page. `evaluate` is not available for the `repository` target.
// returns a *RepositoryRuleEnforcement when successful
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) GetEnforcement()(*i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleEnforcement) {
return m.enforcement
}
// GetFieldDeserializers the deserialization information for the current model
// returns a map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error) when successful
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) GetFieldDeserializers()(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error)) {
res := make(map[string]func(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode)(error))
res["bypass_actors"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.CreateRepositoryRulesetBypassActorFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRulesetBypassActorable, len(val))
for i, v := range val {
if v != nil {
res[i] = v.(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRulesetBypassActorable)
}
}
m.SetBypassActors(res)
}
return nil
}
res["conditions"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetObjectValue(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.CreateEnterpriseRulesetConditionsFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
m.SetConditions(val.(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.EnterpriseRulesetConditionsable))
}
return nil
}
res["enforcement"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetEnumValue(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.ParseRepositoryRuleEnforcement)
if err != nil {
return err
}
if val != nil {
m.SetEnforcement(val.(*i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleEnforcement))
}
return nil
}
res["name"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetStringValue()
if err != nil {
return err
}
if val != nil {
m.SetName(val)
}
return nil
}
res["rules"] = func (n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
val, err := n.GetCollectionOfObjectValues(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.CreateRepositoryRuleFromDiscriminatorValue)
if err != nil {
return err
}
if val != nil {
res := make([]i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleable, len(val))
for i, v := range val {
if v != nil {
res[i] = v.(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleable)
}
}
m.SetRules(res)
}
return nil
}
return res
}
// GetName gets the name property value. The name of the ruleset.
// returns a *string when successful
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) GetName()(*string) {
return m.name
}
// GetRules gets the rules property value. An array of rules within the ruleset.
// returns a []RepositoryRuleable when successful
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) GetRules()([]i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleable) {
return m.rules
}
// Serialize serializes information the current object
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.SerializationWriter)(error) {
if m.GetBypassActors() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetBypassActors()))
for i, v := range m.GetBypassActors() {
if v != nil {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
}
err := writer.WriteCollectionOfObjectValues("bypass_actors", cast)
if err != nil {
return err
}
}
{
err := writer.WriteObjectValue("conditions", m.GetConditions())
if err != nil {
return err
}
}
if m.GetEnforcement() != nil {
cast := (*m.GetEnforcement()).String()
err := writer.WriteStringValue("enforcement", &cast)
if err != nil {
return err
}
}
{
err := writer.WriteStringValue("name", m.GetName())
if err != nil {
return err
}
}
if m.GetRules() != nil {
cast := make([]i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable, len(m.GetRules()))
for i, v := range m.GetRules() {
if v != nil {
cast[i] = v.(i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable)
}
}
err := writer.WriteCollectionOfObjectValues("rules", cast)
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 *ItemRulesetsItemWithRuleset_PutRequestBody) SetAdditionalData(value map[string]any)() {
m.additionalData = value
}
// SetBypassActors sets the bypass_actors property value. The actors that can bypass the rules in this ruleset
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) SetBypassActors(value []i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRulesetBypassActorable)() {
m.bypass_actors = value
}
// SetConditions sets the conditions property value. Conditions for an enterprise ruleset. The conditions object should contain either the `organization_id` or `organization_name` property and the `repository_name` or `repository_property` property. For branch and tag rulesets, the conditions object should also contain the `ref_name` property.
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) SetConditions(value i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.EnterpriseRulesetConditionsable)() {
m.conditions = value
}
// SetEnforcement sets the enforcement property value. The enforcement level of the ruleset. `evaluate` allows admins to test rules before enforcing them. Admins can view insights on the Rule Insights page. `evaluate` is not available for the `repository` target.
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) SetEnforcement(value *i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleEnforcement)() {
m.enforcement = value
}
// SetName sets the name property value. The name of the ruleset.
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) SetName(value *string)() {
m.name = value
}
// SetRules sets the rules property value. An array of rules within the ruleset.
func (m *ItemRulesetsItemWithRuleset_PutRequestBody) SetRules(value []i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleable)() {
m.rules = value
}
type ItemRulesetsItemWithRuleset_PutRequestBodyable interface {
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.AdditionalDataHolder
i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.Parsable
GetBypassActors()([]i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRulesetBypassActorable)
GetConditions()(i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.EnterpriseRulesetConditionsable)
GetEnforcement()(*i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleEnforcement)
GetName()(*string)
GetRules()([]i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleable)
SetBypassActors(value []i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRulesetBypassActorable)()
SetConditions(value i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.EnterpriseRulesetConditionsable)()
SetEnforcement(value *i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleEnforcement)()
SetName(value *string)()
SetRules(value []i65c45deea5ef786561f9cd3a81f83eacee03df1f39b7b57e269c7f0477b77b5d.RepositoryRuleable)()
}
Loading

0 comments on commit d75347c

Please sign in to comment.