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);
        }
예제 #2
0
        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);
        }
예제 #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);
        }
예제 #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;
        }
예제 #5
0
 internal Picture(BuddyClient client = null)
     : base(client)
 {
 }
예제 #6
0
 public Picture(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
예제 #7
0
 public Location(string id= null, BuddyClient client = null)
     : base(id, client)
 {
 }
예제 #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;
 }
예제 #10
0
 public Message(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
예제 #11
0
 internal Album(BuddyClient client = null)
     : base(client)
 {
 }
예제 #12
0
		public Album(string id, BuddyClient client= null)
			: base(id, client)
		{
		}
예제 #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;
        }
예제 #15
0
 public Checkin(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
예제 #16
0
 internal Checkin(BuddyClient client = null)
     : base(client)
 {
 }
예제 #17
0
 internal Message(BuddyClient client = null)
     : base(client)
 {
 }
예제 #18
0
 internal User(BuddyClient client = null): base(client)
 {
 }
예제 #19
0
 public UserListItem(string path, BuddyClient client = null)
     : base(null, client)
 {
     this.path = path;
 }
예제 #20
0
 internal UserListItem(BuddyClient client = null)
     : base(client)
 {
 }
예제 #21
0
 public Metadata(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
예제 #22
0
 internal Location(BuddyClient client = null)
     : base(client)
 {
 }
예제 #23
0
 public Notification(string id, BuddyClient client = null)
     : base(id, client)
 {
 }
예제 #24
0
 public Picture(string id, string signedUrl, BuddyClient client = null)
     : this(id, client)
 {
     SetValue<string>("signedUrl", signedUrl, checkIsProp: false);
 }
예제 #25
0
 internal Notification(BuddyClient client)
     : base(client)
 {
 }
 internal AuthenticatedUser(string id, string accessToken, BuddyClient client)
     : base(id, client)
 {
     this.AccessToken = accessToken;
 }
예제 #27
0
 public BuddyAnalyticsEndpoint()
 {
     this.client = new BuddyClient("bbbbbc.mhbbbxjLrKNl", "83585740-AE7A-4F68-828D-5E6A8825A0EE");
 }