/// <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 <object> GetAsync(this IKeys operations, string id, CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.GetWithHttpMessagesAsync(id, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> AddAsync(this IKeys operations, CreateKeyRequest body = default(CreateKeyRequest), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.AddWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { BasicPing = new BasicPing(this); Keys = new Keys(this); BaseUri = new System.Uri("http://localhost"); 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 int CompareTo(IKeys other) { if (this != MaxValue && other == MaxValue) { return(-1); } if (this == MaxValue && other == MaxValue) { return(0); } if (this == MaxValue && other != MaxValue) { return(+1); } if (this.Length != other.Length) { throw new ArgumentException("Lengths differ"); } int result = 0; var thisKeyEnumerator = this.GetEnumerator(); foreach (var otherKey in other) { thisKeyEnumerator.MoveNext(); result = thisKeyEnumerator.Current.CompareTo(otherKey); if (result != 0) { break; } } return(result); }
protected override void OnElementChanged(ElementChangedEventArgs <Page> e) { base.OnElementChanged(e); var activity = this.Context as Android.App.Activity; OAuth2Authenticator auth2 = null; OAuth1Authenticator auth1 = null; IKeys keys = null; var authPage = Element as AuthorizePage; switch (authPage.Service) { case LoginServices.Facebook: keys = new FacebookKeys(); auth2 = new OAuth2Authenticator( clientId: keys.ClientId, scope: keys.Scope, authorizeUrl: new Uri(keys.AuthorizeUrl), redirectUrl: new Uri(keys.RedirectUrl)); break; case LoginServices.Twitter: keys = new TwitterKeys(); auth1 = new OAuth1Authenticator( consumerKey: keys.ConsumerKey, consumerSecret: keys.ConsumerSecret, requestTokenUrl: new Uri(keys.RequestTokenUrl), authorizeUrl: new Uri(keys.AuthorizeUrl), accessTokenUrl: new Uri(keys.AccessTokenUrl), callbackUrl: new Uri(keys.CallbackUrl)); break; default: throw new Exception("Service " + authPage.Service + " not yet supported"); } if (auth2 != null) { auth2.Completed += async(sender, eventArgs) => { if (eventArgs.IsAuthenticated) { AccountStore.Create().Save(eventArgs.Account, authPage.Service.ToString()); } await authPage.Navigation.PopAsync(); }; activity.StartActivity(auth2.GetUI(activity)); } if (auth1 != null) { auth1.Completed += async(sender, eventArgs) => { if (eventArgs.IsAuthenticated) { AccountStore.Create().Save(eventArgs.Account, authPage.Service.ToString()); } await authPage.Navigation.PopAsync(); }; activity.StartActivity(auth1.GetUI(activity)); } }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='id'> /// </param> public static object Get(this IKeys operations, string id) { return(operations.GetAsync(id).GetAwaiter().GetResult()); }
/// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// </param> public static object Add(this IKeys operations, CreateKeyRequest body = default(CreateKeyRequest)) { return(operations.AddAsync(body).GetAwaiter().GetResult()); }