Esempio n. 1
0
    void Start()
    {
        FindPlaceRequest search = new FindPlaceRequest("KEY");;

        search.fields.Add(FindPlaceRequest.Field.FormattedAddress);

        // Callback search
        search.Send(
            "Manhattan",
            onResult => Debug.Log(JsonUtility.ToJson(onResult)),
            onError => Debug.LogError(onError)
            );

        // Promise search
        search.Send("Manhattan")
        .Then(response => Debug.Log(JsonUtility.ToJson(response)))
        .Catch(exception => Debug.LogError(exception));
    }
Esempio n. 2
0
        public Task <FetchResponse <Candidates <FindPlace> > > FindPlace(
            FindPlaceRequest request,
            string key)
        {
            var @params = new List <(string, object)>();

            if (!string.IsNullOrEmpty(request.input))
            {
                @params.Add(("input", request.input));
            }

            if (!string.IsNullOrEmpty(request.inputtype))
            {
                @params.Add(("inputtype", request.inputtype));
            }

            if (!string.IsNullOrEmpty(request.language))
            {
                @params.Add(("language", request.language));
            }

            if (!string.IsNullOrEmpty(request.language))
            {
                @params.Add(("language", request.language));
            }

            if (!string.IsNullOrEmpty(request.fields))
            {
                @params.Add(("fields", request.fields));
            }

            if (!string.IsNullOrEmpty(request.locationbias))
            {
                @params.Add(("locationbias", request.locationbias));
            }

            return(this.httpClient.ExecuteGet <Candidates <FindPlace> >(
                       Utils.GetApiUrl(FIND_PLACE_URL, key, @params)));
        }
Esempio n. 3
0
        public Task <FetchResponse <Candidates <FindPlace> > > FindPlace(
            string input,
            string inputtype,
            string key,
            string language     = null,
            string fields       = null,
            string locationbias = null)
        {
            var request = new FindPlaceRequest();

            if (!string.IsNullOrEmpty(input))
            {
                request.input = input;
            }

            if (!string.IsNullOrEmpty(inputtype))
            {
                request.inputtype = inputtype;
            }

            if (!string.IsNullOrEmpty(language))
            {
                request.language = language;
            }

            if (!string.IsNullOrEmpty(fields))
            {
                request.fields = fields;
            }

            if (!string.IsNullOrEmpty(locationbias))
            {
                request.locationbias = locationbias;
            }

            return(client.Places.FindPlace(request, key));
        }
Esempio n. 4
0
        async void Start()
        {
            UniMapInitializer.Initialize();

            FindPlaceRequest search = new FindPlaceRequest("KEY");;

            search.fields.Add(FindPlaceRequest.Field.FormattedAddress);

            // Callback search
            search.Send(
                "Manhattan",
                onResult => Debug.Log(JsonUtility.ToJson(onResult)),
                onError => Debug.LogError(onError)
                );

            try {
                var response = await search.Send("Manhattan");

                Debug.Log(response);
            }
            catch (Exception e) {
                Debug.LogError(e);
            }
        }