Coder Social home page Coder Social logo

api-client's People

Contributors

ahhj93 avatar b3none avatar bensherred avatar cjmaxik avatar coolio85 avatar humanewolf avatar idiegonl avatar shawnczek avatar thorerik avatar unoriginaltom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

api-client's Issues

Provide asynchronous interface

Right now, it is possible to make synchronous requests only. This is not viable if you want to, for example, fetch extending models of one object or multiple objects (players, ...) at once. Therefore, along with the standard usage, asynchronous requests should be available, too.

How can i set this up

Hello,
I tryed to set this up also i run the composer command given on the instruction given but it did not work what should i do

Problem with composer

Hello,
When I run the Composer command I get errors

`composer require truckersmp/api-client
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Using version ^1.2 for truckersmp/api-client
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- The requested package truckersmp/api-client No version set (parsed as 1.0.0) is satisfiable by truckersmp/api-client[No version set (parsed as 1.0.0)] but these conflict with your requirements or minimum-stability.
Problem 2
- Installation request for truckersmp/api-client ^1.2 -> satisfiable by truckersmp/api-client[v1.2.0].
- truckersmp/api-client v1.2.0 requires nesbot/carbon ^2.16 -> satisfiable by nesbot/carbon[2.16.0, 2.16.1, 2.16.2, 2.16.3, 2.17.0, 2.17.1, 2.18.0, 2.19.0, 2.19.1, 2.19.2, 2.20.0, 2.21.0, 2.21.1, 2.21.2, 2.21.3, 2.22.0, 2.22.0-beta.1, 2.22.0-beta.2, 2.22.0-beta.3, 2.22.1, 2.22.2, 2.22.3, 2.23.0, 2.23.0-beta.1, 2.23.0-beta.2, 2.23.0-beta.3, 2.23.0-beta.4, 2.23.1, 2.24.0, 2.24.0-beta.1, 2.24.0-beta.2, 2.24.0-beta.3, 2.24.0-beta.4, 2.25.0, 2.25.0-beta.1, 2.25.0-beta.2, 2.25.0-beta.3, 2.25.1, 2.25.2, 2.25.3, 2.26.0, 2.27.0, 2.28.0, 2.28.0-beta.1, 2.29.0, 2.29.1, 2.30.0, 2.31.0, 2.32.0, 2.32.1, 2.32.2, 2.33.0, 2.34.0, 2.34.1, 2.34.2, 2.35.0, 2.36.0, 2.36.1, 2.37.0, 2.38.0, 2.x-dev] but these conflict with your requirements or minimum-stability.

Installation failed, reverting ./composer.json to its original content.`

Use guzzlehttp/guzzle instead of php-http/guzzle6-adapter

If possible, could guzzlehttp/guzzle be used? This would be more consistent with other uses within the Laravel Framework. php-http/guzzle6-adapter is not required by https://github.com/TruckersMP/Steam-Socialite so I am unsure why it is needed here.

C:\laragon\www\plasmagaming>composer require truckersmp/api-client
Using version ^1.2 for truckersmp/api-client
./composer.json has been updated
Running composer update truckersmp/api-client
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- php-http/guzzle6-adapter[dev-master, v1.0.0, ..., v1.1.1, v2.0.0, ..., v2.0.2] require guzzlehttp/guzzle ^6.0 -> found guzzlehttp/guzzle[6.0.0, ..., 6.5.x-dev] but the package is fixed to 7.3.0 (lock file version) by a partial
update and that version does not match. Make sure you list it as an argument for the update command.
- truckersmp/api-client v1.2.0 requires php-http/guzzle6-adapter ^1.0 || ^2.0 -> satisfiable by php-http/guzzle6-adapter[v1.0.0, v1.1.0, v1.1.1, v2.0.0, v2.0.1, v2.0.2, 2.x-dev (alias of dev-master)].
- php-http/guzzle6-adapter 2.x-dev is an alias of php-http/guzzle6-adapter dev-master and thus requires it to be installed too.
- Root composer.json requires truckersmp/api-client ^1.2 -> satisfiable by truckersmp/api-client[v1.2.0].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.

Mock API responses during tests

When running the test suite, we make a call to the TruckersMP API and use the response to assert our logic. However, this is definitely not how things should be done. This could cause issues if the API is offline for example.

Instead, we should update the test suite to instead mock the response (this could be done by loading an example response/schema from a JSON file) and then test our logic.

This will need a bit of investigation into how we can mock the response as some tests call multiple endpoints.

One thing to note with this is that if the schema was to change i.e. a value changes from a string to a boolean we wouldn't catch that due to the response being mocked. However, it is definitely better to mock the response rather than calling the API.

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.