Skip to content

Latest commit

 

History

History
833 lines (564 loc) · 26 KB

VotingApi.md

File metadata and controls

833 lines (564 loc) · 26 KB

Bzzhh\Tzkt\VotingApi

All URIs are relative to https://api.tzkt.io, except if the operation defines another base path.

Method HTTP request Description
votingGetCurrentEpoch() GET /v1/voting/epochs/current Get current voting epoch
votingGetCurrentPeriod() GET /v1/voting/periods/current Get current voting period
votingGetEpoch() GET /v1/voting/epochs/{index} Get voting epoch by index
votingGetEpochs() GET /v1/voting/epochs Get voting epochs
votingGetLatestVoting() GET /v1/voting/epochs/latest_voting Get latest voting
votingGetPeriod() GET /v1/voting/periods/{index} Get voting period by index
votingGetPeriodVoter() GET /v1/voting/periods/{index}/voters/{address} Get period voter
votingGetPeriodVoter2() GET /v1/voting/periods/current/voters/{address} Get current period voter
votingGetPeriodVoters() GET /v1/voting/periods/{index}/voters Get period voters
votingGetPeriodVoters2() GET /v1/voting/periods/current/voters Get current period voters
votingGetPeriods() GET /v1/voting/periods Get voting periods
votingGetProposalByHash() GET /v1/voting/proposals/{hash} Get proposal by hash
votingGetProposals() GET /v1/voting/proposals Get proposals
votingGetProposalsCount() GET /v1/voting/proposals/count Get proposals count

votingGetCurrentEpoch()

votingGetCurrentEpoch(): \Bzzhh\Tzkt\Model\VotingEpoch

Get current voting epoch

Returns the current voting epoch

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->votingGetCurrentEpoch();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetCurrentEpoch: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Bzzhh\Tzkt\Model\VotingEpoch

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetCurrentPeriod()

votingGetCurrentPeriod(): \Bzzhh\Tzkt\Model\VotingPeriod

Get current voting period

Returns current voting period.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->votingGetCurrentPeriod();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetCurrentPeriod: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Bzzhh\Tzkt\Model\VotingPeriod

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetEpoch()

votingGetEpoch($index): \Bzzhh\Tzkt\Model\VotingEpoch

Get voting epoch by index

Returns a voting epoch at the specified index.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$index = 56; // int | Voting epoch index starting from zero

try {
    $result = $apiInstance->votingGetEpoch($index);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetEpoch: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
index int Voting epoch index starting from zero

Return type

\Bzzhh\Tzkt\Model\VotingEpoch

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetEpochs()

votingGetEpochs($sort, $offset, $limit): \Bzzhh\Tzkt\Model\VotingEpoch[]

Get voting epochs

Returns a list of voting epochs.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sort = new \Bzzhh\Tzkt\Model\AccountsGetSortParameter(); // AccountsGetSortParameter | Sorts voting epochs by specified field. Supported fields: `id` (default).
$offset = new \Bzzhh\Tzkt\Model\AccountsGetOffsetParameter(); // AccountsGetOffsetParameter | Specifies which or how many items should be skipped
$limit = 100; // int | Maximum number of items to return

try {
    $result = $apiInstance->votingGetEpochs($sort, $offset, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetEpochs: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
sort AccountsGetSortParameter Sorts voting epochs by specified field. Supported fields: `id` (default). [optional]
offset AccountsGetOffsetParameter Specifies which or how many items should be skipped [optional]
limit int Maximum number of items to return [optional] [default to 100]

Return type

\Bzzhh\Tzkt\Model\VotingEpoch[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetLatestVoting()

votingGetLatestVoting(): \Bzzhh\Tzkt\Model\VotingEpoch

Get latest voting

Returns the latest epoch with at least one proposal

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->votingGetLatestVoting();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetLatestVoting: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

\Bzzhh\Tzkt\Model\VotingEpoch

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetPeriod()

votingGetPeriod($index): \Bzzhh\Tzkt\Model\VotingPeriod

Get voting period by index

Returns a voting period at the specified index.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$index = 56; // int | Voting period index starting from zero

try {
    $result = $apiInstance->votingGetPeriod($index);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetPeriod: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
index int Voting period index starting from zero

Return type

\Bzzhh\Tzkt\Model\VotingPeriod

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetPeriodVoter()

votingGetPeriodVoter($index, $address): \Bzzhh\Tzkt\Model\VoterSnapshot

Get period voter

Returns a voter with the specified address from the voting period at the specified index.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$index = 56; // int | Voting period index starting from zero
$address = 'address_example'; // string | Voter address

try {
    $result = $apiInstance->votingGetPeriodVoter($index, $address);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetPeriodVoter: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
index int Voting period index starting from zero
address string Voter address

Return type

\Bzzhh\Tzkt\Model\VoterSnapshot

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetPeriodVoter2()

votingGetPeriodVoter2($address): \Bzzhh\Tzkt\Model\VoterSnapshot

Get current period voter

Returns a voter with the specified address from the current period.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$address = 'address_example'; // string | Voter address

try {
    $result = $apiInstance->votingGetPeriodVoter2($address);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetPeriodVoter2: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
address string Voter address

Return type

\Bzzhh\Tzkt\Model\VoterSnapshot

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetPeriodVoters()

votingGetPeriodVoters($index, $status, $sort, $offset, $limit): \Bzzhh\Tzkt\Model\VoterSnapshot[]

Get period voters

Returns voters from the voting period at the specified index.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$index = 56; // int | Voting period index starting from zero
$status = new \Bzzhh\Tzkt\Model\VotingGetPeriodVotersStatusParameter(); // VotingGetPeriodVotersStatusParameter | Filters voters by status (`none`, `upvoted`, `voted_yay`, `voted_nay`, `voted_pass`)
$sort = new \Bzzhh\Tzkt\Model\AccountsGetSortParameter(); // AccountsGetSortParameter | Sorts voters by specified field. Supported fields: `id` (default), `votingPower`.
$offset = new \Bzzhh\Tzkt\Model\AccountsGetOffsetParameter(); // AccountsGetOffsetParameter | Specifies which or how many items should be skipped
$limit = 100; // int | Maximum number of items to return

try {
    $result = $apiInstance->votingGetPeriodVoters($index, $status, $sort, $offset, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetPeriodVoters: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
index int Voting period index starting from zero
status VotingGetPeriodVotersStatusParameter Filters voters by status (`none`, `upvoted`, `voted_yay`, `voted_nay`, `voted_pass`) [optional]
sort AccountsGetSortParameter Sorts voters by specified field. Supported fields: `id` (default), `votingPower`. [optional]
offset AccountsGetOffsetParameter Specifies which or how many items should be skipped [optional]
limit int Maximum number of items to return [optional] [default to 100]

Return type

\Bzzhh\Tzkt\Model\VoterSnapshot[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetPeriodVoters2()

votingGetPeriodVoters2($status, $sort, $offset, $limit): \Bzzhh\Tzkt\Model\VoterSnapshot[]

Get current period voters

Returns voters from the current period.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$status = new \Bzzhh\Tzkt\Model\VotingGetPeriodVotersStatusParameter(); // VotingGetPeriodVotersStatusParameter | Filters voters by status (`none`, `upvoted`, `voted_yay`, `voted_nay`, `voted_pass`)
$sort = new \Bzzhh\Tzkt\Model\AccountsGetSortParameter(); // AccountsGetSortParameter | Sorts voters by specified field. Supported fields: `id` (default), `votingPower`.
$offset = new \Bzzhh\Tzkt\Model\AccountsGetOffsetParameter(); // AccountsGetOffsetParameter | Specifies which or how many items should be skipped
$limit = 100; // int | Maximum number of items to return

try {
    $result = $apiInstance->votingGetPeriodVoters2($status, $sort, $offset, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetPeriodVoters2: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
status VotingGetPeriodVotersStatusParameter Filters voters by status (`none`, `upvoted`, `voted_yay`, `voted_nay`, `voted_pass`) [optional]
sort AccountsGetSortParameter Sorts voters by specified field. Supported fields: `id` (default), `votingPower`. [optional]
offset AccountsGetOffsetParameter Specifies which or how many items should be skipped [optional]
limit int Maximum number of items to return [optional] [default to 100]

Return type

\Bzzhh\Tzkt\Model\VoterSnapshot[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetPeriods()

votingGetPeriods($first_level, $last_level, $select, $sort, $offset, $limit): \Bzzhh\Tzkt\Model\VotingPeriod[]

Get voting periods

Returns a list of voting periods.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$first_level = new \Bzzhh\Tzkt\Model\AccountsGetIdParameter(); // AccountsGetIdParameter | Filter by level of the first block of the period.
$last_level = new \Bzzhh\Tzkt\Model\AccountsGetIdParameter(); // AccountsGetIdParameter | Filter by level of the last block of the period.
$select = new \Bzzhh\Tzkt\Model\AccountsGetSelectParameter(); // AccountsGetSelectParameter | Specify comma-separated list of fields to include into response or leave it undefined to return full object. If you select single field, response will be an array of values in both `.fields` and `.values` modes.
$sort = new \Bzzhh\Tzkt\Model\AccountsGetSortParameter(); // AccountsGetSortParameter | Sorts voting periods by specified field. Supported fields: `id` (default).
$offset = new \Bzzhh\Tzkt\Model\AccountsGetOffsetParameter(); // AccountsGetOffsetParameter | Specifies which or how many items should be skipped
$limit = 100; // int | Maximum number of items to return

try {
    $result = $apiInstance->votingGetPeriods($first_level, $last_level, $select, $sort, $offset, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetPeriods: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
first_level AccountsGetIdParameter Filter by level of the first block of the period. [optional]
last_level AccountsGetIdParameter Filter by level of the last block of the period. [optional]
select AccountsGetSelectParameter Specify comma-separated list of fields to include into response or leave it undefined to return full object. If you select single field, response will be an array of values in both `.fields` and `.values` modes. [optional]
sort AccountsGetSortParameter Sorts voting periods by specified field. Supported fields: `id` (default). [optional]
offset AccountsGetOffsetParameter Specifies which or how many items should be skipped [optional]
limit int Maximum number of items to return [optional] [default to 100]

Return type

\Bzzhh\Tzkt\Model\VotingPeriod[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetProposalByHash()

votingGetProposalByHash($hash): \Bzzhh\Tzkt\Model\Proposal

Get proposal by hash

Returns the most recent protocol proposal with the specified hash.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$hash = 'hash_example'; // string | Proposal hash

try {
    $result = $apiInstance->votingGetProposalByHash($hash);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetProposalByHash: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
hash string Proposal hash

Return type

\Bzzhh\Tzkt\Model\Proposal

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetProposals()

votingGetProposals($hash, $epoch, $select, $sort, $offset, $limit): \Bzzhh\Tzkt\Model\Proposal[]

Get proposals

Returns a list of protocol proposals.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$hash = new \Bzzhh\Tzkt\Model\OperationsGetBallotsProposalParameter(); // OperationsGetBallotsProposalParameter | Filters proposals by hash
$epoch = new \Bzzhh\Tzkt\Model\AccountsGetIdParameter(); // AccountsGetIdParameter | Filters proposals by voting epoch
$select = new \Bzzhh\Tzkt\Model\AccountsGetSelectParameter(); // AccountsGetSelectParameter | Specify comma-separated list of fields to include into response or leave it undefined to return full object. If you select single field, response will be an array of values in both `.fields` and `.values` modes.
$sort = new \Bzzhh\Tzkt\Model\AccountsGetSortParameter(); // AccountsGetSortParameter | Sorts proposals by specified field. Supported fields: `id` (default), `upvotes`, `votingPower`.
$offset = new \Bzzhh\Tzkt\Model\AccountsGetOffsetParameter(); // AccountsGetOffsetParameter | Specifies which or how many items should be skipped
$limit = 100; // int | Maximum number of items to return

try {
    $result = $apiInstance->votingGetProposals($hash, $epoch, $select, $sort, $offset, $limit);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetProposals: ', $e->getMessage(), PHP_EOL;
}

Parameters

Name Type Description Notes
hash OperationsGetBallotsProposalParameter Filters proposals by hash [optional]
epoch AccountsGetIdParameter Filters proposals by voting epoch [optional]
select AccountsGetSelectParameter Specify comma-separated list of fields to include into response or leave it undefined to return full object. If you select single field, response will be an array of values in both `.fields` and `.values` modes. [optional]
sort AccountsGetSortParameter Sorts proposals by specified field. Supported fields: `id` (default), `upvotes`, `votingPower`. [optional]
offset AccountsGetOffsetParameter Specifies which or how many items should be skipped [optional]
limit int Maximum number of items to return [optional] [default to 100]

Return type

\Bzzhh\Tzkt\Model\Proposal[]

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

votingGetProposalsCount()

votingGetProposalsCount(): int

Get proposals count

Returns the total number of protocol proposals.

Example

<?php
require_once(__DIR__ . '/vendor/autoload.php');



$apiInstance = new Bzzhh\Tzkt\Api\VotingApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);

try {
    $result = $apiInstance->votingGetProposalsCount();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling VotingApi->votingGetProposalsCount: ', $e->getMessage(), PHP_EOL;
}

Parameters

This endpoint does not need any parameter.

Return type

int

Authorization

No authorization required

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]