Commit 25d4dd7b authored by Leonardo Schwarz's avatar Leonardo Schwarz

Move search up one layer from client mod.

Kind of gross how I did this, but this is also partially due to some
things from client yet having to migrate to search too.
parent 6bc939a9
......@@ -12,11 +12,12 @@ use xpath_reader::reader::{FromXmlContained, XpathStrReader};
use std::time::{Duration, Instant};
use std::thread::sleep;
pub mod search;
use self::search::{AreaSearchBuilder, ArtistSearchBuilder, ReleaseGroupSearchBuilder};
pub use self::search::SearchBuilder;
use search::{AreaSearchBuilder, ArtistSearchBuilder, ReleaseGroupSearchBuilder};
// TODO reconsider reexport
pub use search::SearchBuilder;
mod error;
use self::error::check_response_error;
/// Helper extracting the number of milliseconds from a `Duration`.
......@@ -124,6 +125,7 @@ impl Client {
fn get_body(&mut self, url: Url) -> Result<String, ClientError>
......@@ -195,7 +197,7 @@ mod tests {
let mut client = get_client("release_group_01");
let results = client
......@@ -17,6 +17,7 @@ pub use self::errors::*;
pub mod client;
pub mod entities;
pub mod search;
mod util;
......@@ -11,9 +11,9 @@
// and the string value in the following declarations and then sort the entries alphabetically
// again.
use super::{Mbid, full_entities};
use super::{full_entities};
// use super::query::QueryExpression;
use super::full_entities::PartialDate;
use super::full_entities::{Mbid, PartialDate};
// use super::entities;
pub trait SearchField {
use super::*;
use super::super::entities as full_entities;
use entities as full_entities;
use entities::Resource;
use errors::ClientError;
use client::Client;
use reqwest_mock::Url;
use url::percent_encoding::{DEFAULT_ENCODE_SET, utf8_percent_encode};
use xpath_reader::{FromXml, FromXmlError, XpathReader};
use xpath_reader::{FromXml, FromXmlError, XpathReader, XpathStrReader};
pub mod fields;
use self::fields::{AreaSearchField, ArtistSearchField, ReleaseSearchField, ReleaseGroupSearchField};
......@@ -49,11 +51,11 @@ macro_rules! define_search_builder {
$list_tag:expr ) => {
pub struct $builder<'cl> {
params: Vec<(&'static str, String)>,
client: &'cl mut super::Client,
client: &'cl mut Client,
impl<'cl> $builder<'cl> {
pub fn new(client: &'cl mut super::Client) -> Self {
pub fn new(client: &'cl mut Client) -> Self {
Self {
params: Vec::new(),
client: client,
......@@ -91,7 +93,7 @@ macro_rules! define_search_builder {
context.set_namespace("ext", "");
let reader = XpathStrReader::new(xml, &context)?;
......@@ -4,9 +4,9 @@
//! They are only contained in search results and provide a means to retrive
//! the full entitity a further API request.
use super::{Client, ClientError, Mbid, full_entities};
use super::{Client, ClientError, full_entities};
use self::full_entities::refs::*;
use self::full_entities::Resource;
use self::full_entities::{Mbid, Resource};
use xpath_reader::FromXmlError;
use xpath_reader::reader::{FromXml, FromXmlElement, XpathReader};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment