invoiceninja / sdk-php

PHP wrapper for Invoice Ninja's REST API
https://www.invoiceninja.com
83 stars 41 forks source link

Add custom query function findByCustomQuery() #53

Closed skylarmt closed 4 years ago

skylarmt commented 4 years ago

So API requests like these (from the docs):

curl -X GET ninja.test/api/v1/clients?email=<value> -H "X-Ninja-Token: TOKEN"
curl -X GET ninja.test/api/v1/clients?id_number=<value> -H "X-Ninja-Token: TOKEN"
curl -X GET ninja.test/api/v1/invoices?invoice_number=<value> -H "X-Ninja-Token: TOKEN"

Can be turned into these:

use InvoiceNinja\Models\Client as NinjaClient;
use InvoiceNinja\Models\Invoice as NinjaInvoice;

NinjaClient::findByCustomQuery(["email" => "<value>"]);
NinjaClient::findByCustomQuery(["id_number" => "<value>"]);
NinjaInvoice::findByCustomQuery(["invoice_number" => "<value>"]);

This PR closes #29.

hillelcoren commented 4 years ago

The change looks great, thanks!