Code Monkey home page Code Monkey logo

Comments (3)

enisz avatar enisz commented on August 24, 2024

Hi @games-geeks,

I can see there are a lot of new endpoints since the last update of this wrapper. I may update it in the future, however there may be a workaround for your problem. The fields are not limited by the wrapper, only the endpoints are checked. Check out this example:

<?php
    $igdb = new IGDB($client_id, $access_token);
    $builder = new IGDBQueryBuilder();
    $builder
        ->id(7331)
        ->fields('id,name,language_supports');
    $query = $builder->build();

    try {
        var_dump($igdb->game($query));
    } catch (Exception $e) {
        echo $e->getMessage();
    }
?>

This query will result in the response below

array (size=1)
  0 => 
    object(stdClass)[3]
      public 'id' => int 7331
      public 'name' => string 'Uncharted 4: A Thief's End' (length=26)
      public 'language_supports' => 
        array (size=8)
          0 => int 211197
          1 => int 211200
          2 => int 211204
          3 => int 211205
          4 => int 211207
          5 => int 211210
          6 => int 211212
          7 => int 211213

You can collect the related language data with the expander feature like this:

<?php
    $igdb = new IGDB($client_id, $access_token);
    $builder = new IGDBQueryBuilder();
    $builder
        ->id(7331)
        ->fields('id,name,language_supports.language.name,language_supports.language.native_name,language_supports.language.locale');
    $query = $builder->build();

    try {
        var_dump($igdb->game($query));
    } catch (Exception $e) {
        echo $e->getMessage();
    }
?>

This query will show you the languages realted to the game you are looking for

array (size=1)
  0 => 
    object(stdClass)[3]
      public 'id' => int 7331
      public 'name' => string 'Uncharted 4: A Thief's End' (length=26)
      public 'language_supports' => 
        array (size=8)
          0 => 
            object(stdClass)[4]
              public 'id' => int 211197
              public 'language' => 
                object(stdClass)[5]
                  public 'id' => int 7
                  public 'name' => string 'English' (length=7)
                  public 'native_name' => string 'English (US)' (length=12)
                  public 'locale' => string 'en-US' (length=5)
          1 => 
            object(stdClass)[6]
              public 'id' => int 211200
              public 'language' => 
                object(stdClass)[7]
                  public 'id' => int 12
                  public 'name' => string 'French' (length=6)
                  public 'native_name' => string 'Français' (length=9)
                  public 'locale' => string 'fr-FR' (length=5)
          2 => 
            object(stdClass)[8]
              public 'id' => int 211204
              public 'language' => 
                object(stdClass)[9]
                  public 'id' => int 21
                  public 'name' => string 'Portuguese (Brazil)' (length=19)
                  public 'native_name' => string 'Português (Brasil)' (length=19)
                  public 'locale' => string 'pt-BR' (length=5)
          3 => 
            object(stdClass)[10]
              public 'id' => int 211205
              public 'language' => 
                object(stdClass)[11]
                  public 'id' => int 10
                  public 'name' => string 'Spanish (Mexico)' (length=16)
                  public 'native_name' => string 'Español (Mexico)' (length=17)
                  public 'locale' => string 'es-MX' (length=5)
          4 => 
            object(stdClass)[12]
              public 'id' => int 211207
              public 'language' => 
                object(stdClass)[13]
                  public 'id' => int 7
                  public 'name' => string 'English' (length=7)
                  public 'native_name' => string 'English (US)' (length=12)
                  public 'locale' => string 'en-US' (length=5)
          5 => 
            object(stdClass)[14]
              public 'id' => int 211210
              public 'language' => 
                object(stdClass)[15]
                  public 'id' => int 12
                  public 'name' => string 'French' (length=6)
                  public 'native_name' => string 'Français' (length=9)
                  public 'locale' => string 'fr-FR' (length=5)
          6 => 
            object(stdClass)[16]
              public 'id' => int 211212
              public 'language' => 
                object(stdClass)[17]
                  public 'id' => int 21
                  public 'name' => string 'Portuguese (Brazil)' (length=19)
                  public 'native_name' => string 'Português (Brasil)' (length=19)
                  public 'locale' => string 'pt-BR' (length=5)
          7 => 
            object(stdClass)[18]
              public 'id' => int 211213
              public 'language' => 
                object(stdClass)[19]
                  public 'id' => int 10
                  public 'name' => string 'Spanish (Mexico)' (length=16)
                  public 'native_name' => string 'Español (Mexico)' (length=17)
                  public 'locale' => string 'es-MX' (length=5)

Hopefully this will work for you until I update the wrapper.

from igdb.

enisz avatar enisz commented on August 24, 2024

Just did an update, merged it to master. Give it a try!

Feel free to reopen the issue if you face any problems.

from igdb.

games-geeks avatar games-geeks commented on August 24, 2024

Thanks for your replies.
I can use it, and in fact it's pretty easy to add an endpoint!
Thnaks a lot

from igdb.

Related Issues (17)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.