示例#1
0
 private async Task setApiReference()
 {
   while (apiClient == null)
   {
     apiClient = BaseMediaBrowserAPI.Instance.publicAPIClient;
   }
 }
示例#2
0
        static void Main(string[] args)
        {
            try
            {
                if (!File.Exists(FileName))
                {
                    var newRegistry = ProjectGenerator.GenRegistry(3, 10);
                    newRegistry.Save(FileName);
                }

                var registry = XmlRegistry.Load(FileName);

                // Валидация реестра - урлы в проектах и словах
                XmlRegistry.ValidateRegistry(registry);

                //------

                var apiKey = ConfigurationManager.AppSettings["apikey"];
                if (string.IsNullOrEmpty(apiKey))
                {
                    throw new InvalidOperationException(
                        "Invalid 'apikey' setting in application config.");
                }

                var config = new ClientConfig(apiKey);
                var client = new ApiClient(config);

                var syncClient = new SyncClient(client);

                Console.Write("Project's data loading...");
                syncClient.LoadSyncObjects();

                Console.WriteLine();
                Console.Write("Project's synchronization...");
                syncClient.SyncProjects(registry.Projects);

                Console.WriteLine();
                Console.Write("Groups's synchronization...");
                syncClient.SyncGroups(registry.Projects);

                Console.WriteLine();
                Console.Write("Keywords's synchronization...");
                syncClient.SyncKeywords(registry.Projects);

                Console.WriteLine();
                Console.Write("Synchronization completed, press any key...");
                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine();
                Console.WriteLine("Error:");
                Console.WriteLine(ex.ToString());
                Console.ResetColor();

                Console.Write("Press any key...");
                Console.ReadKey();
            }
        }
 private async Task<UserDto> loadUsers(ApiClient client)
 {            
     //Get Users
     var users = await client.GetUsersAsync();
     var currentUser = users.First();           
     return currentUser;
 }
        private void Form1_Load(object sender, EventArgs e)
        {
            var client = new ApiClient("eu");
            var item = client.GetItem(70534);
            propertyGrid1.SelectedObject = item;

            var races = client.GetRaces();

            var classes = client.GetClasses();

            var grewards = client.GetGuildRewards();

            var gperks = client.GetGuildPerks();

            var quest = client.GetQuest(25, Locale.ru_RU);

            var recipe = client.GetRecipe(2149, Locale.ru_RU);

            var arena = client.GetArenaLadder("шквал", "2v2");

            // http://eu.battle.net/api/wow/data/guild/perks
            // http://us.battle.net/api/wow/data/character/achievements
            // http://us.battle.net/api/wow/data/guild/achievements
            // http://us.battle.net/api/wow/data/battlegroups/
            // http://us.battle.net/api/wow/pvp/arena/Bloodlust/2v2
            // http://us.battle.net/api/wow/pvp/arena/Bloodlust/2v2?size=5
            // http://us.battle.net/api/wow/data/item/classes
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PluginUpdater" /> class.
 /// </summary>
 /// <param name="appHost">The app host.</param>
 /// <param name="logger">The logger.</param>
 public PluginUpdater(IApplicationHost appHost, ILogger logger, IApplicationPaths appPaths, ApiClient apiClient)
 {
     _appHost = appHost;
     _logger = logger;
     _appPaths = appPaths;
     _apiClient = apiClient;
 }
示例#6
0
 private IApiClient GetApiClient()
 {
     var key = new AuthenticationKey(628894, "TQL1KBeSIysqCHZ6slJnWLJM8kQvELjfBqoLD87a1gY9UKj64x2kpPUh2gNsuvgE");
     var mockCacheProvider = new Mock<ICacheProvider>();
     var client = new ApiClient(key, mockCacheProvider.Object);
     return client;
 }
示例#7
0
        public static void CreateMenuTest(string weixinID)
        {
            MenuInfo firstButon1 = new MenuInfo();
            firstButon1.type = MenuType.click.ToString();
            firstButon1.name = "下一个笑话";
            firstButon1.key = "V1001_HOT";
            List<MenuInfo> button = new List<MenuInfo>();
            button.Add(firstButon1);
            string menuInfostr = JsonConvert.SerializeObject(new
            {
                button = button

            });

            CreateMenuRequest request = new CreateMenuRequest(menuInfostr, ApiAccessTokenManager.Instance.GetTokenByWeixinID(weixinID));
            ApiClient client = new ApiClient();
            var response = client.Execute(request);
            if (!response.IsError)
            {
                Console.WriteLine(response.ToString());
            }
            else
            {
                Console.WriteLine(response.ErrorCode + ", " + response.ErrorMessage);
            }
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            m_client = new ApiClient("eu");

            QueryBGs();
            QueryData();
        }
示例#9
0
        public async void CreateNumber()
        {
            var client = new ApiClient(TestUser, TestPassword);

            var id = await client.CreateNumberAsync("se", new Uri("http://sms.tomv.io/receive"), null, null);
            Assert.IsFalse(string.IsNullOrEmpty(id));
        }
示例#10
0
        public List<MediaModel> MapObject(List<BaseItemDto> items, ApiClient client)
        {
            MMList = new List<MediaModel>();
              var imageoptions = new ImageOptions
              {
            ImageType = ImageType.Primary,
            Quality = 100
              };

              foreach (BaseItemDto item in items)
              {
            if (item.HasPrimaryImage)
            {
              initializeCatalog();
              MM.LargeCoverArt = client.GetImageUrl(item, imageoptions);
              MM.Title = item.Name;
              MM.Id = item.Path;
              MM.ReleaseYear = item.ProductionYear.ToString();
              MM.Synopsis = item.Overview;
              MM.AverageRating = item.OfficialRating;
              foreach (string g in item.Genres)
              {
            MM.Category.Add(g);
              }
              foreach (BaseItemPerson p in item.People)
              {
            MM.Cast.Add(p.Name);
              }
              MMList.Add(MM);
            }
              }
              return MMList;
        }
        private static void CreateClient()
        {
            try
            {
                _logger.Info("Creating API Client");
                var device = new Device { DeviceId = SharedUtils.GetDeviceId(), DeviceName = SharedUtils.GetDeviceName() };
                var server = ApplicationSettings.Get<ServerInfo>(Constants.Settings.DefaultServerConnection);
                if (server == null)
                {
                    _logger.Info("No server details found");
                    return;
                }

                var serverAddress = server.LastConnectionMode.HasValue && server.LastConnectionMode.Value == ConnectionMode.Manual ? server.ManualAddress : server.RemoteAddress;
                var client = new ApiClient(MediaBrowserLogger, serverAddress, "Windows Phone 8", device, ApplicationManifest.Current.App.Version, new CryptographyProvider());
                client.SetAuthenticationInfo(server.AccessToken, server.UserId);

                _logger.Info("Client created");
                _apiClient = client;
            }
            catch (Exception ex)
            {
                _logger.FatalException("Error creating ApiClient", ex);
            }
        }
示例#12
0
        public async void SendFlashSMS()
        {
            var client = new ApiClient(TestUser, TestPassword);
            var id = await client.SendSMSAsync("+46702386266", "+46702386266", "The answer is 42", true);
            Assert.IsFalse(string.IsNullOrEmpty(id));

        }
示例#13
0
        /// <summary>
        /// Initializes a new instance of the Configuration class with different settings
        /// </summary>
        /// <param name="apiClient">Api client</param>
        /// <param name="defaultHeader">Dictionary of default HTTP header</param>
        /// <param name="username">Username</param>
        /// <param name="password">Password</param>
        /// <param name="accessToken">accessToken</param>
        /// <param name="apiKey">Dictionary of API key</param>
        /// <param name="apiKeyPrefix">Dictionary of API key prefix</param>
        /// <param name="tempFolderPath">Temp folder path</param>
        /// <param name="dateTimeFormat">DateTime format string</param>
        /// <param name="timeout">HTTP connection timeout (in milliseconds)</param>
        /// <param name="userAgent">HTTP user agent</param>
        public Configuration(ApiClient apiClient = null,
                             Dictionary<String, String> defaultHeader = null,
                             string username = null,
                             string password = null,
                             string accessToken = null,
                             Dictionary<String, String> apiKey = null,
                             Dictionary<String, String> apiKeyPrefix = null,
                             string tempFolderPath = null,
                             string dateTimeFormat = null,
                             int timeout = 100000,
                             string userAgent = "Swagger-Codegen/1.0.0/csharp"
                            )
        {
            setApiClientUsingDefault(apiClient);

            Username = username;
            Password = password;
            AccessToken = accessToken;
            UserAgent = userAgent;

            if (defaultHeader != null)
                DefaultHeader = defaultHeader;
            if (apiKey != null)
                ApiKey = apiKey;
            if (apiKeyPrefix != null)
                ApiKeyPrefix = apiKeyPrefix;

            TempFolderPath = tempFolderPath;
            DateTimeFormat = dateTimeFormat;
            Timeout = timeout;
        }
示例#14
0
 public async virtual Task<string> GetResult(ApiClient client) {
     try {
         var url = this.BuildUrl(client.GetUrl(this));
         HttpClient hc = new HttpClient();
         return await hc.GetStringAsync(url);
     } catch (HttpRequestException ex) {
         var bex = ex.GetBaseException();
         var o = new {
             Message = new {
                 messageval = bex.HResult.ToString(),
                 messagestr = bex.Message
             }
         };
         return JsonConvert.SerializeObject(o);
     } catch (WebException ex1) {
         var bex = ex1.GetBaseException();
         var o = new {
             Message = new {
                 messageval = bex.HResult.ToString(),
                 messagestr = bex.Message
             }
         };
         return JsonConvert.SerializeObject(o);
     }
 }
示例#15
0
        public async virtual Task<string> GetResult(ApiClient client) {

            var url = this.BuildUrl(client.GetUrl(this));
            using (var handler = new HttpClientHandler() {
                UseCookies = this.WithCookies,
                AllowAutoRedirect = !this.NeedLoginFirst
            })
            using (HttpClient hc = new HttpClient(handler)) {
                try {
                    var msg = await hc.GetAsync(url);
                    //只有 AllowAutoRedirect 为 false 时,才会捕捉到 Headers.Location
                    if (this.NeedLoginFirst && msg.Headers.Location != null && msg.Headers.Location.Host.Equals("passport.lagou.com")) {
                        this.ErrorType = ErrorTypes.NeedLogin;
                        await this.PrepareLoginCookie(url);
                        return "";
                    } else
                        return await msg.Content.ReadAsStringAsync();

                    //GetStringAsync 会把 302 当作异常抛出
                    //return await hc.GetStringAsync(url);
                } catch (Exception ex) {
                    var bex = ex.GetBaseException();

                    this.ErrorType = bex.HResult.ToString().ParseErrorType();
                    this.Message = bex.Message;
                    return "";
                }
            }
        }
		public virtual void Dispose()
		{
			if (_client != null)
			{
				_client.Dispose();
				_client = null;
			}
		}
示例#17
0
        public async void SendWithConfirmationUrl()
        {
            var client = new ApiClient(TestUser, TestPassword);

            var id = await client.SendSMSAsync("+46702386266", "+46702386266", "I know you have read this!", false, new Uri("http://sms.tomv.io/confirm"));
            Assert.IsFalse(string.IsNullOrEmpty(id));

        }
示例#18
0
 private async Task<UserDto> loadUsers(ApiClient client)
 {
     //Get Users
     //var users = await client.GetUserAsync("9689f4e3f93ee782f535a2838e967da9");
     var users = await client.GetUsersAsync();
     var currentUser = users.First();
     //var currentUser = users;
     return currentUser;
 }
示例#19
0
		public SubscriptionsManager(ApiClient apiClient, TelemetryClient telemetryClient, AppSettingsService settingsService)
		{
			if (apiClient == null) throw new ArgumentNullException("apiClient");
			if (telemetryClient == null) throw new ArgumentNullException("telemetryClient");
			if (settingsService == null) throw new ArgumentNullException("settingsService");

			_apiClient = apiClient;
			_telemetryClient = telemetryClient;
			_settingsService = settingsService;
		}
示例#20
0
        public static ApiClient GetRealApiClient()
        {
            if (_realApiClient == null)
            {
                var config = new ClientConfig(_debugApiKey);
                _realApiClient = new ApiClient(config);
            }

            return _realApiClient;
        }
示例#21
0
        static async void Get()
        {
            
            using (var client = new ApiClient())
            {
                var response = await client.GetAsync( );
                response.EnsureSuccessStatusCode();
                var content = await response.Content.ReadAsAsync<object>();
            }
	    
        }
示例#22
0
        public bool Authenticate(ApiCredential credentials, HttpResponseBase response)
        {
            var apiClient = new ApiClient(credentials);
            if (!apiClient.Ping())
                return false;

            var userData = credentials.ToNameValueCollection();
            new FormsAuthentication().SetAuthCookie(response, "tinyPM User", true, userData);

            return true;
        }
        public async void UpdateProductInfo()
        {
            var apiClient = new ApiClient();
            var meowbit = await apiClient.GetProduct(prodNameMeowBit);
            if (meowbit != null)
                MeowBit = meowbit;

            var dotbitns = await apiClient.GetProduct(prodNameDotBitNs);
            if (dotbitns != null)
                DotBitNs = dotbitns;
        }
 private BaseMediaBrowserAPI() {
     try
     {
         baseAPIClient = new ApiClient("localhost", 0, "", "", "");
         LoadKernel();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }            
 }
示例#25
0
        public async Task<ActionResult> Index()
        {
            var model = new HomeModel();

            using (var client = new ApiClient())
            {
                model.Rappers = await client.Send<GetAllRappers, Rapper[]>(new GetAllRappers());
            }

            return View(model);
        }
        public V2BuildingService()
        {
            string clientId = ConfigurationManager.AppSettings["JciClientId"];
            string clientSecret = ConfigurationManager.AppSettings["JciClientSecret"];
            string tokenEndpoint = ConfigurationManager.AppSettings["JciTokenEndpoint"];
            string buildingApiEndpoint = ConfigurationManager.AppSettings["JciBuildingApiEndpoint"];
            IWebProxy proxy = WebProxy.GetDefaultProxy();

            _tokenProvider = new ClientCredentialsTokenClient(clientId, clientSecret, tokenEndpoint, proxy);
            _api = new ApiClient(_tokenProvider, buildingApiEndpoint);
        }
        private void MainForm_Load(object sender, EventArgs e)
        {
            var character = new ApiClient("eu").GetCharacter("Гордунни", "Киллшот", CharacterFields.All, Locale.ru_RU);

            if (character == null)
            {
                MessageBox.Show("Character request failed!");
                return;
            }

            propertyGrid1.SelectedObject = character;
        }
示例#28
0
		public SignInPageViewModel(INavigationService navigationService, ICredentialService credentialService, ApiClient apiClient, TelemetryClient telemetryClient)
		{
			if (navigationService == null) throw new ArgumentNullException("navigationService");
			if (credentialService == null) throw new ArgumentNullException("credentialService");
			if (apiClient == null) throw new ArgumentNullException("apiClient");
			if (telemetryClient == null) throw new ArgumentNullException("telemetryClient");

			_navigationService = navigationService;
			_credentialService = credentialService;
			_apiClient = apiClient;
			_telemetryClient = telemetryClient;
		}
        public ActionResult CreateMerchantCallback(string code, string state)
        {
            var merchantResponse = GoCardless.Partner.ParseCreateMerchantResponse(
                "http://localhost:12345/GoCardless/CreateMerchantCallback", code);

            // TODO: store response
            TempData["payload"] = merchantResponse;

            // use ApiClient to make calls on behalf of merchant
            var merchantApiClient = new ApiClient(merchantResponse.AccessToken);

            return RedirectToAction("Success", "Home");
        }
示例#30
0
 private async void LoadKernel()
 {
     try
     {
         await loadInitialClient().ConfigureAwait(false);
         UserDto locUser = await loadUsers(baseAPIClient);
         baseAPIClient.CurrentUserId = locUser.Id;
         publicAPIClient = baseAPIClient;
     }
     catch (Exception ex)
     {
         MessageBox.Show("There was an error launching MOVIES Browser: " + ex.Message);
     }
 }
示例#31
0
 public async Task ResetUserSpecificPermissions(EntityDto <long> input)
 {
     await ApiClient.PostAsync(GetEndpoint(nameof(ResetUserSpecificPermissions)), input);
 }
示例#32
0
 public async Task CreateOrUpdateUser(CreateOrUpdateUserInput input)
 {
     await ApiClient.PostAsync(GetEndpoint(nameof(CreateOrUpdateUser)), input);
 }
示例#33
0
 public async Task UpdateUserPermissions(UpdateUserPermissionsInput input)
 {
     await ApiClient.PutAsync(GetEndpoint(nameof(UpdateUserPermissions)), input);
 }
示例#34
0
 public async Task UnlockUser(EntityDto <long> input)
 {
     await ApiClient.PostAsync(GetEndpoint(nameof(UnlockUser)), input);
 }
示例#35
0
 public async Task DeleteUser(EntityDto <long> input)
 {
     await ApiClient.DeleteAsync(GetEndpoint(nameof(DeleteUser)), input);
 }
示例#36
0
 public async Task <FileDto> GetUsersToExcel()
 {
     return(await ApiClient.GetAsync <FileDto>(GetEndpoint(nameof(GetUsersToExcel))));
 }
 public async Task <UploadProfilePictureOutput> UploadProfilePicture(Action <CapturedMultipartContent> buildContent)
 {
     return(await ApiClient
            .PostMultipartAsync <UploadProfilePictureOutput>(GetEndpoint(nameof(UploadProfilePicture)), buildContent));
 }
 public SearchController()
 {
     _api = new ApiClient();
 }
示例#39
0
 public virtual IEnumerator HandleError(ApiClient client)
 {
     yield break;
 }
示例#40
0
 public async Task <UpdateUserSignInTokenOutput> UpdateUserSignInToken()
 {
     return(await ApiClient.PutAsync <UpdateUserSignInTokenOutput>(GetEndpoint(nameof(UpdateUserSignInToken))));
 }
示例#41
0
 public async Task <GetCurrentLoginInformationsOutput> GetCurrentLoginInformations()
 {
     return(await ApiClient.GetAsync <GetCurrentLoginInformationsOutput>(GetEndpoint(nameof(GetCurrentLoginInformations))));
 }
        public ProductController()
        {
            var apiClient = new ApiClient(HttpClientInstance.Instance);

            productClient = new ProductClient(apiClient);
        }
示例#43
0
        public ActionResult Index()
        {
            var data = new ApiClient().GetData <List <AreaDto> >("api/area");

            return(View(_mapper.Map <List <AreaModel> >(data)));
        }
示例#44
0
        /// <summary>
        ///  Provide worker details for inclusion into the Allocate ecosystem.  The platform will accept the worker information, and respond either synchronously or asynchronously with the allocate worker identifier.  This may entail an on-boarding process, so the final response may require human interaction before it can be completed.  Where there is a source system in common, such as HealthSuite and a Bank system both using ESR as a source of worker data, a person record containing an ESR trust-relative Staff Number is likely to be sufficient.
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="person">Worker information</param>
        /// <returns>Task of ApiResponse (WorkerRegistrationResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <WorkerRegistrationResponse> > RegisterWorkerAsyncWithHttpInfo(Person person)
        {
            // verify the required parameter 'person' is set
            if (person == null)
            {
                throw new ApiException(400, "Missing required parameter 'person' when calling DefaultApi->RegisterWorker");
            }

            var    localVarPath         = "/workers";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (person != null && person.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(person); // http body (model) parameter
            }
            else
            {
                localVarPostBody = person; // byte array
            }

            // authentication (jwt) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password);
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("RegisterWorker", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <WorkerRegistrationResponse>(localVarStatusCode,
                                                                localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                                                (WorkerRegistrationResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(WorkerRegistrationResponse))));
        }
示例#45
0
 public async Task <GetUserPermissionsForEditOutput> GetUserPermissionsForEdit(EntityDto <long> input)
 {
     return(await ApiClient.GetAsync <GetUserPermissionsForEditOutput>(GetEndpoint(nameof(GetUserPermissionsForEdit)), input));
 }
示例#46
0
 public override IEnumerator HandleResponse(ApiClient client)
 {
     yield break;
 }
示例#47
0
 public async Task <GetUserForEditOutput> GetUserForEdit(NullableIdDto <long> input)
 {
     return(await ApiClient.GetAsync <GetUserForEditOutput>(GetEndpoint(nameof(GetUserForEdit)), input));
 }
 public EtkinlikService(ApiClient client)
 {
     this.client = client;
 }
        /// <summary>
        /// Search Searches for the entities as specified by the given query.
        /// </summary>
        /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="spaceId"></param>
        /// <param name="query">The query restricts the token versions which are returned by the search.</param>
        /// <returns>Task of ApiResponse (List&lt;TokenVersion&gt;)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <List <TokenVersion> > > SearchAsyncWithHttpInfo(long?spaceId, EntityQuery query)
        {
            // verify the required parameter 'spaceId' is set
            if (spaceId == null)
            {
                throw new ApiException(400, "Missing required parameter 'spaceId' when calling TokenVersionService->Search");
            }
            // verify the required parameter 'query' is set
            if (query == null)
            {
                throw new ApiException(400, "Missing required parameter 'query' when calling TokenVersionService->Search");
            }

            var    localVarPath         = "/token-version/search";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>();
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json;charset=utf-8"
            };
            String localVarHttpContentType = ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json;charset=utf-8"
            };
            String localVarHttpHeaderAccept = ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (spaceId != null)
            {
                localVarQueryParams.Add("spaceId", ApiClient.ParameterToString(spaceId));                  // query parameter
            }
            if (query != null && query.GetType() != typeof(byte[]))
            {
                localVarPostBody = ApiClient.Serialize(query); // http body (model) parameter
            }
            else
            {
                localVarPostBody = query; // byte array
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await ApiClient.CallApiAsync(localVarPath,
                                                                                         Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                         localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Search", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <List <TokenVersion> >(localVarStatusCode,
                                                          localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                          (List <TokenVersion>)ApiClient.Deserialize(localVarResponse, typeof(List <TokenVersion>))));
        }
        private void WireCommands()
        {
            MoviePageLoaded = new RelayCommand(async() =>
            {
                if (SelectedMovie != null && NavigationService.IsNetworkAvailable)
                {
                    SetProgressBar(AppResources.SysTrayGettingMovieInfo);

                    await GetMovieDetails();

                    if (SelectedMovie.ProviderIds != null)
                    {
                        if (SelectedMovie != null && SelectedMovie.ProviderIds != null && SelectedMovie.ProviderIds.ContainsKey("Imdb"))
                        {
                            ImdbId = SelectedMovie.ProviderIds["Imdb"];
                        }
                    }

                    if (SelectedMovie.RunTimeTicks.HasValue)
                    {
                        var ts      = TimeSpan.FromTicks(SelectedMovie.RunTimeTicks.Value);
                        var runtime = ts.Hours == 0 ? string.Format("{0}m", ts.Minutes) : string.Format("{0}h {1}m", ts.Hours, ts.Minutes);
                        RunTime     = runtime;
                    }

                    if (SelectedMovie.UserData == null)
                    {
                        SelectedMovie.UserData = new UserItemDataDto();
                    }

                    SetProgressBar();
                }
            });

            AddRemoveFavouriteCommand = new RelayCommand(async() =>
            {
                try
                {
                    SetProgressBar(AppResources.SysTrayAddingToFavourites);

                    CanUpdateFavourites = false;

                    SelectedMovie.UserData = await ApiClient.UpdateFavoriteStatusAsync(SelectedMovie.Id, AuthenticationService.Current.LoggedInUserId, !SelectedMovie.UserData.IsFavorite);
                }
                catch (HttpException ex)
                {
                    Utils.HandleHttpException("AddRemoveFavouriteCommand (Movies)", ex, NavigationService, Log);
                    App.ShowMessage(AppResources.ErrorMakingChanges);
                }

                SetProgressBar();

                CanUpdateFavourites = true;
            });

            ShowOtherFilmsCommand = new RelayCommand <BaseItemPerson>(person =>
            {
                App.SelectedItem = person;
                NavigationService.NavigateTo(Constants.Pages.ActorView);
            });

            NavigateTopage = new RelayCommand <BaseItemDto>(NavigationService.NavigateTo);

            SetPosterAsLockScreenCommand = new RelayCommand(async() =>
            {
                if (!LockScreenService.Current.IsProvidedByCurrentApplication)
                {
                    var result = await LockScreenService.Current.RequestAccessAsync();

                    if (result == LockScreenServiceRequestResult.Denied)
                    {
                        return;
                    }
                }

                var url = ApiClient.GetImageUrl(SelectedMovie, LockScreenService.Current.SinglePosterOptions);

                LockScreenService.Current.ManuallySet = true;
                await LockScreenService.Current.SetLockScreenImage(url);
            });

            SyncItemCommand = new RelayCommand(async() =>
            {
                if (!SelectedMovie.CanTakeOffline())
                {
                    return;
                }

                var request = SyncRequestHelper.CreateRequest(SelectedMovie.Id, SelectedMovie.Name);

                await SyncService.Current.AddJobAsync(request);
            }, () => SelectedMovie != null && SelectedMovie.SupportsSync.HasValue && SelectedMovie.SupportsSync.Value);

            UnsyncItemCommand = new RelayCommand(async() =>
            {
                try
                {
                    if (SelectedMovie.IsSynced.HasValue && !SelectedMovie.IsSynced.Value)
                    {
                        return;
                    }

                    await SyncService.Current.UnsyncItem(SelectedMovie.Id);
                }
                catch (HttpException ex)
                {
                    Utils.HandleHttpException("UnsyncItemCommand", ex, NavigationService, Log);
                }
            });
        }
示例#51
0
 public abstract IEnumerator HandleResponse(ApiClient client);
        /// <summary>
        /// Read Reads the entity with the given &#39;id&#39; and returns it.
        /// </summary>
        /// <exception cref="Customweb.Wallee.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="spaceId"></param>
        /// <param name="id">The id of the token version which should be returned.</param>
        /// <returns>Task of ApiResponse (TokenVersion)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <TokenVersion> > ReadAsyncWithHttpInfo(long?spaceId, long?id)
        {
            // verify the required parameter 'spaceId' is set
            if (spaceId == null)
            {
                throw new ApiException(400, "Missing required parameter 'spaceId' when calling TokenVersionService->Read");
            }
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling TokenVersionService->Read");
            }

            var    localVarPath         = "/token-version/read";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new Dictionary <String, String>();
            var    localVarHeaderParams = new Dictionary <String, String>();
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "*/*"
            };
            String localVarHttpContentType = ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json;charset=utf-8"
            };
            String localVarHttpHeaderAccept = ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (spaceId != null)
            {
                localVarQueryParams.Add("spaceId", ApiClient.ParameterToString(spaceId));                  // query parameter
            }
            if (id != null)
            {
                localVarQueryParams.Add("id", ApiClient.ParameterToString(id));             // query parameter
            }
            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await ApiClient.CallApiAsync(localVarPath,
                                                                                         Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                         localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("Read", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <TokenVersion>(localVarStatusCode,
                                                  localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()),
                                                  (TokenVersion)ApiClient.Deserialize(localVarResponse, typeof(TokenVersion))));
        }
示例#53
0
        /// <summary>
        /// <para>
        /// Gets a list of ALL the apps published on Steam. This includes EVERYTHING with no way to cap entries. You will be spending a LONG time waiting for this to succeed.
        /// </para>
        /// Use this with caution - it returns only the AppId and the Name. If you want to limit entries use <see cref="SteamStoreListingExtensions.GetStoreApps"/>
        /// </summary>
        /// <param name="client">The <see cref="SteamApiRequest"/> to use</param>
        /// <returns>Every single Steam App published as a <see cref="SteamBasicSteamApp"/></returns>
        public static IEnumerable <SteamBasicSteamApp> GetAllAppNameAndIds(this ApiClient client)
        {
            var request = new SteamAppsListingRequest();

            return(client.Perform <SteamAppsListingResponse>(request).Listing.Apps);
        }
示例#54
0
 public SalesOrderApi(ApiClient eveTraderApiClient)
 {
     this.eveTraderApiClient = eveTraderApiClient;
 }
示例#55
0
 public override bool Validate(ApiClient client)
 {
     client.ClearCookie();
     return(true);
 }
示例#56
0
 public async Task <PagedResultDto <UserListDto> > GetUsers(GetUsersInput input)
 {
     return(await ApiClient.GetAsync <PagedResultDto <UserListDto> >(GetEndpoint(nameof(GetUsers)), input));
 }
示例#57
0
 public TokenEndpoint(ApiClient client) : base(client)
 {
     payloadFactory = new V3.Payload.PayloadFactory();
 }
示例#58
0
 public DetailsModel(ApiClient apiClient)
 {
     _apiClient = apiClient;
 }
 public ProfileDataContainer(IMessenger messenger, ApiClient client)
 {
     this.messenger = messenger;
     this.client    = client;
 }
示例#60
0
        /// <summary>
        ///  Retrieve worker details from the Allocate ecosystem using the Allocate Worker id. The Allocate Worker id will be issued when registering a worker.
        /// </summary>
        /// <exception cref="ASW.APIServices.Core.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="id">The ID of the worker</param>
        /// <returns>ApiResponse of Person</returns>
        public ApiResponse <Person> GetWorkerWithHttpInfo(string id)
        {
            // verify the required parameter 'id' is set
            if (id == null)
            {
                throw new ApiException(400, "Missing required parameter 'id' when calling DefaultApi->GetWorker");
            }

            var    localVarPath         = "/workers/{id}";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
            };
            String localVarHttpContentType    = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (id != null)
            {
                localVarPathParams.Add("id", this.Configuration.ApiClient.ParameterToString(id));             // path parameter
            }
            // authentication (jwt) required
            // http basic authentication required
            if (!String.IsNullOrEmpty(this.Configuration.Username) || !String.IsNullOrEmpty(this.Configuration.Password))
            {
                localVarHeaderParams["Authorization"] = "Basic " + ApiClient.Base64Encode(this.Configuration.Username + ":" + this.Configuration.Password);
            }

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)this.Configuration.ApiClient.CallApi(localVarPath,
                                                                                                 Method.GET, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                 localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("GetWorker", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <Person>(localVarStatusCode,
                                            localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                            (Person)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(Person))));
        }