public static async Task <XmlDocument> Search(MBEntityType ent, string query, int maxCount, int offset) { // url string = serverpath /<ENTITY>?query=<QUERY>&limit=<LIMIT>&offset=<OFFSET> string ext = $"/{EntityStrings(ent)}?query={query}&limit={maxCount.ToString()}&offset={offset.ToString()}"; return(await GetServerData(APIpath + ext)); }
public static async Task <XmlDocument> Browse(MBEntityType ent, string MBID, int maxCount, int offset, string[] inc = null) { // url string = serverpath /<ENTITY>?<ENTITY>=<MBID>&limit=<LIMIT>&offset=<OFFSET>&inc=<INC> string ext = $"/{EntityStrings(ent)}?{EntityStrings(ent)}={MBID}&limit={maxCount.ToString()}&offset={offset.ToString()}"; if (inc != null) { ext = ext + $"&inc={inc}"; } for (int i = 1; i < inc.Length; i++) { ext = ext + $"%20{inc[i]}"; //multiple inc commands can be added with spaces } return(await GetServerData(APIpath + ext)); }
private const string UserAgentId = @"Gserver/1.0.0 ( [email protected] )"; //server needs identification string in header to allow requests public static async Task <XmlDocument> Lookup(MBEntityType ent, string MBID, string[] inc = null) { // url string = serverpath /<ENTITY>/<MBID>?inc=<INC> string ext = $"/{EntityStrings(ent)}/{MBID}"; if (inc != null) { ext = ext + $"?inc={inc[0]}"; } for (int i = 1; i < inc.Length; i++) { ext = ext + $"%20{inc[i]}"; //multiple inc commands can be added with spaces } return(await GetServerData(APIpath + ext)); }
private static string EntityStrings(MBEntityType ent) { switch (ent) { case MBEntityType.artist: return("artist"); case MBEntityType.recording: return("recording"); case MBEntityType.release: return("release"); case MBEntityType.releaseGroup: return("release-group"); default: return(""); } }
public MBEntity(MBEntityType EntType) { this.EntityType = EntType; }