Skip to content

Commit

Permalink
fix(discovery-v1): update status from string to StatusDetails
Browse files Browse the repository at this point in the history
  • Loading branch information
nan2iz committed Sep 13, 2021
1 parent 12ef233 commit c39d890
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 46 deletions.
28 changes: 12 additions & 16 deletions src/IBM.Watson.Discovery.v1/DiscoveryService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2017, 2021.
* (C) Copyright IBM Corp. 2021.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,7 +16,7 @@
*/

/**
* IBM OpenAPI SDK Code Generator Version: 3.38.0-07189efd-20210827-205025
* IBM OpenAPI SDK Code Generator Version: 99-SNAPSHOT-07189efd-20210907-091205
*/

using System.Collections.Generic;
Expand Down Expand Up @@ -4566,12 +4566,10 @@ public DetailedResponse<CredentialsList> ListCredentials(string environmentId)
/// <param name="credentialDetails">Object containing details of the stored credentials.
///
/// Obtain credentials for your source from the administrator of the source. (optional)</param>
/// <param name="status">The current status of this set of credentials. `connected` indicates that the
/// credentials are available to use with the source configuration of a collection. `invalid` refers to the
/// credentials (for example, the password provided has expired) and must be corrected before they can be used
/// with a collection. (optional)</param>
/// <param name="status">Object that contains details about the status of the authentication process.
/// (optional)</param>
/// <returns><see cref="Credentials" />Credentials</returns>
public DetailedResponse<Credentials> CreateCredentials(string environmentId, string sourceType = null, CredentialDetails credentialDetails = null, string status = null)
public DetailedResponse<Credentials> CreateCredentials(string environmentId, string sourceType = null, CredentialDetails credentialDetails = null, StatusDetails status = null)
{
if (string.IsNullOrEmpty(Version))
{
Expand Down Expand Up @@ -4610,9 +4608,9 @@ public DetailedResponse<Credentials> CreateCredentials(string environmentId, str
{
bodyObject["credential_details"] = JToken.FromObject(credentialDetails);
}
if (!string.IsNullOrEmpty(status))
if (status != null)
{
bodyObject["status"] = status;
bodyObject["status"] = JToken.FromObject(status);
}
var httpContent = new StringContent(JsonConvert.SerializeObject(bodyObject), Encoding.UTF8, HttpMediaType.APPLICATION_JSON);
restRequest.WithBodyContent(httpContent);
Expand Down Expand Up @@ -4720,12 +4718,10 @@ public DetailedResponse<Credentials> GetCredentials(string environmentId, string
/// <param name="credentialDetails">Object containing details of the stored credentials.
///
/// Obtain credentials for your source from the administrator of the source. (optional)</param>
/// <param name="status">The current status of this set of credentials. `connected` indicates that the
/// credentials are available to use with the source configuration of a collection. `invalid` refers to the
/// credentials (for example, the password provided has expired) and must be corrected before they can be used
/// with a collection. (optional)</param>
/// <param name="status">Object that contains details about the status of the authentication process.
/// (optional)</param>
/// <returns><see cref="Credentials" />Credentials</returns>
public DetailedResponse<Credentials> UpdateCredentials(string environmentId, string credentialId, string sourceType = null, CredentialDetails credentialDetails = null, string status = null)
public DetailedResponse<Credentials> UpdateCredentials(string environmentId, string credentialId, string sourceType = null, CredentialDetails credentialDetails = null, StatusDetails status = null)
{
if (string.IsNullOrEmpty(Version))
{
Expand Down Expand Up @@ -4772,9 +4768,9 @@ public DetailedResponse<Credentials> UpdateCredentials(string environmentId, str
{
bodyObject["credential_details"] = JToken.FromObject(credentialDetails);
}
if (!string.IsNullOrEmpty(status))
if (status != null)
{
bodyObject["status"] = status;
bodyObject["status"] = JToken.FromObject(status);
}
var httpContent = new StringContent(JsonConvert.SerializeObject(bodyObject), Encoding.UTF8, HttpMediaType.APPLICATION_JSON);
restRequest.WithBodyContent(httpContent);
Expand Down
6 changes: 3 additions & 3 deletions src/IBM.Watson.Discovery.v1/IDiscoveryService.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2017, 2019.
* (C) Copyright IBM Corp. 2021.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -79,9 +79,9 @@ public partial interface IDiscoveryService
DetailedResponse<MetricResponse> GetMetricsEventRate(DateTime? startTime = null, DateTime? endTime = null, string resultType = null);
DetailedResponse<MetricTokenResponse> GetMetricsQueryTokenEvent(long? count = null);
DetailedResponse<CredentialsList> ListCredentials(string environmentId);
DetailedResponse<Credentials> CreateCredentials(string environmentId, string sourceType = null, CredentialDetails credentialDetails = null, string status = null);
DetailedResponse<Credentials> CreateCredentials(string environmentId, string sourceType = null, CredentialDetails credentialDetails = null, StatusDetails status = null);
DetailedResponse<Credentials> GetCredentials(string environmentId, string credentialId);
DetailedResponse<Credentials> UpdateCredentials(string environmentId, string credentialId, string sourceType = null, CredentialDetails credentialDetails = null, string status = null);
DetailedResponse<Credentials> UpdateCredentials(string environmentId, string credentialId, string sourceType = null, CredentialDetails credentialDetails = null, StatusDetails status = null);
DetailedResponse<DeleteCredentials> DeleteCredentials(string environmentId, string credentialId);
DetailedResponse<GatewayList> ListGateways(string environmentId);
DetailedResponse<Gateway> CreateGateway(string environmentId, string name = null);
Expand Down
33 changes: 6 additions & 27 deletions src/IBM.Watson.Discovery.v1/Model/Credentials.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* (C) Copyright IBM Corp. 2018, 2019.
* (C) Copyright IBM Corp. 2021.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -57,24 +57,6 @@ public class SourceTypeEnumValue

}

/// <summary>
/// The current status of this set of credentials. `connected` indicates that the credentials are available to
/// use with the source configuration of a collection. `invalid` refers to the credentials (for example, the
/// password provided has expired) and must be corrected before they can be used with a collection.
/// </summary>
public class StatusEnumValue
{
/// <summary>
/// Constant CONNECTED for connected
/// </summary>
public const string CONNECTED = "connected";
/// <summary>
/// Constant INVALID for invalid
/// </summary>
public const string INVALID = "invalid";

}

/// <summary>
/// The source that this credentials object connects to.
/// - `box` indicates the credentials are used to connect an instance of Enterprise Box.
Expand All @@ -87,14 +69,6 @@ public class StatusEnumValue
[JsonProperty("source_type", NullValueHandling = NullValueHandling.Ignore)]
public string SourceType { get; set; }
/// <summary>
/// The current status of this set of credentials. `connected` indicates that the credentials are available to
/// use with the source configuration of a collection. `invalid` refers to the credentials (for example, the
/// password provided has expired) and must be corrected before they can be used with a collection.
/// Constants for possible values can be found using Credentials.StatusEnumValue
/// </summary>
[JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)]
public string Status { get; set; }
/// <summary>
/// Unique identifier for this set of credentials.
/// </summary>
[JsonProperty("credential_id", NullValueHandling = NullValueHandling.Ignore)]
Expand All @@ -106,6 +80,11 @@ public class StatusEnumValue
/// </summary>
[JsonProperty("credential_details", NullValueHandling = NullValueHandling.Ignore)]
public CredentialDetails CredentialDetails { get; set; }
/// <summary>
/// Object that contains details about the status of the authentication process.
/// </summary>
[JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)]
public StatusDetails Status { get; set; }
}

}
39 changes: 39 additions & 0 deletions src/IBM.Watson.Discovery.v1/Model/StatusDetails.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/**
* (C) Copyright IBM Corp. 2021.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

using Newtonsoft.Json;

namespace IBM.Watson.Discovery.v1.Model
{
/// <summary>
/// Object that contains details about the status of the authentication process.
/// </summary>
public class StatusDetails
{
/// <summary>
/// Indicates whether the credential is accepted by the target data source.
/// </summary>
[JsonProperty("authentication", NullValueHandling = NullValueHandling.Ignore)]
public bool? Authentication { get; set; }
/// <summary>
/// If `authentication` is `false`, a message describes why the authentication was unsuccessful.
/// </summary>
[JsonProperty("error_message", NullValueHandling = NullValueHandling.Ignore)]
public string ErrorMessage { get; set; }
}

}

0 comments on commit c39d890

Please sign in to comment.