diff --git a/.github/workflows/publishToNPM.yml b/.github/workflows/publishToNPM.yml
new file mode 100644
index 000000000..0a8610464
--- /dev/null
+++ b/.github/workflows/publishToNPM.yml
@@ -0,0 +1,92 @@
+name: Publish TypeScript SDK to npm (OIDC)
+
+on:
+ workflow_dispatch:
+ inputs:
+ tag:
+ description: 'NPM tag for the release (e.g., latest, beta, alpha, next)'
+ required: false
+ default: 'latest'
+ type: string
+
+permissions:
+ id-token: write
+ contents: read
+
+jobs:
+ publish:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v3
+ with:
+ fetch-depth: 0
+
+ - uses: actions/setup-node@v3
+ with:
+ node-version: '20.19.4'
+ registry-url: 'https://registry.npmjs.org'
+
+ - name: Update npm for OIDC support
+ run: npm install -g npm@latest
+
+ - name: Extract version from package.json
+ id: version
+ working-directory: sdks/typescript
+ run: |
+ VERSION=$(node -p "require('./package.json').version")
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
+ echo "Version: $VERSION"
+
+ - name: Check if version exists on npm
+ id: npm-check
+ run: |
+ VERSION="${{ steps.version.outputs.version }}"
+ EXISTING=$(npm view @thoughtspot/rest-api-sdk@${VERSION} version 2>/dev/null || echo 'not_found')
+ if [ "$EXISTING" = "$VERSION" ]; then
+ echo "exists=true" >> $GITHUB_OUTPUT
+ echo "Version $VERSION already exists on npm - skipping publish"
+ else
+ echo "exists=false" >> $GITHUB_OUTPUT
+ fi
+
+ - name: Install dependencies
+ if: steps.npm-check.outputs.exists == 'false'
+ working-directory: sdks/typescript
+ run: npm install
+
+ - name: Build TypeScript SDK
+ if: steps.npm-check.outputs.exists == 'false'
+ working-directory: sdks/typescript
+ run: npm run build
+
+ - name: Get Branch Name
+ id: branch_name
+ run: echo "::set-output name=BRANCH_NAME::$(git branch --show-current)"
+
+ - name: Publish to npm with OIDC
+ if: steps.npm-check.outputs.exists == 'false'
+ working-directory: sdks/typescript
+ run: |
+ BRANCH_NAME="${{ steps.branch_name.outputs.BRANCH_NAME }}"
+ NPM_TAG=$(echo "${{ github.event.inputs.tag }}" | tr '[:upper:]' '[:lower:]')
+ if [ "$BRANCH_NAME" = "release" ]; then
+ echo "publish prod with tag: $NPM_TAG"
+ npm publish --tag $NPM_TAG
+ elif [ "$NPM_TAG" = "latest" ]; then
+ echo "Error: 'latest' tag can only be used when publishing from the release branch"
+ echo "Current branch: $BRANCH_NAME"
+ exit 1
+ else
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
+ if [[ "$CURRENT_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+ echo "Error: Stable versions (X.Y.Z) can only be published from the release branch"
+ echo "Current version: $CURRENT_VERSION"
+ echo "Current branch: $BRANCH_NAME"
+ echo "Please use a pre-release version (e.g., X.Y.Z-beta.1, X.Y.Z-alpha.0) for non-release branches"
+ exit 1
+ fi
+ echo "Publishing from $BRANCH_NAME branch with tag: $NPM_TAG"
+ npm publish --tag $NPM_TAG
+ echo "Published @thoughtspot/rest-api-sdk@${{ steps.version.outputs.version }} to tag $NPM_TAG"
+ fi
diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
new file mode 100644
index 000000000..b46103167
--- /dev/null
+++ b/.github/workflows/sonar.yml
@@ -0,0 +1,28 @@
+name: Sonar Scan
+
+on:
+ push:
+ branches:
+ - main
+ pull_request:
+ types: [opened, synchronize, reopened]
+
+jobs:
+ build:
+ name: Sonar
+ runs-on: self-hosted
+ steps:
+ - uses: actions/checkout@v2
+ with:
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+ - uses: sonarsource/sonarqube-scan-action@master
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
+ with:
+ args: >
+ -Dsonar.projectKey=${{ secrets.SONAR_PROJECTKEY }}
+ - uses: sonarsource/sonarqube-quality-gate-action@master
+ env:
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 000000000..30ef90e42
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1 @@
+* @thoughtspot/tse-code-reviewers
\ No newline at end of file
diff --git a/DotNet/LICENSE b/DotNet/LICENSE
deleted file mode 100644
index c571aa529..000000000
--- a/DotNet/LICENSE
+++ /dev/null
@@ -1,28 +0,0 @@
-License:
-========
-The MIT License (MIT)
-http://opensource.org/licenses/MIT
-
-Copyright (c) 2014 - 2022 APIMATIC Limited
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-Trade Mark:
-==========
-APIMATIC is a trade mark for APIMATIC Limited
\ No newline at end of file
diff --git a/DotNet/README.md b/DotNet/README.md
deleted file mode 100644
index 44638e7f4..000000000
--- a/DotNet/README.md
+++ /dev/null
@@ -1,72 +0,0 @@
-
-# Getting Started with ThoughtSpot Public REST API
-
-## Install the Package
-
-If you are building with .NET CLI tools then you can also use the following command:
-
-```bash
-dotnet add package thoughtspot.rest.api.sdk --version 1.13.1
-```
-
-## Test the SDK
-
-The generated SDK also contain one or more Tests, which are contained in the Tests project. In order to invoke these test cases, you will need `NUnit 3.0 Test Adapter Extension` for Visual Studio. Once the SDK is complied, the test cases should appear in the Test Explorer window. Here, you can click `Run All` to execute these test cases.
-
-## Initialize the API Client
-
-**_Note:_** Documentation for the client can be found [here.](doc/client.md)
-
-The following parameters are configurable for the API Client:
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| `BaseUrl` | `string` | *Default*: `"https://localhost:443"` |
-| `Environment` | Environment | The API environment. **Default: `Environment.Production`** |
-| `Timeout` | `TimeSpan` | Http client timeout. *Default*: `TimeSpan.FromSeconds(100)` |
-| `AccessToken` | `string` | The OAuth 2.0 Access Token to use for API requests. |
-
-The API client can be initialized as follows:
-
-```csharp
-ThoughtSpotPublicRESTAPI.Standard.ThoughtSpotPublicRESTAPIClient client = new ThoughtSpotPublicRESTAPI.Standard.ThoughtSpotPublicRESTAPIClient.Builder()
- .AccessToken("AccessToken")
- .Environment(ThoughtSpotPublicRESTAPI.Standard.Environment.Production)
- .BaseUrl("https://localhost:443")
- .HttpClientConfig(config => config.NumberOfRetries(0))
- .Build();
-```
-
-## Authorization
-
-This API uses `OAuth 2 Bearer token`.
-
-## List of APIs
-
-* [User](doc/controllers/user.md)
-* [Group](doc/controllers/group.md)
-* [Metadata](doc/controllers/metadata.md)
-* [Database](doc/controllers/database.md)
-* [Connection](doc/controllers/connection.md)
-* [Data](doc/controllers/data.md)
-* [Logs](doc/controllers/logs.md)
-* [Custom Actions](doc/controllers/custom-actions.md)
-* [Security](doc/controllers/security.md)
-* [Org](doc/controllers/org.md)
-* [Session](doc/controllers/session.md)
-* [Admin](doc/controllers/admin.md)
-* [Report](doc/controllers/report.md)
-* [Materialization](doc/controllers/materialization.md)
-
-## Classes Documentation
-
-* [Utility Classes](doc/utility-classes.md)
-* [HttpRequest](doc/http-request.md)
-* [HttpResponse](doc/http-response.md)
-* [HttpStringResponse](doc/http-string-response.md)
-* [HttpContext](doc/http-context.md)
-* [HttpClientConfiguration](doc/http-client-configuration.md)
-* [HttpClientConfiguration Builder](doc/http-client-configuration-builder.md)
-* [IAuthManager](doc/i-auth-manager.md)
-* [ApiException](doc/api-exception.md)
-
diff --git a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/BearerAuthManager.cs b/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/BearerAuthManager.cs
deleted file mode 100644
index 3cc9e02aa..000000000
--- a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/BearerAuthManager.cs
+++ /dev/null
@@ -1,62 +0,0 @@
-//
-// Copyright (c) APIMatic. All rights reserved.
-//
-namespace ThoughtSpotPublicRESTAPI.Standard.Authentication
-{
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using ThoughtSpotPublicRESTAPI.Standard.Http.Request;
-
-///
-/// BearerAuthManager.
-///
-internal class BearerAuthManager : IBearerAuthCredentials, IAuthManager
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// accessToken.
- public BearerAuthManager(string accessToken)
- {
- this.AccessToken = accessToken;
- }
-
- ///
- /// Gets string value for accessToken.
- ///
- public string AccessToken { get; }
-
- ///
- /// Check if credentials match.
- ///
- /// The string value for credentials.
- /// True if credentials matched.
- public bool Equals(string accessToken)
- {
- return accessToken.Equals(this.AccessToken);
- }
-
- ///
- /// Adds authentication to the given HttpRequest.
- ///
- /// Http Request.
- /// Returns the httpRequest after adding authentication.
- public HttpRequest Apply(HttpRequest httpRequest)
- {
- httpRequest.Headers["Authorization"] = "Bearer " + this.AccessToken;
- return httpRequest;
- }
-
- ///
- /// Adds authentication to the given HttpRequest.
- ///
- /// Http Request.
- /// Returns the httpRequest after adding authentication.
- public Task ApplyAsync(HttpRequest httpRequest)
- {
- httpRequest.Headers["Authorization"] = "Bearer " + this.AccessToken;
- return Task.FromResult(httpRequest);
- }
- }
-}
\ No newline at end of file
diff --git a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/IAuthManager.cs b/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/IAuthManager.cs
deleted file mode 100644
index 9ec7bec53..000000000
--- a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/IAuthManager.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Copyright (c) APIMatic. All rights reserved.
-//
-namespace ThoughtSpotPublicRESTAPI.Standard.Authentication
-{
- using System.Threading.Tasks;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Request;
-
- ///
- /// IAuthManager adds the authenticaion layer to the http calls.
- ///
- internal interface IAuthManager
- {
- ///
- /// Add authentication information to the HTTP Request.
- ///
- /// The http request object on which authentication will be applied.
- /// HttpRequest.
- HttpRequest Apply(HttpRequest httpRequest);
-
- ///
- /// Asynchronously add authentication information to the HTTP Request.
- ///
- /// The http request object on which authentication will be applied.
- /// A representing the asynchronous operation.
- Task ApplyAsync(HttpRequest httpRequest);
- }
-}
diff --git a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/IBearerAuthCredentials.cs b/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/IBearerAuthCredentials.cs
deleted file mode 100644
index 949289df7..000000000
--- a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Authentication/IBearerAuthCredentials.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-//
-// Copyright (c) APIMatic. All rights reserved.
-//
-namespace ThoughtSpotPublicRESTAPI.Standard.Authentication
-{
- using System;
-
- public interface IBearerAuthCredentials
- {
- ///
- /// Gets string value for accessToken.
- ///
- string AccessToken { get; }
-
- ///
- /// Returns true if credentials matched.
- ///
- /// The string value for credentials.
- /// True if credentials matched.
- bool Equals(string accessToken);
- }
-}
\ No newline at end of file
diff --git a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/AdminController.cs b/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/AdminController.cs
deleted file mode 100644
index 28c515b4a..000000000
--- a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/AdminController.cs
+++ /dev/null
@@ -1,513 +0,0 @@
-//
-// Copyright (c) APIMatic. All rights reserved.
-//
-namespace ThoughtSpotPublicRESTAPI.Standard.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Dynamic;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using Newtonsoft.Json.Converters;
- using ThoughtSpotPublicRESTAPI.Standard;
- using ThoughtSpotPublicRESTAPI.Standard.Authentication;
- using ThoughtSpotPublicRESTAPI.Standard.Exceptions;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Client;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Request;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Request.Configuration;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Response;
- using ThoughtSpotPublicRESTAPI.Standard.Utilities;
-
- ///
- /// AdminController.
- ///
- public class AdminController : BaseController
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// config instance.
- /// httpClient.
- /// authManager.
- /// httpCallBack.
- internal AdminController(IConfiguration config, IHttpClient httpClient, IDictionary authManagers, HttpCallBack httpCallBack = null)
- : base(config, httpClient, authManagers, httpCallBack)
- {
- }
-
- ///
- /// To update the Thoughtspot cluster configuration, use this endpoint.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2UpdateClusterConfig(
- Models.TspublicRestV2AdminConfigurationUpdateRequest body)
- {
- Task t = this.RestapiV2UpdateClusterConfigAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To update the Thoughtspot cluster configuration, use this endpoint.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2UpdateClusterConfigAsync(
- Models.TspublicRestV2AdminConfigurationUpdateRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/admin/configuration/update");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To reset the password of a ThoughtSpot user account, use this endpoint. .
- /// It is mandatory to use Authorization header with token of a user with admin access to successfully run this endpoint. .
- /// At least one of User Id or username is mandatory. When both are given, then user id will be considered.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2ResetUserPassword(
- Models.TspublicRestV2AdminResetpasswordRequest body)
- {
- Task t = this.RestapiV2ResetUserPasswordAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To reset the password of a ThoughtSpot user account, use this endpoint. .
- /// It is mandatory to use Authorization header with token of a user with admin access to successfully run this endpoint. .
- /// At least one of User Id or username is mandatory. When both are given, then user id will be considered.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2ResetUserPasswordAsync(
- Models.TspublicRestV2AdminResetpasswordRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/admin/resetpassword");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To programmatically synchronize user accounts and user groups from external system with ThoughtSpot, use this endpoint. .
- /// The payload takes principals containing all users and groups present in the external system. .
- /// The users and user groups in Thoughtspot get updated for any matching inputs. .
- /// Any user and user group present in the input, but not present in the cluster, gets created in cluster. .
- /// n You can optionally choose to delete the user and groups from the cluster, that are not present in the input.
- ///
- /// Required parameter: Example: .
- /// Returns the Models.AdminsyncPrincipalResponse response from the API call.
- public Models.AdminsyncPrincipalResponse RestapiV2SyncPrincipal(
- Models.TspublicRestV2AdminSyncprincipalRequest body)
- {
- Task t = this.RestapiV2SyncPrincipalAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To programmatically synchronize user accounts and user groups from external system with ThoughtSpot, use this endpoint. .
- /// The payload takes principals containing all users and groups present in the external system. .
- /// The users and user groups in Thoughtspot get updated for any matching inputs. .
- /// Any user and user group present in the input, but not present in the cluster, gets created in cluster. .
- /// n You can optionally choose to delete the user and groups from the cluster, that are not present in the input.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.AdminsyncPrincipalResponse response from the API call.
- public async Task RestapiV2SyncPrincipalAsync(
- Models.TspublicRestV2AdminSyncprincipalRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/admin/syncprincipal");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "accept", "application/json" },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return ApiHelper.JsonDeserialize(response.Body);
- }
-
- ///
- /// To programmatically change the owner of one or several objects from one user account to another, use this endpoint. .
- /// You might want to transfer ownership of objects owned by a user to another active user, when the account is removed from the ThoughtSpot application.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2ChangeAuthorOfObjects(
- Models.TspublicRestV2AdminChangeauthorRequest body)
- {
- Task t = this.RestapiV2ChangeAuthorOfObjectsAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To programmatically change the owner of one or several objects from one user account to another, use this endpoint. .
- /// You might want to transfer ownership of objects owned by a user to another active user, when the account is removed from the ThoughtSpot application.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2ChangeAuthorOfObjectsAsync(
- Models.TspublicRestV2AdminChangeauthorRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/admin/changeauthor");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To programmatically assign an author to one or several objects, use this endpoint. .
- /// Provide either user name or id as input. When both are given user id will be considered. .
- /// Requires administration privilege.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2AssignAuthorToObjects(
- Models.TspublicRestV2AdminAssignauthorRequest body)
- {
- Task t = this.RestapiV2AssignAuthorToObjectsAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To programmatically assign an author to one or several objects, use this endpoint. .
- /// Provide either user name or id as input. When both are given user id will be considered. .
- /// Requires administration privilege.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2AssignAuthorToObjectsAsync(
- Models.TspublicRestV2AdminAssignauthorRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/admin/assignauthor");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To logout one or more users from logged in session, use this endpoint. If no input is provided then all logged in users are force logged out. .
- /// Requires administration privilege.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2ForceLogoutUsers(
- Models.TspublicRestV2AdminForcelogoutRequest body)
- {
- Task t = this.RestapiV2ForceLogoutUsersAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To logout one or more users from logged in session, use this endpoint. If no input is provided then all logged in users are force logged out. .
- /// Requires administration privilege.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2ForceLogoutUsersAsync(
- Models.TspublicRestV2AdminForcelogoutRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/admin/forcelogout");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PostBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
- }
-}
\ No newline at end of file
diff --git a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/BaseController.cs b/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/BaseController.cs
deleted file mode 100644
index cc7ecc5c0..000000000
--- a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/BaseController.cs
+++ /dev/null
@@ -1,137 +0,0 @@
-//
-// Copyright (c) APIMatic. All rights reserved.
-//
-namespace ThoughtSpotPublicRESTAPI.Standard.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Text;
- using ThoughtSpotPublicRESTAPI.Standard;
- using ThoughtSpotPublicRESTAPI.Standard.Authentication;
- using ThoughtSpotPublicRESTAPI.Standard.Exceptions;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Client;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Response;
- using ThoughtSpotPublicRESTAPI.Standard.Utilities;
-
- ///
- /// The base class for all controller classes.
- ///
- public class BaseController
- {
- ///
- /// HttpClient instance.
- ///
- private readonly IHttpClient httpClient;
- private string internalUserAgent = string.Empty;
-
-
- ///
- /// Initializes a new instance of the class.
- ///
- /// Configuration for the API.
- /// HTTP callback to catch before/after HTTP request/response events.
- /// HttpClient for the API.
- /// AuthManagers for the API.
- internal BaseController(
- IConfiguration config,
- IHttpClient httpClient,
- IDictionary authManagers,
- HttpCallBack httpCallBack = null)
- {
- this.Config = config;
- this.httpClient = httpClient;
- this.AuthManagers = authManagers;
- this.HttpCallBack = httpCallBack;
- this.UpdateUserAgent();
- }
-
- ///
- /// Gets AuthManager instance.
- ///
- internal IDictionary AuthManagers { get; }
-
- ///
- /// Gets HttpCallBack instance.
- ///
- internal HttpCallBack HttpCallBack { get; }
-
- ///
- /// Gets array deserialization format.
- ///
- protected ArrayDeserialization ArrayDeserializationFormat => ArrayDeserialization.Plain;
-
- ///
- /// Gets configuration instance.
- ///
- protected IConfiguration Config { get; }
-
- ///
- /// Gets User-Agent header value.
- ///
- protected string UserAgent => internalUserAgent;
-
- ///
- /// Create JSON-encoded multipart content from input.
- ///
- /// input object.
- /// Headers dictionary.
- /// MultipartContent.
- internal static MultipartContent CreateJsonEncodedMultipartContent(object input, Dictionary> headers)
- {
- if (input == null)
- {
- return null;
- }
- return new MultipartByteArrayContent(Encoding.ASCII.GetBytes(ApiHelper.JsonSerialize(input)), headers);
- }
-
- ///
- /// Create binary multipart content from file.
- ///
- /// FileStreamInfo object.
- /// Headers dictionary.
- /// MultipartContent.
- internal static MultipartContent CreateFileMultipartContent(FileStreamInfo input, Dictionary> headers = null)
- {
- if (input == null)
- {
- return null;
- }
- if (headers == null)
- {
- return new MultipartFileContent(input);
- }
- return new MultipartFileContent(input, headers);
- }
-
- ///
- /// Get default HTTP client instance.
- ///
- /// IHttpClient.
- internal IHttpClient GetClientInstance()
- {
- return this.httpClient;
- }
-
- ///
- /// Validates the response against HTTP errors defined at the API level.
- ///
- /// The response recieved.
- /// Context of the request and the recieved response.
- protected void ValidateResponse(HttpResponse response, HttpContext context)
- {
- // [200, 208] = HTTP OK
- if ((response.StatusCode < 200) || (response.StatusCode > 208))
- {
- throw new ApiException(@"HTTP Response Not OK", context);
- }
- }
- ///
- /// Adds runtime information to the placeholders in User-Agent.
- ///
- private void UpdateUserAgent()
- {
- internalUserAgent = "RestAPI V2 SDK";
- }
- }
-}
\ No newline at end of file
diff --git a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/ConnectionController.cs b/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/ConnectionController.cs
deleted file mode 100644
index 6918c96a6..000000000
--- a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/ConnectionController.cs
+++ /dev/null
@@ -1,828 +0,0 @@
-//
-// Copyright (c) APIMatic. All rights reserved.
-//
-namespace ThoughtSpotPublicRESTAPI.Standard.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Dynamic;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using Newtonsoft.Json.Converters;
- using ThoughtSpotPublicRESTAPI.Standard;
- using ThoughtSpotPublicRESTAPI.Standard.Authentication;
- using ThoughtSpotPublicRESTAPI.Standard.Exceptions;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Client;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Request;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Request.Configuration;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Response;
- using ThoughtSpotPublicRESTAPI.Standard.Utilities;
-
- ///
- /// ConnectionController.
- ///
- public class ConnectionController : BaseController
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// config instance.
- /// httpClient.
- /// authManager.
- /// httpCallBack.
- internal ConnectionController(IConfiguration config, IHttpClient httpClient, IDictionary authManagers, HttpCallBack httpCallBack = null)
- : base(config, httpClient, authManagers, httpCallBack)
- {
- }
-
- ///
- /// To get the details of a specific connection use this endpoint.
- ///
- /// Required parameter: The GUID of the connection to query.
- /// Returns the Models.ConnectionResponse response from the API call.
- public Models.ConnectionResponse RestapiV2GetConnection(
- string id)
- {
- Task t = this.RestapiV2GetConnectionAsync(id);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To get the details of a specific connection use this endpoint.
- ///
- /// Required parameter: The GUID of the connection to query.
- /// cancellationToken.
- /// Returns the Models.ConnectionResponse response from the API call.
- public async Task RestapiV2GetConnectionAsync(
- string id,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (id == null)
- {
- throw new ArgumentNullException("id", "The parameter \"id\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection");
-
- // prepare specfied query parameters.
- var queryParams = new Dictionary()
- {
- { "id", id },
- };
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "accept", "application/json" },
- };
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().Get(queryBuilder.ToString(), headers, queryParameters: queryParams);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return ApiHelper.JsonDeserialize(response.Body);
- }
-
- ///
- /// To get the list of databases for a connection, use this endpoint. .
- /// The response will include databases from the data platform corresponding to the connection id provided.
- ///
- /// Required parameter: The GUID of the connection.
- /// Returns the List of string response from the API call.
- public List RestapiV2GetConnectionDatabase(
- string id)
- {
- Task> t = this.RestapiV2GetConnectionDatabaseAsync(id);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To get the list of databases for a connection, use this endpoint. .
- /// The response will include databases from the data platform corresponding to the connection id provided.
- ///
- /// Required parameter: The GUID of the connection.
- /// cancellationToken.
- /// Returns the List of string response from the API call.
- public async Task> RestapiV2GetConnectionDatabaseAsync(
- string id,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (id == null)
- {
- throw new ArgumentNullException("id", "The parameter \"id\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/database");
-
- // prepare specfied query parameters.
- var queryParams = new Dictionary()
- {
- { "id", id },
- };
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "accept", "application/json" },
- };
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().Get(queryBuilder.ToString(), headers, queryParameters: queryParams);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return ApiHelper.JsonDeserialize>(response.Body);
- }
-
- ///
- /// To programmatically create a connection in the ThoughtSpot system use this API endpoint.
- /// Using this API, you can create a connection and assign groups.
- /// To create a connection, you require admin connection privileges.
- /// All connections created in the ThoughtSpot system are added to ALL_GROUP.
- ///
- /// Required parameter: Example: .
- /// Returns the Models.CreateConnectionResponse response from the API call.
- public Models.CreateConnectionResponse RestapiV2CreateConnection(
- Models.TspublicRestV2ConnectionCreateRequest body)
- {
- Task t = this.RestapiV2CreateConnectionAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To programmatically create a connection in the ThoughtSpot system use this API endpoint.
- /// Using this API, you can create a connection and assign groups.
- /// To create a connection, you require admin connection privileges.
- /// All connections created in the ThoughtSpot system are added to ALL_GROUP.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.CreateConnectionResponse response from the API call.
- public async Task RestapiV2CreateConnectionAsync(
- Models.TspublicRestV2ConnectionCreateRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/create");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "accept", "application/json" },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PostBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return ApiHelper.JsonDeserialize(response.Body);
- }
-
- ///
- /// You can use this endpoint to programmatically modify an existing connection.
- /// To modify a connection, you require admin connection privileges.
- /// At least one of Connection Id or connectionname is mandatory. When both are given, then connection id will be considered and connectionname will be updated.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2UpdateConnection(
- Models.TspublicRestV2ConnectionUpdateRequest body)
- {
- Task t = this.RestapiV2UpdateConnectionAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// You can use this endpoint to programmatically modify an existing connection.
- /// To modify a connection, you require admin connection privileges.
- /// At least one of Connection Id or connectionname is mandatory. When both are given, then connection id will be considered and connectionname will be updated.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2UpdateConnectionAsync(
- Models.TspublicRestV2ConnectionUpdateRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/update");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To remove a connection from the ThoughtSpot system, use this endpoint.
- ///
- /// Required parameter: A JSON array of GUIDs of the connection.
- /// Returns the bool response from the API call.
- public bool RestapiV2DeleteConnection(
- List id)
- {
- Task t = this.RestapiV2DeleteConnectionAsync(id);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To remove a connection from the ThoughtSpot system, use this endpoint.
- ///
- /// Required parameter: A JSON array of GUIDs of the connection.
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2DeleteConnectionAsync(
- List id,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (id == null)
- {
- throw new ArgumentNullException("id", "The parameter \"id\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/delete");
-
- // prepare specfied query parameters.
- var queryParams = new Dictionary()
- {
- { "id", id },
- };
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- };
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().Delete(queryBuilder.ToString(), headers, null, queryParameters: queryParams);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To programmatically add table to an existing connection use this endpoint.
- /// When you assign groups to a connection, the connection inherits the privileges assigned to those groups.
- /// At least one of Connection Id or connectionname is mandatory. When both are given, then connection id will be considered.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2AddTableToConnection(
- Models.TspublicRestV2ConnectionAddtableRequest body)
- {
- Task t = this.RestapiV2AddTableToConnectionAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To programmatically add table to an existing connection use this endpoint.
- /// When you assign groups to a connection, the connection inherits the privileges assigned to those groups.
- /// At least one of Connection Id or connectionname is mandatory. When both are given, then connection id will be considered.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2AddTableToConnectionAsync(
- Models.TspublicRestV2ConnectionAddtableRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/addtable");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To programmatically remove a table from a connection use API endpoint.
- /// The API removes only the connection association. It does not delete the connection or group from the Thoughtspot system.
- /// At least one of id or name of connection is required. When both are given connection id will be considered.
- ///
- /// Required parameter: Example: .
- /// Returns the bool response from the API call.
- public bool RestapiV2RemoveTableFromConnection(
- Models.TspublicRestV2ConnectionRemovetableRequest body)
- {
- Task t = this.RestapiV2RemoveTableFromConnectionAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To programmatically remove a table from a connection use API endpoint.
- /// The API removes only the connection association. It does not delete the connection or group from the Thoughtspot system.
- /// At least one of id or name of connection is required. When both are given connection id will be considered.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the bool response from the API call.
- public async Task RestapiV2RemoveTableFromConnectionAsync(
- Models.TspublicRestV2ConnectionRemovetableRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/removetable");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PutBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return bool.Parse(response.Body);
- }
-
- ///
- /// To get the details of a specific connection or all connections in the ThoughtSpot system use this end point.
- ///
- /// Required parameter: Example: .
- /// Returns the List of Models.ConnectionResponse response from the API call.
- public List RestapiV2SearchConnection(
- Models.TspublicRestV2ConnectionSearchRequest body)
- {
- Task> t = this.RestapiV2SearchConnectionAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To get the details of a specific connection or all connections in the ThoughtSpot system use this end point.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the List of Models.ConnectionResponse response from the API call.
- public async Task> RestapiV2SearchConnectionAsync(
- Models.TspublicRestV2ConnectionSearchRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/search");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "accept", "application/json" },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PostBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return ApiHelper.JsonDeserialize>(response.Body);
- }
-
- ///
- /// To get the details of tables from a connection, use this endpoint. .
- /// You can get the details of tables in the data platform for the connection id provided.
- ///
- /// Required parameter: Example: .
- /// Returns the Models.ConnectionTableResponse response from the API call.
- public Models.ConnectionTableResponse RestapiV2GetConnectionTables(
- Models.TspublicRestV2ConnectionTableRequest body)
- {
- Task t = this.RestapiV2GetConnectionTablesAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To get the details of tables from a connection, use this endpoint. .
- /// You can get the details of tables in the data platform for the connection id provided.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.ConnectionTableResponse response from the API call.
- public async Task RestapiV2GetConnectionTablesAsync(
- Models.TspublicRestV2ConnectionTableRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/table");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "accept", "application/json" },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PostBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return ApiHelper.JsonDeserialize(response.Body);
- }
-
- ///
- /// To get the details of columns in a table associated to a connection, use this endpoint. .
- /// You can get the columns of any table available in the data platform for the connection id provided.
- ///
- /// Required parameter: Example: .
- /// Returns the Models.ConnectionTableColumnsResponse response from the API call.
- public Models.ConnectionTableColumnsResponse RestapiV2GetConnectionTableColumns(
- Models.TspublicRestV2ConnectionTablecoloumnRequest body)
- {
- Task t = this.RestapiV2GetConnectionTableColumnsAsync(body);
- ApiHelper.RunTaskSynchronously(t);
- return t.Result;
- }
-
- ///
- /// To get the details of columns in a table associated to a connection, use this endpoint. .
- /// You can get the columns of any table available in the data platform for the connection id provided.
- ///
- /// Required parameter: Example: .
- /// cancellationToken.
- /// Returns the Models.ConnectionTableColumnsResponse response from the API call.
- public async Task RestapiV2GetConnectionTableColumnsAsync(
- Models.TspublicRestV2ConnectionTablecoloumnRequest body,
- CancellationToken cancellationToken = default)
- {
- // validating required parameters.
- if (body == null)
- {
- throw new ArgumentNullException("body", "The parameter \"body\" is a required parameter and cannot be null.");
- }
-
- // the base uri for api requests.
- string baseUri = this.Config.GetBaseUri();
-
- // prepare query string for API call.
- StringBuilder queryBuilder = new StringBuilder(baseUri);
- queryBuilder.Append("/tspublic/rest/v2/connection/tablecoloumn");
-
- // append request with appropriate headers and parameters
- var headers = new Dictionary()
- {
- { "user-agent", this.UserAgent },
- { "accept", "application/json" },
- { "Content-Type", "application/json" },
- };
-
- // append body params.
- var bodyText = ApiHelper.JsonSerialize(body);
-
- // prepare the API call request to fetch the response.
- HttpRequest httpRequest = this.GetClientInstance().PostBody(queryBuilder.ToString(), headers, bodyText);
-
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnBeforeHttpRequestEventHandler(this.GetClientInstance(), httpRequest);
- }
-
- httpRequest = await this.AuthManagers["global"].ApplyAsync(httpRequest).ConfigureAwait(false);
-
- // invoke request and get response.
- HttpStringResponse response = await this.GetClientInstance().ExecuteAsStringAsync(httpRequest, cancellationToken: cancellationToken).ConfigureAwait(false);
- HttpContext context = new HttpContext(httpRequest, response);
- if (this.HttpCallBack != null)
- {
- this.HttpCallBack.OnAfterHttpResponseEventHandler(this.GetClientInstance(), response);
- }
-
- if (response.StatusCode == 500)
- {
- throw new ErrorResponseException("Operation failed", context);
- }
-
- // handle errors defined at the API level.
- this.ValidateResponse(response, context);
-
- return ApiHelper.JsonDeserialize(response.Body);
- }
- }
-}
\ No newline at end of file
diff --git a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/CustomActionsController.cs b/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/CustomActionsController.cs
deleted file mode 100644
index 3ec797ccd..000000000
--- a/DotNet/ThoughtSpotPublicRESTAPI.Standard/Controllers/CustomActionsController.cs
+++ /dev/null
@@ -1,668 +0,0 @@
-//
-// Copyright (c) APIMatic. All rights reserved.
-//
-namespace ThoughtSpotPublicRESTAPI.Standard.Controllers
-{
- using System;
- using System.Collections.Generic;
- using System.Dynamic;
- using System.Globalization;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading;
- using System.Threading.Tasks;
- using Newtonsoft.Json.Converters;
- using ThoughtSpotPublicRESTAPI.Standard;
- using ThoughtSpotPublicRESTAPI.Standard.Authentication;
- using ThoughtSpotPublicRESTAPI.Standard.Exceptions;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Client;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Request;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Request.Configuration;
- using ThoughtSpotPublicRESTAPI.Standard.Http.Response;
- using ThoughtSpotPublicRESTAPI.Standard.Utilities;
-
- ///
- /// CustomActionsController.
- ///
- public class CustomActionsController : BaseController
- {
- ///
- /// Initializes a new instance of the class.
- ///
- /// config instance.
- /// httpClient.
- /// authManager.
- /// httpCallBack.
- internal CustomActionsController(IConfiguration config, IHttpClient httpClient, IDictionary authManagers, HttpCallBack httpCallBack = null)
- : base(config, httpClient, authManagers, httpCallBack)
- {
- }
-
- ///
- /// To get details of a specific custom action configured in the ThoughtSpot system, use this endpoint.
- ///
- /// Required parameter: GUID of the custom action.
- /// Returns the object response from the API call.
- public object RestapiV2GetCustomAction(
- string id)
- {
- Task