Skip to content

Commit

Permalink
fix(Global Search): remove deprecated method getSupportedTypes (#206)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrizio Leoni <[email protected]>
  • Loading branch information
fabrizio-leoni authored Apr 28, 2023
1 parent b869c63 commit 4be6c67
Show file tree
Hide file tree
Showing 6 changed files with 1,572 additions and 1,722 deletions.
23 changes: 0 additions & 23 deletions examples/global-search.v2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,27 +91,4 @@ describe('GlobalSearchV2', () => {

// end-search
});
test('getSupportedTypes request example', async () => {

consoleLogMock.mockImplementation(output => {
originalLog(output);
});
consoleWarnMock.mockImplementation(output => {
originalWarn(output);
// when the test fails we need to print out the error message and stop execution right after it
expect(true).toBeFalsy();
});

originalLog('getSupportedTypes() result:');
// begin-get_supported_types

try {
const res = await globalSearchService.getSupportedTypes({});
console.log(JSON.stringify(res.result, null, 2));
} catch (err) {
console.warn(err);
}

// end-get_supported_types
});
});
79 changes: 1 addition & 78 deletions global-search/v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/**
* IBM OpenAPI SDK Code Generator Version: 3.67.0-df2073a1-20230222-221157
* IBM OpenAPI SDK Code Generator Version: 3.70.0-7df966bf-20230419-195904
*/

import * as extend from 'extend';
Expand All @@ -26,8 +26,6 @@ import {
getAuthenticatorFromEnvironment,
validateParams,
UserOptions,
getNewLogger,
SDKLogger,
} from 'ibm-cloud-sdk-core';
import { getSdkHeaders } from '../lib/common';

Expand All @@ -44,8 +42,6 @@ import { getSdkHeaders } from '../lib/common';
*/

class GlobalSearchV2 extends BaseService {
static _logger: SDKLogger = getNewLogger('GlobalSearchV2');

static DEFAULT_SERVICE_URL: string = 'https://api.global-search-tagging.cloud.ibm.com';

static DEFAULT_SERVICE_NAME: string = 'global_search';
Expand Down Expand Up @@ -133,8 +129,6 @@ class GlobalSearchV2 extends BaseService {
* @param {string} [params.transactionId] - An alphanumeric string that can be used to trace a request across
* services. If not specified, it automatically generated with the prefix "gst-".
* @param {string} [params.accountId] - The account ID to filter resources.
* @param {string} [params.boundary] - The boundary where the search performs. This parameter must be set only for the
* cross-account searches.
* @param {number} [params.limit] - The maximum number of hits to return. Defaults to 10.
* @param {number} [params.timeout] - A search timeout in milliseconds, bounding the search request to run within the
* specified time value and bail with the hits accumulated up to that point when expired. Defaults to the system
Expand Down Expand Up @@ -171,7 +165,6 @@ class GlobalSearchV2 extends BaseService {
'searchCursor',
'transactionId',
'accountId',
'boundary',
'limit',
'timeout',
'sort',
Expand All @@ -195,7 +188,6 @@ class GlobalSearchV2 extends BaseService {

const query = {
'account_id': _params.accountId,
'boundary': _params.boundary,
'limit': _params.limit,
'timeout': _params.timeout,
'sort': _params.sort,
Expand Down Expand Up @@ -229,57 +221,6 @@ class GlobalSearchV2 extends BaseService {
}),
};

return this.createRequest(parameters);
}
/*************************
* resourceTypes
************************/

/**
* DEPRECATED. Get all GhoST indexes.
*
* Retrieves a list of all GhoST indexes.
*
* @param {Object} [params] - The parameters to send to the service.
* @param {OutgoingHttpHeaders} [params.headers] - Custom request headers
* @returns {Promise<GlobalSearchV2.Response<GlobalSearchV2.SupportedTypesList>>}
* @deprecated this method is deprecated and may be removed in a future release
*/
public getSupportedTypes(
params?: GlobalSearchV2.GetSupportedTypesParams
): Promise<GlobalSearchV2.Response<GlobalSearchV2.SupportedTypesList>> {
GlobalSearchV2._logger.warn('A deprecated operation has been invoked: getSupportedTypes');
const _params = { ...params };
const _requiredParams = [];
const _validParams = ['headers'];
const _validationErrors = validateParams(_params, _requiredParams, _validParams);
if (_validationErrors) {
return Promise.reject(_validationErrors);
}

const sdkHeaders = getSdkHeaders(
GlobalSearchV2.DEFAULT_SERVICE_NAME,
'v2',
'getSupportedTypes'
);

const parameters = {
options: {
url: '/v2/resources/supported_types',
method: 'GET',
},
defaultOptions: extend(true, {}, this.baseOptions, {
headers: extend(
true,
sdkHeaders,
{
'Accept': 'application/json',
},
_params.headers
),
}),
};

return this.createRequest(parameters);
}
}
Expand Down Expand Up @@ -330,8 +271,6 @@ namespace GlobalSearchV2 {
transactionId?: string;
/** The account ID to filter resources. */
accountId?: string;
/** The boundary where the search performs. This parameter must be set only for the cross-account searches. */
boundary?: SearchConstants.Boundary | string;
/** The maximum number of hits to return. Defaults to 10. */
limit?: number;
/** A search timeout in milliseconds, bounding the search request to run within the specified time value and
Expand Down Expand Up @@ -371,11 +310,6 @@ namespace GlobalSearchV2 {

/** Constants for the `search` operation. */
export namespace SearchConstants {
/** The boundary where the search performs. This parameter must be set only for the cross-account searches. */
export enum Boundary {
GLOBAL = 'global',
US_REGULATED = 'us-regulated',
}
/** Determines if deleted documents should be included in result set or not. Possible values are false (default), true or any. If false, only existing documents are returned; if true, only deleted documents are returned; If any, both existing and deleted documents are returned. (_for administrators only_). */
export enum IsDeleted {
TRUE = 'true',
Expand All @@ -401,11 +335,6 @@ namespace GlobalSearchV2 {
}
}

/** Parameters for the `getSupportedTypes` operation. */
export interface GetSupportedTypesParams {
headers?: OutgoingHttpHeaders;
}

/*************************
* model interfaces
************************/
Expand All @@ -429,12 +358,6 @@ namespace GlobalSearchV2 {
*/
items: ResultItem[];
}

/** A list of all GhoST indexes. */
export interface SupportedTypesList {
/** A list of all GhoST indexes. */
supported_types?: string[];
}
}

export = GlobalSearchV2;
Loading

0 comments on commit 4be6c67

Please sign in to comment.