Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]

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