Beispiel #1
0
        private static string BuildPagingQueryString(int numRows, int offset, CollectionTypeFilter collectionTypeFilter)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("numRows=").Append(numRows).Append("&offset=").Append(offset);
            if (collectionTypeFilter != CollectionTypeFilter.All)
            {
                List <string> collectionTypes = new List <string>();
                foreach (var collectionType in new[] { CollectionTypeFilter.Panos, CollectionTypeFilter.Synths, CollectionTypeFilter.SynthPackets })
                {
                    if (collectionTypeFilter.HasFlag(collectionType))
                    {
                        collectionTypes.Add(collectionType.ToString());
                    }
                }

                if (collectionTypes.Any())
                {
                    sb.Append("&collectionTypeFilter=").Append(string.Join(",", collectionTypes));
                }
            }

            return(sb.ToString());
        }
Beispiel #2
0
 /// <summary>
 /// Gets the user's library of Photosynth collections. If the username does not belong to the current user,
 /// only public Photosynths will be returned.
 /// </summary>
 /// <param name="username">The username of the library to fetch.</param>
 /// <param name="numRows">The number of collections to return.</param>
 /// <param name="offset">The offset.</param>
 /// <param name="collectionTypeFilter">Flags indicating which collection types to return.</param>
 /// <returns>The user's library.</returns>
 public async Task <MediaCollection> GetUserLibraryAsync(
     string username, int numRows = DefaultNumRows, int offset = DefaultOffset, CollectionTypeFilter collectionTypeFilter = CollectionTypeFilter.All)
 {
     return(await this.MakeRequestAsync <MediaCollection>(
                "/users/" + username + "/media?" + BuildPagingQueryString(numRows, offset, collectionTypeFilter), HttpMethod.Get));
 }