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

Rest Client Upgradation & Interface Segregation #102

Merged
merged 10 commits into from
Feb 4, 2024
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
870 changes: 360 additions & 510 deletions Conductor/Api/ApplicationResourceApi.cs

Large diffs are not rendered by default.

170 changes: 68 additions & 102 deletions Conductor/Api/AuthorizationResourceApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,82 +5,12 @@
using RestSharp;
using Conductor.Client;
using Conductor.Client.Models;
using ThreadTask = System.Threading.Tasks;
using conductor_csharp.Api;

namespace Conductor.Api
{
/// <summary>
/// Represents a collection of functions to interact with the API endpoints
/// </summary>
public interface IAuthorizationResourceApi : IApiAccessor
{
#region Synchronous Operations
/// <summary>
/// Get the access that have been granted over the given object
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="type"></param>
/// <param name="id"></param>
/// <returns>Object</returns>
Object GetPermissions(string type, string id);

/// <summary>
/// Get the access that have been granted over the given object
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="type"></param>
/// <param name="id"></param>
/// <returns>ApiResponse of Object</returns>
ApiResponse<Object> GetPermissionsWithHttpInfo(string type, string id);
/// <summary>
/// Grant access to a user over the target
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body"></param>
/// <returns>Response</returns>
Response GrantPermissions(AuthorizationRequest body);

/// <summary>
/// Grant access to a user over the target
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body"></param>
/// <returns>ApiResponse of Response</returns>
ApiResponse<Response> GrantPermissionsWithHttpInfo(AuthorizationRequest body);
/// <summary>
/// Remove user&#x27;s access over the target
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body"></param>
/// <returns>Response</returns>
Response RemovePermissions(AuthorizationRequest body);

/// <summary>
/// Remove user&#x27;s access over the target
/// </summary>
/// <remarks>
///
/// </remarks>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body"></param>
/// <returns>ApiResponse of Response</returns>
ApiResponse<Response> RemovePermissionsWithHttpInfo(AuthorizationRequest body);
#endregion Synchronous Operations
}

/// <summary>
/// Represents a collection of functions to interact with the API endpoints
Expand Down Expand Up @@ -133,7 +63,7 @@ public AuthorizationResourceApi(Conductor.Client.Configuration configuration = n
/// <value>The base path</value>
public String GetBasePath()
{
return this.Configuration.ApiClient.RestClient.BaseUrl.ToString();
return this.Configuration.ApiClient.RestClient.Options.BaseUrl.ToString();
}

/// <summary>
Expand Down Expand Up @@ -167,7 +97,20 @@ public Conductor.Client.ExceptionFactory ExceptionFactory
/// <returns>Object</returns>
public Object GetPermissions(string type, string id)
{
ApiResponse<Object> localVarResponse = GetPermissionsWithHttpInfo(type, id);
ApiResponse<object> localVarResponse = GetPermissionsWithHttpInfo(type, id);
return localVarResponse.Data;
}

/// <summary>
/// Asynchronous Get the access that have been granted over the given object
/// </summary>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="type"></param>
/// <param name="id"></param>
/// <returns>Object</returns>
public async ThreadTask.Task<object> GetPermissionsAsync(string type, string id)
{
ApiResponse<object> localVarResponse = await ThreadTask.Task.FromResult(GetPermissionsWithHttpInfo(type, id));
return localVarResponse.Data;
}

Expand All @@ -178,7 +121,7 @@ public Object GetPermissions(string type, string id)
/// <param name="type"></param>
/// <param name="id"></param>
/// <returns>ApiResponse of Object</returns>
public ApiResponse<Object> GetPermissionsWithHttpInfo(string type, string id)
public ApiResponse<object> GetPermissionsWithHttpInfo(string type, string id)
{
// verify the required parameter 'type' is set
if (type == null)
Expand All @@ -197,29 +140,29 @@ public ApiResponse<Object> GetPermissionsWithHttpInfo(string type, string id)

// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
};
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);

if (type != null) localVarPathParams.Add("type", this.Configuration.ApiClient.ParameterToString(type)); // path parameter
if (id != null) localVarPathParams.Add("id", this.Configuration.ApiClient.ParameterToString(id)); // path parameter
// authentication (api_key) required
// authentication (api_key) required
if (!String.IsNullOrEmpty(this.Configuration.AccessToken))
{
localVarHeaderParams["X-Authorization"] = this.Configuration.AccessToken;
}

// make the HTTP request
IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
Method.Get, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);

int localVarStatusCode = (int)localVarResponse.StatusCode;

Expand All @@ -230,8 +173,8 @@ public ApiResponse<Object> GetPermissionsWithHttpInfo(string type, string id)
}

return new ApiResponse<Object>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object)));
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Object)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Object)));
}

/// <summary>
Expand All @@ -246,6 +189,17 @@ public Response GrantPermissions(AuthorizationRequest body)
return localVarResponse.Data;
}

/// <summary>
/// Asynchronous Grant access to a user over the target
/// </summary>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body"></param>
/// <returns>Response</returns>
public async ThreadTask.Task<Response> GrantPermissionsAsync(AuthorizationRequest body)
{
ApiResponse<Response> localVarResponse = await ThreadTask.Task.FromResult(GrantPermissionsWithHttpInfo(body));
return localVarResponse.Data;
}
/// <summary>
/// Grant access to a user over the target
/// </summary>
Expand All @@ -268,14 +222,14 @@ public ApiResponse<Response> GrantPermissionsWithHttpInfo(AuthorizationRequest b

// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json"
};
"application/json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
Expand All @@ -295,9 +249,9 @@ public ApiResponse<Response> GrantPermissionsWithHttpInfo(AuthorizationRequest b
}

// make the HTTP request
IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
Method.Post, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);

int localVarStatusCode = (int)localVarResponse.StatusCode;

Expand All @@ -308,8 +262,8 @@ public ApiResponse<Response> GrantPermissionsWithHttpInfo(AuthorizationRequest b
}

return new ApiResponse<Response>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Response)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Response)));
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Response)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Response)));
}

/// <summary>
Expand All @@ -324,6 +278,18 @@ public Response RemovePermissions(AuthorizationRequest body)
return localVarResponse.Data;
}

/// <summary>
/// Asynchronous Remove user&#x27;s access over the target
/// </summary>
/// <exception cref="Conductor.Client.ApiException">Thrown when fails to make API call</exception>
/// <param name="body"></param>
/// <returns>Response</returns>
public async ThreadTask.Task<Response> RemovePermissionsAsync(AuthorizationRequest body)
{
ApiResponse<Response> localVarResponse = await ThreadTask.Task.FromResult(RemovePermissionsWithHttpInfo(body));
return localVarResponse.Data;
}

/// <summary>
/// Remove user&#x27;s access over the target
/// </summary>
Expand All @@ -346,14 +312,14 @@ public ApiResponse<Response> RemovePermissionsWithHttpInfo(AuthorizationRequest

// to determine the Content-Type header
String[] localVarHttpContentTypes = new String[] {
"application/json"
};
"application/json"
};
String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

// to determine the Accept header
String[] localVarHttpHeaderAccepts = new String[] {
"application/json"
};
"application/json"
};
String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);
if (localVarHttpHeaderAccept != null)
localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
Expand All @@ -373,9 +339,9 @@ public ApiResponse<Response> RemovePermissionsWithHttpInfo(AuthorizationRequest
}

// make the HTTP request
IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
Method.DELETE, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);
RestResponse localVarResponse = (RestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
Method.Delete, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
localVarPathParams, localVarHttpContentType);

int localVarStatusCode = (int)localVarResponse.StatusCode;

Expand All @@ -386,8 +352,8 @@ public ApiResponse<Response> RemovePermissionsWithHttpInfo(AuthorizationRequest
}

return new ApiResponse<Response>(localVarStatusCode,
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Response)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Response)));
localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
(Response)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Response)));
}
}
}
Loading
Loading