private void InitializeSDKs() { var apiKey = _settingsProvider.GetAppSettingsValue(EnvKey); if (string.IsNullOrWhiteSpace(apiKey)) { var message = $"{EnvKey}: is null or empty"; _log.LogEvent(LogEventIds.CloudPortApiError, message); throw new ArgumentNullException(LogEventIds.CloudPortApiError.Name, message); } Telestream.Cloud.Stores.Client.Configuration storesConfiguration = new Telestream.Cloud.Stores.Client.Configuration(); storesConfiguration.ApiKey.Add("X-Api-Key", apiKey); CloudPortStoresApi = new StoresApi(storesConfiguration); // Notifications are not being used just yet, but we include them now for future possibilies. Telestream.Cloud.Notifications.Client.Configuration notificationsConfiguration = new Telestream.Cloud.Notifications.Client.Configuration(); notificationsConfiguration.ApiKey.Add("X-Api-Key", apiKey); CloudPortNotificationsApi = new NotificationsApi(notificationsConfiguration); Telestream.Cloud.VantageCloudPort.Client.Configuration cloudPortConfiguration = new Telestream.Cloud.VantageCloudPort.Client.Configuration(); cloudPortConfiguration.ApiKey.Add("X-Api-Key", apiKey); CloudPortApi = new Telestream.Cloud.VantageCloudPort.Api.VantageCloudPortApi(cloudPortConfiguration); Telestream.Cloud.Flip.Client.Configuration flipConfiguration = new Telestream.Cloud.Flip.Client.Configuration(); flipConfiguration.ApiKey.Add("X-Api-Key", apiKey); FlipApi = new FlipApi(flipConfiguration); }
public void GetNotificationTest() { string authorization = "Basic asdadsa"; mockRestClient.Expects.One.Method(v => v.Execute(new RestRequest())).With(NMock.Is.TypeOf(typeof(RestRequest))).WillReturn(notificationResponse); ApiClient apiClient = new ApiClient(mockRestClient.MockObject); apiClient.Configuration = null; Configuration configuration = new Configuration { ApiClient = apiClient, Username = "******", Password = "******", AccessToken = null, ApiKey = null, ApiKeyPrefix = null, TempFolderPath = null, DateTimeFormat = null, Timeout = 60000, UserAgent = "asdasd" }; instance = new NotificationsApi(configuration); string notificationsId = "e8223fe7-13cb-4e04-881c-bf87b9beab28"; var response = instance.GetNotification(authorization, notificationsId); Assert.IsInstanceOf <GetNotificationResponse>(response, "response is GetNotificationResponse"); }
/// <summary> /// Register new webhook for incoming subscriptions. /// </summary> /// <param name="webhook"><see cref="Webhook"/></param> /// <example> /// <code> /// try /// { /// var webhook = new Webhook /// { /// Url = "www.exampleurl.com", /// }; /// connectApi.UpdateWebhook(webhook); /// } /// catch (CloudApiException) /// { /// throw; /// } /// </code> /// </example> /// <exception cref="CloudApiException">CloudApiException</exception> /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns> public async Task UpdateWebhookAsync(Webhook webhook) { if (DeliveryMethod == null) { DeliveryMethod = NotificationDeliveryMethod.DeliveryMethod.SERVER_INITIATED; } if (DeliveryMethod == NotificationDeliveryMethod.DeliveryMethod.CLIENT_INITIATED) { throw new CloudApiException(400, "cannot update webhook when delivery method is Client Initiated"); } try { if (forceClear) { await StopNotificationsAsync(); } var currentWebhook = GetWebhook(); if (currentWebhook.Url != webhook.Url) { await NotificationsApi.RegisterWebhookAsync(Webhook.MapToApiWebook(webhook)); } } catch (mds.Client.ApiException ex) { throw new CloudApiException(ex.ErrorCode, ex.Message, ex.ErrorContent); } }
public Group(IndiebackendAPI api, ApiGroup <TPublic, TPrivate> res, string profileToken, NotificationsApi notifications) { _profileToken = profileToken; UpdateFromApi(res); _api = api; _notificationsApi = notifications; }
public void GetNotificationsTest() { string authorization = "Basic asdadsa"; mockRestClient.Expects.One.Method(v => v.Execute(new RestRequest())).With(NMock.Is.TypeOf(typeof(RestRequest))).WillReturn(allNotificationResponse); ApiClient apiClient = new ApiClient(mockRestClient.MockObject); apiClient.Configuration = null; Configuration configuration = new Configuration { ApiClient = apiClient, Username = "******", Password = "******", AccessToken = null, ApiKey = null, ApiKeyPrefix = null, TempFolderPath = null, DateTimeFormat = null, Timeout = 60000, UserAgent = "asdasd" }; instance = new NotificationsApi(configuration); string deliveryStatus = "Delivered"; string fromDate = "2017-03-03"; string toDate = "2018-03-03"; int? offset = 0; int? limit = 100; var response = instance.GetNotifications(authorization, deliveryStatus, fromDate, toDate, offset, limit); Console.WriteLine(response); Assert.IsInstanceOf <GetNotificationsResponse>(response, "response is GetNotificationsResponse"); }
public EmailService(HttpClient httpClient, ILogger <EmailService> logger, ILoginConfig config) { _logger = logger; var notificationsApiClientConfiguration = new NotificationsApiClientConfiguration() { ApiBaseUrl = config.NotificationsApiClientConfiguration.ApiBaseUrl, #pragma warning disable 618 ClientToken = config.NotificationsApiClientConfiguration.ClientToken, #pragma warning restore 618 ClientId = config.NotificationsApiClientConfiguration.ClientId, ClientSecret = config.NotificationsApiClientConfiguration.ClientSecret, IdentifierUri = config.NotificationsApiClientConfiguration.IdentifierUri, Tenant = config.NotificationsApiClientConfiguration.Tenant, }; if (string.IsNullOrWhiteSpace(config.NotificationsApiClientConfiguration.ClientId)) { httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", config.NotificationsApiClientConfiguration.ClientToken); } else { var azureAdToken = new AzureADBearerTokenGenerator(notificationsApiClientConfiguration).Generate().Result; httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", azureAdToken); } _notificationApi = new NotificationsApi(httpClient, notificationsApiClientConfiguration); }
public string GetNotification(int id) { NotificationsApi notificationApi = new NotificationsApi(); var jsonData = JsonConvert.SerializeObject(notificationApi.GetNotification(id)); return(jsonData); }
public BitmovinApi(IBitmovinApiClientFactory apiClientFactory) { Account = new AccountApi(apiClientFactory); Analytics = new AnalyticsApi(apiClientFactory); Encoding = new EncodingApi(apiClientFactory); General = new GeneralApi(apiClientFactory); Notifications = new NotificationsApi(apiClientFactory); Player = new PlayerApi(apiClientFactory); }
public void UpdateNotification(Notifications notification) { NotificationsApi notificationApi = new NotificationsApi(); if (notification != null) { notificationApi.UpdateNotification(notification); } }
public void AddNotification(Notifications notification)//[FromBody]string value { NotificationsApi notificationApi = new NotificationsApi(); if (notification != null) { notificationApi.AddNotifications(notification); } }
/// <summary> /// Delete/remove registered webhook. /// </summary> /// <example> /// <code> /// try /// { /// connectApi.DeleteWebhook(); /// } /// catch (CloudApiException) /// { /// throw; /// } /// </code> /// </example> /// <exception cref="CloudApiException">CloudApiException</exception> public void DeleteWebhook() { try { NotificationsApi.DeregisterWebhook(); ResourceSubscribtions.Clear(); } catch (mds.Client.ApiException ex) { throw new CloudApiException(ex.ErrorCode, ex.Message, ex.ErrorContent); } }
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); }
public void DeleteNotification(int id) { NotificationsApi notificationApi = new NotificationsApi(); try { notificationApi.DeleteNotification(id); } catch (Exception ex) { throw ex; throw; } }
private void subscibeButton_Click(object sender, EventArgs e) { var api = new NotificationsApi(); Channel result = api.PostNotificationsChannels(); subscribeResultTextbox.Text = result.ToJson(); string channelId = result.Id; ChannelTopic body = new ChannelTopic($"v2.users.{userIdTextbox.Text}.conversations.calls"); List <ChannelTopic> topics = new List <ChannelTopic>(); ChannelTopicEntityListing resultListing = api.PutNotificationsChannelSubscriptions(channelId, topics); subscribeResultTextbox.Text += "\n\n=============================\n\n" + result.ToJson(); }
private static void SendEmail() { //var apiBaseUrl = "https://at-notifications.apprenticeships.sfa.bis.gov.uk/"; var apiBaseUrl = Configuration.NotificationsApiClientConfiguration.ApiBaseUrl; //var token = "<your token>"; var token = Configuration.NotificationsApiClientConfiguration.ClientToken; var config = new NotificationsApiClientConfiguration { ApiBaseUrl = apiBaseUrl, ClientToken = token }; IGenerateBearerToken jwtToken = new JwtBearerTokenGenerator(config); var httpClient = new HttpClientBuilder() .WithBearerAuthorisationHeader(jwtToken) .WithDefaultHeaders() .Build(); var apiClient = new NotificationsApi(httpClient, config); var recipients = Configuration.DefaultEmailAddress; var sender = Configuration.DefaultEmailSenderAddress; var replyTo = Configuration.DefaultEmailReplyToAddress; var customFields = new Dictionary <string, string> { { "UserEmailAddress", sender }, { "UserFullName", "Test User" }, { "UserEnquiry", "I have a question" }, { "UserEnquiryDetails", "Wanted to have different appSettings for debug and release when building your app ? " } }; var c = new Email { Tokens = customFields, RecipientsAddress = recipients, ReplyToAddress = replyTo, SystemId = "xyz", TemplateId = "VacancyService_CandidateContactUsMessage", Subject = "hello" }; apiClient.SendEmail(c).Wait(); }
public async Task <Player> WithMessaging() { if (string.IsNullOrEmpty(Token)) { throw new Exception("Can't invoke Player.WithMessaging() without being connected"); } _messaging = new MessagingApi(Token); await _messaging.Connect(); // Subscribe to player channel Notifications = new NotificationsApi(_api.GetHttp(), _messaging); _playerNotifications = await Notifications.Subscribe(AppId, "player", Id); return(this); }
/// <summary> /// Get the current callback URL if it exists. /// </summary> /// <returns>Webhook</returns> /// <example> /// <code> /// try /// { /// var webhook = connectApi.GetWebhook(); /// return webhook; /// } /// catch (CloudApiException) /// { /// throw; /// } /// </code> /// </example> /// <exception cref="CloudApiException">CloudApiException</exception> public Webhook GetWebhook() { try { return(Webhook.Map(NotificationsApi.GetWebhook())); } catch (mds.Client.ApiException ex) { if (ex.ErrorCode == 404) { // no webhook return(null); } throw new CloudApiException(ex.ErrorCode, ex.Message, ex.ErrorContent); } }
/// <summary> /// Creates a client to work with VK API methods. /// </summary> public CitrinaClient() { AuthHelper = new AuthHelper(); Execute = new ExecuteApi(); Account = new AccountApi(); Ads = new AdsApi(); Apps = new AppsApi(); Auth = new AuthApi(); Board = new BoardApi(); Database = new DatabaseApi(); Docs = new DocsApi(); Fave = new FaveApi(); Friends = new FriendsApi(); Gifts = new GiftsApi(); Groups = new GroupsApi(); Leads = new LeadsApi(); Likes = new LikesApi(); Market = new MarketApi(); Messages = new MessagesApi(); Newsfeed = new NewsfeedApi(); Notes = new NotesApi(); Notifications = new NotificationsApi(); Orders = new OrdersApi(); Pages = new PagesApi(); Photos = new PhotosApi(); Places = new PlacesApi(); Polls = new PollsApi(); Search = new SearchApi(); Secure = new SecureApi(); Stats = new StatsApi(); Status = new StatusApi(); Storage = new StorageApi(); Users = new UsersApi(); Utils = new UtilsApi(); Video = new VideoApi(); Wall = new WallApi(); Widgets = new WidgetsApi(); }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { AlbumApi = new AlbumApi(this); AnmmarApi = new AnmmarApi(this); AnnouncementApi = new AnnouncementApi(this); AssessmentsMessages = new AssessmentsMessages(this); AttendanceApi = new AttendanceApi(this); AuthorizationApi = new AuthorizationApi(this); BadgeApi = new BadgeApi(this); BehaviourApi = new BehaviourApi(this); CalendarApi = new CalendarApi(this); CertificateApi = new CertificateApi(this); ClassApi = new ClassApi(this); ConfigurationMangerApi = new ConfigurationMangerApi(this); CopyApi = new CopyApi(this); CourseApi = new CourseApi(this); CourseCatalogueApi = new CourseCatalogueApi(this); CourseGroupAuthors = new CourseGroupAuthors(this); CourseImageApi = new CourseImageApi(this); CourseRequestsApi = new CourseRequestsApi(this); CoursesProgress = new CoursesProgress(this); DiscussionApi = new DiscussionApi(this); EduShareApi = new EduShareApi(this); EvaluationApi = new EvaluationApi(this); EventApi = new EventApi(this); FileApi = new FileApi(this); FormsTemplatesApi = new FormsTemplatesApi(this); GradeApi = new GradeApi(this); GradeBookApi = new GradeBookApi(this); HelpApi = new HelpApi(this); IenApi = new IenApi(this); InvitationApi = new InvitationApi(this); InviteApi = new InviteApi(this); LanguageApi = new LanguageApi(this); LearningObjectivesApi = new LearningObjectivesApi(this); LearningPathApi = new LearningPathApi(this); LTILMSConsumerApi = new LTILMSConsumerApi(this); MaterialApi = new MaterialApi(this); MaterialSeenByUser = new MaterialSeenByUser(this); MembersApi = new MembersApi(this); MentorApi = new MentorApi(this); NotificationsApi = new NotificationsApi(this); OfferApi = new OfferApi(this); Office365 = new Office365(this); OfficeAddInApi = new OfficeAddInApi(this); Onenote = new Onenote(this); OrganizationUserAPI = new OrganizationUserAPI(this); OutcomesApi = new OutcomesApi(this); PointsApi = new PointsApi(this); PollApi = new PollApi(this); PrerequisitesApi = new PrerequisitesApi(this); QtiInteroperability = new QtiInteroperability(this); QuestionBankApi = new QuestionBankApi(this); ReflectionApi = new ReflectionApi(this); RelatedCoursesApi = new RelatedCoursesApi(this); ReportApi = new ReportApi(this); RoleManagementApi = new RoleManagementApi(this); ScheduleVisitApi = new ScheduleVisitApi(this); SchoolTypeApi = new SchoolTypeApi(this); SessionApi = new SessionApi(this); SpaceApi = new SpaceApi(this); StudentApi = new StudentApi(this); SubjectApi = new SubjectApi(this); SystemAdministrationApi = new SystemAdministrationApi(this); SystemReportsApi = new SystemReportsApi(this); TagsApi = new TagsApi(this); Themes = new Themes(this); TimeTableApi = new TimeTableApi(this); ToolConsumerProfileApi = new ToolConsumerProfileApi(this); TourApi = new TourApi(this); TrackApi = new TrackApi(this); TrainingPlanApi = new TrainingPlanApi(this); UserApi = new UserApi(this); UserProfileApi = new UserProfileApi(this); UserProgressApi = new UserProgressApi(this); UserSettingsApi = new UserSettingsApi(this); WallApi = new WallApi(this); BaseUri = new System.Uri("https://xwinji.azurewebsites.net"); SerializationSettings = new JsonSerializerSettings { Formatting = Newtonsoft.Json.Formatting.Indented, DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
public void Init() { instance = new NotificationsApi(); }