How to use the @algolia/requester-common.MethodEnum.Delete function in @algolia/requester-common

To help you get started, we’ve selected a few @algolia/requester-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github algolia / algoliasearch-client-javascript / packages / client-search / src / methods / client / removeUserID.ts View on Github external
return (
    userID: string,
    requestOptions?: RequestOptions
  ): Readonly> => {
    const mappedRequestOptions = createMappedRequestOptions(requestOptions);

    // eslint-disable-next-line functional/immutable-data
    mappedRequestOptions.headers['X-Algolia-User-ID'] = userID;

    return base.transporter.write(
      {
        method: MethodEnum.Delete,
        path: '1/clusters/mapping',
      },
      mappedRequestOptions
    );
  };
};
github algolia / algoliasearch-client-javascript / packages / client-search / src / methods / index / deleteRule.ts View on Github external
return (
    objectID: string,
    requestOptions?: RequestOptions
  ): Readonly> => {
    const { forwardToReplicas, ...options } = requestOptions || {};

    const mappedRequestOptions = createMappedRequestOptions(options);
    if (forwardToReplicas) {
      mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
    }

    return createWaitablePromise(
      base.transporter.write(
        {
          method: MethodEnum.Delete,
          path: encode('1/indexes/%s/rules/%s', base.indexName, objectID),
        },
        mappedRequestOptions
      ),
      (response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
    );
  };
};
github algolia / algoliasearch-client-javascript / packages / client-search / src / methods / index / deleteSynonym.ts View on Github external
return (
    objectID: string,
    requestOptions?: RequestOptions & DeleteSynonymOptions
  ): Readonly> => {
    const { forwardToReplicas, ...options } = requestOptions || {};

    const mappedRequestOptions = createMappedRequestOptions(options);
    if (forwardToReplicas) {
      mappedRequestOptions.queryParameters.forwardToReplicas = 1; // eslint-disable-line functional/immutable-data
    }

    return createWaitablePromise(
      base.transporter.write(
        {
          method: MethodEnum.Delete,
          path: encode('1/indexes/%s/synonyms/%s', base.indexName, objectID),
        },
        mappedRequestOptions
      ),
      (response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
    );
  };
};
github algolia / algoliasearch-client-javascript / packages / client-search / src / methods / index / deleteIndex.ts View on Github external
return (requestOptions?: RequestOptions): Readonly> => {
    return createWaitablePromise(
      base.transporter.write(
        {
          method: MethodEnum.Delete,
          path: encode('1/indexes/%s', base.indexName),
        },
        requestOptions
      ),
      (response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
    );
  };
};
github algolia / algoliasearch-client-javascript / packages / client-search / src / methods / client / deleteApiKey.ts View on Github external
const wait: Wait = (_, waitRequestOptions) => {
      return createRetryablePromise(retry => {
        return getApiKey(base)(apiKey, waitRequestOptions)
          .catch((apiError: ApiError) => {
            if (apiError.status !== 404) {
              throw apiError;
            }
          })
          .then(retry);
      });
    };

    return createWaitablePromise(
      base.transporter.write(
        {
          method: MethodEnum.Delete,
          path: encode('1/keys/%s', apiKey),
        },
        requestOptions
      ),
      wait
    );
  };
};

@algolia/requester-common

Common interfaces for promise-based request libraries

MIT
Latest version published 5 months ago

Package Health Score

78 / 100
Full package analysis

Similar packages