Giter Site home page Giter Site logo

luyadev / luya-headless Goto Github PK

View Code? Open in Web Editor NEW
10.0 5.0 2.0 355 KB

A client library to access content from the LUYA APIs (or any other REST API).

Home Page: https://luya.io

License: MIT License

PHP 100.00%
yii2 luya hacktoberfest rest-client

luya-headless's People

Contributors

dependabot[bot] avatar dev7ch avatar hbugdoll avatar nadar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

luya-headless's Issues

Add sorting option

An option to sort the models after they have been assigned to the model.

Cache time anomaly

As its very common to setup multiple cache keys with the same time like (now + 60seconds) we should introduce an option which adds a random time range to an existing cache lifetime (like + rand(0,10)

composite keys

When using view([1,2]) it should generate endpoint/1,2, otherwise its hard to work with composite keys.

ActiveEndpoint

  • Rename AbstractActiveEndpoint and ensure the getEndpointName() from the class.
  • ActiveEndpoint should be able to set Pagination and Sort also for findAll()

add delete()

In model context, the delete() method should exists and call remove()

Composer install

Needed to run composer require luyadev/luya-headless:dev-master --prefer-source otherwise getting error

[InvalidArgumentException]
  Could not find a version of package luyadev/luya-headless matching your minimum-stability (sta
  ble). Require it with an explicit version constraint allowing its desired stability.

get one() from array list

Get only 1 item even when calling the all() this can be usedfull in combiation of setPerPage(1) and setSort()

->setPerPage(1)->setSort(['publication_date' => SORT_DESC])->one()

DynamicCacheKey class

What steps will reproduce the problem?

Add time() to a filter or arg, this will result in constantly new generating of cache key .. which makes caching useless.

What is the expected result?

Cachekey should be consistent. Therfore we need something like:

new DynamicValue(time()) which will threat this expression as "static".

Broken JSON responses

What steps will reproduce the problem?

https://demo.luya.io/en/admin/login
Log in as admin and check XHR responses.

What is the expected result?

Valid JSON

What do you get instead? (A Screenshot can help us a lot!)

Invalid JSON always starting with )]}',

LUYA Check ouput (run this script and post the result: luyacheck.php)

Problem is in any version.
Using docker version with nginx, so no apache modules
1: [ini_get('short_open_tag')] ''
2: [ini_get('error_reporting')] '32767'
3: [phpversion()] '7.2.17'
4: [php_ini_loaded_file()] false
5: [php_sapi_name()] 'fpm-fcgi'
6: [isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : unknown] 'nginx/1.17.2'

Additional infos

Q A
LUYA Version Kickstarter 1.0.6 with core 1.0.20, headless 2.3.0, module-admin 2.1.0, bootstrap 1.0.5, composer 1.0.5, generic 1.0.4
PHP Version 7.2.17
Platform Docker with luyadev/luya-docker-php, mysql:5.7, nginx:latest
Operating system OSX

one does not set endpoint/<id>

in order to return a single entry: find()->with(['timetables'])->one(1337); one needs to set setEndpoint('{endpointName}/{id}') - one should do this or there should be a short code for this like:

Fix cache name

The setCache() option should also provide a key which can be defined instead of dynamic generating of cache keys. This can be useful in order to flush an explicit cache key.

Enclosed option

Sometimes items of a list response are enclosed within a tag like items' => [...] an optional setting for an active endpoint to handle such a situtation.

re-set endpointName as token

What steps will reproduce the problem?

Currently its not possible to override the endpointName token with using setTokens

What is the expected result?

What do you get instead? (A Screenshot can help us a lot!)

LUYA Check ouput (run this script and post the result: luyacheck.php)

Additional infos

Q A
LUYA Version
PHP Version
Platform Apache/XAMPP/MAMPP/etc.
Operating system Windows/Linux Server/OSX/etc.

Option to set Language

Add option to set Language for i18n Fields in Client

$client = new Client('TOKEN', 'BASE_URL', 'de');

Default expand

add new option to default expand properties, this can be used for definition inside find methods but users can set setExpand() other fields.

Populate new fields from save

When saving values with save() and its an insert, there can be fields which are returned from the api and should be assigned afterwards (assuming a model returns a token after creating, this should be assigned after saving)

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.