package org.jtb.quickr;

import java.io.InputStream;
import java.util.Map;

class PhotosGetAllContextsRequest extends MethodRequest {
    private String photoId;

    protected PhotosGetAllContextsRequest(String baseUrl, String apiKey, String photoId) {
        super(baseUrl, apiKey, "flickr.photos.getAllContexts");
        this.photoId = photoId;
    }


    @Override
    protected Map<String,String> getArgs() {
        putArg("photo_id", photoId);

        return super.getArgs();
    }

    @Override
    public ContextsResponse execute() throws QuickrException {
        FlickrUrl furl = createServiceMethodUrl();

        Get get = new Get(furl.getUrl());
        InputStream is = get.execute();

        ContextsResponse cr = new ContextsResponse(is);

        return cr;
    }
}
