internal static BuddyServiceClientBase CreateServiceClient(BuddySDK.BuddyClient client, string serviceRoot, string appID, string sharedSecret)
        {
            var    type     = typeof(BuddyServiceClientHttp);
            string typeName = null;

            try
            {
                typeName = PlatformAccess.Current.GetConfigSetting("BuddyServiceClientType");
            }
            catch (NotImplementedException)
            {
                // platform access doesn't provide config settings
            }

            if (typeName != null)
            {
                type = Type.GetType(typeName, true);
            }

            if (!typeof(BuddyServiceClientBase).IsAssignableFrom(type))
            {
                throw new ArgumentException(type.FullName + " is not a BuddyServiceClientBase implementor.");
            }

            var bsc = (BuddyServiceClientBase)Activator.CreateInstance(type, serviceRoot, appID, sharedSecret);

            bsc.Client = client;
            return(bsc);
        }
        public static IBuddyClient Init(string appId, string appKey, BuddyOptions options = null)
        {
            if (options == null)
            {
                options = new BuddyOptions();
            }

            if (_currentClientKey != null && !options.Flags.HasFlag(BuddyClientFlags.AllowReinitialize))
            {
                throw new InvalidOperationException("Already initialized.");
            }

            CurrentInstance = new BuddyClient(appId, appKey, options);

            return(CurrentInstance);
        }
Exemple #3
0
        protected async Task <bool> OnServiceException(BuddyClient client, BuddyServiceException buddyException)
        {
            if (buddyException is BuddyUnauthorizedException)
            {
                client.OnAuthorizationFailure((BuddyUnauthorizedException)buddyException);
                return(false);
            }
            else if (buddyException is BuddyNoInternetException)
            {
                await client.OnConnectivityChanged(ConnectivityLevel.None);

                return(false);
            }

            bool result = false;

            if (ServiceException != null)
            {
                var args = new ServiceExceptionEventArgs(buddyException);
                ServiceException(this, args);
                result = args.ShouldThrow;
            }
            return(result);
        }
Exemple #4
0
        public static void Init(string appId, string appKey, BuddyClientFlags flags = PlatformAccess.DefaultFlags)
        {
            if (_creds != null && !flags.HasFlag(BuddyClientFlags.AllowReinitialize))
            {
                throw new InvalidOperationException("Already initialized.");
            }
            _creds = new Tuple<string, string, BuddyClientFlags>(appId, appKey, flags);

            _client = null;
        }
Exemple #5
0
 internal Picture(BuddyClient client = null)
     : base(client)
 {
 }
Exemple #6
0
 public Picture(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
Exemple #7
0
 public Location(string id= null, BuddyClient client = null)
     : base(id, client)
 {
 }
Exemple #8
0
 public User(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
 internal SocialAuthenticatedUser(string id, string accessToken, bool isNew, BuddyClient client = null)
     : base(id, accessToken, client)
 {
     IsNew = isNew;
 }
Exemple #10
0
 public Message(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
Exemple #11
0
 internal Album(BuddyClient client = null)
     : base(client)
 {
 }
Exemple #12
0
		public Album(string id, BuddyClient client= null)
			: base(id, client)
		{
		}
Exemple #13
0
 public AlbumItem(string path, BuddyClient client = null)
     : base(null, client)
 {
     this.path = path;
 }
        protected BuddyMetadataBase(string id, BuddyClient client = null)
        {
            this._metadataId = id;

            this._client = client;
        }
Exemple #15
0
 public Checkin(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
Exemple #16
0
 internal Checkin(BuddyClient client = null)
     : base(client)
 {
 }
Exemple #17
0
 internal Message(BuddyClient client = null)
     : base(client)
 {
 }
Exemple #18
0
 internal User(BuddyClient client = null): base(client)
 {
 }
 public UserListItem(string path, BuddyClient client = null)
     : base(null, client)
 {
     this.path = path;
 }
 internal UserListItem(BuddyClient client = null)
     : base(client)
 {
 }
Exemple #21
0
 public Metadata(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
Exemple #22
0
 internal Location(BuddyClient client = null)
     : base(client)
 {
 }
 public Notification(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
Exemple #24
0
 public Picture(string id, string signedUrl, BuddyClient client = null)
     : this(id, client)
 {
     SetValue<string>("signedUrl", signedUrl, checkIsProp: false);
 }
 internal Notification(BuddyClient client)
     : base(client)
 {
 }
 internal AuthenticatedUser(string id, string accessToken, BuddyClient client)
     : base(id, client)
 {
     this.AccessToken = accessToken;
 }
 public BuddyAnalyticsEndpoint()
 {
     this.client = new BuddyClient("bbbbbc.mhbbbxjLrKNl", "83585740-AE7A-4F68-828D-5E6A8825A0EE");
 }