dolibarr 21.0.0-alpha
Members Class Reference
Inheritance diagram for Members:
Collaboration diagram for Members:

Public Member Functions

 __construct ()
 Constructor.
 
 get ($id)
 Get properties of a member object.
 
 getByThirdparty ($thirdparty)
 Get properties of a member object by linked thirdparty.
 
 getByThirdpartyAccounts ($site, $key_account)
 Get properties of a member object by linked thirdparty account.
 
 getByThirdpartyEmail ($email)
 Get properties of a member object by linked thirdparty email.
 
 getByThirdpartyBarcode ($barcode)
 Get properties of a member object by linked thirdparty barcode.
 
 index ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $typeid='', $category=0, $sqlfilters='', $properties='', $pagination_data=false)
 List members.
 
 post ($request_data=null)
 Create member object.
 
 put ($id, $request_data=null)
 Update member.
 
 delete ($id)
 Delete member.
 
 getSubscriptions ($id)
 List subscriptions of a member.
 
 createSubscription ($id, $start_date, $end_date, $amount, $label='')
 Add a subscription for a member.
 
 getCategories ($id, $sortfield="s.rowid", $sortorder='ASC', $limit=0, $page=0)
 Get categories for a member.
 
 getType ($id)
 Get properties of a member type object.
 
 indexType ($sortfield="t.rowid", $sortorder='ASC', $limit=100, $page=0, $sqlfilters='', $properties='', $pagination_data=false)
 List members types.
 
 postType ($request_data=null)
 Create member type object.
 
 putType ($id, $request_data=null)
 Update member type.
 
 deleteType ($id)
 Delete member type.
 
- Public Member Functions inherited from DolibarrApi
 __construct ($db, $cachedir='', $refreshCache=false)
 Constructor.
 

Protected Member Functions

 _cleanObjectDatas ($object)
 Clean sensible object datas.
 
- Protected Member Functions inherited from DolibarrApi
 _checkValForAPI ($field, $value, $object)
 Check and convert a string depending on its type/name.
 
 _filterObjectProperties ($object, $properties)
 Filter properties that will be returned on object.
 
 _checkFilters ($sqlfilters, &$error='')
 Return if a $sqlfilters parameter is valid Function no more used.
 

Private Member Functions

 _validate ($data)
 Validate fields before creating an object.
 
 _validateType ($data)
 Validate fields before creating an object.
 

Additional Inherited Members

- Static Protected Member Functions inherited from DolibarrApi
static _checkAccessToResource ($resource, $resource_id=0, $dbtablename='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid')
 Check access by user to a given resource.
 
static _forge_criteria_callback ($matches)
 Function to forge a SQL criteria from a Generic filter string.
 

Detailed Description

Definition at line 37 of file api_members.class.php.

Member Function Documentation

◆ _cleanObjectDatas()

Members::_cleanObjectDatas ( $object)
protected

Clean sensible object datas.

Parameters
Object$objectObject to clean
Returns
Object Object with cleaned properties

Reimplemented from DolibarrApi.

Definition at line 539 of file api_members.class.php.

References $object.

Referenced by get(), getByThirdparty(), getByThirdpartyAccounts(), getByThirdpartyBarcode(), getByThirdpartyEmail(), getSubscriptions(), getType(), index(), and indexType().

◆ _validate()

Members::_validate ( $data)
private

Validate fields before creating an object.

Parameters
array<string,null|int|float|string>$data Data to validate
Returns
array<string,null|int|float|string> Return array with validated mandatory fields and their value @phan-return array<string,?int|?float|?string> Return array with validated mandatory fields and their value
Exceptions
RestException

Definition at line 515 of file api_members.class.php.

Referenced by post().

◆ _validateType()

Members::_validateType ( $data)
private

Validate fields before creating an object.

Parameters
?array<string,null|int|float|string>$data Data to validate
Returns
array<string,null|int|float|string>
Exceptions
RestException

Definition at line 978 of file api_members.class.php.

Referenced by postType().

◆ createSubscription()

Members::createSubscription ( $id,
$start_date,
$end_date,
$amount,
$label = '' )

Add a subscription for a member.

Parameters
int$idID of member
string$start_dateStart date {@from body} {@type timestamp}
string$end_dateEnd date {@from body} {@type timestamp}
float$amountAmount (may be 0) {@from body}
string$labelLabel {@from body}
Returns
int ID of subscription

@url POST {id}/subscriptions

Exceptions
RestException403 Access denied
RestException404 Member not found

Definition at line 654 of file api_members.class.php.

References $id.

◆ delete()

Members::delete ( $id)

Delete member.

Parameters
int$idmember ID
Returns
array @phan-return array<string,array{code:int,message:string}> @phpstan-return array<string,array{code:int,message:string}>
Exceptions
RestException403 Access denied
RestException404 Member not found
RestException500 Error when deleting a Member

Definition at line 477 of file api_members.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ deleteType()

Members::deleteType ( $id)

Delete member type.

Parameters
int$idmember type ID
Returns
array @phan-return array<string,array{code:int,message:string}> @phpstan-return array<string,array{code:int,message:string}>

@url DELETE /types/{id}

Exceptions
RestException403 Access denied
RestException404 No Member Type found
RestException500 Error when deleting Member Type

Definition at line 942 of file api_members.class.php.

References $id, and DolibarrApi\_checkAccessToResource().

◆ get()

Members::get ( $id)

Get properties of a member object.

Return an array with member information

Parameters
int$idID of member
Returns
Object Object with cleaned properties
Exceptions
RestException403 Access denied
RestException404 Member not found

Definition at line 67 of file api_members.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ getByThirdparty()

Members::getByThirdparty ( $thirdparty)

Get properties of a member object by linked thirdparty.

Return an array with member information

Parameters
int$thirdpartyID of third party
Returns
Object Data without useless information

@url GET thirdparty/{thirdparty}

Exceptions
RestException403 Access denied
RestException404 Member not found

Definition at line 104 of file api_members.class.php.

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ getByThirdpartyAccounts()

Members::getByThirdpartyAccounts ( $site,
$key_account )

Get properties of a member object by linked thirdparty account.

Parameters
string$siteSite key
string$key_accountKey of account
Returns
array|mixed
Exceptions
RestException401 Unauthorized: User does not have permission to read thirdparties
RestException404 Not Found: Specified thirdparty ID does not belongs to an existing thirdparty

@url GET thirdparty/accounts/{site}/{key_account}

Definition at line 135 of file api_members.class.php.

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ getByThirdpartyBarcode()

Members::getByThirdpartyBarcode ( $barcode)

Get properties of a member object by linked thirdparty barcode.

Return an array with member information

Parameters
string$barcodeBarcode of third party
Returns
Object Data without useless information

@url GET thirdparty/barcode/{barcode}

Exceptions
RestException403 Access denied
RestException404 Member or ThirdParty not found

Definition at line 225 of file api_members.class.php.

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ getByThirdpartyEmail()

Members::getByThirdpartyEmail ( $email)

Get properties of a member object by linked thirdparty email.

Return an array with member information

Parameters
string$emailEmail of third party
Returns
Object Data without useless information

@url GET thirdparty/email/{email}

Exceptions
RestException403 Access denied
RestException404 Member or ThirdParty not found

Definition at line 186 of file api_members.class.php.

References DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ getCategories()

Members::getCategories ( $id,
$sortfield = "s.rowid",
$sortorder = 'ASC',
$limit = 0,
$page = 0 )

Get categories for a member.

Parameters
int$idID of member
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
Returns
mixed

@url GET {id}/categories

Exceptions
RestException403 Access denied
RestException404 Category not found
RestException503 Error when retrieving Category list

Definition at line 686 of file api_members.class.php.

References $id.

◆ getSubscriptions()

Members::getSubscriptions ( $id)

List subscriptions of a member.

Get a list of subscriptions

Parameters
int$idID of member
Returns
array Array of subscription objects @phan-return Object[] @phpstan-return Object[]

@url GET {id}/subscriptions

Exceptions
RestException403 Access denied
RestException404 Member not found

Definition at line 620 of file api_members.class.php.

References $id, and _cleanObjectDatas().

◆ getType()

Members::getType ( $id)

Get properties of a member type object.

Return an array with member type information

Parameters
int$idID of member type
Returns
Object Object with cleaned properties

@url GET /types/{id}

Exceptions
RestException403 Access denied
RestException404 No Member Type found

Definition at line 719 of file api_members.class.php.

References $id, DolibarrApi\_checkAccessToResource(), and _cleanObjectDatas().

◆ index()

Members::index ( $sortfield = "t.rowid",
$sortorder = 'ASC',
$limit = 100,
$page = 0,
$typeid = '',
$category = 0,
$sqlfilters = '',
$properties = '',
$pagination_data = false )

List members.

Get a list of members

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$typeidID of the type of member
int$categoryUse this param to filter list by category
string$sqlfiltersOther criteria to filter answers separated by a comma. Example: "(t.ref:like:'SO-%') and ((t.date_creation:<:'20160101') or (t.nature:is:NULL))"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
bool$pagination_dataIf this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
Returns
array Array of member objects @phan-return array<array<string,null|int|float|string>> @phpstan-return array<array<string,null|int|float|string>>
Exceptions
RestException400 Error on SQL filters
RestException403 Access denied
RestException404 No Member found
RestException503 Error when retrieving Member list

Definition at line 274 of file api_members.class.php.

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().

◆ indexType()

Members::indexType ( $sortfield = "t.rowid",
$sortorder = 'ASC',
$limit = 100,
$page = 0,
$sqlfilters = '',
$properties = '',
$pagination_data = false )

List members types.

Get a list of members types

Parameters
string$sortfieldSort field
string$sortorderSort order
int$limitLimit for list
int$pagePage number
string$sqlfiltersOther criteria to filter answers separated by a comma. Syntax example "(t.libelle:like:'SO-%') and (t.subscription:=:'1')"
string$propertiesRestrict the data returned to these properties. Ignored if empty. Comma separated list of properties names
bool$pagination_dataIf this parameter is set to true the response will include pagination data. Default value is false. Page starts from 0*
Returns
array Array of member type objects @phan-return array<array<string,null|int|float|string>> @phpstan-return array<array<string,null|int|float|string>>

@url GET /types/

Exceptions
RestException403 Access denied
RestException404 No Member Type found
RestException503 Error when retrieving Member list

Definition at line 760 of file api_members.class.php.

References _cleanObjectDatas(), DolibarrApi\_filterObjectProperties(), and forgeSQLFromUniversalSearchCriteria().

◆ post()

Members::post ( $request_data = null)

Create member object.

Parameters
array<string,string>$request_data Request data
Returns
int ID of member
Exceptions
RestException403 Access denied
RestException500 Error when creating Member

Definition at line 364 of file api_members.class.php.

References DolibarrApi\_checkValForAPI(), _validate(), and sanitizeVal().

◆ postType()

Members::postType ( $request_data = null)

Create member type object.

Parameters
array$request_dataRequest data @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
int ID of member type

@url POST /types/

Exceptions
RestException403 Access denied
RestException500 Error when creating Member Type

Definition at line 844 of file api_members.class.php.

References DolibarrApi\_checkValForAPI(), _validateType(), and sanitizeVal().

◆ put()

Members::put ( $id,
$request_data = null )

Update member.

Parameters
int$idID of member to update
array$request_dataDatas @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
Object Updated object
Exceptions
RestException403 Access denied
RestException404 Member not found
RestException500 Error when resiliating, validating, excluding, updating a Member

Definition at line 401 of file api_members.class.php.

References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), and sanitizeVal().

◆ putType()

Members::putType ( $id,
$request_data = null )

Update member type.

Parameters
int$idID of member type to update
array$request_dataDatas @phan-param ?array<string,string> $request_data @phpstan-param ?array<string,string> $request_data
Returns
Object Updated object

@url PUT /types/{id}

Exceptions
RestException403 Access denied
RestException404 No Member Type found
RestException500 Error when updating Member Type

Definition at line 883 of file api_members.class.php.

References $id, DolibarrApi\_checkAccessToResource(), DolibarrApi\_checkValForAPI(), and sanitizeVal().


The documentation for this class was generated from the following file: