/// <seealso href="https://developer.foursquare.com/overview/auth#userless" /> public FoursquareUserlessContext(HttpMessageHandler handler, UserlessAccessSettings settings) { if (handler == null) { throw new ArgumentNullException(nameof(handler)); } if (settings == null) { throw new ArgumentNullException(nameof(settings)); } var userlessHandler = HttpClientFactory.CreatePipeline(handler, new DelegatingHandler[] { new QueryAppenderHandler("client_id", settings.ClientId), new QueryAppenderHandler("client_secret", settings.ClientSecret) }); _httpClient = new HttpClient(userlessHandler, false) { BaseAddress = new Uri(Constants.FoursquareApiBaseUrl) }; Categories = new CategoriesClient(_httpClient); Venues = new VenuesClient(_httpClient); Photos = new PhotosClient(_httpClient); }
public static Task <IReadOnlyCollection <CompactVenue> > SearchVenues(this VenueCategory category, string placeName, int limit) { if (category == null) { throw new ArgumentNullException(nameof(category)); } var client = new VenuesClient(category.HttpClient); return(client.Search(placeName, category.Id, limit)); }
public ViagogoClient( ProductHeaderValue product, IGogoKitConfiguration configuration, IOAuth2TokenStore tokenStore, IJsonSerializer serializer, IHttpConnection oauthConnection, IHttpConnection apiConnection) { Requires.ArgumentNotNull(product, nameof(product)); Requires.ArgumentNotNull(configuration, nameof(configuration)); Requires.ArgumentNotNull(tokenStore, nameof(tokenStore)); Requires.ArgumentNotNull(serializer, nameof(serializer)); Requires.ArgumentNotNull(oauthConnection, nameof(oauthConnection)); Requires.ArgumentNotNull(apiConnection, nameof(apiConnection)); var halKitConfiguration = new HalKitConfiguration(configuration.ViagogoApiRootEndpoint) { CaptureSynchronizationContext = configuration.CaptureSynchronizationContext }; Configuration = configuration; TokenStore = tokenStore; Hypermedia = new HalClient(halKitConfiguration, apiConnection); var linkFactory = new LinkFactory(configuration); OAuth2 = new OAuth2Client(oauthConnection, configuration); User = new UserClient(Hypermedia); Search = new SearchClient(Hypermedia); Addresses = new AddressesClient(User, Hypermedia, linkFactory); Purchases = new PurchasesClient(User, Hypermedia, linkFactory); Sales = new SalesClient(Hypermedia, linkFactory); Shipments = new ShipmentsClient(Hypermedia, linkFactory); PaymentMethods = new PaymentMethodsClient(User, Hypermedia, linkFactory); Countries = new CountriesClient(Hypermedia, linkFactory); Currencies = new CurrenciesClient(Hypermedia, linkFactory); Categories = new CategoriesClient(Hypermedia, linkFactory); Events = new EventsClient(Hypermedia); Listings = new ListingsClient(Hypermedia); Venues = new VenuesClient(Hypermedia); SellerListings = new SellerListingsClient(Hypermedia, linkFactory); Webhooks = new WebhooksClient(Hypermedia, linkFactory); BatchClient = new BatchClient(apiConnection, new ApiResponseFactory(serializer, halKitConfiguration), serializer, new LinkResolver()); }
public GetVenueDetailsMethodTests() { _venue = Fixture.Create <Venue>(); Client .ExecuteTaskAsync <Venue>(Arg.Any <IRestRequest>()) .Returns(new RestResponse <Venue> { Data = _venue, StatusCode = HttpStatusCode.OK }); Client .ExecuteTaskAsync(Arg.Any <IRestRequest>()) .Returns(new RestResponse { StatusCode = HttpStatusCode.OK, Content = _venue.ToString() }); _sut = new VenuesClient(Client, Config); }
public SearchVenuesMethodTests() { _response = Fixture.Create <SearchVenuesResponse>(); Client .ExecuteTaskAsync <SearchVenuesResponse>(Arg.Any <IRestRequest>()) .Returns(new RestResponse <SearchVenuesResponse> { Data = _response, StatusCode = HttpStatusCode.OK }); Client .ExecuteTaskAsync(Arg.Any <IRestRequest>()) .Returns(new RestResponse { StatusCode = HttpStatusCode.OK, Content = _response.ToString() }); _sut = new VenuesClient(Client, Config); }
public EventsController(EventsDbContext context, VenuesClient venuesClient) { _context = context; _dataAccess = new EventsDataAccess(context); _venuesClient = venuesClient; }