Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

   1  <?php
   2  /*
   3   * Copyright 2010 Google Inc.
   4   *
   5   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   6   * use this file except in compliance with the License. You may obtain a copy of
   7   * the License at
   8   *
   9   * http://www.apache.org/licenses/LICENSE-2.0
  10   *
  11   * Unless required by applicable law or agreed to in writing, software
  12   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14   * License for the specific language governing permissions and limitations under
  15   * the License.
  16   */
  17  
  18  /**
  19   * Service definition for Freebase (v1).
  20   *
  21   * <p>
  22   * Find Freebase entities using textual queries and other constraints.</p>
  23   *
  24   * <p>
  25   * For more information about this service, see the API
  26   * <a href="https://developers.google.com/freebase/" target="_blank">Documentation</a>
  27   * </p>
  28   *
  29   * @author Google, Inc.
  30   */
  31  class Google_Service_Freebase extends Google_Service
  32  {
  33  
  34  
  35  
  36    private $base_methods;
  37  
  38    /**
  39     * Constructs the internal representation of the Freebase service.
  40     *
  41     * @param Google_Client $client
  42     */
  43    public function __construct(Google_Client $client)
  44    {
  45      parent::__construct($client);
  46      $this->rootUrl = 'https://www.googleapis.com/';
  47      $this->servicePath = 'freebase/v1/';
  48      $this->version = 'v1';
  49      $this->serviceName = 'freebase';
  50  
  51      $this->base_methods = new Google_Service_Resource(
  52          $this,
  53          $this->serviceName,
  54          '',
  55          array(
  56            'methods' => array(
  57              'reconcile' => array(
  58                'path' => 'reconcile',
  59                'httpMethod' => 'GET',
  60                'parameters' => array(
  61                  'lang' => array(
  62                    'location' => 'query',
  63                    'type' => 'string',
  64                    'repeated' => true,
  65                  ),
  66                  'confidence' => array(
  67                    'location' => 'query',
  68                    'type' => 'number',
  69                  ),
  70                  'name' => array(
  71                    'location' => 'query',
  72                    'type' => 'string',
  73                  ),
  74                  'kind' => array(
  75                    'location' => 'query',
  76                    'type' => 'string',
  77                    'repeated' => true,
  78                  ),
  79                  'prop' => array(
  80                    'location' => 'query',
  81                    'type' => 'string',
  82                    'repeated' => true,
  83                  ),
  84                  'limit' => array(
  85                    'location' => 'query',
  86                    'type' => 'integer',
  87                  ),
  88                ),
  89              ),'search' => array(
  90                'path' => 'search',
  91                'httpMethod' => 'GET',
  92                'parameters' => array(
  93                  'domain' => array(
  94                    'location' => 'query',
  95                    'type' => 'string',
  96                    'repeated' => true,
  97                  ),
  98                  'help' => array(
  99                    'location' => 'query',
 100                    'type' => 'string',
 101                  ),
 102                  'query' => array(
 103                    'location' => 'query',
 104                    'type' => 'string',
 105                  ),
 106                  'scoring' => array(
 107                    'location' => 'query',
 108                    'type' => 'string',
 109                  ),
 110                  'cursor' => array(
 111                    'location' => 'query',
 112                    'type' => 'integer',
 113                  ),
 114                  'prefixed' => array(
 115                    'location' => 'query',
 116                    'type' => 'boolean',
 117                  ),
 118                  'exact' => array(
 119                    'location' => 'query',
 120                    'type' => 'boolean',
 121                  ),
 122                  'mid' => array(
 123                    'location' => 'query',
 124                    'type' => 'string',
 125                    'repeated' => true,
 126                  ),
 127                  'encode' => array(
 128                    'location' => 'query',
 129                    'type' => 'string',
 130                  ),
 131                  'type' => array(
 132                    'location' => 'query',
 133                    'type' => 'string',
 134                    'repeated' => true,
 135                  ),
 136                  'as_of_time' => array(
 137                    'location' => 'query',
 138                    'type' => 'string',
 139                  ),
 140                  'stemmed' => array(
 141                    'location' => 'query',
 142                    'type' => 'boolean',
 143                  ),
 144                  'format' => array(
 145                    'location' => 'query',
 146                    'type' => 'string',
 147                  ),
 148                  'spell' => array(
 149                    'location' => 'query',
 150                    'type' => 'string',
 151                  ),
 152                  'with' => array(
 153                    'location' => 'query',
 154                    'type' => 'string',
 155                    'repeated' => true,
 156                  ),
 157                  'lang' => array(
 158                    'location' => 'query',
 159                    'type' => 'string',
 160                    'repeated' => true,
 161                  ),
 162                  'indent' => array(
 163                    'location' => 'query',
 164                    'type' => 'boolean',
 165                  ),
 166                  'filter' => array(
 167                    'location' => 'query',
 168                    'type' => 'string',
 169                    'repeated' => true,
 170                  ),
 171                  'callback' => array(
 172                    'location' => 'query',
 173                    'type' => 'string',
 174                  ),
 175                  'without' => array(
 176                    'location' => 'query',
 177                    'type' => 'string',
 178                    'repeated' => true,
 179                  ),
 180                  'limit' => array(
 181                    'location' => 'query',
 182                    'type' => 'integer',
 183                  ),
 184                  'output' => array(
 185                    'location' => 'query',
 186                    'type' => 'string',
 187                  ),
 188                  'mql_output' => array(
 189                    'location' => 'query',
 190                    'type' => 'string',
 191                  ),
 192                ),
 193              ),
 194            )
 195          )
 196      );
 197    }
 198    /**
 199     * Reconcile entities to Freebase open data. (reconcile)
 200     *
 201     * @param array $optParams Optional parameters.
 202     *
 203     * @opt_param string lang Languages for names and values. First language is used
 204     * for display. Default is 'en'.
 205     * @opt_param float confidence Required confidence for a candidate to match.
 206     * Must be between .5 and 1.0
 207     * @opt_param string name Name of entity.
 208     * @opt_param string kind Classifications of entity e.g. type, category, title.
 209     * @opt_param string prop Property values for entity formatted as :
 210     * @opt_param int limit Maximum number of candidates to return.
 211     * @return Google_Service_Freebase_ReconcileGet
 212     */
 213    public function reconcile($optParams = array())
 214    {
 215      $params = array();
 216      $params = array_merge($params, $optParams);
 217      return $this->base_methods->call('reconcile', array($params), "Google_Service_Freebase_ReconcileGet");
 218    }
 219    /**
 220     * Search Freebase open data. (search)
 221     *
 222     * @param array $optParams Optional parameters.
 223     *
 224     * @opt_param string domain Restrict to topics with this Freebase domain id.
 225     * @opt_param string help The keyword to request help on.
 226     * @opt_param string query Query term to search for.
 227     * @opt_param string scoring Relevance scoring algorithm to use.
 228     * @opt_param int cursor The cursor value to use for the next page of results.
 229     * @opt_param bool prefixed Prefix match against names and aliases.
 230     * @opt_param bool exact Query on exact name and keys only.
 231     * @opt_param string mid A mid to use instead of a query.
 232     * @opt_param string encode The encoding of the response. You can use this
 233     * parameter to enable html encoding.
 234     * @opt_param string type Restrict to topics with this Freebase type id.
 235     * @opt_param string as_of_time A mql as_of_time value to use with mql_output
 236     * queries.
 237     * @opt_param bool stemmed Query on stemmed names and aliases. May not be used
 238     * with prefixed.
 239     * @opt_param string format Structural format of the json response.
 240     * @opt_param string spell Request 'did you mean' suggestions
 241     * @opt_param string with A rule to match against.
 242     * @opt_param string lang The code of the language to run the query with.
 243     * Default is 'en'.
 244     * @opt_param bool indent Whether to indent the json results or not.
 245     * @opt_param string filter A filter to apply to the query.
 246     * @opt_param string callback JS method name for JSONP callbacks.
 247     * @opt_param string without A rule to not match against.
 248     * @opt_param int limit Maximum number of results to return.
 249     * @opt_param string output An output expression to request data from matches.
 250     * @opt_param string mql_output The MQL query to run againist the results to
 251     * extract more data.
 252     */
 253    public function search($optParams = array())
 254    {
 255      $params = array();
 256      $params = array_merge($params, $optParams);
 257      return $this->base_methods->call('search', array($params));
 258    }
 259  }
 260  
 261  
 262  
 263  
 264  
 265  class Google_Service_Freebase_ReconcileCandidate extends Google_Model
 266  {
 267    protected $internal_gapi_mappings = array(
 268    );
 269    public $confidence;
 270    public $lang;
 271    public $mid;
 272    public $name;
 273    protected $notableType = 'Google_Service_Freebase_ReconcileCandidateNotable';
 274    protected $notableDataType = '';
 275  
 276  
 277    public function setConfidence($confidence)
 278    {
 279      $this->confidence = $confidence;
 280    }
 281    public function getConfidence()
 282    {
 283      return $this->confidence;
 284    }
 285    public function setLang($lang)
 286    {
 287      $this->lang = $lang;
 288    }
 289    public function getLang()
 290    {
 291      return $this->lang;
 292    }
 293    public function setMid($mid)
 294    {
 295      $this->mid = $mid;
 296    }
 297    public function getMid()
 298    {
 299      return $this->mid;
 300    }
 301    public function setName($name)
 302    {
 303      $this->name = $name;
 304    }
 305    public function getName()
 306    {
 307      return $this->name;
 308    }
 309    public function setNotable(Google_Service_Freebase_ReconcileCandidateNotable $notable)
 310    {
 311      $this->notable = $notable;
 312    }
 313    public function getNotable()
 314    {
 315      return $this->notable;
 316    }
 317  }
 318  
 319  class Google_Service_Freebase_ReconcileCandidateNotable extends Google_Model
 320  {
 321    protected $internal_gapi_mappings = array(
 322    );
 323    public $id;
 324    public $name;
 325  
 326  
 327    public function setId($id)
 328    {
 329      $this->id = $id;
 330    }
 331    public function getId()
 332    {
 333      return $this->id;
 334    }
 335    public function setName($name)
 336    {
 337      $this->name = $name;
 338    }
 339    public function getName()
 340    {
 341      return $this->name;
 342    }
 343  }
 344  
 345  class Google_Service_Freebase_ReconcileGet extends Google_Collection
 346  {
 347    protected $collection_key = 'warning';
 348    protected $internal_gapi_mappings = array(
 349    );
 350    protected $candidateType = 'Google_Service_Freebase_ReconcileCandidate';
 351    protected $candidateDataType = 'array';
 352    protected $costsType = 'Google_Service_Freebase_ReconcileGetCosts';
 353    protected $costsDataType = '';
 354    protected $matchType = 'Google_Service_Freebase_ReconcileCandidate';
 355    protected $matchDataType = '';
 356    protected $warningType = 'Google_Service_Freebase_ReconcileGetWarning';
 357    protected $warningDataType = 'array';
 358  
 359  
 360    public function setCandidate($candidate)
 361    {
 362      $this->candidate = $candidate;
 363    }
 364    public function getCandidate()
 365    {
 366      return $this->candidate;
 367    }
 368    public function setCosts(Google_Service_Freebase_ReconcileGetCosts $costs)
 369    {
 370      $this->costs = $costs;
 371    }
 372    public function getCosts()
 373    {
 374      return $this->costs;
 375    }
 376    public function setMatch(Google_Service_Freebase_ReconcileCandidate $match)
 377    {
 378      $this->match = $match;
 379    }
 380    public function getMatch()
 381    {
 382      return $this->match;
 383    }
 384    public function setWarning($warning)
 385    {
 386      $this->warning = $warning;
 387    }
 388    public function getWarning()
 389    {
 390      return $this->warning;
 391    }
 392  }
 393  
 394  class Google_Service_Freebase_ReconcileGetCosts extends Google_Model
 395  {
 396    protected $internal_gapi_mappings = array(
 397    );
 398    public $hits;
 399    public $ms;
 400  
 401  
 402    public function setHits($hits)
 403    {
 404      $this->hits = $hits;
 405    }
 406    public function getHits()
 407    {
 408      return $this->hits;
 409    }
 410    public function setMs($ms)
 411    {
 412      $this->ms = $ms;
 413    }
 414    public function getMs()
 415    {
 416      return $this->ms;
 417    }
 418  }
 419  
 420  class Google_Service_Freebase_ReconcileGetWarning extends Google_Model
 421  {
 422    protected $internal_gapi_mappings = array(
 423    );
 424    public $location;
 425    public $message;
 426    public $reason;
 427  
 428  
 429    public function setLocation($location)
 430    {
 431      $this->location = $location;
 432    }
 433    public function getLocation()
 434    {
 435      return $this->location;
 436    }
 437    public function setMessage($message)
 438    {
 439      $this->message = $message;
 440    }
 441    public function getMessage()
 442    {
 443      return $this->message;
 444    }
 445    public function setReason($reason)
 446    {
 447      $this->reason = $reason;
 448    }
 449    public function getReason()
 450    {
 451      return $this->reason;
 452    }
 453  }