Skip to content

Commit

Permalink
refactor(geocoder): rename IGeocodeServiceInfoResponse to IGetGeocode…
Browse files Browse the repository at this point in the history
…ServiceResponse

AFFECTS PACKAGES:
@esri/arcgis-rest-geocoder
  • Loading branch information
jgravois committed Mar 1, 2018
1 parent 041d1ba commit 2586de1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions packages/arcgis-rest-geocoder/src/geocoder.ts
Expand Up @@ -155,7 +155,7 @@ export interface IBulkGeocodeResponse {
}>;
}

export interface IGeocodeServiceInfoResponse {
export interface IGetGeocodeServiceResponse {
currentVersion: number;
serviceDescription: string;
addressFields: any[];
Expand Down Expand Up @@ -384,9 +384,9 @@ export function bulkGeocode(
* @param requestOptions - Request options can contain a custom geocoding service to fetch metadata from.
* @returns A Promise that will resolve with the data from the response.
*/
export function geocodeService(
export function getGeocodeService(
requestOptions?: IEndpointRequestOptions
): Promise<IGeocodeServiceInfoResponse> {
): Promise<IGetGeocodeServiceResponse> {
const url = (requestOptions && requestOptions.endpoint) || worldGeocoder;

const options: IEndpointRequestOptions = {
Expand All @@ -399,18 +399,18 @@ export function geocodeService(
}

/**
* Deprecated. Please use `geocodeService()` instead.
* Deprecated. Please use `getGeocodeService()` instead.
*
* @param requestOptions - Request options can contain a custom geocoding service to fetch metadata from.
* @returns A Promise that will resolve with the data from the response.
*/
export function serviceInfo(
requestOptions?: IEndpointRequestOptions
): Promise<IGeocodeServiceInfoResponse> {
): Promise<IGetGeocodeServiceResponse> {
warn(
"serviceInfo() will be deprecated in the next major release. please use getGeocoderServiceInfo() instead."
);
return geocodeService(requestOptions);
return getGeocodeService(requestOptions);
}

export default {
Expand Down
8 changes: 4 additions & 4 deletions packages/arcgis-rest-geocoder/test/geocoder.test.ts
Expand Up @@ -4,7 +4,7 @@ import {
reverseGeocode,
bulkGeocode,
serviceInfo,
geocodeService
getGeocodeService
} from "../src/index";

import * as fetchMock from "fetch-mock";
Expand Down Expand Up @@ -347,7 +347,7 @@ describe("geocode", () => {
it("should retrieve metadata from the World Geocoding Service", done => {
fetchMock.once("*", SharingInfo);

geocodeService()
getGeocodeService()
.then(response => {
expect(fetchMock.called()).toEqual(true);
const [url, options]: [string, RequestInit] = fetchMock.lastCall("*");
Expand All @@ -370,7 +370,7 @@ describe("geocode", () => {
it("should make POST request for metadata from the World Geocoding Service", done => {
fetchMock.once("*", SharingInfo);

geocodeService({ httpMethod: "POST" })
getGeocodeService({ httpMethod: "POST" })
.then(response => {
expect(fetchMock.called()).toEqual(true);
const [url, options]: [string, RequestInit] = fetchMock.lastCall("*");
Expand All @@ -395,7 +395,7 @@ describe("geocode", () => {
it("should retrieve metadata from custom geocoding services", done => {
fetchMock.once("*", SharingInfo);

geocodeService({ endpoint: customGeocoderUrl })
getGeocodeService({ endpoint: customGeocoderUrl })
.then(response => {
expect(fetchMock.called()).toEqual(true);
const [url, options]: [string, RequestInit] = fetchMock.lastCall("*");
Expand Down

0 comments on commit 2586de1

Please sign in to comment.