diff --git a/algolia/ingestion/model_auth_input.go b/algolia/ingestion/model_auth_input.go index 650f0a6a3..8b7756c4d 100644 --- a/algolia/ingestion/model_auth_input.go +++ b/algolia/ingestion/model_auth_input.go @@ -16,6 +16,7 @@ type AuthInput struct { AuthBasic *AuthBasic AuthGoogleServiceAccount *AuthGoogleServiceAccount AuthOAuth *AuthOAuth + MapmapOfStringstring *map[string]string } // AuthOAuthAsAuthInput is a convenience function that returns AuthOAuth wrapped in AuthInput. @@ -60,6 +61,13 @@ func AuthAlgoliaInsightsAsAuthInput(v *AuthAlgoliaInsights) *AuthInput { } } +// map[string]stringAsAuthInput is a convenience function that returns map[string]string wrapped in AuthInput. +func MapmapOfStringstringAsAuthInput(v map[string]string) *AuthInput { + return &AuthInput{ + MapmapOfStringstring: &v, + } +} + // Unmarshal JSON data into one of the pointers in the struct. func (dst *AuthInput) UnmarshalJSON(data []byte) error { var err error @@ -116,6 +124,13 @@ func (dst *AuthInput) UnmarshalJSON(data []byte) error { } else { dst.AuthAlgoliaInsights = nil } + // try to unmarshal data into MapmapOfStringstring + err = newStrictDecoder(data).Decode(&dst.MapmapOfStringstring) + if err == nil && validateStruct(dst.MapmapOfStringstring) == nil { + return nil // found the correct type + } else { + dst.MapmapOfStringstring = nil + } return fmt.Errorf("Data failed to match schemas in oneOf(AuthInput)") } @@ -176,6 +191,15 @@ func (src AuthInput) MarshalJSON() ([]byte, error) { return serialized, nil } + if src.MapmapOfStringstring != nil { + serialized, err := json.Marshal(&src.MapmapOfStringstring) + if err != nil { + return nil, fmt.Errorf("failed to unmarshal one of MapmapOfStringstring of AuthInput: %w", err) + } + + return serialized, nil + } + return nil, nil // no data in oneOf schemas } @@ -205,6 +229,10 @@ func (obj AuthInput) GetActualInstance() any { return *obj.AuthOAuth } + if obj.MapmapOfStringstring != nil { + return *obj.MapmapOfStringstring + } + // all schemas are nil return nil } diff --git a/algolia/ingestion/model_authentication_type.go b/algolia/ingestion/model_authentication_type.go index 6dedd29e3..1c4c4ff11 100644 --- a/algolia/ingestion/model_authentication_type.go +++ b/algolia/ingestion/model_authentication_type.go @@ -17,6 +17,7 @@ const ( AUTHENTICATION_TYPE_OAUTH AuthenticationType = "oauth" AUTHENTICATION_TYPE_ALGOLIA AuthenticationType = "algolia" AUTHENTICATION_TYPE_ALGOLIA_INSIGHTS AuthenticationType = "algoliaInsights" + AUTHENTICATION_TYPE_SECRETS AuthenticationType = "secrets" ) // All allowed values of AuthenticationType enum. @@ -27,6 +28,7 @@ var AllowedAuthenticationTypeEnumValues = []AuthenticationType{ "oauth", "algolia", "algoliaInsights", + "secrets", } func (v *AuthenticationType) UnmarshalJSON(src []byte) error {