BexioFile
extends BexioAPI
in package
Uses
tBexioV3Api, tBexioObject, tBexioCollection
Represent the enpoint Files
Tags
Table of Contents
Constants
- type = 'files'
Properties
- $className : string
- $ctx : BexioCTX
- $endpoint : string
- $ownerid : int|null
- $query : string
- $userid : int|null
- $uuid : mixed
Methods
- __construct() : mixed
- Create withing the given context.
- delete() : bool
- Delete an item in the collection.
- get() : BXObject
- Get a file from file endpoint.
- getId() : mixed
- getIdName() : string
- Return the property name used as unique id for this collection.
- getType() : string
- Get the current type.
- list() : array<string|int, BXObject>
- List the collection.
- new() : BXObject
- Create a new BXObject.
- newQuery() : BXquery
- Create a new BXQuery object for this collection.
- search() : array<string|int, BXObject>
- Search the collection.
- set() : BXObject|false
- Set an item in the collection
- setCurrentOwner() : void
- Set current owner id.
- setCurrentUser() : void
- Set current user id.
- update() : BXObject|false
- [!!!] Update an item in the collection
Constants
type
public
mixed
type
= 'files'
Properties
$className
protected
string
$className
= 'BizCuit\\BXObject\\File'
$ctx
protected
BexioCTX
$ctx
$endpoint
protected
string
$endpoint
$ownerid
protected
int|null
$ownerid
= null
$query
protected
string
$query
= 'BizCuit\\BXQuery\\File'
$userid
protected
int|null
$userid
= null
$uuid
protected
mixed
$uuid
Methods
__construct()
Create withing the given context.
public
__construct(BexioCTX $ctx) : mixed
Parameters
- $ctx : BexioCTX
-
The context in which the API will work.
delete()
Delete an item in the collection.
public
delete(int|string|BXObject $id) : bool
Parameters
- $id : int|string|BXObject
-
The id or the object to delete.
Return values
bool —True on success, false otherwise.
get()
Get a file from file endpoint.
public
get(int|string|BXObject $uuid[, array<string|int, mixed> $options = [] ]) : BXObject
Files use UUID most of the time, and the documentation says that they use ID but id don't work that way. The content is associated with the file which require two requests.
Parameters
- $uuid : int|string|BXObject
- $options : array<string|int, mixed> = []
-
Options it not used here.
Return values
BXObject —The file as an object with content property added.
getId()
public
getId() : mixed
getIdName()
Return the property name used as unique id for this collection.
public
getIdName() : string
Return values
string —ID name.
getType()
Get the current type.
public
getType() : string
The current type correspond to an endpoint in the upstream API.
Return values
string —The type name
list()
List the collection.
public
list([int $offset = 0 ][, int $limit = 500 ]) : array<string|int, BXObject>
Parameters
- $offset : int = 0
-
Offset in the search result,
- $limit : int = 500
-
Max number of search result.
Return values
array<string|int, BXObject> —Items in the collection.
new()
Create a new BXObject.
public
new() : BXObject
Return values
BXObject —New empty BXObject.
newQuery()
Create a new BXQuery object for this collection.
public
newQuery() : BXquery
Return values
BXquery —The BXQuery valid for this collection.
search()
Search the collection.
public
search(BXQuery $query[, int $offset = 0 ][, int $limit = 500 ]) : array<string|int, BXObject>
Parameters
- $query : BXQuery
-
The query object.
- $offset : int = 0
-
Offset in the search result,
- $limit : int = 500
-
Max number of search resutl.
Return values
array<string|int, BXObject> —Matching items in the collection.
set()
Set an item in the collection
public
set(BXObject $content) : BXObject|false
Setting an item would create the item if it don't have an ID or overwrite the item if it has an ID.
Parameters
- $content : BXObject
-
The object to be set.
Return values
BXObject|false —The item is returned as stored in collection or false in case of error
setCurrentOwner()
Set current owner id.
public
setCurrentOwner(int $ownerid) : void
Some items, at creation, need a user id and/or an owner id. This set the owner.
Parameters
- $ownerid : int
-
The id of the owner for all creation from now on.
setCurrentUser()
Set current user id.
public
setCurrentUser(int $userid) : void
Some items, at creation, need a user id and/or an owner id. Setting this here allows to automatically add this to the item. If only user is set, when owner is needed it would be set to user.
Parameters
- $userid : int
-
The id of the user for all creation from now on.
update()
[!!!] Update an item in the collection
public
update(BXObject $content) : BXObject|false
This should update property of an item. But the upstream API is buggy here, so no way to know what UPDATE does.
Parameters
- $content : BXObject
-
The object to be set.
Return values
BXObject|false —The item is returned as stored in collection or false in case of error