Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add include data to get team memberships response #2407

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.6",
"regenerated": "2024-03-19 16:19:43.241047",
"spec_repo_commit": "a75cff58"
"regenerated": "2024-03-19 19:35:54.308091",
"spec_repo_commit": "a7489f2d"
},
"v2": {
"apigentools_version": "1.6.6",
"regenerated": "2024-03-19 16:19:43.259192",
"spec_repo_commit": "a75cff58"
"regenerated": "2024-03-19 19:35:54.325591",
"spec_repo_commit": "a7489f2d"
}
}
}
5 changes: 5 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22320,6 +22320,11 @@ components:
items:
$ref: '#/components/schemas/UserTeam'
type: array
included:
description: Resources related to the team memberships
items:
$ref: '#/components/schemas/UserTeamIncluded'
type: array
links:
$ref: '#/components/schemas/TeamsResponseLinks'
meta:
Expand Down
43 changes: 39 additions & 4 deletions api/datadogV2/model_user_teams_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import (
type UserTeamsResponse struct {
// Team memberships response data
Data []UserTeam `json:"data,omitempty"`
// Resources related to the team memberships
Included []UserTeamIncluded `json:"included,omitempty"`
// Teams response links.
Links *TeamsResponseLinks `json:"links,omitempty"`
// Teams response metadata.
Expand Down Expand Up @@ -66,6 +68,34 @@ func (o *UserTeamsResponse) SetData(v []UserTeam) {
o.Data = v
}

// GetIncluded returns the Included field value if set, zero value otherwise.
func (o *UserTeamsResponse) GetIncluded() []UserTeamIncluded {
if o == nil || o.Included == nil {
var ret []UserTeamIncluded
return ret
}
return o.Included
}

// GetIncludedOk returns a tuple with the Included field value if set, nil otherwise
// and a boolean to check if the value has been set.
func (o *UserTeamsResponse) GetIncludedOk() (*[]UserTeamIncluded, bool) {
if o == nil || o.Included == nil {
return nil, false
}
return &o.Included, true
}

// HasIncluded returns a boolean if a field has been set.
func (o *UserTeamsResponse) HasIncluded() bool {
return o != nil && o.Included != nil
}

// SetIncluded gets a reference to the given []UserTeamIncluded and assigns it to the Included field.
func (o *UserTeamsResponse) SetIncluded(v []UserTeamIncluded) {
o.Included = v
}

// GetLinks returns the Links field value if set, zero value otherwise.
func (o *UserTeamsResponse) GetLinks() TeamsResponseLinks {
if o == nil || o.Links == nil {
Expand Down Expand Up @@ -131,6 +161,9 @@ func (o UserTeamsResponse) MarshalJSON() ([]byte, error) {
if o.Data != nil {
toSerialize["data"] = o.Data
}
if o.Included != nil {
toSerialize["included"] = o.Included
}
if o.Links != nil {
toSerialize["links"] = o.Links
}
Expand All @@ -147,22 +180,24 @@ func (o UserTeamsResponse) MarshalJSON() ([]byte, error) {
// UnmarshalJSON deserializes the given payload.
func (o *UserTeamsResponse) UnmarshalJSON(bytes []byte) (err error) {
all := struct {
Data []UserTeam `json:"data,omitempty"`
Links *TeamsResponseLinks `json:"links,omitempty"`
Meta *TeamsResponseMeta `json:"meta,omitempty"`
Data []UserTeam `json:"data,omitempty"`
Included []UserTeamIncluded `json:"included,omitempty"`
Links *TeamsResponseLinks `json:"links,omitempty"`
Meta *TeamsResponseMeta `json:"meta,omitempty"`
}{}
if err = datadog.Unmarshal(bytes, &all); err != nil {
return datadog.Unmarshal(bytes, &o.UnparsedObject)
}
additionalProperties := make(map[string]interface{})
if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil {
datadog.DeleteKeys(additionalProperties, &[]string{"data", "links", "meta"})
datadog.DeleteKeys(additionalProperties, &[]string{"data", "included", "links", "meta"})
} else {
return err
}

hasInvalidField := false
o.Data = all.Data
o.Included = all.Included
if all.Links != nil && all.Links.UnparsedObject != nil && o.UnparsedObject == nil {
hasInvalidField = true
}
Expand Down
Loading