public Task<SearchResult<MetadataItem>> FindMetadataAsync(
            string key = null,
            string value = null,
            string keyPrefix = null,
            BuddyGeoLocationRange locationRange = null,
            DateRange created = null,
            DateRange lastModified = null,
            BuddyPermissions? visibility = null, string ownerUserId = null, int pageSize = 100, string pagingToken = null)
        {
            var obj = new Dictionary<string, object>(DotNetDeltas.InvariantComparer(true)){
                    {"created", created},
                    {"lastModified", lastModified},
                    {"locationRange", locationRange},
                    {"ownerID", ownerUserId},
                    {"key", key},
                        {"value", value},
                    {"keyPrefix", keyPrefix}
                };

            if (visibility != null)
            {
                obj["visibility"] = visibility;
            }

            BuddyCollectionBase<BuddyBase>.InitializePaging(obj, pagingToken, pageSize);

            return Client.CallServiceMethod<SearchResult<MetadataItem>>("GET",
                GetMetadataPath(), obj
            ).WrapTask<BuddyResult<SearchResult<MetadataItem>>, SearchResult<MetadataItem>>((r1) => r1.Result.Value);
        }
Пример #2
0
        public Task<SearchResult<MetadataItem>> FindMetadataAsync(
            string key = null, 
            string keyPrefix = null,
            BuddyGeoLocationRange locationRange = null,
            DateRange created = null,
            DateRange lastModified = null,
            BuddyPermissions visibility = BuddyPermissions.Default
            )
        {
            return Task.Run<SearchResult<MetadataItem>>(() =>
            {
                IDictionary<string, object> obj = new Dictionary<string, object>(DotNetDeltas.InvariantComparer(true)){
                        {"visibility", visibility},
                        {"created", created},
                        {"lastModified", lastModified},
                        {"locationRange", locationRange},
                        {"key", key},
                        {"keyPrefix", keyPrefix}
                    };

                var r = Client.CallServiceMethod<SearchResult<MetadataItem>>("GET",
                        GetMetadataPath(), obj
                        ).Result;

                if (r.IsSuccess)
                {
                    return r.Value;
                }
                else
                {
                    return new SearchResult<MetadataItem>(r.RequestID, r.Error);
                }
            });
        }