/// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <string> UserGetLastActivityAsync(this IAPIClient operations, System.Guid?id = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UserGetLastActivityWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='email'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <UserDetailModelInner> UserGetByEmailAsync(this IAPIClient operations, string email = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UserGetByEmailWithHttpMessagesAsync(email, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <UserListModelInner> > UsersNotInTeamAsync(this IAPIClient operations, System.Guid?id = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UsersNotInTeamWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='name'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <bool?> TeamExistsAsync(this IAPIClient operations, string name = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.TeamExistsWithHttpMessagesAsync(name, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='user'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <UserDetailModelInner> UserCreateAsync(this IAPIClient operations, UserDetailModelInner user = default(UserDetailModelInner), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.UserCreateWithHttpMessagesAsync(user, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='substring'>
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <System.Guid?> > SearchInPostsAsync(this IAPIClient operations, string substring = default(string), System.Guid?id = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.SearchInPostsWithHttpMessagesAsync(substring, id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='team'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <TeamDetailModelInner> CreateTeamAsync(this IAPIClient operations, TeamDetailModelInner team = default(TeamDetailModelInner), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateTeamWithHttpMessagesAsync(team, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#8
0
 public FriendsController(ILogger <FriendsController> logger, IIdentityClient client, IConfiguration Configuration, IAPIClient taskClient)
 {
     _client            = client;
     _logger            = logger;
     this.Configuration = Configuration;
     _taskClient        = taskClient;
 }
示例#9
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='id'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <RecipeModelInner> RecipesGetItemAsync(this IAPIClient operations, System.Guid?id = default(System.Guid?), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RecipesGetItemWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#10
0
 public MyTaskController(ILogger <MyTaskController> logger, IAPIClient client, IMyTaskFilterService filterService, IIdentityClient identityClient)
 {
     _client         = client;
     _logger         = logger;
     _filterService  = filterService;
     _identityClient = identityClient;
 }
示例#11
0
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <IList <RecipeModelInner> > RecipesGetAllItemsAsync(this IAPIClient operations, CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.RecipesGetAllItemsWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
示例#12
0
        public void Setup()
        {
            _listingsForTraining = new List <SoldListing>();

            var apiClientMock = new Mock <IAPIClient>();

            _client = apiClientMock.Object;
        }
        public StudentsController(IAPIClient <Student> apiClient, IAPIClient <Course> apiClientCourse, IAPIClient <Address> apiAddressCourse)
        {
            _apiClientStudent = apiClient;
            _apiClientCourse  = apiClientCourse;
            _apiClientAddress = apiAddressCourse;

            selectCourses = new SelectList(_apiClientCourse.GetListFromAPI("api/Course").GetAwaiter().GetResult(), "Id", "Name");;
        }
 public IndexModel(IAPIClient apiClient, SignInManager <User> signInManager,
                   ILogger <IndexModel> logger, UserManager <User> userManager)
 {
     this._apiClient     = apiClient;
     this._signInManager = signInManager;
     this._logger        = logger;
     this._userManager   = userManager;
 }
        public CustomerProxyRepository(IAppSettings appSettings, IAPIClient apiClient)
        {
            _appSettings = appSettings;
            _apiClient   = apiClient;

            //_appSettings.CustomerServiceAPI.BaseUrl = "http://main-api/";
            //_appSettings.CustomerServiceAPI.GetCustomers = "api/customers";
            //_appSettings.CustomerServiceAPI.GetCustomerByID = "api/customers/{0}";
        }
        public void EmployeeMonthsWorked_EmployeeWithNoShifts_ReturnsEmptyList()
        {
            client     = new MockApiClient(shifts, employees, null);
            controller = new WorkingTimeController(client);

            var result     = controller.EmployeeMonthsWorked(3);
            var viewResult = Assert.IsType <PartialViewResult>(result);
            var model      = Assert.IsAssignableFrom <MonthYearViewModel>(viewResult.ViewData.Model);

            Assert.Empty(model.EmployeeMonths);
        }
        public void EmployeeShiftsInMonth_EmployeeWithNoShifts_ReturnsViewModel_CalculatesTotalHours()
        {
            // pass no shift data to the mock client - test without shifts
            client     = new MockApiClient(null, employees, null);
            controller = new WorkingTimeController(client);

            var result     = controller.EmployeeShiftsInMonth(1, null);
            var viewResult = Assert.IsType <PartialViewResult>(result);

            Assert.Null(viewResult.ViewData.Model);
        }
        public void Index_ReturnsAViewResult_WithListOfEmployees()
        {
            client     = new MockApiClient(shifts, employees, months);
            controller = new WorkingTimeController(client);

            var result = controller.Index();

            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <EmployeeViewModel>(viewResult.ViewData.Model);

            Assert.Equal(6, model.Employees.Count());
        }
        public void EmployeeMonthsWorked_EmployeeWithShifts_ReturnsListOfMonths()
        {
            client     = new MockApiClient(shifts, employees, months);
            controller = new WorkingTimeController(client);

            var result = controller.EmployeeMonthsWorked(1);

            // dummy data contains 2 months
            var viewResult = Assert.IsType <PartialViewResult>(result);
            var model      = Assert.IsAssignableFrom <MonthYearViewModel>(viewResult.ViewData.Model);

            Assert.Equal(2, model.EmployeeMonths.Count());
        }
示例#20
0
        public IAPIClient Create(string apiType)
        {
            IAPIClient _client = null;

            if (apiType == "Flicker")
            {
                _client = new FlickrAPIClient();
            }
            else if (apiType == "Twitter")
            {
            }

            return(_client);
        }
        public void EmployeeShiftsInMonth_EmployeeWithShifts_ReturnsViewModel_CalculatesTotalHours()
        {
            client     = new MockApiClient(shifts, employees, months);
            controller = new WorkingTimeController(client);

            var result = controller.EmployeeShiftsInMonth(1, "11/2016");

            // test data includes 4 shifts (3x 9-17, 1x 10-14) - total hours = 28

            var viewResult = Assert.IsType <PartialViewResult>(result);
            var model      = Assert.IsAssignableFrom <EmployeeShiftViewModel>(viewResult.ViewData.Model);

            Assert.Equal(4, model.ShiftsForMonth.Count());
            Assert.Equal(28, model.TotalHours);
        }
示例#22
0
        static void Main(string[] args)
        {
            // The following values which needed to be populated in the App.Config file will need to be provided by Inform Billing
            baseUrl             = ConfigurationManager.AppSettings["InformBillingAPIBaseUrl"];
            tokenAccessEndPoint = ConfigurationManager.AppSettings["TokenAccessEndPoint"];
            clientId            = ConfigurationManager.AppSettings["ClientId"];
            apiKey              = ConfigurationManager.AppSettings["APIKey"];
            customerAPIKey      = ConfigurationManager.AppSettings["CustomerAPIKey"];
            getCustomerEndPoint = ConfigurationManager.AppSettings["GetCustomerByIdEndPoint"];

            // Best to use Dependency Injection here but keeping it simple for this example.
            sampleAPIClient = new SampleAPIClient(baseUrl, tokenAccessEndPoint, clientId, apiKey, customerAPIKey, new TimeSpan(0, 5, 0));

            // Call EndPoint
            CallGetEndPoint();

            Console.ReadLine();
        }
示例#23
0
 public BasePage(IAPIClient client)
 {
     this.Client = client;
 }
示例#24
0
 public MainWindowPage(IAPIClient client)
     : base(client)
 {
 }
示例#25
0
 public static async Task RecipesInsertItemAsync(this IAPIClient operations, RecipeModelInner recipe, CancellationToken cancellationToken = default)
 {
     await operations.RecipesInsertItemAsync(recipe.Name, recipe.Description, recipe.FoodType.ToString(), recipe.Id, cancellationToken);
 }
 public HomeScreenViewModel(IAPIClient apiClient)
 {
     _apiClient         = apiClient;
     ShowWeatherCommand = new MvxCommand(async() => await ExecuteFindWeatherCommand());
 }
示例#27
0
 public LoginArguments(IAPIClient cl, string username)
     : base(cl)
 {
     this.Username = username;
 }
示例#28
0
 public virtual void OnSocketReceive(IAPIClient client, dynamic obj)
 {
 }
示例#29
0
 public SocketReceiveArguments(IAPIClient cl, dynamic rec)
     : base(cl)
 {
     this.Received = rec;
 }
示例#30
0
 public TPlusRepository(BaseAPIConfig config)
 {
     _Client = new TPlusClient(config);
 }
 public PredictionsPage(IAPIClient client)
     : base(client)
 {
 }
示例#32
0
 public PessoasController(IPessoaService PessoaService, IAPIClient outraAPIClient)
 {
     _outraAPIClient = outraAPIClient;
     _personService  = PessoaService;
 }
示例#33
0
        /// <summary>
        /// Tries to invoke the matching routes
        /// </summary>
        /// <param name="routeName"></param>
        /// <param name="client"></param>
        /// <returns>True if a route has been found matching routeName, false otherwise.</returns>
        public static bool TryFireRoute(string routeName, IAPIClient client)
        {
            if (string.IsNullOrEmpty(routeName))
            {
                return false;
            }
            if (routeName.StartsWith("/"))
            {
                routeName = routeName.Remove(0, 1);
            }
            List<Route> routes = RouteManager.GetMatchingRoutes(routeName);
            if (routes.Count == 0)
            {
                APIServer.Log.Error("Couldn't find any routes with routename '" + routeName + "'");
                return false;
            }

            foreach (Route route in routes)
            {
                APIServer.Log.Info(route.Name + " route found matching '" + routeName + "'!");

                var properties = new ExpandoObject() as IDictionary<string, Object>;

                int i = 0;
                foreach (string strSegment in routeName.Split('/'))
                {
                    RouteSegment segment = route.Segments[i];
                    if (segment.IsProperty)
                    {
                        properties.Add(segment.Name, strSegment);
                        APIServer.Log.Info(segment.Name + " = " + strSegment);
                    }

                    i += 1;
                }

                RouteResult result = new RouteResult();
                result.Client = client;
                result.Route = route;
                result.Properties = properties;

                foreach (Action<RouteResult> routeResult in route.Results)
                {
                    routeResult.Invoke(result);
                }
            }
            return true;
        }
示例#34
0
 public MoviesService(IAPIClient apiClient, MovieSettings movieSettings)
 {
     _movieSettings = movieSettings;
     _apiClient     = apiClient;
 }
示例#35
0
 public PacketOut(IAPIClient c)
 {
     Client = c;
     Bytes = new byte[1];
 }
示例#36
0
 public FinancePageModel(IAPIClient apiClient)
 {
     _apiClient = apiClient;
 }
示例#37
0
 public HelloWorldPage(IAPIClient client)
     : base(client)
 {
 }
示例#38
0
 public static void RecipesInsertItem(this IAPIClient operations, RecipeModelInner recipe)
 {
     operations.RecipesInsertItem(recipe.Name, recipe.Description, recipe.FoodType.ToString(), recipe.Id);
 }
示例#39
0
 public PacketJSON(IAPIClient client, string json)
     : base(client)
 {
     WriteInt(json.Length);
     WriteString(json);
 }
示例#40
0
 public DeveloperService(IRepository <Developer> repository, IAPIClient apiClient)
 {
     _repository = repository;
     _apiClient  = apiClient;
 }
示例#41
0
 public ClientArguments(IAPIClient cl)
 {
     this.Client = cl;
 }