Skip to content
  • Harald Sitter's avatar
    port to bugzilla REST API · a4330e62
    Harald Sitter authored
    Summary:
    https://bugzilla.readthedocs.io/en/5.0/api/
    
    the old API is deprecated. the new API is RESTy and much easier to use
    plus also has some efficiency boosts.
    
    this commit introduces a new supporting library to wrap the REST API
    for easy consumption in drkonqi.
    
    - new internal lib wrapping the REST API
    - unit testing of the lib
    - xmlrpc use gone
    - BugzillaManager continues to be a singleton manager for the API
    - ancient cookie system for login is entirely gone, this has been
      deprecated (or perhaps even removed?) for years
    - duplicate querying is pretty inefficient, needs porting to
      pagination, but is not worse than what it was before. in fact,
      it's faster than before out of the box!
    
    the lib api is split in three pieces:
    
    1. the connection containing protocol logic
    2. the clients containing routing logic
    2.1. command models that are basically POSIX-style argument structs which can serialize into json
    3. the models deserializing the json API replies back into cpp
    
    clients get a request, give back a job and the intended use is for
    the consumer to then connect to the finished signal of the job to then
    ask the clients for the final return value of the job.
    this is a bit 'meh'. what I really wanted was a Future to be returned
    and the caller to connect to the future. unfortunately qfuture is fairly
    limited and since qtbase has no Promise implementation I'm rather opting
    for the double-function-approach than doing it like we did in the previous
    decade and have a gazillion signals.
    this way the handling of the job is always uniform and all specific
    "handling code" is inside the connected slot rather than the actual
    connection.
    
    error handling has been put entirely into exceptions which get raised
    when trying to access a finished job. in BugzillaManager they get rescued
    and turned into the already existing signals. this simplifies error
    handling a fair amount and also makes the error handling code
    look uniform across the various API calls we have.
    the uniform representation of errors on the REST side thus always has
    uniform representation on the c++ side.
    
    Reviewers: apol
    
    Reviewed By: apol
    
    Subscribers: apol, plasma-devel
    
    Tags: #plasma
    
    Differential Revision: https://phabricator.kde.org/D19612
    a4330e62