Exemplo n.º 1
0
        //Required parameters:
        //-key
        //-location=lat,long
        //-radius={...meters} !not when rankby=distance

        //Optional parameters:
        //- language = {en, pl}
        //- keyword= {term to be matched against all content} !If rankby=distance
        //= minprice, maxprice= 0(affordable) to 4(expensive)
        //-name = {like keyword}
        //- rankby={prominence, distance}  !prominence based on importance, distance based on distance from location,
        // if rankby=distance is specified, then one or more of keyword, name, or type is required
        //- type= {result matching specified tyep} !only one !If rankby=distance
        //- pagetoken -Returns the next 20 results from a previously run search. Setting a pagetoken parameter will execute a search with the same parameters used previously


        public GooglePlaceNearbySearchInput Create(Location location, GooglePlaceTypeCategory typeCategory)
        {
            LanguageType language = LanguageType.Pl;
            var          types    = GooglePlaceTypes.Table.Where(x => x.Type == typeCategory).ToList();
            Random       rnd      = new Random();
            var          index    = rnd.Next(types.Count);

            return(new GooglePlaceNearbySearchInput(location, language, String.Empty, types[index]));
        }
        //Required parameters:
        //-key
        //-inputtype = {textquery , phonenumber}
        //-input ...

        //Optional parameters:
        //- language = {en, pl}
        //- fields   {formatted_address, geometry, icon, id, name, permanently_closed, photos, place_id, plus_code, scope, types,price_level, rating,opening_hours}
        //- locationbias = {ipbiad | point:lat,lng | circle:radius@lat,lng |rectangle:south,west|north,east}


        public GooglePlaceSearchInput CreateUseful(Location location, GooglePlaceTypeCategory typeCategory, LanguageType language)
        {
            var allUsefulFields = GoogleFields.Table
                                  .Where(x => x.AllowedServices.Contains(ExternalServicesType.GooglePlaceSearch) &&
                                         (x.Type == GoogleFieldType.Details || x.Type == GoogleFieldType.PlaceInfo || x.Type == GoogleFieldType.Reviews))
                                  .ToList();

            var input = GooglePlaceTypes.Table.First(x => x.Type == typeCategory).Name;

            return(new GooglePlaceSearchInput(input, location, language, allUsefulFields));
        }
Exemplo n.º 3
0
        public GooglePlaceType(string name, GooglePlaceTypeCategory type)
        {
            Name = name;
            Type = type;
            switch (type)
            {
            case GooglePlaceTypeCategory.None:
                PlanElementType = PlanElementType.Nothing;
                break;

            case GooglePlaceTypeCategory.Restaurant:
                PlanElementType = PlanElementType.Eating;
                break;

            case GooglePlaceTypeCategory.Food:
                PlanElementType = PlanElementType.Eating;
                break;

            case GooglePlaceTypeCategory.Entertainment:
                PlanElementType = PlanElementType.Entertainment;
                break;

            case GooglePlaceTypeCategory.Relax:
                PlanElementType = PlanElementType.Relax;
                break;

            case GooglePlaceTypeCategory.Activity:
                PlanElementType = PlanElementType.Activity;
                break;

            case GooglePlaceTypeCategory.Culture:
                PlanElementType = PlanElementType.Culture;
                break;

            case GooglePlaceTypeCategory.Sightseeing:
                PlanElementType = PlanElementType.Sightseeing;
                break;

            case GooglePlaceTypeCategory.Partying:
                PlanElementType = PlanElementType.Partying;
                break;

            case GooglePlaceTypeCategory.Shopping:
                PlanElementType = PlanElementType.Shopping;
                break;

            case GooglePlaceTypeCategory.Address:
                PlanElementType = PlanElementType.Nothing;
                break;

            case GooglePlaceTypeCategory.Bank:
                PlanElementType = PlanElementType.Nothing;
                break;

            case GooglePlaceTypeCategory.Car_rental:
                PlanElementType = PlanElementType.Nothing;
                break;

            case GooglePlaceTypeCategory.Airport:
                PlanElementType = PlanElementType.Nothing;
                break;

            case GooglePlaceTypeCategory.City_communication:
                PlanElementType = PlanElementType.Nothing;
                break;

            case GooglePlaceTypeCategory.Other_shop:
                PlanElementType = PlanElementType.Shopping;
                break;

            default:
                PlanElementType = PlanElementType.Nothing;
                break;
            }
        }