mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 20:22:42 +01:00
Updates for openapi
This commit is contained in:
parent
7b322cb41d
commit
b70f01fff2
@ -933,6 +933,7 @@ class Email implements ShouldQueue
|
|||||||
private function refreshOfficeToken(User $user): mixed
|
private function refreshOfficeToken(User $user): mixed
|
||||||
{
|
{
|
||||||
$expiry = $user->oauth_user_token_expiry ?: now()->subDay();
|
$expiry = $user->oauth_user_token_expiry ?: now()->subDay();
|
||||||
|
$token = false;
|
||||||
|
|
||||||
if ($expiry->lt(now())) {
|
if ($expiry->lt(now())) {
|
||||||
$guzzle = new \GuzzleHttp\Client();
|
$guzzle = new \GuzzleHttp\Client();
|
||||||
|
@ -2249,6 +2249,43 @@ paths:
|
|||||||
description: 'Server error'
|
description: 'Server error'
|
||||||
default:
|
default:
|
||||||
$ref: "#/components/responses/default"
|
$ref: "#/components/responses/default"
|
||||||
|
"/api/v1/companies/current":
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- companies
|
||||||
|
summary: "Returns the current comapny"
|
||||||
|
description: "Returns the current company based on the API token passed in"
|
||||||
|
operationId: showCurrentCompany
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/X-API-TOKEN"
|
||||||
|
- $ref: "#/components/parameters/X-Requested-With"
|
||||||
|
- $ref: "#/components/parameters/include"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "Returns the company object"
|
||||||
|
headers:
|
||||||
|
X-MINIMUM-CLIENT-VERSION:
|
||||||
|
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
|
||||||
|
X-RateLimit-Remaining:
|
||||||
|
$ref: "#/components/headers/X-RateLimit-Remaining"
|
||||||
|
X-RateLimit-Limit:
|
||||||
|
$ref: "#/components/headers/X-RateLimit-Limit"
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Company"
|
||||||
|
401:
|
||||||
|
$ref: "#/components/responses/401"
|
||||||
|
403:
|
||||||
|
$ref: "#/components/responses/403"
|
||||||
|
422:
|
||||||
|
$ref: "#/components/responses/422"
|
||||||
|
429:
|
||||||
|
$ref: "#/components/responses/429"
|
||||||
|
5XX:
|
||||||
|
description: 'Server error'
|
||||||
|
default:
|
||||||
|
$ref: "#/components/responses/default"
|
||||||
/api/v1/company_gateways:
|
/api/v1/company_gateways:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
@ -10138,10 +10175,28 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "List products"
|
summary: "List products"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products?filter=search&per_page=20&page=1&include=documents' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$products = $ninja->products->all([
|
||||||
|
'filter' => 'search',
|
||||||
|
'per_page' => 20,
|
||||||
|
'page' => 1,
|
||||||
|
'include' => 'documents'
|
||||||
|
]);
|
||||||
description: |
|
description: |
|
||||||
Lists products, search and filters allow fine grained lists to be generated.
|
Lists products within your company.
|
||||||
Query parameters can be added to perform fine grained filtering of the products list, these are handled by the ProductFilters class
|
|
||||||
which defines the methods available
|
You can search and filter the result set using query parameters. These can be chained together allowing fine grained lists to be generated.
|
||||||
|
|
||||||
operationId: getProducts
|
operationId: getProducts
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/components/parameters/X-API-TOKEN"
|
- $ref: "#/components/parameters/X-API-TOKEN"
|
||||||
@ -10213,6 +10268,25 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Create Product"
|
summary: "Create Product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X POST 'https://invoicing.co/api/v1/products' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "Content-Type:application/json" \
|
||||||
|
-d '{"product_key":"sku_1","notes":"product description","cost":1,"price":10}' \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$products = $ninja->products->create([
|
||||||
|
'product_key' => "sku_1",
|
||||||
|
'notes' => "product description",
|
||||||
|
'cost' => 1,
|
||||||
|
'price' => 10
|
||||||
|
]);
|
||||||
description: "Adds a product to a company"
|
description: "Adds a product to a company"
|
||||||
operationId: storeProduct
|
operationId: storeProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -10257,6 +10331,18 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Show product"
|
summary: "Show product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products/{id}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: php
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->get("{id}");
|
||||||
description: "Displays a product by id"
|
description: "Displays a product by id"
|
||||||
operationId: showProduct
|
operationId: showProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -10301,6 +10387,27 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Update product"
|
summary: "Update product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X PUT 'https://invoicing.co/api/v1/products/{id}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"product_key": "Updated Product",
|
||||||
|
"price": 150.0,
|
||||||
|
"notes": "An updated description of the product"
|
||||||
|
}'
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->update("id", [
|
||||||
|
"name" => "Updated Product",
|
||||||
|
"price" => 150.0,
|
||||||
|
"description" => "An updated description of the product"
|
||||||
|
]);
|
||||||
description: "Handles the updating of a product by id"
|
description: "Handles the updating of a product by id"
|
||||||
operationId: updateProduct
|
operationId: updateProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -10352,6 +10459,18 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Delete product"
|
summary: "Delete product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X DELETE 'https://invoicing.co/api/v1/products/{id}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$ninja->products->bulk("delete", "id");
|
||||||
description: "Handles the deletion of a product by id"
|
description: "Handles the deletion of a product by id"
|
||||||
operationId: deleteProduct
|
operationId: deleteProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -10393,6 +10512,18 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Edit product"
|
summary: "Edit product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products/{id}/edit' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: php
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->get("{id}");
|
||||||
description: "Displays an Product by id"
|
description: "Displays an Product by id"
|
||||||
operationId: editProduct
|
operationId: editProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -10476,6 +10607,20 @@ paths:
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Bulk product actions"
|
summary: "Bulk product actions"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products/bulk' \
|
||||||
|
-H "Content-Type:application/json" \
|
||||||
|
-d '{"action":"archive","ids":["id","id2"]}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: php
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->bulk("action", ["id","id2"]);
|
||||||
description: "Archive / Restore / Delete / Set tax id in bulk"
|
description: "Archive / Restore / Delete / Set tax id in bulk"
|
||||||
operationId: bulkProducts
|
operationId: bulkProducts
|
||||||
parameters:
|
parameters:
|
||||||
|
@ -2159,6 +2159,43 @@ paths:
|
|||||||
description: 'Server error'
|
description: 'Server error'
|
||||||
default:
|
default:
|
||||||
$ref: "#/components/responses/default"
|
$ref: "#/components/responses/default"
|
||||||
|
"/api/v1/companies/current":
|
||||||
|
post:
|
||||||
|
tags:
|
||||||
|
- companies
|
||||||
|
summary: "Returns the current comapny"
|
||||||
|
description: "Returns the current company based on the API token passed in"
|
||||||
|
operationId: showCurrentCompany
|
||||||
|
parameters:
|
||||||
|
- $ref: "#/components/parameters/X-API-TOKEN"
|
||||||
|
- $ref: "#/components/parameters/X-Requested-With"
|
||||||
|
- $ref: "#/components/parameters/include"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: "Returns the company object"
|
||||||
|
headers:
|
||||||
|
X-MINIMUM-CLIENT-VERSION:
|
||||||
|
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
|
||||||
|
X-RateLimit-Remaining:
|
||||||
|
$ref: "#/components/headers/X-RateLimit-Remaining"
|
||||||
|
X-RateLimit-Limit:
|
||||||
|
$ref: "#/components/headers/X-RateLimit-Limit"
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: "#/components/schemas/Company"
|
||||||
|
401:
|
||||||
|
$ref: "#/components/responses/401"
|
||||||
|
403:
|
||||||
|
$ref: "#/components/responses/403"
|
||||||
|
422:
|
||||||
|
$ref: "#/components/responses/422"
|
||||||
|
429:
|
||||||
|
$ref: "#/components/responses/429"
|
||||||
|
5XX:
|
||||||
|
description: 'Server error'
|
||||||
|
default:
|
||||||
|
$ref: "#/components/responses/default"
|
||||||
/api/v1/company_gateways:
|
/api/v1/company_gateways:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
|
@ -3,10 +3,28 @@
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "List products"
|
summary: "List products"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products?filter=search&per_page=20&page=1&include=documents' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$products = $ninja->products->all([
|
||||||
|
'filter' => 'search',
|
||||||
|
'per_page' => 20,
|
||||||
|
'page' => 1,
|
||||||
|
'include' => 'documents'
|
||||||
|
]);
|
||||||
description: |
|
description: |
|
||||||
Lists products, search and filters allow fine grained lists to be generated.
|
Lists products within your company.
|
||||||
Query parameters can be added to perform fine grained filtering of the products list, these are handled by the ProductFilters class
|
|
||||||
which defines the methods available
|
You can search and filter the result set using query parameters. These can be chained together allowing fine grained lists to be generated.
|
||||||
|
|
||||||
operationId: getProducts
|
operationId: getProducts
|
||||||
parameters:
|
parameters:
|
||||||
- $ref: "#/components/parameters/X-API-TOKEN"
|
- $ref: "#/components/parameters/X-API-TOKEN"
|
||||||
@ -78,6 +96,25 @@
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Create Product"
|
summary: "Create Product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X POST 'https://invoicing.co/api/v1/products' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "Content-Type:application/json" \
|
||||||
|
-d '{"product_key":"sku_1","notes":"product description","cost":1,"price":10}' \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$products = $ninja->products->create([
|
||||||
|
'product_key' => "sku_1",
|
||||||
|
'notes' => "product description",
|
||||||
|
'cost' => 1,
|
||||||
|
'price' => 10
|
||||||
|
]);
|
||||||
description: "Adds a product to a company"
|
description: "Adds a product to a company"
|
||||||
operationId: storeProduct
|
operationId: storeProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -122,6 +159,18 @@
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Show product"
|
summary: "Show product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products/{id}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: php
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->get("{id}");
|
||||||
description: "Displays a product by id"
|
description: "Displays a product by id"
|
||||||
operationId: showProduct
|
operationId: showProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -166,6 +215,27 @@
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Update product"
|
summary: "Update product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X PUT 'https://invoicing.co/api/v1/products/{id}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"product_key": "Updated Product",
|
||||||
|
"price": 150.0,
|
||||||
|
"notes": "An updated description of the product"
|
||||||
|
}'
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->update("id", [
|
||||||
|
"name" => "Updated Product",
|
||||||
|
"price" => 150.0,
|
||||||
|
"description" => "An updated description of the product"
|
||||||
|
]);
|
||||||
description: "Handles the updating of a product by id"
|
description: "Handles the updating of a product by id"
|
||||||
operationId: updateProduct
|
operationId: updateProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -217,6 +287,18 @@
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Delete product"
|
summary: "Delete product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X DELETE 'https://invoicing.co/api/v1/products/{id}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: go
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$ninja->products->bulk("delete", "id");
|
||||||
description: "Handles the deletion of a product by id"
|
description: "Handles the deletion of a product by id"
|
||||||
operationId: deleteProduct
|
operationId: deleteProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -258,6 +340,18 @@
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Edit product"
|
summary: "Edit product"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products/{id}/edit' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: php
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->get("{id}");
|
||||||
description: "Displays an Product by id"
|
description: "Displays an Product by id"
|
||||||
operationId: editProduct
|
operationId: editProduct
|
||||||
parameters:
|
parameters:
|
||||||
@ -341,6 +435,20 @@
|
|||||||
tags:
|
tags:
|
||||||
- products
|
- products
|
||||||
summary: "Bulk product actions"
|
summary: "Bulk product actions"
|
||||||
|
x-code-samples:
|
||||||
|
- lang: curl
|
||||||
|
label: Curl
|
||||||
|
source: |
|
||||||
|
curl -X GET 'https://invoicing.co/api/v1/products/bulk' \
|
||||||
|
-H "Content-Type:application/json" \
|
||||||
|
-d '{"action":"archive","ids":["id","id2"]}' \
|
||||||
|
-H "X-API-TOKEN:company-token-test" \
|
||||||
|
-H "X-Requested-With: XMLHttpRequest";
|
||||||
|
- lang: php
|
||||||
|
label: PHP
|
||||||
|
source: |
|
||||||
|
$ninja = new InvoiceNinja("your_token");
|
||||||
|
$product = $ninja->products->bulk("action", ["id","id2"]);
|
||||||
description: "Archive / Restore / Delete / Set tax id in bulk"
|
description: "Archive / Restore / Delete / Set tax id in bulk"
|
||||||
operationId: bulkProducts
|
operationId: bulkProducts
|
||||||
parameters:
|
parameters:
|
||||||
|
Loading…
Reference in New Issue
Block a user