Blesta Source Documentation

DataFeeds extends AppModel

Data feeds management

Table of Contents

Methods

__construct() Initialize DataFeeds
add() Adds a new data feed
addEndpoint() Adds a new endpoint to an existing data feed
delete() Deletes a data feed and all of its endpoints
deleteEndpoint() Deletes an endpoint
edit() Edits an existing data feed
editEndpoint() Updates an existing endpoint
execute() Executes the endpoint of a data feed for a given company
get() Fetches a single data feed including all of its endpoints
getAll() Gets all data feeds with their respective endpoints that meet the given criteria
getAllEndpoints() Gets all endpoints that meet the given criteria
getEndpoint() Fetches an endpoint from the system
getInstance() Fetches a data feed instance
getEndpointRules() Returns the rule set for adding/editing endpoints
getRules() Returns the rule set for adding/editing data feeds
Methods

__construct()

Initialize DataFeeds

public __construct() : mixed

add()

Adds a new data feed

public add(array<string|int, mixed> $vars) : mixed
Parameters
$vars : array<string|int, mixed>

An array containing the following parameters:

  • feed The name of the data feed
  • dir The plugin directory where the data feed belongs (optional, default null)
  • class The data feed class
  • endpoints
    • company_id The ID of the company where the data feed will be added
    • endpoint The name of the endpoint
    • enabled Whether the endpoint it's enabled

addEndpoint()

Adds a new endpoint to an existing data feed

public addEndpoint(array<string|int, mixed> $vars) : mixed
Parameters
$vars : array<string|int, mixed>

A key/value array containing:

  • company_id The ID of the company where the endpoint will be created
  • feed The name of the data feed it will belong to
  • endpoint The name of the endpoint
  • enabled Whether the endpoint it's enabled

delete()

Deletes a data feed and all of its endpoints

public delete(string $feed) : mixed
Parameters
$feed : string

The feed key/name to be deleted

deleteEndpoint()

Deletes an endpoint

public deleteEndpoint(int $endpoint_id) : mixed
Parameters
$endpoint_id : int

The ID of the endpoint to be deleted

edit()

Edits an existing data feed

public edit(string $feed, array<string|int, mixed> $vars) : mixed
Parameters
$feed : string

The feed key/name to be updated

$vars : array<string|int, mixed>

A key/value array containing:

  • dir The plugin directory where the data feed belongs (optional, default null)
  • class The data feed class
  • endpoints A multi-dimensional array containing the endpoints to update, each one containing:
    • id The ID of the endpoint to update
    • company_id The ID of the company where the data feed will be added
    • endpoint The name of the endpoint
    • enabled Whether the endpoint it's enabled

editEndpoint()

Updates an existing endpoint

public editEndpoint(int $endpoint_id, array<string|int, mixed> $vars) : int
Parameters
$endpoint_id : int

The ID of the endpoint to be updated

$vars : array<string|int, mixed>

A key/value array containing:

  • feed The name of the data feed it will belong to
  • endpoint The name of the endpoint
  • enabled Whether the endpoint it's enabled
Return values
int

The ID of the endpoint

execute()

Executes the endpoint of a data feed for a given company

public execute(string $feed, string $endpoint, array<string|int, mixed> $vars[, int $company_id = null ]) : mixed
Parameters
$feed : string

The class name of the data feed to instantiate

$endpoint : string

The endpoint to execute through the data feed

$vars : array<string|int, mixed>

An array containing the parameters for the request

$company_id : int = null

The ID of the company where the data feed will be executed

Return values
mixed

The response of the data feed

get()

Fetches a single data feed including all of its endpoints

public get(string $feed[, int $company_id = null ]) : stdClass
Parameters
$feed : string

The class name of the data feed to instantiate

$company_id : int = null

The ID of the company whose data feed is to be fetched

Return values
stdClass

An object representing the data feed

getAll()

Gets all data feeds with their respective endpoints that meet the given criteria

public getAll([array<string|int, mixed> $filters = [] ]) : array<string|int, mixed>
Parameters
$filters : array<string|int, mixed> = []

A list of parameters to filter by, including:

  • company_id The ID of the company on which to filter the data feeds (optional, default null to fetch all)
  • enabled The status of the data feed endpoints (optional, default null) one of the following:
    • 1 Fetch only enabled endpoints
    • 0 Fetch only disabled endpoints
    • null Fetch all endpoints
Return values
array<string|int, mixed>

A numerically indexed array of objects, each one representing a data feed

getAllEndpoints()

Gets all endpoints that meet the given criteria

public getAllEndpoints([array<string|int, mixed> $filters = [] ]) : array<string|int, mixed>
Parameters
$filters : array<string|int, mixed> = []

A list of parameters to filter by, including:

  • company_id The ID of the company on which to filter the endpoints (optional, default null to fetch all)
  • enabled The status of the endpoints (optional, default null) one of the following:
    • 1 Fetch only enabled endpoints
    • 0 Fetch only disabled endpoints
    • null Fetch all endpoints
Return values
array<string|int, mixed>

A numerically indexed array of objects, each one representing an endpoint

getEndpoint()

Fetches an endpoint from the system

public getEndpoint(int $endpoint_id) : stdClass
Parameters
$endpoint_id : int

The ID of the endpoint to fetch

Return values
stdClass

An object representing the endpoint

getInstance()

Fetches a data feed instance

public getInstance(string $feed) : stdClass
Parameters
$feed : string

The class name of the data feed to instantiate

Return values
stdClass

An object representing the data feed

getEndpointRules()

Returns the rule set for adding/editing endpoints

private getEndpointRules(array<string|int, mixed> $vars[, mixed $edit = false ]) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

The input vars

$edit : mixed = false
Return values
array<string|int, mixed>

The data feed rules

getRules()

Returns the rule set for adding/editing data feeds

private getRules(array<string|int, mixed> $vars[, mixed $edit = false ]) : array<string|int, mixed>
Parameters
$vars : array<string|int, mixed>

The input vars

$edit : mixed = false
Return values
array<string|int, mixed>

The data feed rules

Tags
subpackage

app.models

copyright

Copyright (c) 2022, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results