How to use the @algolia/requester-common.MethodEnum.Put 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 / index / setSettings.ts View on Github external
return (
    settings: Settings,
    requestOptions?: RequestOptions & SetSettingsOptions
  ): 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.Put,
          path: encode('1/indexes/%s/settings', base.indexName),
          data: settings,
        },
        mappedRequestOptions
      ),
      (response, waitRequestOptions) => waitTask(base)(response.taskID, waitRequestOptions)
    );
  };
};
github algolia / algoliasearch-client-javascript / packages / client-search / src / methods / client / updateApiKey.ts View on Github external
getApiKeyResponse[updatedField] === updatedFields[updatedField]
          );
        });
    };

    const wait: Wait = (_, waitRequestOptions) =>
      createRetryablePromise(retry => {
        return getApiKey(base)(apiKey, waitRequestOptions).then(getApiKeyResponse => {
          return hasChanged(getApiKeyResponse) ? Promise.resolve() : retry();
        });
      });

    return createWaitablePromise(
      base.transporter.write(
        {
          method: MethodEnum.Put,
          path: encode('1/keys/%s', apiKey),
          data,
        },
        options
      ),
      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