// Path: src/main/java/com/sonoport/freesound/query/HTTPRequestMethod.java
// public enum HTTPRequestMethod {
// 
// 	/** HTTP GET. */
// 	GET,
// 
// 	/** HTTP POST. */
// 	POST,
// 
// 	/** HTTP PUT. */
// 	PUT,
// 
// 	/** HTTP DELETE. */
// 	DELETE,
// 
// 	/** HTTP PATCH. */
// 	PATCH,
// 
// 	/** HTTP HEAD. */
// 	HEAD,
// 
// 	/** HTTP OPTIONS. */
// 	OPTIONS;
// }
// 
// Path: src/main/java/com/sonoport/freesound/query/JSONResponseQuery.java
// public abstract class JSONResponseQuery<R extends Object> extends Query<JSONObject, R> {
// 
// 	/**
// 	 * @param httpRequestMethod HTTP method to use for query
// 	 * @param path Endpoint to submit the query to
// 	 * @param resultsMapper {@link Mapper} to convert results
// 	 */
// 	protected JSONResponseQuery(
// 			final HTTPRequestMethod httpRequestMethod, final String path, final Mapper<JSONObject, R> resultsMapper) {
// 		super(httpRequestMethod, path, resultsMapper);
// 	}
// 
// 	@Override
// 	protected String extractErrorMessage(final JSONObject freesoundResponse) {
// 		return freesoundResponse.getString("detail");
// 	}
// 
// }
// 
// Path: src/main/java/com/sonoport/freesound/query/OAuthQuery.java
// public interface OAuthQuery {
// 
// 	/**
// 	 * @return The oauthToken to be presented with the request
// 	 */
// 	String getOauthToken();
// 
// }
// 
// Path: src/main/java/com/sonoport/freesound/response/mapping/DetailStringMapper.java
// public class DetailStringMapper extends Mapper<JSONObject, String> {
// 
// 	@Override
// 	public String map(final JSONObject source) {
// 		return extractFieldValue(source, "detail", String.class);
// 	}
// 
// }


import java.util.HashMap;
import java.util.Map;
import com.sonoport.freesound.query.HTTPRequestMethod;
import com.sonoport.freesound.query.JSONResponseQuery;
import com.sonoport.freesound.query.OAuthQuery;
import com.sonoport.freesound.response.mapping.DetailStringMapper;
/*
 * Copyright 2014 Sonoport (Asia) Pte Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sonoport.freesound.query.sound;



/**
 * Query class that allows users to add comments to sounds.
 */
public class CommentSound extends JSONResponseQuery<String> implements OAuthQuery {

	/** Name of route parameter to be replaced with teh sound identifier. */
	protected static final String SOUND_IDENTIFIER_ROUTE_PARAMETER = "sound_id";

	/** Path to API endpoint. */
	private static final String PATH = String.format("/sounds/{%s}/comment/", SOUND_IDENTIFIER_ROUTE_PARAMETER);

	/** Parameter to pass comment through as. */
	protected static final String COMMENT_PARAMETER_NAME = "comment";

	/** Identifier of sound to add comment to. */
	private final int soundIdentifier;

	/** Comment to add. */
	private final String comment;

	/** OAuth taken to present. */
	private final String oauthToken;

	/**
	 * @param soundIdentifier Identifier of sound
	 * @param comment Comment to add
	 * @param oauthToken Token to present
	 */
	public CommentSound(final int soundIdentifier, final String comment, final String oauthToken) {
// Path: src/main/java/com/sonoport/freesound/query/HTTPRequestMethod.java
// public enum HTTPRequestMethod {
// 
// 	/** HTTP GET. */
// 	GET,
// 
// 	/** HTTP POST. */
// 	POST,
// 
// 	/** HTTP PUT. */
// 	PUT,
// 
// 	/** HTTP DELETE. */
// 	DELETE,
// 
// 	/** HTTP PATCH. */
// 	PATCH,
// 
// 	/** HTTP HEAD. */
// 	HEAD,
// 
// 	/** HTTP OPTIONS. */
// 	OPTIONS;
// }
// 
// Path: src/main/java/com/sonoport/freesound/query/JSONResponseQuery.java
// public abstract class JSONResponseQuery<R extends Object> extends Query<JSONObject, R> {
// 
// 	/**
// 	 * @param httpRequestMethod HTTP method to use for query
// 	 * @param path Endpoint to submit the query to
// 	 * @param resultsMapper {@link Mapper} to convert results
// 	 */
// 	protected JSONResponseQuery(
// 			final HTTPRequestMethod httpRequestMethod, final String path, final Mapper<JSONObject, R> resultsMapper) {
// 		super(httpRequestMethod, path, resultsMapper);
// 	}
// 
// 	@Override
// 	protected String extractErrorMessage(final JSONObject freesoundResponse) {
// 		return freesoundResponse.getString("detail");
// 	}
// 
// }
// 
// Path: src/main/java/com/sonoport/freesound/query/OAuthQuery.java
// public interface OAuthQuery {
// 
// 	/**
// 	 * @return The oauthToken to be presented with the request
// 	 */
// 	String getOauthToken();
// 
// }
// 
// Path: src/main/java/com/sonoport/freesound/response/mapping/DetailStringMapper.java
// public class DetailStringMapper extends Mapper<JSONObject, String> {
// 
// 	@Override
// 	public String map(final JSONObject source) {
// 		return extractFieldValue(source, "detail", String.class);
// 	}
// 
// }


// Path: src/main/java/com/sonoport/freesound/query/sound/CommentSound.java
import java.util.HashMap;
import java.util.Map;
import com.sonoport.freesound.query.HTTPRequestMethod;
import com.sonoport.freesound.query.JSONResponseQuery;
import com.sonoport.freesound.query.OAuthQuery;
import com.sonoport.freesound.response.mapping.DetailStringMapper;

/*
 * Copyright 2014 Sonoport (Asia) Pte Ltd
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.sonoport.freesound.query.sound;



/**
 * Query class that allows users to add comments to sounds.
 */
public class CommentSound extends JSONResponseQuery<String> implements OAuthQuery {

	/** Name of route parameter to be replaced with teh sound identifier. */
	protected static final String SOUND_IDENTIFIER_ROUTE_PARAMETER = "sound_id";

	/** Path to API endpoint. */
	private static final String PATH = String.format("/sounds/{%s}/comment/", SOUND_IDENTIFIER_ROUTE_PARAMETER);

	/** Parameter to pass comment through as. */
	protected static final String COMMENT_PARAMETER_NAME = "comment";

	/** Identifier of sound to add comment to. */
	private final int soundIdentifier;

	/** Comment to add. */
	private final String comment;

	/** OAuth taken to present. */
	private final String oauthToken;

	/**
	 * @param soundIdentifier Identifier of sound
	 * @param comment Comment to add
	 * @param oauthToken Token to present
	 */
	public CommentSound(final int soundIdentifier, final String comment, final String oauthToken) {
		super(HTTPRequestMethod.POST, PATH, new DetailStringMapper());