~dobey/unity-scope-click/finite-search

« back to all changes in this revision

Viewing changes to src/click-webservice.vala

  • Committer: Rodney Dawes
  • Date: 2013-10-08 20:25:26 UTC
  • mfrom: (60.2.12 trunk)
  • Revision ID: rodney.dawes@canonical.com-20131008202526-zxhoxi6nh3xmsijk
[ Alejandro J. Cura ]
* Pass the publisher field if available to the app preview. (LP:
  #1226265)
* Include the framework in the search query. (LP: #1234255)
* Catch more download errors, and ask for credentials on 401. (LP:
  #1234742)
[ Ubuntu daily release ]
* Automatic snapshot from revision 70
[ Alejandro J. Cura ]
* Do not show suggested apps when internet search is off. (LP:
  #1231378)
* Don't show Uninstall button if manifest has _removable:0, and remove
  pin-to-launcher. (LP: #1233641, #1233653)
* Show download manager failures. (LP: #1226021)
* Ask for confirmation before uninstall . (LP: #1233643)
[ Rodney Dawes ]
* Remove the fake ratings and reviews data from the app previews. (LP:
  #1209213)
* Remove the noauth=1 appendage to the URL.
* Refactor the error handling, to separate credentials errors from
  other errors. Show a "Go to Accounts" button in the credentials
  error preview. (LP: #1231517)
* Don't add the Install button, if there was an error. (LP: #1233169)
[ Ubuntu daily release ]
* Automatic snapshot from revision 66

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
const string JSON_FIELD_DOWNLOAD_URL = "download_url";
28
28
const string JSON_FIELD_SCREENSHOT_URL = "screenshot_url";
29
29
const string JSON_FIELD_LICENSE = "license";
 
30
const string JSON_FIELD_PUBLISHER = "publisher";
30
31
const string JSON_FIELD_BINARY_FILESIZE = "binary_filesize";
31
32
const string JSON_FIELD_SCREENSHOT_URLS = "screenshot_urls";
32
33
const string JSON_FIELD_DESCRIPTION = "description";
112
113
    public string terms_of_service { get; construct; }
113
114
    public string package_name { get; construct; }
114
115
    public string license { get; construct; }
 
116
    public string publisher { get; construct; }
115
117
    public string main_screenshot_url { get; construct; }
116
118
    public string[] more_screenshot_urls { get; construct; }
117
119
    public uint64 binary_filesize { get; construct; }
145
147
        var parser = new Json.Parser();
146
148
        parser.load_from_data(json_string, -1);
147
149
        var details = parser.get_root().get_object();
 
150
        var publisher = "";
 
151
        if (details.has_member(JSON_FIELD_PUBLISHER)) {
 
152
            publisher = details.get_string_member(JSON_FIELD_PUBLISHER);
 
153
        }
148
154
 
149
155
        Object(
150
156
            app_id: details.get_string_member(JSON_FIELD_NAME),
152
158
            download_url: details.get_string_member(JSON_FIELD_DOWNLOAD_URL),
153
159
            main_screenshot_url: details.get_string_member(JSON_FIELD_SCREENSHOT_URL),
154
160
            license: details.get_string_member(JSON_FIELD_LICENSE),
 
161
            publisher: publisher,
155
162
            binary_filesize: details.get_int_member(JSON_FIELD_BINARY_FILESIZE),
156
163
            more_screenshot_urls: parse_string_list (details, JSON_FIELD_SCREENSHOT_URLS),
157
164
 
232
239
{
233
240
    private const string SEARCH_BASE_URL = "https://search.apps.ubuntu.com/";
234
241
    private const string SEARCH_PATH = "api/v1/search?q=%s";
 
242
    private const string SUPPORTED_FRAMEWORKS = "framework:ubuntu-sdk-13.10";
235
243
    private const string DETAILS_PATH = "api/v1/package/%s";
236
244
 
237
245
    internal Soup.SessionAsync http_session;
250
258
    }
251
259
 
252
260
    string get_search_url() {
253
 
        return get_base_url() + SEARCH_PATH;
 
261
        return get_base_url() + SEARCH_PATH + "," + SUPPORTED_FRAMEWORKS;
254
262
    }
255
263
 
256
264
    string get_details_url() {