Example #1
0
        private void SetUpApi(Config config, statistics.Client.Configuration statsConfig = null, mds.Client.Configuration mdsConfig = null, Configuration deviceConfig = null)
        {
            const string dateFormat = "yyyy-MM-dd'T'HH:mm:ss.fffZ";
            var          auth       = $"{config.AuthorizationPrefix} {config.ApiKey}";

            if (statsConfig == null)
            {
                statsConfig = new statistics.Client.Configuration
                {
                    BasePath       = config.Host,
                    DateTimeFormat = dateFormat,
                    UserAgent      = UserAgent,
                };
                statsConfig.AddApiKey("Authorization", config.ApiKey);
                statsConfig.AddApiKeyPrefix("Authorization", config.AuthorizationPrefix);
                statsConfig.CreateApiClient();
            }

            if (mdsConfig == null)
            {
                mdsConfig = new mds.Client.Configuration
                {
                    BasePath       = config.Host,
                    DateTimeFormat = dateFormat,
                    UserAgent      = UserAgent,
                };
                mdsConfig.AddApiKey("Authorization", config.ApiKey);
                mdsConfig.AddApiKeyPrefix("Authorization", config.AuthorizationPrefix);
                mdsConfig.CreateApiClient();
            }

            if (deviceConfig == null)
            {
                deviceConfig = new device_directory.Client.Configuration
                {
                    BasePath       = config.Host,
                    DateTimeFormat = dateFormat,
                    UserAgent      = UserAgent,
                };
                deviceConfig.AddApiKey("Authorization", config.ApiKey);
                deviceConfig.AddApiKeyPrefix("Authorization", config.AuthorizationPrefix);
                deviceConfig.CreateApiClient();
            }

            DeviceDirectoryApi = new device_directory.Api.DefaultApi(deviceConfig);
            StatisticsApi      = new statistics.Api.StatisticsApi(statsConfig);
            SubscriptionsApi   = new SubscriptionsApi(mdsConfig);
            ResourcesApi       = new ResourcesApi(mdsConfig);
            EndpointsApi       = new EndpointsApi(mdsConfig);
            AccountApi         = new statistics.Api.AccountApi(statsConfig);
            NotificationsApi   = new NotificationsApi(mdsConfig);
            DeviceRequestsApi  = new DeviceRequestsApi(mdsConfig);
        }
Example #2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="apiKey">UWaterloo API Key</param>
 public UWaterlooApi(string apiKey)
 {
     // Initializing endpoints
     FoodServices        = new FoodServicesApi(apiKey);
     Courses             = new CoursesApi(apiKey);
     Events              = new EventsApi(apiKey);
     News                = new NewsApi(apiKey);
     Weather             = new WeatherApi(apiKey);
     Terms               = new TermsApi(apiKey);
     Resources           = new ResourcesApi(apiKey);
     DefinitionsAndCodes = new DefinitionsAndCodesApi(apiKey);
     Buildings           = new BuildingsApi(apiKey);
     Api    = new ApiApi(apiKey);
     Server = new ServerApi(apiKey);
 }
Example #3
0
 public void Init()
 {
     instance = new ResourcesApi();
 }