diff --git a/.openapi-generator-ignore b/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION new file mode 100644 index 0000000..ecedc98 --- /dev/null +++ b/.openapi-generator/VERSION @@ -0,0 +1 @@ +4.3.1 \ No newline at end of file diff --git a/.php_cs b/.php_cs new file mode 100644 index 0000000..4fbe53e --- /dev/null +++ b/.php_cs @@ -0,0 +1,23 @@ +setUsingCache(true) + ->setRules([ + '@PSR2' => true, + 'ordered_imports' => true, + 'phpdoc_order' => true, + 'array_syntax' => [ 'syntax' => 'short' ], + 'strict_comparison' => true, + 'strict_param' => true, + 'no_trailing_whitespace' => false, + 'no_trailing_whitespace_in_comment' => false, + 'braces' => false, + 'single_blank_line_at_eof' => false, + 'blank_line_after_namespace' => false, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) + ); diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..d77f382 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,10 @@ +language: php +sudo: false +php: + - 5.4 + - 5.5 + - 5.6 + - 7.0 + - hhvm +before_install: "composer install" +script: "vendor/bin/phpunit" diff --git a/README.md b/README.md new file mode 100644 index 0000000..9782550 --- /dev/null +++ b/README.md @@ -0,0 +1,222 @@ +# Finnhub + +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + +This PHP package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: 1.0.0 +- Package version: 1.0.0 +- Build package: org.openapitools.codegen.languages.PhpClientCodegen + +## Requirements + +PHP 5.5 and later + +## Installation & Usage + +### Composer + +To install the bindings via [Composer](http://getcomposer.org/), add the following to `composer.json`: + +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + } + ], + "require": { + "GIT_USER_ID/GIT_REPO_ID": "*@dev" + } +} +``` + +Then run `composer install` + +### Manual Installation + +Download the files and include `autoload.php`: + +```php + require_once('/path/to/Finnhub/vendor/autoload.php'); +``` + +## Tests + +To run the unit tests: + +```bash +composer install +./vendor/bin/phpunit +``` + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | symbol +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. + +try { + $result = $apiInstance->aggregateIndicator($symbol, $resolution); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->aggregateIndicator: ', $e->getMessage(), PHP_EOL; +} + +?> +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://finnhub.io/api/v1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*DefaultApi* | [**aggregateIndicator**](docs/Api/DefaultApi.md#aggregateindicator) | **GET** /scan/technical-indicator | Aggregate Indicators +*DefaultApi* | [**companyBasicFinancials**](docs/Api/DefaultApi.md#companybasicfinancials) | **GET** /stock/metric | Basic Financials +*DefaultApi* | [**companyEarnings**](docs/Api/DefaultApi.md#companyearnings) | **GET** /stock/earnings | Earnings Surprises +*DefaultApi* | [**companyEpsEstimates**](docs/Api/DefaultApi.md#companyepsestimates) | **GET** /stock/eps-estimate | Earnings Estimates +*DefaultApi* | [**companyExecutive**](docs/Api/DefaultApi.md#companyexecutive) | **GET** /stock/executive | Company Executive +*DefaultApi* | [**companyNews**](docs/Api/DefaultApi.md#companynews) | **GET** /company-news | Company News +*DefaultApi* | [**companyPeers**](docs/Api/DefaultApi.md#companypeers) | **GET** /stock/peers | Peers +*DefaultApi* | [**companyProfile**](docs/Api/DefaultApi.md#companyprofile) | **GET** /stock/profile | Company Profile +*DefaultApi* | [**companyProfile2**](docs/Api/DefaultApi.md#companyprofile2) | **GET** /stock/profile2 | Company Profile 2 +*DefaultApi* | [**companyRevenueEstimates**](docs/Api/DefaultApi.md#companyrevenueestimates) | **GET** /stock/revenue-estimate | Revenue Estimates +*DefaultApi* | [**country**](docs/Api/DefaultApi.md#country) | **GET** /country | Country Metadata +*DefaultApi* | [**covid19**](docs/Api/DefaultApi.md#covid19) | **GET** /covid19/us | COVID-19 +*DefaultApi* | [**cryptoCandles**](docs/Api/DefaultApi.md#cryptocandles) | **GET** /crypto/candle | Crypto Candles +*DefaultApi* | [**cryptoExchanges**](docs/Api/DefaultApi.md#cryptoexchanges) | **GET** /crypto/exchange | Crypto Exchanges +*DefaultApi* | [**cryptoSymbols**](docs/Api/DefaultApi.md#cryptosymbols) | **GET** /crypto/symbol | Crypto Symbol +*DefaultApi* | [**earningsCalendar**](docs/Api/DefaultApi.md#earningscalendar) | **GET** /calendar/earnings | Earnings Calendar +*DefaultApi* | [**economicCode**](docs/Api/DefaultApi.md#economiccode) | **GET** /economic/code | Economic Code +*DefaultApi* | [**economicData**](docs/Api/DefaultApi.md#economicdata) | **GET** /economic | Economic Data +*DefaultApi* | [**filings**](docs/Api/DefaultApi.md#filings) | **GET** /stock/filings | Filings +*DefaultApi* | [**financials**](docs/Api/DefaultApi.md#financials) | **GET** /stock/financials | Financial Statements +*DefaultApi* | [**financialsReported**](docs/Api/DefaultApi.md#financialsreported) | **GET** /stock/financials-reported | Financials As Reported +*DefaultApi* | [**forexCandles**](docs/Api/DefaultApi.md#forexcandles) | **GET** /forex/candle | Forex Candles +*DefaultApi* | [**forexExchanges**](docs/Api/DefaultApi.md#forexexchanges) | **GET** /forex/exchange | Forex Exchanges +*DefaultApi* | [**forexRates**](docs/Api/DefaultApi.md#forexrates) | **GET** /forex/rates | Forex rates +*DefaultApi* | [**forexSymbols**](docs/Api/DefaultApi.md#forexsymbols) | **GET** /forex/symbol | Forex Symbol +*DefaultApi* | [**fundOwnership**](docs/Api/DefaultApi.md#fundownership) | **GET** /stock/fund-ownership | Fund Ownership +*DefaultApi* | [**generalNews**](docs/Api/DefaultApi.md#generalnews) | **GET** /news | General News +*DefaultApi* | [**investorsOwnership**](docs/Api/DefaultApi.md#investorsownership) | **GET** /stock/investor-ownership | Investors Ownership +*DefaultApi* | [**ipoCalendar**](docs/Api/DefaultApi.md#ipocalendar) | **GET** /calendar/ipo | IPO Calendar +*DefaultApi* | [**majorDevelopments**](docs/Api/DefaultApi.md#majordevelopments) | **GET** /major-development | Major Developments +*DefaultApi* | [**newsSentiment**](docs/Api/DefaultApi.md#newssentiment) | **GET** /news-sentiment | News Sentiment +*DefaultApi* | [**patternRecognition**](docs/Api/DefaultApi.md#patternrecognition) | **GET** /scan/pattern | Pattern Recognition +*DefaultApi* | [**priceTarget**](docs/Api/DefaultApi.md#pricetarget) | **GET** /stock/price-target | Price Target +*DefaultApi* | [**quote**](docs/Api/DefaultApi.md#quote) | **GET** /quote | Quote +*DefaultApi* | [**recommendationTrends**](docs/Api/DefaultApi.md#recommendationtrends) | **GET** /stock/recommendation | Recommendation Trends +*DefaultApi* | [**stockBidask**](docs/Api/DefaultApi.md#stockbidask) | **GET** /stock/bidask | Last Bid-Ask +*DefaultApi* | [**stockCandles**](docs/Api/DefaultApi.md#stockcandles) | **GET** /stock/candle | Stock Candles +*DefaultApi* | [**stockDividends**](docs/Api/DefaultApi.md#stockdividends) | **GET** /stock/dividend | Dividends +*DefaultApi* | [**stockSplits**](docs/Api/DefaultApi.md#stocksplits) | **GET** /stock/split | Splits +*DefaultApi* | [**stockSymbols**](docs/Api/DefaultApi.md#stocksymbols) | **GET** /stock/symbol | Stock Symbol +*DefaultApi* | [**stockTick**](docs/Api/DefaultApi.md#stocktick) | **GET** /stock/tick | Tick Data +*DefaultApi* | [**supportResistance**](docs/Api/DefaultApi.md#supportresistance) | **GET** /scan/support-resistance | Support/Resistance +*DefaultApi* | [**technicalIndicator**](docs/Api/DefaultApi.md#technicalindicator) | **POST** /indicator | Technical Indicators +*DefaultApi* | [**transcripts**](docs/Api/DefaultApi.md#transcripts) | **GET** /stock/transcripts | Earnings Call Transcripts +*DefaultApi* | [**transcriptsList**](docs/Api/DefaultApi.md#transcriptslist) | **GET** /stock/transcripts/list | Earnings Call Transcripts List +*DefaultApi* | [**upgradeDowngrade**](docs/Api/DefaultApi.md#upgradedowngrade) | **GET** /stock/upgrade-downgrade | Stock Upgrade/Downgrade + + +## Documentation For Models + + - [AggregateIndicators](docs/Model/AggregateIndicators.md) + - [BasicFinancials](docs/Model/BasicFinancials.md) + - [Company](docs/Model/Company.md) + - [CompanyExecutive](docs/Model/CompanyExecutive.md) + - [CompanyNewsStatistics](docs/Model/CompanyNewsStatistics.md) + - [CompanyProfile](docs/Model/CompanyProfile.md) + - [CompanyProfile2](docs/Model/CompanyProfile2.md) + - [CountryMetadata](docs/Model/CountryMetadata.md) + - [CovidInfo](docs/Model/CovidInfo.md) + - [CryptoCandles](docs/Model/CryptoCandles.md) + - [CryptoSymbol](docs/Model/CryptoSymbol.md) + - [Development](docs/Model/Development.md) + - [Dividends](docs/Model/Dividends.md) + - [EarningEstimate](docs/Model/EarningEstimate.md) + - [EarningRelease](docs/Model/EarningRelease.md) + - [EarningResult](docs/Model/EarningResult.md) + - [EarningsCalendar](docs/Model/EarningsCalendar.md) + - [EarningsCallTranscripts](docs/Model/EarningsCallTranscripts.md) + - [EarningsCallTranscriptsList](docs/Model/EarningsCallTranscriptsList.md) + - [EarningsEstimates](docs/Model/EarningsEstimates.md) + - [EconomicCalendar](docs/Model/EconomicCalendar.md) + - [EconomicCode](docs/Model/EconomicCode.md) + - [EconomicData](docs/Model/EconomicData.md) + - [EconomicEvent](docs/Model/EconomicEvent.md) + - [Estimate](docs/Model/Estimate.md) + - [Filing](docs/Model/Filing.md) + - [FinancialStatements](docs/Model/FinancialStatements.md) + - [FinancialsAsReported](docs/Model/FinancialsAsReported.md) + - [ForexCandles](docs/Model/ForexCandles.md) + - [ForexSymbol](docs/Model/ForexSymbol.md) + - [Forexrates](docs/Model/Forexrates.md) + - [FundOwnership](docs/Model/FundOwnership.md) + - [IPOCalendar](docs/Model/IPOCalendar.md) + - [IPOEvent](docs/Model/IPOEvent.md) + - [Indicator](docs/Model/Indicator.md) + - [Investor](docs/Model/Investor.md) + - [InvestorsOwnership](docs/Model/InvestorsOwnership.md) + - [LastBidAsk](docs/Model/LastBidAsk.md) + - [MajorDevelopments](docs/Model/MajorDevelopments.md) + - [News](docs/Model/News.md) + - [NewsSentiment](docs/Model/NewsSentiment.md) + - [PatternRecognition](docs/Model/PatternRecognition.md) + - [PriceTarget](docs/Model/PriceTarget.md) + - [Quote](docs/Model/Quote.md) + - [RecommendationTrend](docs/Model/RecommendationTrend.md) + - [Report](docs/Model/Report.md) + - [RevenueEstimates](docs/Model/RevenueEstimates.md) + - [Sentiment](docs/Model/Sentiment.md) + - [Split](docs/Model/Split.md) + - [Stock](docs/Model/Stock.md) + - [StockCandles](docs/Model/StockCandles.md) + - [StockTranscripts](docs/Model/StockTranscripts.md) + - [SupportResistance](docs/Model/SupportResistance.md) + - [TechnicalAnalysis](docs/Model/TechnicalAnalysis.md) + - [TickData](docs/Model/TickData.md) + - [TranscriptContent](docs/Model/TranscriptContent.md) + - [TranscriptParticipant](docs/Model/TranscriptParticipant.md) + - [Trend](docs/Model/Trend.md) + - [UpgradeDowngrade](docs/Model/UpgradeDowngrade.md) + + +## Documentation For Authorization + + + +## api_key + + +- **Type**: API key +- **API key parameter name**: token +- **Location**: URL query string + + + +## Author + + + diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..011ed8f --- /dev/null +++ b/composer.json @@ -0,0 +1,40 @@ +{ + "name": "GIT_USER_ID/GIT_REPO_ID", + "version": "1.0.0", + "description": "No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": ">=7.1", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^6.2" + }, + "require-dev": { + "phpunit/phpunit": "^7.4", + "squizlabs/php_codesniffer": "~2.6", + "friendsofphp/php-cs-fixer": "~2.12" + }, + "autoload": { + "psr-4": { "Finnhub\\" : "lib/" } + }, + "autoload-dev": { + "psr-4": { "Finnhub\\" : "test/" } + } +} diff --git a/docs/Api/DefaultApi.md b/docs/Api/DefaultApi.md new file mode 100644 index 0000000..2fc13bf --- /dev/null +++ b/docs/Api/DefaultApi.md @@ -0,0 +1,3044 @@ +# Finnhub\DefaultApi + +All URIs are relative to *https://finnhub.io/api/v1* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**aggregateIndicator**](DefaultApi.md#aggregateIndicator) | **GET** /scan/technical-indicator | Aggregate Indicators +[**companyBasicFinancials**](DefaultApi.md#companyBasicFinancials) | **GET** /stock/metric | Basic Financials +[**companyEarnings**](DefaultApi.md#companyEarnings) | **GET** /stock/earnings | Earnings Surprises +[**companyEpsEstimates**](DefaultApi.md#companyEpsEstimates) | **GET** /stock/eps-estimate | Earnings Estimates +[**companyExecutive**](DefaultApi.md#companyExecutive) | **GET** /stock/executive | Company Executive +[**companyNews**](DefaultApi.md#companyNews) | **GET** /company-news | Company News +[**companyPeers**](DefaultApi.md#companyPeers) | **GET** /stock/peers | Peers +[**companyProfile**](DefaultApi.md#companyProfile) | **GET** /stock/profile | Company Profile +[**companyProfile2**](DefaultApi.md#companyProfile2) | **GET** /stock/profile2 | Company Profile 2 +[**companyRevenueEstimates**](DefaultApi.md#companyRevenueEstimates) | **GET** /stock/revenue-estimate | Revenue Estimates +[**country**](DefaultApi.md#country) | **GET** /country | Country Metadata +[**covid19**](DefaultApi.md#covid19) | **GET** /covid19/us | COVID-19 +[**cryptoCandles**](DefaultApi.md#cryptoCandles) | **GET** /crypto/candle | Crypto Candles +[**cryptoExchanges**](DefaultApi.md#cryptoExchanges) | **GET** /crypto/exchange | Crypto Exchanges +[**cryptoSymbols**](DefaultApi.md#cryptoSymbols) | **GET** /crypto/symbol | Crypto Symbol +[**earningsCalendar**](DefaultApi.md#earningsCalendar) | **GET** /calendar/earnings | Earnings Calendar +[**economicCode**](DefaultApi.md#economicCode) | **GET** /economic/code | Economic Code +[**economicData**](DefaultApi.md#economicData) | **GET** /economic | Economic Data +[**filings**](DefaultApi.md#filings) | **GET** /stock/filings | Filings +[**financials**](DefaultApi.md#financials) | **GET** /stock/financials | Financial Statements +[**financialsReported**](DefaultApi.md#financialsReported) | **GET** /stock/financials-reported | Financials As Reported +[**forexCandles**](DefaultApi.md#forexCandles) | **GET** /forex/candle | Forex Candles +[**forexExchanges**](DefaultApi.md#forexExchanges) | **GET** /forex/exchange | Forex Exchanges +[**forexRates**](DefaultApi.md#forexRates) | **GET** /forex/rates | Forex rates +[**forexSymbols**](DefaultApi.md#forexSymbols) | **GET** /forex/symbol | Forex Symbol +[**fundOwnership**](DefaultApi.md#fundOwnership) | **GET** /stock/fund-ownership | Fund Ownership +[**generalNews**](DefaultApi.md#generalNews) | **GET** /news | General News +[**investorsOwnership**](DefaultApi.md#investorsOwnership) | **GET** /stock/investor-ownership | Investors Ownership +[**ipoCalendar**](DefaultApi.md#ipoCalendar) | **GET** /calendar/ipo | IPO Calendar +[**majorDevelopments**](DefaultApi.md#majorDevelopments) | **GET** /major-development | Major Developments +[**newsSentiment**](DefaultApi.md#newsSentiment) | **GET** /news-sentiment | News Sentiment +[**patternRecognition**](DefaultApi.md#patternRecognition) | **GET** /scan/pattern | Pattern Recognition +[**priceTarget**](DefaultApi.md#priceTarget) | **GET** /stock/price-target | Price Target +[**quote**](DefaultApi.md#quote) | **GET** /quote | Quote +[**recommendationTrends**](DefaultApi.md#recommendationTrends) | **GET** /stock/recommendation | Recommendation Trends +[**stockBidask**](DefaultApi.md#stockBidask) | **GET** /stock/bidask | Last Bid-Ask +[**stockCandles**](DefaultApi.md#stockCandles) | **GET** /stock/candle | Stock Candles +[**stockDividends**](DefaultApi.md#stockDividends) | **GET** /stock/dividend | Dividends +[**stockSplits**](DefaultApi.md#stockSplits) | **GET** /stock/split | Splits +[**stockSymbols**](DefaultApi.md#stockSymbols) | **GET** /stock/symbol | Stock Symbol +[**stockTick**](DefaultApi.md#stockTick) | **GET** /stock/tick | Tick Data +[**supportResistance**](DefaultApi.md#supportResistance) | **GET** /scan/support-resistance | Support/Resistance +[**technicalIndicator**](DefaultApi.md#technicalIndicator) | **POST** /indicator | Technical Indicators +[**transcripts**](DefaultApi.md#transcripts) | **GET** /stock/transcripts | Earnings Call Transcripts +[**transcriptsList**](DefaultApi.md#transcriptsList) | **GET** /stock/transcripts/list | Earnings Call Transcripts List +[**upgradeDowngrade**](DefaultApi.md#upgradeDowngrade) | **GET** /stock/upgrade-downgrade | Stock Upgrade/Downgrade + + + +## aggregateIndicator + +> \Finnhub\Model\AggregateIndicators aggregateIndicator($symbol, $resolution) + +Aggregate Indicators + +Get aggregate signal of multiple technical indicators such as MACD, RSI, Moving Average v.v. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | symbol +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. + +try { + $result = $apiInstance->aggregateIndicator($symbol, $resolution); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->aggregateIndicator: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| symbol | + **resolution** | **string**| Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. | + +### Return type + +[**\Finnhub\Model\AggregateIndicators**](../Model/AggregateIndicators.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyBasicFinancials + +> \Finnhub\Model\BasicFinancials companyBasicFinancials($symbol, $metric) + +Basic Financials + +Get company basic financials such as margin, P/E ratio, 52-week high/low etc. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. +$metric = 'metric_example'; // string | Metric type. Can be 1 of the following values all, price, valuation, margin + +try { + $result = $apiInstance->companyBasicFinancials($symbol, $metric); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyBasicFinancials: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + **metric** | **string**| Metric type. Can be 1 of the following values <code>all, price, valuation, margin</code> | + +### Return type + +[**\Finnhub\Model\BasicFinancials**](../Model/BasicFinancials.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyEarnings + +> \Finnhub\Model\EarningResult[] companyEarnings($symbol, $limit) + +Earnings Surprises + +Get company historical quarterly earnings surprise going back to 2000. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. +$limit = 56; // int | Limit number of period returned. Leave blank to get the full history. + +try { + $result = $apiInstance->companyEarnings($symbol, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyEarnings: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + **limit** | **int**| Limit number of period returned. Leave blank to get the full history. | [optional] + +### Return type + +[**\Finnhub\Model\EarningResult[]**](../Model/EarningResult.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyEpsEstimates + +> \Finnhub\Model\EarningsEstimates companyEpsEstimates($symbol, $freq) + +Earnings Estimates + +Get company's EPS estimates. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. +$freq = 'freq_example'; // string | Can take 1 of the following values: annual, quarterly. Default to quarterly + +try { + $result = $apiInstance->companyEpsEstimates($symbol, $freq); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyEpsEstimates: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + **freq** | **string**| Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> | [optional] + +### Return type + +[**\Finnhub\Model\EarningsEstimates**](../Model/EarningsEstimates.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyExecutive + +> \Finnhub\Model\CompanyExecutive companyExecutive($symbol) + +Company Executive + +Get a list of company's executives and members of the Board. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. + +try { + $result = $apiInstance->companyExecutive($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyExecutive: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + +### Return type + +[**\Finnhub\Model\CompanyExecutive**](../Model/CompanyExecutive.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyNews + +> \Finnhub\Model\News[] companyNews($symbol, $from, $to) + +Company News + +List latest company news by symbol. This endpoint is only available for North American companies. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Company symbol. +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | From date YYYY-MM-DD. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | To date YYYY-MM-DD. + +try { + $result = $apiInstance->companyNews($symbol, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyNews: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Company symbol. | + **from** | **\DateTime**| From date <code>YYYY-MM-DD</code>. | + **to** | **\DateTime**| To date <code>YYYY-MM-DD</code>. | + +### Return type + +[**\Finnhub\Model\News[]**](../Model/News.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyPeers + +> string[] companyPeers($symbol) + +Peers + +Get company peers. Return a list of peers in the same country and GICS sub-industry + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. + +try { + $result = $apiInstance->companyPeers($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyPeers: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + +### Return type + +**string[]** + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyProfile + +> \Finnhub\Model\CompanyProfile companyProfile($symbol, $isin, $cusip) + +Company Profile + +Get general information of a company. You can query by symbol, ISIN or CUSIP + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL e.g. +$isin = 'isin_example'; // string | ISIN +$cusip = 'cusip_example'; // string | CUSIP + +try { + $result = $apiInstance->companyProfile($symbol, $isin, $cusip); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyProfile: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL e.g. | [optional] + **isin** | **string**| ISIN | [optional] + **cusip** | **string**| CUSIP | [optional] + +### Return type + +[**\Finnhub\Model\CompanyProfile**](../Model/CompanyProfile.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyProfile2 + +> \Finnhub\Model\CompanyProfile2 companyProfile2($symbol, $isin, $cusip) + +Company Profile 2 + +Get general information of a company. You can query by symbol, ISIN or CUSIP. This is the free version of Company Profile. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL e.g. +$isin = 'isin_example'; // string | ISIN +$cusip = 'cusip_example'; // string | CUSIP + +try { + $result = $apiInstance->companyProfile2($symbol, $isin, $cusip); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyProfile2: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL e.g. | [optional] + **isin** | **string**| ISIN | [optional] + **cusip** | **string**| CUSIP | [optional] + +### Return type + +[**\Finnhub\Model\CompanyProfile2**](../Model/CompanyProfile2.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## companyRevenueEstimates + +> \Finnhub\Model\RevenueEstimates companyRevenueEstimates($symbol, $freq) + +Revenue Estimates + +Get company's revenue estimates. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. +$freq = 'freq_example'; // string | Can take 1 of the following values: annual, quarterly. Default to quarterly + +try { + $result = $apiInstance->companyRevenueEstimates($symbol, $freq); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->companyRevenueEstimates: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + **freq** | **string**| Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> | [optional] + +### Return type + +[**\Finnhub\Model\RevenueEstimates**](../Model/RevenueEstimates.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## country + +> \Finnhub\Model\CountryMetadata[] country() + +Country Metadata + +List all countries and metadata. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); + +try { + $result = $apiInstance->country(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->country: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Finnhub\Model\CountryMetadata[]**](../Model/CountryMetadata.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## covid19 + +> \Finnhub\Model\CovidInfo[] covid19() + +COVID-19 + +Get real-time updates on the number of COVID-19 (Corona virus) cases in the US with a state-by-state breakdown. Data is sourced from CDC and reputable sources. You can also access this API here + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); + +try { + $result = $apiInstance->covid19(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->covid19: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Finnhub\Model\CovidInfo[]**](../Model/CovidInfo.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## cryptoCandles + +> \Finnhub\Model\CryptoCandles cryptoCandles($symbol, $resolution, $from, $to) + +Crypto Candles + +Get candlestick data for crypto symbols. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Use symbol returned in /crypto/symbol endpoint for this field. +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. +$from = 56; // int | UNIX timestamp. Interval initial value. +$to = 56; // int | UNIX timestamp. Interval end value. + +try { + $result = $apiInstance->cryptoCandles($symbol, $resolution, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->cryptoCandles: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Use symbol returned in <code>/crypto/symbol</code> endpoint for this field. | + **resolution** | **string**| Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. | + **from** | **int**| UNIX timestamp. Interval initial value. | + **to** | **int**| UNIX timestamp. Interval end value. | + +### Return type + +[**\Finnhub\Model\CryptoCandles**](../Model/CryptoCandles.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## cryptoExchanges + +> string[] cryptoExchanges() + +Crypto Exchanges + +List supported crypto exchanges + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); + +try { + $result = $apiInstance->cryptoExchanges(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->cryptoExchanges: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**string[]** + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## cryptoSymbols + +> \Finnhub\Model\CryptoSymbol[] cryptoSymbols($exchange) + +Crypto Symbol + +List supported crypto symbols by exchange + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$exchange = 'exchange_example'; // string | Exchange you want to get the list of symbols from. + +try { + $result = $apiInstance->cryptoSymbols($exchange); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->cryptoSymbols: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **exchange** | **string**| Exchange you want to get the list of symbols from. | + +### Return type + +[**\Finnhub\Model\CryptoSymbol[]**](../Model/CryptoSymbol.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## earningsCalendar + +> \Finnhub\Model\EarningsCalendar earningsCalendar($from, $to, $symbol, $international) + +Earnings Calendar + +Get historical and coming earnings release dating back to 2003. You can setup webhook to receive real-time earnings update. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | From date: 2020-03-15. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | To date: 2020-03-16. +$symbol = 'symbol_example'; // string | Filter by symbol: AAPL. +$international = new \Finnhub\Model\AnyType(); // AnyType | Set to true to include international markets. Default value is false + +try { + $result = $apiInstance->earningsCalendar($from, $to, $symbol, $international); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->earningsCalendar: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **from** | **\DateTime**| From date: 2020-03-15. | [optional] + **to** | **\DateTime**| To date: 2020-03-16. | [optional] + **symbol** | **string**| Filter by symbol: AAPL. | [optional] + **international** | [**AnyType**](../Model/.md)| Set to <code>true</code> to include international markets. Default value is <code>false</code> | [optional] + +### Return type + +[**\Finnhub\Model\EarningsCalendar**](../Model/EarningsCalendar.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## economicCode + +> \Finnhub\Model\EconomicCode[] economicCode() + +Economic Code + +List codes of supported economic data. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); + +try { + $result = $apiInstance->economicCode(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->economicCode: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Finnhub\Model\EconomicCode[]**](../Model/EconomicCode.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## economicData + +> \Finnhub\Model\EconomicData economicData($code) + +Economic Data + +Get economic data. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$code = 'code_example'; // string | Economic code. + +try { + $result = $apiInstance->economicData($code); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->economicData: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **code** | **string**| Economic code. | + +### Return type + +[**\Finnhub\Model\EconomicData**](../Model/EconomicData.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## filings + +> \Finnhub\Model\Filing[] filings($symbol, $cik, $access_number, $form, $from, $to) + +Filings + +List company's filing. Limit to 250 documents at a time. This data is available for bulk download on Kaggle SEC Filings database. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol. Leave symbol,cik and accessNumber empty to list latest filings. +$cik = 'cik_example'; // string | CIK. +$access_number = 'access_number_example'; // string | Access number of a specific report you want to retrieve data from. +$form = 'form_example'; // string | Filter by form. You can use this value NT 10-K to find non-timely filings for a company. +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | From date: 2020-03-15. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | To date: 2020-03-16. + +try { + $result = $apiInstance->filings($symbol, $cik, $access_number, $form, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->filings: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol. Leave <code>symbol</code>,<code>cik</code> and <code>accessNumber</code> empty to list latest filings. | [optional] + **cik** | **string**| CIK. | [optional] + **access_number** | **string**| Access number of a specific report you want to retrieve data from. | [optional] + **form** | **string**| Filter by form. You can use this value <code>NT 10-K</code> to find non-timely filings for a company. | [optional] + **from** | **\DateTime**| From date: 2020-03-15. | [optional] + **to** | **\DateTime**| To date: 2020-03-16. | [optional] + +### Return type + +[**\Finnhub\Model\Filing[]**](../Model/Filing.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## financials + +> \Finnhub\Model\FinancialStatements financials($symbol, $statement, $freq) + +Financial Statements + +Get standardized balance sheet, income statement and cash flow for global companies going back 30+ years. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. +$statement = 'statement_example'; // string | Statement can take 1 of these values bs, ic, cf for Balance Sheet, Income Statement, Cash Flow respectively. +$freq = 'freq_example'; // string | Frequency can take 1 of these values annual, quarterly, ttm, ytd. TTM (Trailing Twelve Months) option is available for Income Statement and Cash Flow. YTD (Year To Date) option is only available for Cash Flow. + +try { + $result = $apiInstance->financials($symbol, $statement, $freq); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->financials: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + **statement** | **string**| Statement can take 1 of these values <code>bs, ic, cf</code> for Balance Sheet, Income Statement, Cash Flow respectively. | + **freq** | **string**| Frequency can take 1 of these values <code>annual, quarterly, ttm, ytd</code>. TTM (Trailing Twelve Months) option is available for Income Statement and Cash Flow. YTD (Year To Date) option is only available for Cash Flow. | + +### Return type + +[**\Finnhub\Model\FinancialStatements**](../Model/FinancialStatements.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## financialsReported + +> \Finnhub\Model\FinancialsAsReported financialsReported($symbol, $cik, $access_number, $freq) + +Financials As Reported + +Get financials as reported. This data is available for bulk download on Kaggle SEC Financials database. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol. +$cik = 'cik_example'; // string | CIK. +$access_number = 'access_number_example'; // string | Access number of a specific report you want to retrieve financials from. +$freq = 'freq_example'; // string | Frequency. Can be either annual or quarterly. Default to annual. + +try { + $result = $apiInstance->financialsReported($symbol, $cik, $access_number, $freq); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->financialsReported: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol. | [optional] + **cik** | **string**| CIK. | [optional] + **access_number** | **string**| Access number of a specific report you want to retrieve financials from. | [optional] + **freq** | **string**| Frequency. Can be either <code>annual</code> or <code>quarterly</code>. Default to <code>annual</code>. | [optional] + +### Return type + +[**\Finnhub\Model\FinancialsAsReported**](../Model/FinancialsAsReported.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## forexCandles + +> \Finnhub\Model\ForexCandles forexCandles($symbol, $resolution, $from, $to) + +Forex Candles + +Get candlestick data for forex symbols. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Use symbol returned in /forex/symbol endpoint for this field. +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. +$from = 56; // int | UNIX timestamp. Interval initial value. +$to = 56; // int | UNIX timestamp. Interval end value. + +try { + $result = $apiInstance->forexCandles($symbol, $resolution, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->forexCandles: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Use symbol returned in <code>/forex/symbol</code> endpoint for this field. | + **resolution** | **string**| Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. | + **from** | **int**| UNIX timestamp. Interval initial value. | + **to** | **int**| UNIX timestamp. Interval end value. | + +### Return type + +[**\Finnhub\Model\ForexCandles**](../Model/ForexCandles.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## forexExchanges + +> string[] forexExchanges() + +Forex Exchanges + +List supported forex exchanges + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); + +try { + $result = $apiInstance->forexExchanges(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->forexExchanges: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +**string[]** + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## forexRates + +> \Finnhub\Model\Forexrates forexRates($base) + +Forex rates + +Get rates for all forex pairs. Ideal for currency conversion + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$base = 'base_example'; // string | Base currency. Default to EUR. + +try { + $result = $apiInstance->forexRates($base); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->forexRates: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **base** | **string**| Base currency. Default to EUR. | [optional] + +### Return type + +[**\Finnhub\Model\Forexrates**](../Model/Forexrates.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## forexSymbols + +> \Finnhub\Model\ForexSymbol[] forexSymbols($exchange) + +Forex Symbol + +List supported forex symbols. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$exchange = 'exchange_example'; // string | Exchange you want to get the list of symbols from. + +try { + $result = $apiInstance->forexSymbols($exchange); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->forexSymbols: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **exchange** | **string**| Exchange you want to get the list of symbols from. | + +### Return type + +[**\Finnhub\Model\ForexSymbol[]**](../Model/ForexSymbol.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## fundOwnership + +> \Finnhub\Model\FundOwnership fundOwnership($symbol, $limit) + +Fund Ownership + +Get a full list fund and institutional investors of a company in descending order of the number of shares held. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. +$limit = 56; // int | Limit number of results. Leave empty to get the full list. + +try { + $result = $apiInstance->fundOwnership($symbol, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->fundOwnership: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + **limit** | **int**| Limit number of results. Leave empty to get the full list. | [optional] + +### Return type + +[**\Finnhub\Model\FundOwnership**](../Model/FundOwnership.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## generalNews + +> \Finnhub\Model\News[] generalNews($category, $min_id) + +General News + +Get latest market news. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$category = 'category_example'; // string | This parameter can be 1 of the following values general, forex, crypto, merger. +$min_id = 'min_id_example'; // string | Use this field to get only news after this ID. Default to 0 + +try { + $result = $apiInstance->generalNews($category, $min_id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->generalNews: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **category** | **string**| This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>. | + **min_id** | **string**| Use this field to get only news after this ID. Default to 0 | [optional] + +### Return type + +[**\Finnhub\Model\News[]**](../Model/News.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## investorsOwnership + +> \Finnhub\Model\InvestorsOwnership investorsOwnership($symbol, $limit) + +Investors Ownership + +Get a full list of shareholders/investors of a company in descending order of the number of shares held. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. +$limit = 56; // int | Limit number of results. Leave empty to get the full list. + +try { + $result = $apiInstance->investorsOwnership($symbol, $limit); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->investorsOwnership: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + **limit** | **int**| Limit number of results. Leave empty to get the full list. | [optional] + +### Return type + +[**\Finnhub\Model\InvestorsOwnership**](../Model/InvestorsOwnership.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## ipoCalendar + +> \Finnhub\Model\IPOCalendar ipoCalendar($from, $to) + +IPO Calendar + +Get recent and coming IPO. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | From date: 2020-03-15. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | To date: 2020-03-16. + +try { + $result = $apiInstance->ipoCalendar($from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->ipoCalendar: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **from** | **\DateTime**| From date: 2020-03-15. | + **to** | **\DateTime**| To date: 2020-03-16. | + +### Return type + +[**\Finnhub\Model\IPOCalendar**](../Model/IPOCalendar.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## majorDevelopments + +> \Finnhub\Model\MajorDevelopments majorDevelopments($symbol, $from, $to) + +Major Developments + +List latest major developments of a company going back 20 years with 12M+ data points. This data can be used to highlight the most significant events. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Company symbol. +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | From time: 2020-01-01. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | To time: 2020-01-05. + +try { + $result = $apiInstance->majorDevelopments($symbol, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->majorDevelopments: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Company symbol. | + **from** | **\DateTime**| From time: 2020-01-01. | [optional] + **to** | **\DateTime**| To time: 2020-01-05. | [optional] + +### Return type + +[**\Finnhub\Model\MajorDevelopments**](../Model/MajorDevelopments.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## newsSentiment + +> \Finnhub\Model\NewsSentiment newsSentiment($symbol) + +News Sentiment + +Get company's news sentiment and statistics. This endpoint is only available for US companies. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Company symbol. + +try { + $result = $apiInstance->newsSentiment($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->newsSentiment: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Company symbol. | + +### Return type + +[**\Finnhub\Model\NewsSentiment**](../Model/NewsSentiment.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## patternRecognition + +> \Finnhub\Model\PatternRecognition patternRecognition($symbol, $resolution) + +Pattern Recognition + +Run pattern recognition algorithm on a symbol. Support double top/bottom, triple top/bottom, head and shoulders, triangle, wedge, channel, flag, and candlestick patterns. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. + +try { + $result = $apiInstance->patternRecognition($symbol, $resolution); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->patternRecognition: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol | + **resolution** | **string**| Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. | + +### Return type + +[**\Finnhub\Model\PatternRecognition**](../Model/PatternRecognition.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## priceTarget + +> \Finnhub\Model\PriceTarget priceTarget($symbol) + +Price Target + +Get latest price target consensus. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. + +try { + $result = $apiInstance->priceTarget($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->priceTarget: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + +### Return type + +[**\Finnhub\Model\PriceTarget**](../Model/PriceTarget.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## quote + +> \Finnhub\Model\Quote quote($symbol) + +Quote + +

Get real-time quote data for US stocks. Constant polling is not recommended. Use websocket if you need real-time update.

Real-time stock prices for international markets are supported for Enterprise clients via our partner's feed. Contact Us to learn more.

+ +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol + +try { + $result = $apiInstance->quote($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->quote: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol | + +### Return type + +[**\Finnhub\Model\Quote**](../Model/Quote.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## recommendationTrends + +> \Finnhub\Model\RecommendationTrend[] recommendationTrends($symbol) + +Recommendation Trends + +Get latest analyst recommendation trends for a company. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. + +try { + $result = $apiInstance->recommendationTrends($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->recommendationTrends: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. | + +### Return type + +[**\Finnhub\Model\RecommendationTrend[]**](../Model/RecommendationTrend.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## stockBidask + +> \Finnhub\Model\LastBidAsk stockBidask($symbol) + +Last Bid-Ask + +Get last bid/ask data for US stocks. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol. + +try { + $result = $apiInstance->stockBidask($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->stockBidask: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol. | + +### Return type + +[**\Finnhub\Model\LastBidAsk**](../Model/LastBidAsk.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## stockCandles + +> \Finnhub\Model\StockCandles stockCandles($symbol, $resolution, $from, $to, $adjusted) + +Stock Candles + +

Get candlestick data for stocks going back 25 years for US stocks.

Real-time stock prices for international markets are supported for Enterprise clients via our partner's feed. Contact Us to learn more.

+ +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol. +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. +$from = 56; // int | UNIX timestamp. Interval initial value. +$to = 56; // int | UNIX timestamp. Interval end value. +$adjusted = 'adjusted_example'; // string | By default, adjusted=false. Use true to get adjusted data. + +try { + $result = $apiInstance->stockCandles($symbol, $resolution, $from, $to, $adjusted); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->stockCandles: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol. | + **resolution** | **string**| Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. | + **from** | **int**| UNIX timestamp. Interval initial value. | + **to** | **int**| UNIX timestamp. Interval end value. | + **adjusted** | **string**| By default, <code>adjusted=false</code>. Use <code>true</code> to get adjusted data. | [optional] + +### Return type + +[**\Finnhub\Model\StockCandles**](../Model/StockCandles.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## stockDividends + +> \Finnhub\Model\Dividends[] stockDividends($symbol, $from, $to) + +Dividends + +Get dividends data for common stocks going back 30 years. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol. +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | YYYY-MM-DD. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | YYYY-MM-DD. + +try { + $result = $apiInstance->stockDividends($symbol, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->stockDividends: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol. | + **from** | **\DateTime**| YYYY-MM-DD. | + **to** | **\DateTime**| YYYY-MM-DD. | + +### Return type + +[**\Finnhub\Model\Dividends[]**](../Model/Dividends.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## stockSplits + +> \Finnhub\Model\Split[] stockSplits($symbol, $from, $to) + +Splits + +Get splits data for stocks. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol. +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | YYYY-MM-DD. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | YYYY-MM-DD. + +try { + $result = $apiInstance->stockSplits($symbol, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->stockSplits: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol. | + **from** | **\DateTime**| YYYY-MM-DD. | + **to** | **\DateTime**| YYYY-MM-DD. | + +### Return type + +[**\Finnhub\Model\Split[]**](../Model/Split.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## stockSymbols + +> \Finnhub\Model\Stock[] stockSymbols($exchange) + +Stock Symbol + +List supported stocks. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$exchange = 'exchange_example'; // string | Exchange you want to get the list of symbols from. List of exchanges with fundamental data can be found here. + +try { + $result = $apiInstance->stockSymbols($exchange); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->stockSymbols: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **exchange** | **string**| Exchange you want to get the list of symbols from. List of exchanges with fundamental data can be found <a href=\"https://docs.google.com/spreadsheets/d/1I3pBxjfXB056-g_JYf_6o3Rns3BV2kMGG1nCatb91ls/edit?usp=sharing\" target=\"_blank\">here</a>. | + +### Return type + +[**\Finnhub\Model\Stock[]**](../Model/Stock.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## stockTick + +> \Finnhub\Model\TickData stockTick($symbol, $date, $limit, $skip) + +Tick Data + +

Get historical tick data for US stocks from all 13 exchanges. You can send the request directly to our tick server at https://tick.finnhub.io/ with the same path and parameters or get redirected there if you call our main server. Data is updated at the end of each trading day.

Tick data from 1985 is available for Enterprise clients. Contact us to learn more.

+ +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol. +$date = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | Date: 2020-04-02. +$limit = 56; // int | Limit number of ticks returned. Maximum value: 25000 +$skip = 56; // int | Number of ticks to skip. Use this parameter to loop through the entire data. + +try { + $result = $apiInstance->stockTick($symbol, $date, $limit, $skip); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->stockTick: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol. | + **date** | **\DateTime**| Date: 2020-04-02. | + **limit** | **int**| Limit number of ticks returned. Maximum value: <code>25000</code> | + **skip** | **int**| Number of ticks to skip. Use this parameter to loop through the entire data. | + +### Return type + +[**\Finnhub\Model\TickData**](../Model/TickData.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## supportResistance + +> \Finnhub\Model\SupportResistance supportResistance($symbol, $resolution) + +Support/Resistance + +Get support and resistance levels for a symbol. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. + +try { + $result = $apiInstance->supportResistance($symbol, $resolution); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->supportResistance: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol | + **resolution** | **string**| Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. | + +### Return type + +[**\Finnhub\Model\SupportResistance**](../Model/SupportResistance.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## technicalIndicator + +> object technicalIndicator($symbol, $resolution, $from, $to, $indicator, $indicator_fields) + +Technical Indicators + +Return technical indicator with price data. List of supported indicators can be found here. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | symbol +$resolution = 'resolution_example'; // string | Supported resolution includes 1, 5, 15, 30, 60, D, W, M .Some timeframes might not be available depending on the exchange. +$from = 56; // int | UNIX timestamp. Interval initial value. +$to = 56; // int | UNIX timestamp. Interval end value. +$indicator = 'indicator_example'; // string | Indicator name. Full list can be found here. +$indicator_fields = new \stdClass; // object | Check out this page to see which indicators and params are supported. + +try { + $result = $apiInstance->technicalIndicator($symbol, $resolution, $from, $to, $indicator, $indicator_fields); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->technicalIndicator: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| symbol | + **resolution** | **string**| Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. | + **from** | **int**| UNIX timestamp. Interval initial value. | + **to** | **int**| UNIX timestamp. Interval end value. | + **indicator** | **string**| Indicator name. Full list can be found <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">here</a>. | + **indicator_fields** | **object**| Check out <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">this page</a> to see which indicators and params are supported. | [optional] + +### Return type + +**object** + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: application/json +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## transcripts + +> \Finnhub\Model\EarningsCallTranscripts transcripts($id) + +Earnings Call Transcripts + +

Get earnings call transcripts, audio and participants' list. This endpoint is only available for US companies.

17+ years of data is available with 170,000+ audio which add up to 6TB in size.

+ +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$id = 'id_example'; // string | Transcript's id obtained with Transcripts List endpoint. + +try { + $result = $apiInstance->transcripts($id); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->transcripts: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **string**| Transcript's id obtained with <a href=\"#transcripts-list\">Transcripts List endpoint</a>. | + +### Return type + +[**\Finnhub\Model\EarningsCallTranscripts**](../Model/EarningsCallTranscripts.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## transcriptsList + +> \Finnhub\Model\EarningsCallTranscriptsList transcriptsList($symbol) + +Earnings Call Transcripts List + +List earnings call transcripts' metadata. This endpoint is only available for US companies. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Company symbol: AAPL. Leave empty to list the latest transcripts + +try { + $result = $apiInstance->transcriptsList($symbol); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->transcriptsList: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Company symbol: AAPL. Leave empty to list the latest transcripts | + +### Return type + +[**\Finnhub\Model\EarningsCallTranscriptsList**](../Model/EarningsCallTranscriptsList.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + + +## upgradeDowngrade + +> \Finnhub\Model\UpgradeDowngrade[] upgradeDowngrade($symbol, $from, $to) + +Stock Upgrade/Downgrade + +Get latest stock upgrade and downgrade. + +### Example + +```php +setApiKey('token', 'YOUR_API_KEY'); +// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed +// $config = Finnhub\Configuration::getDefaultConfiguration()->setApiKeyPrefix('token', 'Bearer'); + + +$apiInstance = new Finnhub\Api\DefaultApi( + // 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(), + $config +); +$symbol = 'symbol_example'; // string | Symbol of the company: AAPL. If left blank, the API will return latest stock upgrades/downgrades. +$from = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | From date: 2000-03-15. +$to = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | To date: 2020-03-16. + +try { + $result = $apiInstance->upgradeDowngrade($symbol, $from, $to); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling DefaultApi->upgradeDowngrade: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **symbol** | **string**| Symbol of the company: AAPL. If left blank, the API will return latest stock upgrades/downgrades. | [optional] + **from** | **\DateTime**| From date: 2000-03-15. | [optional] + **to** | **\DateTime**| To date: 2020-03-16. | [optional] + +### Return type + +[**\Finnhub\Model\UpgradeDowngrade[]**](../Model/UpgradeDowngrade.md) + +### Authorization + +[api_key](../../README.md#api_key) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) +[[Back to Model list]](../../README.md#documentation-for-models) +[[Back to README]](../../README.md) + diff --git a/docs/Model/AggregateIndicators.md b/docs/Model/AggregateIndicators.md new file mode 100644 index 0000000..490e564 --- /dev/null +++ b/docs/Model/AggregateIndicators.md @@ -0,0 +1,12 @@ +# # AggregateIndicators + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**technical_analysis** | [**\Finnhub\Model\TechnicalAnalysis**](TechnicalAnalysis.md) | | [optional] +**trend** | [**\Finnhub\Model\Trend**](Trend.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/BasicFinancials.md b/docs/Model/BasicFinancials.md new file mode 100644 index 0000000..bce4f91 --- /dev/null +++ b/docs/Model/BasicFinancials.md @@ -0,0 +1,13 @@ +# # BasicFinancials + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol of the company. | [optional] +**metric_type** | **string** | Metric type. | [optional] +**metric** | [**object**](.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Company.md b/docs/Model/Company.md new file mode 100644 index 0000000..2528a56 --- /dev/null +++ b/docs/Model/Company.md @@ -0,0 +1,17 @@ +# # Company + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Executive name | [optional] +**age** | **int** | Age | [optional] +**title** | **string** | Title | [optional] +**since** | **string** | Year appointed | [optional] +**sex** | **string** | Sex | [optional] +**compensation** | **int** | Total compensation | [optional] +**currency** | **string** | Compensation currency | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CompanyExecutive.md b/docs/Model/CompanyExecutive.md new file mode 100644 index 0000000..6faf5b9 --- /dev/null +++ b/docs/Model/CompanyExecutive.md @@ -0,0 +1,12 @@ +# # CompanyExecutive + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**executive** | **object[]** | Array of company's executives and members of the Board. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CompanyNewsStatistics.md b/docs/Model/CompanyNewsStatistics.md new file mode 100644 index 0000000..a79441d --- /dev/null +++ b/docs/Model/CompanyNewsStatistics.md @@ -0,0 +1,13 @@ +# # CompanyNewsStatistics + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**articles_in_last_week** | **int** | | [optional] +**buzz** | **float** | | [optional] +**weekly_average** | **float** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CompanyProfile.md b/docs/Model/CompanyProfile.md new file mode 100644 index 0000000..0d50d52 --- /dev/null +++ b/docs/Model/CompanyProfile.md @@ -0,0 +1,38 @@ +# # CompanyProfile + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **string** | Address of company's headquarter. | [optional] +**city** | **string** | City of company's headquarter. | [optional] +**country** | **string** | Country of company's headquarter. | [optional] +**currency** | **string** | Currency used in company filings. | [optional] +**cusip** | **string** | CUSIP number. | [optional] +**sedol** | **int** | Sedol number. | [optional] +**description** | **string** | Company business summary. | [optional] +**exchange** | **string** | Listed exchange. | [optional] +**ggroup** | **string** | GICS industry group. | [optional] +**gind** | **string** | GICS industry. | [optional] +**gsector** | **string** | GICS sector. | [optional] +**gsubind** | **string** | GICS sub-industry. | [optional] +**isin** | **string** | ISIN number. | [optional] +**naics_national_industry** | **string** | NAICS national industry. | [optional] +**naics** | **string** | NAICS industry. | [optional] +**naics_sector** | **string** | NAICS sector. | [optional] +**naics_subsector** | **string** | NAICS subsector. | [optional] +**name** | **string** | Company name. | [optional] +**phone** | **string** | Company phone number. | [optional] +**state** | **string** | State of company's headquarter. | [optional] +**ticker** | **string** | Company symbol/ticker as used on the listed exchange. | [optional] +**weburl** | **string** | Company website. | [optional] +**ipo** | [**\DateTime**](\DateTime.md) | IPO date. | [optional] +**market_capitalization** | **float** | Market Capitalization. | [optional] +**share_outstanding** | **float** | Number of oustanding shares. | [optional] +**employee_total** | **int** | Number of employee. | [optional] +**logo** | **string** | Logo image. | [optional] +**finnhub_industry** | **string** | Finnhub industry classification. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CompanyProfile2.md b/docs/Model/CompanyProfile2.md new file mode 100644 index 0000000..e0b91ac --- /dev/null +++ b/docs/Model/CompanyProfile2.md @@ -0,0 +1,22 @@ +# # CompanyProfile2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**country** | **string** | Country of company's headquarter. | [optional] +**currency** | **string** | Currency used in company filings. | [optional] +**exchange** | **string** | Listed exchange. | [optional] +**name** | **string** | Company name. | [optional] +**ticker** | **string** | Company symbol/ticker as used on the listed exchange. | [optional] +**ipo** | [**\DateTime**](\DateTime.md) | IPO date. | [optional] +**market_capitalization** | **float** | Market Capitalization. | [optional] +**share_outstanding** | **float** | Number of oustanding shares. | [optional] +**logo** | **string** | Logo image. | [optional] +**phone** | **string** | Company phone number. | [optional] +**weburl** | **string** | Company website. | [optional] +**finnhub_industry** | **string** | Finnhub industry classification. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CountryMetadata.md b/docs/Model/CountryMetadata.md new file mode 100644 index 0000000..f6f09ec --- /dev/null +++ b/docs/Model/CountryMetadata.md @@ -0,0 +1,16 @@ +# # CountryMetadata + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**country** | **string** | Country name | [optional] +**code2** | **string** | Alpha 2 code | [optional] +**code3** | **string** | Alpha 3 code | [optional] +**code_no** | **string** | UN code | [optional] +**currency** | **string** | Currency name | [optional] +**currency_code** | **string** | Currency code | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CovidInfo.md b/docs/Model/CovidInfo.md new file mode 100644 index 0000000..7037c3d --- /dev/null +++ b/docs/Model/CovidInfo.md @@ -0,0 +1,14 @@ +# # CovidInfo + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**state** | **string** | State. | [optional] +**case** | **float** | Number of confirmed cases. | [optional] +**death** | **float** | Number of confirmed deaths. | [optional] +**updated** | [**\DateTime**](\DateTime.md) | Updated time. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CryptoCandles.md b/docs/Model/CryptoCandles.md new file mode 100644 index 0000000..fd93666 --- /dev/null +++ b/docs/Model/CryptoCandles.md @@ -0,0 +1,17 @@ +# # CryptoCandles + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**o** | **float[]** | List of open prices for returned candles. | [optional] +**h** | **float[]** | List of high prices for returned candles. | [optional] +**l** | **float[]** | List of low prices for returned candles. | [optional] +**c** | **float[]** | List of close prices for returned candles. | [optional] +**v** | **float[]** | List of volume data for returned candles. | [optional] +**t** | **int[]** | List of timestamp for returned candles. | [optional] +**s** | **string** | Status of the response. This field can either be ok or no_data. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/CryptoSymbol.md b/docs/Model/CryptoSymbol.md new file mode 100644 index 0000000..5b0b289 --- /dev/null +++ b/docs/Model/CryptoSymbol.md @@ -0,0 +1,13 @@ +# # CryptoSymbol + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **string** | Symbol description | [optional] +**display_symbol** | **string** | Display symbol name. | [optional] +**symbol** | **string** | Unique symbol used to identify this symbol used in <code>/crypto/candle</code> endpoint. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Development.md b/docs/Model/Development.md new file mode 100644 index 0000000..a92f3e7 --- /dev/null +++ b/docs/Model/Development.md @@ -0,0 +1,14 @@ +# # Development + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**datetime** | [**\DateTime**](\DateTime.md) | Published time in <code>YYYY-MM-DD HH:MM:SS</code> format. | [optional] +**headline** | **string** | Development headline. | [optional] +**description** | **string** | Development description. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Dividends.md b/docs/Model/Dividends.md new file mode 100644 index 0000000..00812b7 --- /dev/null +++ b/docs/Model/Dividends.md @@ -0,0 +1,18 @@ +# # Dividends + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol. | [optional] +**date** | [**\DateTime**](\DateTime.md) | Ex-Dividend date. | [optional] +**amount** | **float** | Amount in local currency. | [optional] +**adjusted_amount** | **float** | Adjusted dividend. | [optional] +**pay_date** | [**\DateTime**](\DateTime.md) | Pay date. | [optional] +**record_date** | [**\DateTime**](\DateTime.md) | Record date. | [optional] +**declaration_date** | [**\DateTime**](\DateTime.md) | Declaration date. | [optional] +**currency** | **string** | Currency. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EarningEstimate.md b/docs/Model/EarningEstimate.md new file mode 100644 index 0000000..a903c45 --- /dev/null +++ b/docs/Model/EarningEstimate.md @@ -0,0 +1,15 @@ +# # EarningEstimate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**eps_avg** | **float** | Average EPS estimates. | [optional] +**eps_high** | **float** | Highest estimate. | [optional] +**eps_low** | **float** | Lowest estimate. | [optional] +**number_analysts** | **int** | Number of Analysts. | [optional] +**period** | [**\DateTime**](\DateTime.md) | Period. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EarningRelease.md b/docs/Model/EarningRelease.md new file mode 100644 index 0000000..d3599d8 --- /dev/null +++ b/docs/Model/EarningRelease.md @@ -0,0 +1,19 @@ +# # EarningRelease + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol. | [optional] +**date** | [**\DateTime**](\DateTime.md) | Date. | [optional] +**hour** | **string** | Indicates whether the earnings is announced before market open(<code>bmo</code>), after market close(<code>amc</code>), or during market hour(<code>dmh</code>). | [optional] +**year** | **int** | Earnings year. | [optional] +**quarter** | **int** | Earnings quarter. | [optional] +**eps_estimate** | **float** | EPS estimate. | [optional] +**eps_actual** | **float** | EPS actual. | [optional] +**revenue_estimate** | **int** | Revenue estimate. | [optional] +**revenue_actual** | **int** | Revenue actual. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EarningResult.md b/docs/Model/EarningResult.md new file mode 100644 index 0000000..227df39 --- /dev/null +++ b/docs/Model/EarningResult.md @@ -0,0 +1,14 @@ +# # EarningResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**actual** | **float** | Actual earning result. | [optional] +**estimate** | **float** | Estimated earning. | [optional] +**period** | [**\DateTime**](\DateTime.md) | Reported period. | [optional] +**symbol** | **string** | Company symbol. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EarningsCalendar.md b/docs/Model/EarningsCalendar.md new file mode 100644 index 0000000..d731b76 --- /dev/null +++ b/docs/Model/EarningsCalendar.md @@ -0,0 +1,11 @@ +# # EarningsCalendar + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**earnings_calendar** | **object[]** | Array of earnings release. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EarningsCallTranscripts.md b/docs/Model/EarningsCallTranscripts.md new file mode 100644 index 0000000..c2e8572 --- /dev/null +++ b/docs/Model/EarningsCallTranscripts.md @@ -0,0 +1,19 @@ +# # EarningsCallTranscripts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**transcript** | **object[]** | Transcript content. | [optional] +**participant** | **object[]** | Participant list | [optional] +**audio** | **string** | Audio link. | [optional] +**id** | **string** | Transcript's ID. | [optional] +**title** | **string** | Title. | [optional] +**time** | [**\DateTime**](\DateTime.md) | Time of the event. | [optional] +**year** | **int** | Year of earnings result in the case of earnings call transcript. | [optional] +**quarter** | **int** | Quarter of earnings result in the case of earnings call transcript. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EarningsCallTranscriptsList.md b/docs/Model/EarningsCallTranscriptsList.md new file mode 100644 index 0000000..96d291d --- /dev/null +++ b/docs/Model/EarningsCallTranscriptsList.md @@ -0,0 +1,12 @@ +# # EarningsCallTranscriptsList + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**transcripts** | **object[]** | Array of transcripts' metadata | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EarningsEstimates.md b/docs/Model/EarningsEstimates.md new file mode 100644 index 0000000..70a24f7 --- /dev/null +++ b/docs/Model/EarningsEstimates.md @@ -0,0 +1,13 @@ +# # EarningsEstimates + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | **object[]** | List of estimates | [optional] +**freq** | **string** | Frequency: annual or quarterly. | [optional] +**symbol** | **string** | Company symbol. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EconomicCalendar.md b/docs/Model/EconomicCalendar.md new file mode 100644 index 0000000..0b111e8 --- /dev/null +++ b/docs/Model/EconomicCalendar.md @@ -0,0 +1,11 @@ +# # EconomicCalendar + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**economic_calendar** | **object[]** | Array of economic events. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EconomicCode.md b/docs/Model/EconomicCode.md new file mode 100644 index 0000000..71cd313 --- /dev/null +++ b/docs/Model/EconomicCode.md @@ -0,0 +1,14 @@ +# # EconomicCode + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **string** | Finnhub economic code used to get historical data | [optional] +**country** | **string** | Country | [optional] +**name** | **string** | Indicator name | [optional] +**unit** | **string** | Unit | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EconomicData.md b/docs/Model/EconomicData.md new file mode 100644 index 0000000..43e5ef9 --- /dev/null +++ b/docs/Model/EconomicData.md @@ -0,0 +1,12 @@ +# # EconomicData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | **object[]** | Array of economic data for requested code. | [optional] +**code** | **string** | Finnhub economic code | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/EconomicEvent.md b/docs/Model/EconomicEvent.md new file mode 100644 index 0000000..516214b --- /dev/null +++ b/docs/Model/EconomicEvent.md @@ -0,0 +1,18 @@ +# # EconomicEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**actual** | **float** | Actual release | [optional] +**prev** | **float** | Previous release | [optional] +**country** | **string** | Country | [optional] +**unit** | **string** | Unit | [optional] +**estimate** | **float** | Estimate | [optional] +**event** | **string** | Event | [optional] +**impact** | **string** | Impact level | [optional] +**time** | **string** | Release time | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Estimate.md b/docs/Model/Estimate.md new file mode 100644 index 0000000..66cc5d0 --- /dev/null +++ b/docs/Model/Estimate.md @@ -0,0 +1,15 @@ +# # Estimate + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**revenue_avg** | **int** | Average revenue estimates. | [optional] +**revenue_high** | **int** | Highest estimate. | [optional] +**revenue_low** | **int** | Lowest estimate. | [optional] +**number_analysts** | **int** | Number of Analysts. | [optional] +**period** | [**\DateTime**](\DateTime.md) | Period. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Filing.md b/docs/Model/Filing.md new file mode 100644 index 0000000..358a26d --- /dev/null +++ b/docs/Model/Filing.md @@ -0,0 +1,18 @@ +# # Filing + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**access_number** | **string** | Access number. | [optional] +**symbol** | **string** | Symbol. | [optional] +**cik** | **string** | CIK. | [optional] +**form** | **string** | Form type. | [optional] +**filed_date** | [**\DateTime**](\DateTime.md) | Filed date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] +**accepted_date** | [**\DateTime**](\DateTime.md) | Accepted date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] +**report_url** | **string** | Report's URL. | [optional] +**filing_url** | **string** | Filing's URL. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/FinancialStatements.md b/docs/Model/FinancialStatements.md new file mode 100644 index 0000000..ddc5d16 --- /dev/null +++ b/docs/Model/FinancialStatements.md @@ -0,0 +1,12 @@ +# # FinancialStatements + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol of the company. | [optional] +**financials** | **object[]** | An array of map of key, value pairs containing the data for each period. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/FinancialsAsReported.md b/docs/Model/FinancialsAsReported.md new file mode 100644 index 0000000..59317a2 --- /dev/null +++ b/docs/Model/FinancialsAsReported.md @@ -0,0 +1,13 @@ +# # FinancialsAsReported + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol | [optional] +**cik** | **string** | CIK | [optional] +**data** | **object[]** | Array of filings. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/ForexCandles.md b/docs/Model/ForexCandles.md new file mode 100644 index 0000000..70c72f2 --- /dev/null +++ b/docs/Model/ForexCandles.md @@ -0,0 +1,17 @@ +# # ForexCandles + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**o** | **float[]** | List of open prices for returned candles. | [optional] +**h** | **float[]** | List of high prices for returned candles. | [optional] +**l** | **float[]** | List of low prices for returned candles. | [optional] +**c** | **float[]** | List of close prices for returned candles. | [optional] +**v** | **float[]** | List of volume data for returned candles. | [optional] +**t** | **float[]** | List of timestamp for returned candles. | [optional] +**s** | **string** | Status of the response. This field can either be ok or no_data. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/ForexSymbol.md b/docs/Model/ForexSymbol.md new file mode 100644 index 0000000..4e4ac3a --- /dev/null +++ b/docs/Model/ForexSymbol.md @@ -0,0 +1,13 @@ +# # ForexSymbol + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **string** | Symbol description | [optional] +**display_symbol** | **string** | Display symbol name. | [optional] +**symbol** | **string** | Unique symbol used to identify this symbol used in <code>/forex/candle</code> endpoint. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Forexrates.md b/docs/Model/Forexrates.md new file mode 100644 index 0000000..3b7b00f --- /dev/null +++ b/docs/Model/Forexrates.md @@ -0,0 +1,12 @@ +# # Forexrates + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**base** | **string** | Base currency. | [optional] +**quote** | [**object**](.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/FundOwnership.md b/docs/Model/FundOwnership.md new file mode 100644 index 0000000..f683a8b --- /dev/null +++ b/docs/Model/FundOwnership.md @@ -0,0 +1,12 @@ +# # FundOwnership + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol of the company. | [optional] +**ownership** | **object[]** | Array of investors with detailed information about their holdings. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/IPOCalendar.md b/docs/Model/IPOCalendar.md new file mode 100644 index 0000000..77fd8a3 --- /dev/null +++ b/docs/Model/IPOCalendar.md @@ -0,0 +1,11 @@ +# # IPOCalendar + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ipo_calendar** | **object[]** | Array of IPO events. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/IPOEvent.md b/docs/Model/IPOEvent.md new file mode 100644 index 0000000..60baef9 --- /dev/null +++ b/docs/Model/IPOEvent.md @@ -0,0 +1,18 @@ +# # IPOEvent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol. | [optional] +**date** | [**\DateTime**](\DateTime.md) | IPO date. | [optional] +**exchange** | **string** | Exchange. | [optional] +**name** | **string** | Company's name. | [optional] +**status** | **string** | IPO status. Can take 1 of the following values: <code>expected</code>,<code>priced</code>,<code>withdrawn</code>,<code>filed</code> | [optional] +**price** | **string** | Projected price or price range. | [optional] +**number_of_shares** | **int** | Number of shares offered during the IPO. | [optional] +**total_shares_value** | **int** | Total shares value. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Indicator.md b/docs/Model/Indicator.md new file mode 100644 index 0000000..6694fb9 --- /dev/null +++ b/docs/Model/Indicator.md @@ -0,0 +1,13 @@ +# # Indicator + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**buy** | **int** | Number of buy signals | [optional] +**neutral** | **int** | Number of neutral signals | [optional] +**sell** | **int** | Number of sell signals | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Investor.md b/docs/Model/Investor.md new file mode 100644 index 0000000..2fbf559 --- /dev/null +++ b/docs/Model/Investor.md @@ -0,0 +1,14 @@ +# # Investor + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Investor's name. | [optional] +**share** | **int** | Number of shares held by the investor. | [optional] +**change** | **int** | Number of share changed (net buy or sell) from the last period. | [optional] +**filing_date** | [**\DateTime**](\DateTime.md) | Filing date. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/InvestorsOwnership.md b/docs/Model/InvestorsOwnership.md new file mode 100644 index 0000000..3dba175 --- /dev/null +++ b/docs/Model/InvestorsOwnership.md @@ -0,0 +1,12 @@ +# # InvestorsOwnership + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol of the company. | [optional] +**ownership** | **object[]** | Array of investors with detailed information about their holdings. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/LastBidAsk.md b/docs/Model/LastBidAsk.md new file mode 100644 index 0000000..46fcffe --- /dev/null +++ b/docs/Model/LastBidAsk.md @@ -0,0 +1,15 @@ +# # LastBidAsk + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**b** | **float** | Bid price. | [optional] +**a** | **float** | Ask price. | [optional] +**bv** | **float** | Bid volume. | [optional] +**av** | **float** | Ask volume. | [optional] +**t** | **int** | Reference UNIX timestamp in ms. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/MajorDevelopments.md b/docs/Model/MajorDevelopments.md new file mode 100644 index 0000000..1271d28 --- /dev/null +++ b/docs/Model/MajorDevelopments.md @@ -0,0 +1,12 @@ +# # MajorDevelopments + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**major_development** | **object[]** | Array of major developments. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/News.md b/docs/Model/News.md new file mode 100644 index 0000000..dd243f6 --- /dev/null +++ b/docs/Model/News.md @@ -0,0 +1,19 @@ +# # News + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**category** | **string** | News category. | [optional] +**datetime** | **int** | Published time in UNIX timestamp. | [optional] +**headline** | **string** | News headline. | [optional] +**id** | **int** | News ID. This value can be used for <code>minId</code> params to get the latest news only. | [optional] +**image** | **string** | Thumbnail image URL. | [optional] +**related** | **string** | Related stocks and companies mentioned in the article. | [optional] +**source** | **string** | News source. | [optional] +**summary** | **string** | News summary. | [optional] +**url** | **string** | URL of the original article. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/NewsSentiment.md b/docs/Model/NewsSentiment.md new file mode 100644 index 0000000..aa0d0ff --- /dev/null +++ b/docs/Model/NewsSentiment.md @@ -0,0 +1,16 @@ +# # NewsSentiment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**buzz** | [**\Finnhub\Model\CompanyNewsStatistics**](CompanyNewsStatistics.md) | | [optional] +**company_news_score** | **float** | News score. | [optional] +**sector_average_bullish_percent** | **float** | Sector average bullish percent. | [optional] +**sector_average_news_score** | **float** | Sectore average score. | [optional] +**sentiment** | [**\Finnhub\Model\Sentiment**](Sentiment.md) | | [optional] +**symbol** | **string** | Requested symbol. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/PatternRecognition.md b/docs/Model/PatternRecognition.md new file mode 100644 index 0000000..ef68ff7 --- /dev/null +++ b/docs/Model/PatternRecognition.md @@ -0,0 +1,11 @@ +# # PatternRecognition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**points** | **object[]** | Array of patterns. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/PriceTarget.md b/docs/Model/PriceTarget.md new file mode 100644 index 0000000..6b430b8 --- /dev/null +++ b/docs/Model/PriceTarget.md @@ -0,0 +1,16 @@ +# # PriceTarget + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**target_high** | **float** | Highes analysts' target. | [optional] +**target_low** | **float** | Lowest analysts' target. | [optional] +**target_mean** | **float** | Mean of all analysts' targets. | [optional] +**target_median** | **float** | Median of all analysts' targets. | [optional] +**last_updated** | [**\DateTime**](\DateTime.md) | Updated time of the data | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Quote.md b/docs/Model/Quote.md new file mode 100644 index 0000000..b3675c2 --- /dev/null +++ b/docs/Model/Quote.md @@ -0,0 +1,15 @@ +# # Quote + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**o** | **float** | Open price of the day | [optional] +**h** | **float** | High price of the day | [optional] +**l** | **float** | Low price of the day | [optional] +**c** | **float** | Current price | [optional] +**pc** | **float** | Previous close price | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/RecommendationTrend.md b/docs/Model/RecommendationTrend.md new file mode 100644 index 0000000..96ae236 --- /dev/null +++ b/docs/Model/RecommendationTrend.md @@ -0,0 +1,17 @@ +# # RecommendationTrend + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**buy** | **int** | Number of recommendations that fall into the Buy category | [optional] +**hold** | **int** | Number of recommendations that fall into the Hold category | [optional] +**period** | **string** | Updated period | [optional] +**sell** | **int** | Number of recommendations that fall into the Sell category | [optional] +**strong_buy** | **int** | Number of recommendations that fall into the Strong Buy category | [optional] +**strong_sell** | **int** | Number of recommendations that fall into the Strong Sell category | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Report.md b/docs/Model/Report.md new file mode 100644 index 0000000..0fe8b44 --- /dev/null +++ b/docs/Model/Report.md @@ -0,0 +1,21 @@ +# # Report + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**access_number** | **string** | Access number. | [optional] +**symbol** | **string** | Symbol. | [optional] +**cik** | **string** | CIK. | [optional] +**year** | **int** | Year. | [optional] +**quarter** | **int** | Quarter. | [optional] +**form** | **string** | Form type. | [optional] +**start_date** | [**\DateTime**](\DateTime.md) | Period start date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] +**end_date** | [**\DateTime**](\DateTime.md) | Period end date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] +**filed_date** | [**\DateTime**](\DateTime.md) | Filed date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] +**accepted_date** | [**\DateTime**](\DateTime.md) | Accepted date <code>%Y-%m-%d %H:%M:%S</code>. | [optional] +**report** | [**object**](.md) | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/RevenueEstimates.md b/docs/Model/RevenueEstimates.md new file mode 100644 index 0000000..5059e0f --- /dev/null +++ b/docs/Model/RevenueEstimates.md @@ -0,0 +1,13 @@ +# # RevenueEstimates + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | **object[]** | List of estimates | [optional] +**freq** | **string** | Frequency: annual or quarterly. | [optional] +**symbol** | **string** | Company symbol. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Sentiment.md b/docs/Model/Sentiment.md new file mode 100644 index 0000000..ff8a05f --- /dev/null +++ b/docs/Model/Sentiment.md @@ -0,0 +1,12 @@ +# # Sentiment + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bearish_percent** | **int** | | [optional] +**bullish_percent** | **int** | | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Split.md b/docs/Model/Split.md new file mode 100644 index 0000000..3c7a891 --- /dev/null +++ b/docs/Model/Split.md @@ -0,0 +1,14 @@ +# # Split + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Symbol. | [optional] +**date** | [**\DateTime**](\DateTime.md) | Split date. | [optional] +**from_factor** | **float** | From factor. | [optional] +**to_factor** | **float** | To factor. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Stock.md b/docs/Model/Stock.md new file mode 100644 index 0000000..2973157 --- /dev/null +++ b/docs/Model/Stock.md @@ -0,0 +1,13 @@ +# # Stock + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**description** | **string** | Symbol description | [optional] +**display_symbol** | **string** | Display symbol name. | [optional] +**symbol** | **string** | Unique symbol used to identify this symbol used in <code>/stock/candle</code> endpoint. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/StockCandles.md b/docs/Model/StockCandles.md new file mode 100644 index 0000000..249ddad --- /dev/null +++ b/docs/Model/StockCandles.md @@ -0,0 +1,17 @@ +# # StockCandles + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**o** | **float[]** | List of open prices for returned candles. | [optional] +**h** | **float[]** | List of high prices for returned candles. | [optional] +**l** | **float[]** | List of low prices for returned candles. | [optional] +**c** | **float[]** | List of close prices for returned candles. | [optional] +**v** | **float[]** | List of volume data for returned candles. | [optional] +**t** | **int[]** | List of timestamp for returned candles. | [optional] +**s** | **string** | Status of the response. This field can either be ok or no_data. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/StockTranscripts.md b/docs/Model/StockTranscripts.md new file mode 100644 index 0000000..1cb87d0 --- /dev/null +++ b/docs/Model/StockTranscripts.md @@ -0,0 +1,15 @@ +# # StockTranscripts + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **string** | Transcript's ID used to get the <a href=\"#transcripts\">full transcript</a>. | [optional] +**title** | **string** | Title. | [optional] +**time** | [**\DateTime**](\DateTime.md) | Time of the event. | [optional] +**year** | **int** | Year of earnings result in the case of earnings call transcript. | [optional] +**quarter** | **int** | Quarter of earnings result in the case of earnings call transcript. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/SupportResistance.md b/docs/Model/SupportResistance.md new file mode 100644 index 0000000..07defad --- /dev/null +++ b/docs/Model/SupportResistance.md @@ -0,0 +1,11 @@ +# # SupportResistance + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**levels** | **float[]** | Array of support and resistance levels. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/TechnicalAnalysis.md b/docs/Model/TechnicalAnalysis.md new file mode 100644 index 0000000..3b41009 --- /dev/null +++ b/docs/Model/TechnicalAnalysis.md @@ -0,0 +1,12 @@ +# # TechnicalAnalysis + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**count** | [**\Finnhub\Model\Indicator**](Indicator.md) | | [optional] +**signal** | **string** | Aggregate Signal | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/TickData.md b/docs/Model/TickData.md new file mode 100644 index 0000000..7cf5e03 --- /dev/null +++ b/docs/Model/TickData.md @@ -0,0 +1,18 @@ +# # TickData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**s** | **string** | Symbol. | [optional] +**skip** | **int** | Number of ticks skipped. | [optional] +**count** | **int** | Number of ticks returned. If <code>count</code> < <code>limit</code>, all data for that date has been returned. | [optional] +**total** | **int** | Total number of ticks for that date. | [optional] +**v** | **float[]** | List of volume data. | [optional] +**p** | **float[]** | List of price data. | [optional] +**t** | **int[]** | List of timestamp in UNIX ms. | [optional] +**x** | **string[]** | List of venues/exchanges. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/TranscriptContent.md b/docs/Model/TranscriptContent.md new file mode 100644 index 0000000..3de20ef --- /dev/null +++ b/docs/Model/TranscriptContent.md @@ -0,0 +1,12 @@ +# # TranscriptContent + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Speaker's name | [optional] +**speech** | **string[]** | Speaker's speech | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/TranscriptParticipant.md b/docs/Model/TranscriptParticipant.md new file mode 100644 index 0000000..3f4a9df --- /dev/null +++ b/docs/Model/TranscriptParticipant.md @@ -0,0 +1,12 @@ +# # TranscriptParticipant + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **string** | Participant's name | [optional] +**description** | **string** | Participant's description | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/Trend.md b/docs/Model/Trend.md new file mode 100644 index 0000000..2162cd8 --- /dev/null +++ b/docs/Model/Trend.md @@ -0,0 +1,11 @@ +# # Trend + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**adx** | **float** | ADX reading | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/docs/Model/UpgradeDowngrade.md b/docs/Model/UpgradeDowngrade.md new file mode 100644 index 0000000..1cbfe2d --- /dev/null +++ b/docs/Model/UpgradeDowngrade.md @@ -0,0 +1,16 @@ +# # UpgradeDowngrade + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **string** | Company symbol. | [optional] +**grade_time** | **int** | Upgrade/downgrade time in UNIX timestamp. | [optional] +**from_grade** | **string** | From grade. | [optional] +**to_grade** | **string** | To grade. | [optional] +**company** | **string** | Company/analyst who did the upgrade/downgrade. | [optional] +**action** | **string** | Action can take any of the following values: <code>up(upgrade), down(downgrade), main(maintains), init(initiate), reit(reiterate)</code>. | [optional] + +[[Back to Model list]](../../README.md#documentation-for-models) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to README]](../../README.md) + + diff --git a/git_push.sh b/git_push.sh new file mode 100644 index 0000000..ced3be2 --- /dev/null +++ b/git_push.sh @@ -0,0 +1,58 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-pestore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=`git remote` +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:${GIT_TOKEN}@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' + diff --git a/lib/ApiException.php b/lib/ApiException.php new file mode 100644 index 0000000..c723008 --- /dev/null +++ b/lib/ApiException.php @@ -0,0 +1,121 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return mixed HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deseralized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deseralized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/lib/Configuration.php b/lib/Configuration.php new file mode 100644 index 0000000..19a8230 --- /dev/null +++ b/lib/Configuration.php @@ -0,0 +1,485 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the detault configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (Finnhub) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 1.0.0' . PHP_EOL; + $report .= ' SDK Package Version: 1.0.0' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return an array of host settings + */ + public function getHostSettings() + { + return array( + array( + "url" => "https://finnhub.io/api/v1", + "description" => "No description provided", + ) + ); + } + + /** + * Returns URL based on the index and variables + * + * @param index array index of the host settings + * @param variables hash of variable and the corresponding value (optional) + * @return URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + if (null === $variables) { + $variables = array(); + } + + $hosts = $this->getHostSettings(); + + // check array index out of bound + if ($index < 0 || $index >= sizeof($hosts)) { + throw new \InvalidArgumentException("Invalid index $index when selecting the host. Must be less than ".sizeof($hosts)); + } + + $host = $hosts[$index]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (in_array($variables[$name], $variable["enum_values"])) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } +} diff --git a/lib/DefaultApi.php b/lib/DefaultApi.php new file mode 100644 index 0000000..8c8fc69 --- /dev/null +++ b/lib/DefaultApi.php @@ -0,0 +1,13588 @@ +client = $client ?: new Client(); + $this->config = $config ?: new Configuration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $host_index; + } + + /** + * Set the host index + * + * @param int Host index (required) + */ + public function setHostIndex($host_index) + { + $this->hostIndex = $host_index; + } + + /** + * Get the host index + * + * @return Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation aggregateIndicator + * + * Aggregate Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\AggregateIndicators + */ + public function aggregateIndicator($symbol, $resolution) + { + list($response) = $this->aggregateIndicatorWithHttpInfo($symbol, $resolution); + return $response; + } + + /** + * Operation aggregateIndicatorWithHttpInfo + * + * Aggregate Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\AggregateIndicators, HTTP status code, HTTP response headers (array of strings) + */ + public function aggregateIndicatorWithHttpInfo($symbol, $resolution) + { + $request = $this->aggregateIndicatorRequest($symbol, $resolution); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\AggregateIndicators' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\AggregateIndicators', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\AggregateIndicators'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\AggregateIndicators', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation aggregateIndicatorAsync + * + * Aggregate Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function aggregateIndicatorAsync($symbol, $resolution) + { + return $this->aggregateIndicatorAsyncWithHttpInfo($symbol, $resolution) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation aggregateIndicatorAsyncWithHttpInfo + * + * Aggregate Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function aggregateIndicatorAsyncWithHttpInfo($symbol, $resolution) + { + $returnType = '\Finnhub\Model\AggregateIndicators'; + $request = $this->aggregateIndicatorRequest($symbol, $resolution); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'aggregateIndicator' + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function aggregateIndicatorRequest($symbol, $resolution) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling aggregateIndicator' + ); + } + // verify the required parameter 'resolution' is set + if ($resolution === null || (is_array($resolution) && count($resolution) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resolution when calling aggregateIndicator' + ); + } + + $resourcePath = '/scan/technical-indicator'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($resolution)) { + $resolution = ObjectSerializer::serializeCollection($resolution, '', true); + } + if ($resolution !== null) { + $queryParams['resolution'] = $resolution; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyBasicFinancials + * + * Basic Financials + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $metric Metric type. Can be 1 of the following values <code>all, price, valuation, margin</code> (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\BasicFinancials + */ + public function companyBasicFinancials($symbol, $metric) + { + list($response) = $this->companyBasicFinancialsWithHttpInfo($symbol, $metric); + return $response; + } + + /** + * Operation companyBasicFinancialsWithHttpInfo + * + * Basic Financials + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $metric Metric type. Can be 1 of the following values <code>all, price, valuation, margin</code> (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\BasicFinancials, HTTP status code, HTTP response headers (array of strings) + */ + public function companyBasicFinancialsWithHttpInfo($symbol, $metric) + { + $request = $this->companyBasicFinancialsRequest($symbol, $metric); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\BasicFinancials' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\BasicFinancials', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\BasicFinancials'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\BasicFinancials', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyBasicFinancialsAsync + * + * Basic Financials + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $metric Metric type. Can be 1 of the following values <code>all, price, valuation, margin</code> (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyBasicFinancialsAsync($symbol, $metric) + { + return $this->companyBasicFinancialsAsyncWithHttpInfo($symbol, $metric) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyBasicFinancialsAsyncWithHttpInfo + * + * Basic Financials + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $metric Metric type. Can be 1 of the following values <code>all, price, valuation, margin</code> (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyBasicFinancialsAsyncWithHttpInfo($symbol, $metric) + { + $returnType = '\Finnhub\Model\BasicFinancials'; + $request = $this->companyBasicFinancialsRequest($symbol, $metric); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyBasicFinancials' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $metric Metric type. Can be 1 of the following values <code>all, price, valuation, margin</code> (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyBasicFinancialsRequest($symbol, $metric) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling companyBasicFinancials' + ); + } + // verify the required parameter 'metric' is set + if ($metric === null || (is_array($metric) && count($metric) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $metric when calling companyBasicFinancials' + ); + } + + $resourcePath = '/stock/metric'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($metric)) { + $metric = ObjectSerializer::serializeCollection($metric, '', true); + } + if ($metric !== null) { + $queryParams['metric'] = $metric; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyEarnings + * + * Earnings Surprises + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of period returned. Leave blank to get the full history. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\EarningResult[] + */ + public function companyEarnings($symbol, $limit = null) + { + list($response) = $this->companyEarningsWithHttpInfo($symbol, $limit); + return $response; + } + + /** + * Operation companyEarningsWithHttpInfo + * + * Earnings Surprises + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of period returned. Leave blank to get the full history. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\EarningResult[], HTTP status code, HTTP response headers (array of strings) + */ + public function companyEarningsWithHttpInfo($symbol, $limit = null) + { + $request = $this->companyEarningsRequest($symbol, $limit); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\EarningResult[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\EarningResult[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\EarningResult[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\EarningResult[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyEarningsAsync + * + * Earnings Surprises + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of period returned. Leave blank to get the full history. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyEarningsAsync($symbol, $limit = null) + { + return $this->companyEarningsAsyncWithHttpInfo($symbol, $limit) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyEarningsAsyncWithHttpInfo + * + * Earnings Surprises + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of period returned. Leave blank to get the full history. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyEarningsAsyncWithHttpInfo($symbol, $limit = null) + { + $returnType = '\Finnhub\Model\EarningResult[]'; + $request = $this->companyEarningsRequest($symbol, $limit); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyEarnings' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of period returned. Leave blank to get the full history. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyEarningsRequest($symbol, $limit = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling companyEarnings' + ); + } + + $resourcePath = '/stock/earnings'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyEpsEstimates + * + * Earnings Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\EarningsEstimates + */ + public function companyEpsEstimates($symbol, $freq = null) + { + list($response) = $this->companyEpsEstimatesWithHttpInfo($symbol, $freq); + return $response; + } + + /** + * Operation companyEpsEstimatesWithHttpInfo + * + * Earnings Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\EarningsEstimates, HTTP status code, HTTP response headers (array of strings) + */ + public function companyEpsEstimatesWithHttpInfo($symbol, $freq = null) + { + $request = $this->companyEpsEstimatesRequest($symbol, $freq); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\EarningsEstimates' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\EarningsEstimates', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\EarningsEstimates'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\EarningsEstimates', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyEpsEstimatesAsync + * + * Earnings Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyEpsEstimatesAsync($symbol, $freq = null) + { + return $this->companyEpsEstimatesAsyncWithHttpInfo($symbol, $freq) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyEpsEstimatesAsyncWithHttpInfo + * + * Earnings Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyEpsEstimatesAsyncWithHttpInfo($symbol, $freq = null) + { + $returnType = '\Finnhub\Model\EarningsEstimates'; + $request = $this->companyEpsEstimatesRequest($symbol, $freq); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyEpsEstimates' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyEpsEstimatesRequest($symbol, $freq = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling companyEpsEstimates' + ); + } + + $resourcePath = '/stock/eps-estimate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($freq)) { + $freq = ObjectSerializer::serializeCollection($freq, '', true); + } + if ($freq !== null) { + $queryParams['freq'] = $freq; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyExecutive + * + * Company Executive + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\CompanyExecutive + */ + public function companyExecutive($symbol) + { + list($response) = $this->companyExecutiveWithHttpInfo($symbol); + return $response; + } + + /** + * Operation companyExecutiveWithHttpInfo + * + * Company Executive + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\CompanyExecutive, HTTP status code, HTTP response headers (array of strings) + */ + public function companyExecutiveWithHttpInfo($symbol) + { + $request = $this->companyExecutiveRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\CompanyExecutive' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\CompanyExecutive', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\CompanyExecutive'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\CompanyExecutive', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyExecutiveAsync + * + * Company Executive + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyExecutiveAsync($symbol) + { + return $this->companyExecutiveAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyExecutiveAsyncWithHttpInfo + * + * Company Executive + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyExecutiveAsyncWithHttpInfo($symbol) + { + $returnType = '\Finnhub\Model\CompanyExecutive'; + $request = $this->companyExecutiveRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyExecutive' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyExecutiveRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling companyExecutive' + ); + } + + $resourcePath = '/stock/executive'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyNews + * + * Company News + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From date <code>YYYY-MM-DD</code>. (required) + * @param \DateTime $to To date <code>YYYY-MM-DD</code>. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\News[] + */ + public function companyNews($symbol, $from, $to) + { + list($response) = $this->companyNewsWithHttpInfo($symbol, $from, $to); + return $response; + } + + /** + * Operation companyNewsWithHttpInfo + * + * Company News + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From date <code>YYYY-MM-DD</code>. (required) + * @param \DateTime $to To date <code>YYYY-MM-DD</code>. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\News[], HTTP status code, HTTP response headers (array of strings) + */ + public function companyNewsWithHttpInfo($symbol, $from, $to) + { + $request = $this->companyNewsRequest($symbol, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\News[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\News[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\News[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\News[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyNewsAsync + * + * Company News + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From date <code>YYYY-MM-DD</code>. (required) + * @param \DateTime $to To date <code>YYYY-MM-DD</code>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyNewsAsync($symbol, $from, $to) + { + return $this->companyNewsAsyncWithHttpInfo($symbol, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyNewsAsyncWithHttpInfo + * + * Company News + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From date <code>YYYY-MM-DD</code>. (required) + * @param \DateTime $to To date <code>YYYY-MM-DD</code>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyNewsAsyncWithHttpInfo($symbol, $from, $to) + { + $returnType = '\Finnhub\Model\News[]'; + $request = $this->companyNewsRequest($symbol, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyNews' + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From date <code>YYYY-MM-DD</code>. (required) + * @param \DateTime $to To date <code>YYYY-MM-DD</code>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyNewsRequest($symbol, $from, $to) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling companyNews' + ); + } + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling companyNews' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling companyNews' + ); + } + + $resourcePath = '/company-news'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyPeers + * + * Peers + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function companyPeers($symbol) + { + list($response) = $this->companyPeersWithHttpInfo($symbol); + return $response; + } + + /** + * Operation companyPeersWithHttpInfo + * + * Peers + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function companyPeersWithHttpInfo($symbol) + { + $request = $this->companyPeersRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyPeersAsync + * + * Peers + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyPeersAsync($symbol) + { + return $this->companyPeersAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyPeersAsyncWithHttpInfo + * + * Peers + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyPeersAsyncWithHttpInfo($symbol) + { + $returnType = 'string[]'; + $request = $this->companyPeersRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyPeers' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyPeersRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling companyPeers' + ); + } + + $resourcePath = '/stock/peers'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyProfile + * + * Company Profile + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\CompanyProfile + */ + public function companyProfile($symbol = null, $isin = null, $cusip = null) + { + list($response) = $this->companyProfileWithHttpInfo($symbol, $isin, $cusip); + return $response; + } + + /** + * Operation companyProfileWithHttpInfo + * + * Company Profile + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\CompanyProfile, HTTP status code, HTTP response headers (array of strings) + */ + public function companyProfileWithHttpInfo($symbol = null, $isin = null, $cusip = null) + { + $request = $this->companyProfileRequest($symbol, $isin, $cusip); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\CompanyProfile' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\CompanyProfile', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\CompanyProfile'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\CompanyProfile', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyProfileAsync + * + * Company Profile + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyProfileAsync($symbol = null, $isin = null, $cusip = null) + { + return $this->companyProfileAsyncWithHttpInfo($symbol, $isin, $cusip) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyProfileAsyncWithHttpInfo + * + * Company Profile + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyProfileAsyncWithHttpInfo($symbol = null, $isin = null, $cusip = null) + { + $returnType = '\Finnhub\Model\CompanyProfile'; + $request = $this->companyProfileRequest($symbol, $isin, $cusip); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyProfile' + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyProfileRequest($symbol = null, $isin = null, $cusip = null) + { + + $resourcePath = '/stock/profile'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($isin)) { + $isin = ObjectSerializer::serializeCollection($isin, '', true); + } + if ($isin !== null) { + $queryParams['isin'] = $isin; + } + // query params + if (is_array($cusip)) { + $cusip = ObjectSerializer::serializeCollection($cusip, '', true); + } + if ($cusip !== null) { + $queryParams['cusip'] = $cusip; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyProfile2 + * + * Company Profile 2 + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\CompanyProfile2 + */ + public function companyProfile2($symbol = null, $isin = null, $cusip = null) + { + list($response) = $this->companyProfile2WithHttpInfo($symbol, $isin, $cusip); + return $response; + } + + /** + * Operation companyProfile2WithHttpInfo + * + * Company Profile 2 + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\CompanyProfile2, HTTP status code, HTTP response headers (array of strings) + */ + public function companyProfile2WithHttpInfo($symbol = null, $isin = null, $cusip = null) + { + $request = $this->companyProfile2Request($symbol, $isin, $cusip); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\CompanyProfile2' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\CompanyProfile2', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\CompanyProfile2'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\CompanyProfile2', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyProfile2Async + * + * Company Profile 2 + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyProfile2Async($symbol = null, $isin = null, $cusip = null) + { + return $this->companyProfile2AsyncWithHttpInfo($symbol, $isin, $cusip) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyProfile2AsyncWithHttpInfo + * + * Company Profile 2 + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyProfile2AsyncWithHttpInfo($symbol = null, $isin = null, $cusip = null) + { + $returnType = '\Finnhub\Model\CompanyProfile2'; + $request = $this->companyProfile2Request($symbol, $isin, $cusip); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyProfile2' + * + * @param string $symbol Symbol of the company: AAPL e.g. (optional) + * @param string $isin ISIN (optional) + * @param string $cusip CUSIP (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyProfile2Request($symbol = null, $isin = null, $cusip = null) + { + + $resourcePath = '/stock/profile2'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($isin)) { + $isin = ObjectSerializer::serializeCollection($isin, '', true); + } + if ($isin !== null) { + $queryParams['isin'] = $isin; + } + // query params + if (is_array($cusip)) { + $cusip = ObjectSerializer::serializeCollection($cusip, '', true); + } + if ($cusip !== null) { + $queryParams['cusip'] = $cusip; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation companyRevenueEstimates + * + * Revenue Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\RevenueEstimates + */ + public function companyRevenueEstimates($symbol, $freq = null) + { + list($response) = $this->companyRevenueEstimatesWithHttpInfo($symbol, $freq); + return $response; + } + + /** + * Operation companyRevenueEstimatesWithHttpInfo + * + * Revenue Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\RevenueEstimates, HTTP status code, HTTP response headers (array of strings) + */ + public function companyRevenueEstimatesWithHttpInfo($symbol, $freq = null) + { + $request = $this->companyRevenueEstimatesRequest($symbol, $freq); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\RevenueEstimates' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\RevenueEstimates', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\RevenueEstimates'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\RevenueEstimates', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation companyRevenueEstimatesAsync + * + * Revenue Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyRevenueEstimatesAsync($symbol, $freq = null) + { + return $this->companyRevenueEstimatesAsyncWithHttpInfo($symbol, $freq) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation companyRevenueEstimatesAsyncWithHttpInfo + * + * Revenue Estimates + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function companyRevenueEstimatesAsyncWithHttpInfo($symbol, $freq = null) + { + $returnType = '\Finnhub\Model\RevenueEstimates'; + $request = $this->companyRevenueEstimatesRequest($symbol, $freq); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'companyRevenueEstimates' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $freq Can take 1 of the following values: <code>annual, quarterly</code>. Default to <code>quarterly</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function companyRevenueEstimatesRequest($symbol, $freq = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling companyRevenueEstimates' + ); + } + + $resourcePath = '/stock/revenue-estimate'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($freq)) { + $freq = ObjectSerializer::serializeCollection($freq, '', true); + } + if ($freq !== null) { + $queryParams['freq'] = $freq; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation country + * + * Country Metadata + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\CountryMetadata[] + */ + public function country() + { + list($response) = $this->countryWithHttpInfo(); + return $response; + } + + /** + * Operation countryWithHttpInfo + * + * Country Metadata + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\CountryMetadata[], HTTP status code, HTTP response headers (array of strings) + */ + public function countryWithHttpInfo() + { + $request = $this->countryRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\CountryMetadata[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\CountryMetadata[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\CountryMetadata[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\CountryMetadata[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation countryAsync + * + * Country Metadata + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function countryAsync() + { + return $this->countryAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation countryAsyncWithHttpInfo + * + * Country Metadata + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function countryAsyncWithHttpInfo() + { + $returnType = '\Finnhub\Model\CountryMetadata[]'; + $request = $this->countryRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'country' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function countryRequest() + { + + $resourcePath = '/country'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation covid19 + * + * COVID-19 + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\CovidInfo[] + */ + public function covid19() + { + list($response) = $this->covid19WithHttpInfo(); + return $response; + } + + /** + * Operation covid19WithHttpInfo + * + * COVID-19 + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\CovidInfo[], HTTP status code, HTTP response headers (array of strings) + */ + public function covid19WithHttpInfo() + { + $request = $this->covid19Request(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\CovidInfo[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\CovidInfo[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\CovidInfo[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\CovidInfo[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation covid19Async + * + * COVID-19 + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function covid19Async() + { + return $this->covid19AsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation covid19AsyncWithHttpInfo + * + * COVID-19 + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function covid19AsyncWithHttpInfo() + { + $returnType = '\Finnhub\Model\CovidInfo[]'; + $request = $this->covid19Request(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'covid19' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function covid19Request() + { + + $resourcePath = '/covid19/us'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cryptoCandles + * + * Crypto Candles + * + * @param string $symbol Use symbol returned in <code>/crypto/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\CryptoCandles + */ + public function cryptoCandles($symbol, $resolution, $from, $to) + { + list($response) = $this->cryptoCandlesWithHttpInfo($symbol, $resolution, $from, $to); + return $response; + } + + /** + * Operation cryptoCandlesWithHttpInfo + * + * Crypto Candles + * + * @param string $symbol Use symbol returned in <code>/crypto/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\CryptoCandles, HTTP status code, HTTP response headers (array of strings) + */ + public function cryptoCandlesWithHttpInfo($symbol, $resolution, $from, $to) + { + $request = $this->cryptoCandlesRequest($symbol, $resolution, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\CryptoCandles' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\CryptoCandles', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\CryptoCandles'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\CryptoCandles', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cryptoCandlesAsync + * + * Crypto Candles + * + * @param string $symbol Use symbol returned in <code>/crypto/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cryptoCandlesAsync($symbol, $resolution, $from, $to) + { + return $this->cryptoCandlesAsyncWithHttpInfo($symbol, $resolution, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cryptoCandlesAsyncWithHttpInfo + * + * Crypto Candles + * + * @param string $symbol Use symbol returned in <code>/crypto/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cryptoCandlesAsyncWithHttpInfo($symbol, $resolution, $from, $to) + { + $returnType = '\Finnhub\Model\CryptoCandles'; + $request = $this->cryptoCandlesRequest($symbol, $resolution, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cryptoCandles' + * + * @param string $symbol Use symbol returned in <code>/crypto/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cryptoCandlesRequest($symbol, $resolution, $from, $to) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling cryptoCandles' + ); + } + // verify the required parameter 'resolution' is set + if ($resolution === null || (is_array($resolution) && count($resolution) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resolution when calling cryptoCandles' + ); + } + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling cryptoCandles' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling cryptoCandles' + ); + } + + $resourcePath = '/crypto/candle'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($resolution)) { + $resolution = ObjectSerializer::serializeCollection($resolution, '', true); + } + if ($resolution !== null) { + $queryParams['resolution'] = $resolution; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cryptoExchanges + * + * Crypto Exchanges + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function cryptoExchanges() + { + list($response) = $this->cryptoExchangesWithHttpInfo(); + return $response; + } + + /** + * Operation cryptoExchangesWithHttpInfo + * + * Crypto Exchanges + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function cryptoExchangesWithHttpInfo() + { + $request = $this->cryptoExchangesRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cryptoExchangesAsync + * + * Crypto Exchanges + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cryptoExchangesAsync() + { + return $this->cryptoExchangesAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cryptoExchangesAsyncWithHttpInfo + * + * Crypto Exchanges + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cryptoExchangesAsyncWithHttpInfo() + { + $returnType = 'string[]'; + $request = $this->cryptoExchangesRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cryptoExchanges' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cryptoExchangesRequest() + { + + $resourcePath = '/crypto/exchange'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation cryptoSymbols + * + * Crypto Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\CryptoSymbol[] + */ + public function cryptoSymbols($exchange) + { + list($response) = $this->cryptoSymbolsWithHttpInfo($exchange); + return $response; + } + + /** + * Operation cryptoSymbolsWithHttpInfo + * + * Crypto Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\CryptoSymbol[], HTTP status code, HTTP response headers (array of strings) + */ + public function cryptoSymbolsWithHttpInfo($exchange) + { + $request = $this->cryptoSymbolsRequest($exchange); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\CryptoSymbol[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\CryptoSymbol[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\CryptoSymbol[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\CryptoSymbol[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation cryptoSymbolsAsync + * + * Crypto Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cryptoSymbolsAsync($exchange) + { + return $this->cryptoSymbolsAsyncWithHttpInfo($exchange) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation cryptoSymbolsAsyncWithHttpInfo + * + * Crypto Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function cryptoSymbolsAsyncWithHttpInfo($exchange) + { + $returnType = '\Finnhub\Model\CryptoSymbol[]'; + $request = $this->cryptoSymbolsRequest($exchange); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'cryptoSymbols' + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function cryptoSymbolsRequest($exchange) + { + // verify the required parameter 'exchange' is set + if ($exchange === null || (is_array($exchange) && count($exchange) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exchange when calling cryptoSymbols' + ); + } + + $resourcePath = '/crypto/symbol'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($exchange)) { + $exchange = ObjectSerializer::serializeCollection($exchange, '', true); + } + if ($exchange !== null) { + $queryParams['exchange'] = $exchange; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation earningsCalendar + * + * Earnings Calendar + * + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * @param string $symbol Filter by symbol: AAPL. (optional) + * @param AnyType $international Set to <code>true</code> to include international markets. Default value is <code>false</code> (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\EarningsCalendar + */ + public function earningsCalendar($from = null, $to = null, $symbol = null, $international = null) + { + list($response) = $this->earningsCalendarWithHttpInfo($from, $to, $symbol, $international); + return $response; + } + + /** + * Operation earningsCalendarWithHttpInfo + * + * Earnings Calendar + * + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * @param string $symbol Filter by symbol: AAPL. (optional) + * @param AnyType $international Set to <code>true</code> to include international markets. Default value is <code>false</code> (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\EarningsCalendar, HTTP status code, HTTP response headers (array of strings) + */ + public function earningsCalendarWithHttpInfo($from = null, $to = null, $symbol = null, $international = null) + { + $request = $this->earningsCalendarRequest($from, $to, $symbol, $international); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\EarningsCalendar' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\EarningsCalendar', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\EarningsCalendar'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\EarningsCalendar', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation earningsCalendarAsync + * + * Earnings Calendar + * + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * @param string $symbol Filter by symbol: AAPL. (optional) + * @param AnyType $international Set to <code>true</code> to include international markets. Default value is <code>false</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function earningsCalendarAsync($from = null, $to = null, $symbol = null, $international = null) + { + return $this->earningsCalendarAsyncWithHttpInfo($from, $to, $symbol, $international) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation earningsCalendarAsyncWithHttpInfo + * + * Earnings Calendar + * + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * @param string $symbol Filter by symbol: AAPL. (optional) + * @param AnyType $international Set to <code>true</code> to include international markets. Default value is <code>false</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function earningsCalendarAsyncWithHttpInfo($from = null, $to = null, $symbol = null, $international = null) + { + $returnType = '\Finnhub\Model\EarningsCalendar'; + $request = $this->earningsCalendarRequest($from, $to, $symbol, $international); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'earningsCalendar' + * + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * @param string $symbol Filter by symbol: AAPL. (optional) + * @param AnyType $international Set to <code>true</code> to include international markets. Default value is <code>false</code> (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function earningsCalendarRequest($from = null, $to = null, $symbol = null, $international = null) + { + + $resourcePath = '/calendar/earnings'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($international)) { + $international = ObjectSerializer::serializeCollection($international, '', true); + } + if ($international !== null) { + $queryParams['international'] = $international; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation economicCode + * + * Economic Code + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\EconomicCode[] + */ + public function economicCode() + { + list($response) = $this->economicCodeWithHttpInfo(); + return $response; + } + + /** + * Operation economicCodeWithHttpInfo + * + * Economic Code + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\EconomicCode[], HTTP status code, HTTP response headers (array of strings) + */ + public function economicCodeWithHttpInfo() + { + $request = $this->economicCodeRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\EconomicCode[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\EconomicCode[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\EconomicCode[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\EconomicCode[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation economicCodeAsync + * + * Economic Code + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function economicCodeAsync() + { + return $this->economicCodeAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation economicCodeAsyncWithHttpInfo + * + * Economic Code + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function economicCodeAsyncWithHttpInfo() + { + $returnType = '\Finnhub\Model\EconomicCode[]'; + $request = $this->economicCodeRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'economicCode' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function economicCodeRequest() + { + + $resourcePath = '/economic/code'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation economicData + * + * Economic Data + * + * @param string $code Economic code. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\EconomicData + */ + public function economicData($code) + { + list($response) = $this->economicDataWithHttpInfo($code); + return $response; + } + + /** + * Operation economicDataWithHttpInfo + * + * Economic Data + * + * @param string $code Economic code. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\EconomicData, HTTP status code, HTTP response headers (array of strings) + */ + public function economicDataWithHttpInfo($code) + { + $request = $this->economicDataRequest($code); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\EconomicData' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\EconomicData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\EconomicData'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\EconomicData', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation economicDataAsync + * + * Economic Data + * + * @param string $code Economic code. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function economicDataAsync($code) + { + return $this->economicDataAsyncWithHttpInfo($code) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation economicDataAsyncWithHttpInfo + * + * Economic Data + * + * @param string $code Economic code. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function economicDataAsyncWithHttpInfo($code) + { + $returnType = '\Finnhub\Model\EconomicData'; + $request = $this->economicDataRequest($code); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'economicData' + * + * @param string $code Economic code. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function economicDataRequest($code) + { + // verify the required parameter 'code' is set + if ($code === null || (is_array($code) && count($code) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $code when calling economicData' + ); + } + + $resourcePath = '/economic'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($code)) { + $code = ObjectSerializer::serializeCollection($code, '', true); + } + if ($code !== null) { + $queryParams['code'] = $code; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation filings + * + * Filings + * + * @param string $symbol Symbol. Leave <code>symbol</code>,<code>cik</code> and <code>accessNumber</code> empty to list latest filings. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve data from. (optional) + * @param string $form Filter by form. You can use this value <code>NT 10-K</code> to find non-timely filings for a company. (optional) + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\Filing[] + */ + public function filings($symbol = null, $cik = null, $access_number = null, $form = null, $from = null, $to = null) + { + list($response) = $this->filingsWithHttpInfo($symbol, $cik, $access_number, $form, $from, $to); + return $response; + } + + /** + * Operation filingsWithHttpInfo + * + * Filings + * + * @param string $symbol Symbol. Leave <code>symbol</code>,<code>cik</code> and <code>accessNumber</code> empty to list latest filings. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve data from. (optional) + * @param string $form Filter by form. You can use this value <code>NT 10-K</code> to find non-timely filings for a company. (optional) + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\Filing[], HTTP status code, HTTP response headers (array of strings) + */ + public function filingsWithHttpInfo($symbol = null, $cik = null, $access_number = null, $form = null, $from = null, $to = null) + { + $request = $this->filingsRequest($symbol, $cik, $access_number, $form, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\Filing[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\Filing[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\Filing[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\Filing[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation filingsAsync + * + * Filings + * + * @param string $symbol Symbol. Leave <code>symbol</code>,<code>cik</code> and <code>accessNumber</code> empty to list latest filings. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve data from. (optional) + * @param string $form Filter by form. You can use this value <code>NT 10-K</code> to find non-timely filings for a company. (optional) + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function filingsAsync($symbol = null, $cik = null, $access_number = null, $form = null, $from = null, $to = null) + { + return $this->filingsAsyncWithHttpInfo($symbol, $cik, $access_number, $form, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation filingsAsyncWithHttpInfo + * + * Filings + * + * @param string $symbol Symbol. Leave <code>symbol</code>,<code>cik</code> and <code>accessNumber</code> empty to list latest filings. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve data from. (optional) + * @param string $form Filter by form. You can use this value <code>NT 10-K</code> to find non-timely filings for a company. (optional) + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function filingsAsyncWithHttpInfo($symbol = null, $cik = null, $access_number = null, $form = null, $from = null, $to = null) + { + $returnType = '\Finnhub\Model\Filing[]'; + $request = $this->filingsRequest($symbol, $cik, $access_number, $form, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'filings' + * + * @param string $symbol Symbol. Leave <code>symbol</code>,<code>cik</code> and <code>accessNumber</code> empty to list latest filings. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve data from. (optional) + * @param string $form Filter by form. You can use this value <code>NT 10-K</code> to find non-timely filings for a company. (optional) + * @param \DateTime $from From date: 2020-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function filingsRequest($symbol = null, $cik = null, $access_number = null, $form = null, $from = null, $to = null) + { + + $resourcePath = '/stock/filings'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($cik)) { + $cik = ObjectSerializer::serializeCollection($cik, '', true); + } + if ($cik !== null) { + $queryParams['cik'] = $cik; + } + // query params + if (is_array($access_number)) { + $access_number = ObjectSerializer::serializeCollection($access_number, '', true); + } + if ($access_number !== null) { + $queryParams['accessNumber'] = $access_number; + } + // query params + if (is_array($form)) { + $form = ObjectSerializer::serializeCollection($form, '', true); + } + if ($form !== null) { + $queryParams['form'] = $form; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation financials + * + * Financial Statements + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $statement Statement can take 1 of these values <code>bs, ic, cf</code> for Balance Sheet, Income Statement, Cash Flow respectively. (required) + * @param string $freq Frequency can take 1 of these values <code>annual, quarterly, ttm, ytd</code>. TTM (Trailing Twelve Months) option is available for Income Statement and Cash Flow. YTD (Year To Date) option is only available for Cash Flow. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\FinancialStatements + */ + public function financials($symbol, $statement, $freq) + { + list($response) = $this->financialsWithHttpInfo($symbol, $statement, $freq); + return $response; + } + + /** + * Operation financialsWithHttpInfo + * + * Financial Statements + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $statement Statement can take 1 of these values <code>bs, ic, cf</code> for Balance Sheet, Income Statement, Cash Flow respectively. (required) + * @param string $freq Frequency can take 1 of these values <code>annual, quarterly, ttm, ytd</code>. TTM (Trailing Twelve Months) option is available for Income Statement and Cash Flow. YTD (Year To Date) option is only available for Cash Flow. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\FinancialStatements, HTTP status code, HTTP response headers (array of strings) + */ + public function financialsWithHttpInfo($symbol, $statement, $freq) + { + $request = $this->financialsRequest($symbol, $statement, $freq); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\FinancialStatements' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\FinancialStatements', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\FinancialStatements'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\FinancialStatements', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation financialsAsync + * + * Financial Statements + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $statement Statement can take 1 of these values <code>bs, ic, cf</code> for Balance Sheet, Income Statement, Cash Flow respectively. (required) + * @param string $freq Frequency can take 1 of these values <code>annual, quarterly, ttm, ytd</code>. TTM (Trailing Twelve Months) option is available for Income Statement and Cash Flow. YTD (Year To Date) option is only available for Cash Flow. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function financialsAsync($symbol, $statement, $freq) + { + return $this->financialsAsyncWithHttpInfo($symbol, $statement, $freq) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation financialsAsyncWithHttpInfo + * + * Financial Statements + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $statement Statement can take 1 of these values <code>bs, ic, cf</code> for Balance Sheet, Income Statement, Cash Flow respectively. (required) + * @param string $freq Frequency can take 1 of these values <code>annual, quarterly, ttm, ytd</code>. TTM (Trailing Twelve Months) option is available for Income Statement and Cash Flow. YTD (Year To Date) option is only available for Cash Flow. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function financialsAsyncWithHttpInfo($symbol, $statement, $freq) + { + $returnType = '\Finnhub\Model\FinancialStatements'; + $request = $this->financialsRequest($symbol, $statement, $freq); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'financials' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param string $statement Statement can take 1 of these values <code>bs, ic, cf</code> for Balance Sheet, Income Statement, Cash Flow respectively. (required) + * @param string $freq Frequency can take 1 of these values <code>annual, quarterly, ttm, ytd</code>. TTM (Trailing Twelve Months) option is available for Income Statement and Cash Flow. YTD (Year To Date) option is only available for Cash Flow. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function financialsRequest($symbol, $statement, $freq) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling financials' + ); + } + // verify the required parameter 'statement' is set + if ($statement === null || (is_array($statement) && count($statement) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $statement when calling financials' + ); + } + // verify the required parameter 'freq' is set + if ($freq === null || (is_array($freq) && count($freq) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $freq when calling financials' + ); + } + + $resourcePath = '/stock/financials'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($statement)) { + $statement = ObjectSerializer::serializeCollection($statement, '', true); + } + if ($statement !== null) { + $queryParams['statement'] = $statement; + } + // query params + if (is_array($freq)) { + $freq = ObjectSerializer::serializeCollection($freq, '', true); + } + if ($freq !== null) { + $queryParams['freq'] = $freq; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation financialsReported + * + * Financials As Reported + * + * @param string $symbol Symbol. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve financials from. (optional) + * @param string $freq Frequency. Can be either <code>annual</code> or <code>quarterly</code>. Default to <code>annual</code>. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\FinancialsAsReported + */ + public function financialsReported($symbol = null, $cik = null, $access_number = null, $freq = null) + { + list($response) = $this->financialsReportedWithHttpInfo($symbol, $cik, $access_number, $freq); + return $response; + } + + /** + * Operation financialsReportedWithHttpInfo + * + * Financials As Reported + * + * @param string $symbol Symbol. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve financials from. (optional) + * @param string $freq Frequency. Can be either <code>annual</code> or <code>quarterly</code>. Default to <code>annual</code>. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\FinancialsAsReported, HTTP status code, HTTP response headers (array of strings) + */ + public function financialsReportedWithHttpInfo($symbol = null, $cik = null, $access_number = null, $freq = null) + { + $request = $this->financialsReportedRequest($symbol, $cik, $access_number, $freq); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\FinancialsAsReported' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\FinancialsAsReported', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\FinancialsAsReported'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\FinancialsAsReported', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation financialsReportedAsync + * + * Financials As Reported + * + * @param string $symbol Symbol. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve financials from. (optional) + * @param string $freq Frequency. Can be either <code>annual</code> or <code>quarterly</code>. Default to <code>annual</code>. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function financialsReportedAsync($symbol = null, $cik = null, $access_number = null, $freq = null) + { + return $this->financialsReportedAsyncWithHttpInfo($symbol, $cik, $access_number, $freq) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation financialsReportedAsyncWithHttpInfo + * + * Financials As Reported + * + * @param string $symbol Symbol. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve financials from. (optional) + * @param string $freq Frequency. Can be either <code>annual</code> or <code>quarterly</code>. Default to <code>annual</code>. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function financialsReportedAsyncWithHttpInfo($symbol = null, $cik = null, $access_number = null, $freq = null) + { + $returnType = '\Finnhub\Model\FinancialsAsReported'; + $request = $this->financialsReportedRequest($symbol, $cik, $access_number, $freq); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'financialsReported' + * + * @param string $symbol Symbol. (optional) + * @param string $cik CIK. (optional) + * @param string $access_number Access number of a specific report you want to retrieve financials from. (optional) + * @param string $freq Frequency. Can be either <code>annual</code> or <code>quarterly</code>. Default to <code>annual</code>. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function financialsReportedRequest($symbol = null, $cik = null, $access_number = null, $freq = null) + { + + $resourcePath = '/stock/financials-reported'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($cik)) { + $cik = ObjectSerializer::serializeCollection($cik, '', true); + } + if ($cik !== null) { + $queryParams['cik'] = $cik; + } + // query params + if (is_array($access_number)) { + $access_number = ObjectSerializer::serializeCollection($access_number, '', true); + } + if ($access_number !== null) { + $queryParams['accessNumber'] = $access_number; + } + // query params + if (is_array($freq)) { + $freq = ObjectSerializer::serializeCollection($freq, '', true); + } + if ($freq !== null) { + $queryParams['freq'] = $freq; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation forexCandles + * + * Forex Candles + * + * @param string $symbol Use symbol returned in <code>/forex/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\ForexCandles + */ + public function forexCandles($symbol, $resolution, $from, $to) + { + list($response) = $this->forexCandlesWithHttpInfo($symbol, $resolution, $from, $to); + return $response; + } + + /** + * Operation forexCandlesWithHttpInfo + * + * Forex Candles + * + * @param string $symbol Use symbol returned in <code>/forex/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\ForexCandles, HTTP status code, HTTP response headers (array of strings) + */ + public function forexCandlesWithHttpInfo($symbol, $resolution, $from, $to) + { + $request = $this->forexCandlesRequest($symbol, $resolution, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\ForexCandles' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\ForexCandles', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\ForexCandles'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\ForexCandles', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation forexCandlesAsync + * + * Forex Candles + * + * @param string $symbol Use symbol returned in <code>/forex/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexCandlesAsync($symbol, $resolution, $from, $to) + { + return $this->forexCandlesAsyncWithHttpInfo($symbol, $resolution, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation forexCandlesAsyncWithHttpInfo + * + * Forex Candles + * + * @param string $symbol Use symbol returned in <code>/forex/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexCandlesAsyncWithHttpInfo($symbol, $resolution, $from, $to) + { + $returnType = '\Finnhub\Model\ForexCandles'; + $request = $this->forexCandlesRequest($symbol, $resolution, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'forexCandles' + * + * @param string $symbol Use symbol returned in <code>/forex/symbol</code> endpoint for this field. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function forexCandlesRequest($symbol, $resolution, $from, $to) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling forexCandles' + ); + } + // verify the required parameter 'resolution' is set + if ($resolution === null || (is_array($resolution) && count($resolution) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resolution when calling forexCandles' + ); + } + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling forexCandles' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling forexCandles' + ); + } + + $resourcePath = '/forex/candle'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($resolution)) { + $resolution = ObjectSerializer::serializeCollection($resolution, '', true); + } + if ($resolution !== null) { + $queryParams['resolution'] = $resolution; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation forexExchanges + * + * Forex Exchanges + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return string[] + */ + public function forexExchanges() + { + list($response) = $this->forexExchangesWithHttpInfo(); + return $response; + } + + /** + * Operation forexExchangesWithHttpInfo + * + * Forex Exchanges + * + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of string[], HTTP status code, HTTP response headers (array of strings) + */ + public function forexExchangesWithHttpInfo() + { + $request = $this->forexExchangesRequest(); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('string[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, 'string[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'string[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation forexExchangesAsync + * + * Forex Exchanges + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexExchangesAsync() + { + return $this->forexExchangesAsyncWithHttpInfo() + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation forexExchangesAsyncWithHttpInfo + * + * Forex Exchanges + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexExchangesAsyncWithHttpInfo() + { + $returnType = 'string[]'; + $request = $this->forexExchangesRequest(); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'forexExchanges' + * + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function forexExchangesRequest() + { + + $resourcePath = '/forex/exchange'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation forexRates + * + * Forex rates + * + * @param string $base Base currency. Default to EUR. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\Forexrates + */ + public function forexRates($base = null) + { + list($response) = $this->forexRatesWithHttpInfo($base); + return $response; + } + + /** + * Operation forexRatesWithHttpInfo + * + * Forex rates + * + * @param string $base Base currency. Default to EUR. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\Forexrates, HTTP status code, HTTP response headers (array of strings) + */ + public function forexRatesWithHttpInfo($base = null) + { + $request = $this->forexRatesRequest($base); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\Forexrates' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\Forexrates', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\Forexrates'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\Forexrates', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation forexRatesAsync + * + * Forex rates + * + * @param string $base Base currency. Default to EUR. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexRatesAsync($base = null) + { + return $this->forexRatesAsyncWithHttpInfo($base) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation forexRatesAsyncWithHttpInfo + * + * Forex rates + * + * @param string $base Base currency. Default to EUR. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexRatesAsyncWithHttpInfo($base = null) + { + $returnType = '\Finnhub\Model\Forexrates'; + $request = $this->forexRatesRequest($base); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'forexRates' + * + * @param string $base Base currency. Default to EUR. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function forexRatesRequest($base = null) + { + + $resourcePath = '/forex/rates'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($base)) { + $base = ObjectSerializer::serializeCollection($base, '', true); + } + if ($base !== null) { + $queryParams['base'] = $base; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation forexSymbols + * + * Forex Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\ForexSymbol[] + */ + public function forexSymbols($exchange) + { + list($response) = $this->forexSymbolsWithHttpInfo($exchange); + return $response; + } + + /** + * Operation forexSymbolsWithHttpInfo + * + * Forex Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\ForexSymbol[], HTTP status code, HTTP response headers (array of strings) + */ + public function forexSymbolsWithHttpInfo($exchange) + { + $request = $this->forexSymbolsRequest($exchange); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\ForexSymbol[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\ForexSymbol[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\ForexSymbol[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\ForexSymbol[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation forexSymbolsAsync + * + * Forex Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexSymbolsAsync($exchange) + { + return $this->forexSymbolsAsyncWithHttpInfo($exchange) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation forexSymbolsAsyncWithHttpInfo + * + * Forex Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function forexSymbolsAsyncWithHttpInfo($exchange) + { + $returnType = '\Finnhub\Model\ForexSymbol[]'; + $request = $this->forexSymbolsRequest($exchange); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'forexSymbols' + * + * @param string $exchange Exchange you want to get the list of symbols from. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function forexSymbolsRequest($exchange) + { + // verify the required parameter 'exchange' is set + if ($exchange === null || (is_array($exchange) && count($exchange) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exchange when calling forexSymbols' + ); + } + + $resourcePath = '/forex/symbol'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($exchange)) { + $exchange = ObjectSerializer::serializeCollection($exchange, '', true); + } + if ($exchange !== null) { + $queryParams['exchange'] = $exchange; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation fundOwnership + * + * Fund Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\FundOwnership + */ + public function fundOwnership($symbol, $limit = null) + { + list($response) = $this->fundOwnershipWithHttpInfo($symbol, $limit); + return $response; + } + + /** + * Operation fundOwnershipWithHttpInfo + * + * Fund Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\FundOwnership, HTTP status code, HTTP response headers (array of strings) + */ + public function fundOwnershipWithHttpInfo($symbol, $limit = null) + { + $request = $this->fundOwnershipRequest($symbol, $limit); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\FundOwnership' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\FundOwnership', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\FundOwnership'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\FundOwnership', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation fundOwnershipAsync + * + * Fund Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fundOwnershipAsync($symbol, $limit = null) + { + return $this->fundOwnershipAsyncWithHttpInfo($symbol, $limit) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation fundOwnershipAsyncWithHttpInfo + * + * Fund Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function fundOwnershipAsyncWithHttpInfo($symbol, $limit = null) + { + $returnType = '\Finnhub\Model\FundOwnership'; + $request = $this->fundOwnershipRequest($symbol, $limit); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'fundOwnership' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function fundOwnershipRequest($symbol, $limit = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling fundOwnership' + ); + } + + $resourcePath = '/stock/fund-ownership'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation generalNews + * + * General News + * + * @param string $category This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>. (required) + * @param string $min_id Use this field to get only news after this ID. Default to 0 (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\News[] + */ + public function generalNews($category, $min_id = null) + { + list($response) = $this->generalNewsWithHttpInfo($category, $min_id); + return $response; + } + + /** + * Operation generalNewsWithHttpInfo + * + * General News + * + * @param string $category This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>. (required) + * @param string $min_id Use this field to get only news after this ID. Default to 0 (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\News[], HTTP status code, HTTP response headers (array of strings) + */ + public function generalNewsWithHttpInfo($category, $min_id = null) + { + $request = $this->generalNewsRequest($category, $min_id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\News[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\News[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\News[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\News[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation generalNewsAsync + * + * General News + * + * @param string $category This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>. (required) + * @param string $min_id Use this field to get only news after this ID. Default to 0 (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function generalNewsAsync($category, $min_id = null) + { + return $this->generalNewsAsyncWithHttpInfo($category, $min_id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation generalNewsAsyncWithHttpInfo + * + * General News + * + * @param string $category This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>. (required) + * @param string $min_id Use this field to get only news after this ID. Default to 0 (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function generalNewsAsyncWithHttpInfo($category, $min_id = null) + { + $returnType = '\Finnhub\Model\News[]'; + $request = $this->generalNewsRequest($category, $min_id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'generalNews' + * + * @param string $category This parameter can be 1 of the following values <code>general, forex, crypto, merger</code>. (required) + * @param string $min_id Use this field to get only news after this ID. Default to 0 (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function generalNewsRequest($category, $min_id = null) + { + // verify the required parameter 'category' is set + if ($category === null || (is_array($category) && count($category) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $category when calling generalNews' + ); + } + + $resourcePath = '/news'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($category)) { + $category = ObjectSerializer::serializeCollection($category, '', true); + } + if ($category !== null) { + $queryParams['category'] = $category; + } + // query params + if (is_array($min_id)) { + $min_id = ObjectSerializer::serializeCollection($min_id, '', true); + } + if ($min_id !== null) { + $queryParams['minId'] = $min_id; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation investorsOwnership + * + * Investors Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\InvestorsOwnership + */ + public function investorsOwnership($symbol, $limit = null) + { + list($response) = $this->investorsOwnershipWithHttpInfo($symbol, $limit); + return $response; + } + + /** + * Operation investorsOwnershipWithHttpInfo + * + * Investors Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\InvestorsOwnership, HTTP status code, HTTP response headers (array of strings) + */ + public function investorsOwnershipWithHttpInfo($symbol, $limit = null) + { + $request = $this->investorsOwnershipRequest($symbol, $limit); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\InvestorsOwnership' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\InvestorsOwnership', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\InvestorsOwnership'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\InvestorsOwnership', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation investorsOwnershipAsync + * + * Investors Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function investorsOwnershipAsync($symbol, $limit = null) + { + return $this->investorsOwnershipAsyncWithHttpInfo($symbol, $limit) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation investorsOwnershipAsyncWithHttpInfo + * + * Investors Ownership + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function investorsOwnershipAsyncWithHttpInfo($symbol, $limit = null) + { + $returnType = '\Finnhub\Model\InvestorsOwnership'; + $request = $this->investorsOwnershipRequest($symbol, $limit); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'investorsOwnership' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * @param int $limit Limit number of results. Leave empty to get the full list. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function investorsOwnershipRequest($symbol, $limit = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling investorsOwnership' + ); + } + + $resourcePath = '/stock/investor-ownership'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation ipoCalendar + * + * IPO Calendar + * + * @param \DateTime $from From date: 2020-03-15. (required) + * @param \DateTime $to To date: 2020-03-16. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\IPOCalendar + */ + public function ipoCalendar($from, $to) + { + list($response) = $this->ipoCalendarWithHttpInfo($from, $to); + return $response; + } + + /** + * Operation ipoCalendarWithHttpInfo + * + * IPO Calendar + * + * @param \DateTime $from From date: 2020-03-15. (required) + * @param \DateTime $to To date: 2020-03-16. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\IPOCalendar, HTTP status code, HTTP response headers (array of strings) + */ + public function ipoCalendarWithHttpInfo($from, $to) + { + $request = $this->ipoCalendarRequest($from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\IPOCalendar' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\IPOCalendar', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\IPOCalendar'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\IPOCalendar', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation ipoCalendarAsync + * + * IPO Calendar + * + * @param \DateTime $from From date: 2020-03-15. (required) + * @param \DateTime $to To date: 2020-03-16. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function ipoCalendarAsync($from, $to) + { + return $this->ipoCalendarAsyncWithHttpInfo($from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation ipoCalendarAsyncWithHttpInfo + * + * IPO Calendar + * + * @param \DateTime $from From date: 2020-03-15. (required) + * @param \DateTime $to To date: 2020-03-16. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function ipoCalendarAsyncWithHttpInfo($from, $to) + { + $returnType = '\Finnhub\Model\IPOCalendar'; + $request = $this->ipoCalendarRequest($from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'ipoCalendar' + * + * @param \DateTime $from From date: 2020-03-15. (required) + * @param \DateTime $to To date: 2020-03-16. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function ipoCalendarRequest($from, $to) + { + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling ipoCalendar' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling ipoCalendar' + ); + } + + $resourcePath = '/calendar/ipo'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation majorDevelopments + * + * Major Developments + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From time: 2020-01-01. (optional) + * @param \DateTime $to To time: 2020-01-05. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\MajorDevelopments + */ + public function majorDevelopments($symbol, $from = null, $to = null) + { + list($response) = $this->majorDevelopmentsWithHttpInfo($symbol, $from, $to); + return $response; + } + + /** + * Operation majorDevelopmentsWithHttpInfo + * + * Major Developments + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From time: 2020-01-01. (optional) + * @param \DateTime $to To time: 2020-01-05. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\MajorDevelopments, HTTP status code, HTTP response headers (array of strings) + */ + public function majorDevelopmentsWithHttpInfo($symbol, $from = null, $to = null) + { + $request = $this->majorDevelopmentsRequest($symbol, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\MajorDevelopments' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\MajorDevelopments', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\MajorDevelopments'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\MajorDevelopments', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation majorDevelopmentsAsync + * + * Major Developments + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From time: 2020-01-01. (optional) + * @param \DateTime $to To time: 2020-01-05. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function majorDevelopmentsAsync($symbol, $from = null, $to = null) + { + return $this->majorDevelopmentsAsyncWithHttpInfo($symbol, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation majorDevelopmentsAsyncWithHttpInfo + * + * Major Developments + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From time: 2020-01-01. (optional) + * @param \DateTime $to To time: 2020-01-05. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function majorDevelopmentsAsyncWithHttpInfo($symbol, $from = null, $to = null) + { + $returnType = '\Finnhub\Model\MajorDevelopments'; + $request = $this->majorDevelopmentsRequest($symbol, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'majorDevelopments' + * + * @param string $symbol Company symbol. (required) + * @param \DateTime $from From time: 2020-01-01. (optional) + * @param \DateTime $to To time: 2020-01-05. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function majorDevelopmentsRequest($symbol, $from = null, $to = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling majorDevelopments' + ); + } + + $resourcePath = '/major-development'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation newsSentiment + * + * News Sentiment + * + * @param string $symbol Company symbol. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\NewsSentiment + */ + public function newsSentiment($symbol) + { + list($response) = $this->newsSentimentWithHttpInfo($symbol); + return $response; + } + + /** + * Operation newsSentimentWithHttpInfo + * + * News Sentiment + * + * @param string $symbol Company symbol. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\NewsSentiment, HTTP status code, HTTP response headers (array of strings) + */ + public function newsSentimentWithHttpInfo($symbol) + { + $request = $this->newsSentimentRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\NewsSentiment' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\NewsSentiment', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\NewsSentiment'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\NewsSentiment', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation newsSentimentAsync + * + * News Sentiment + * + * @param string $symbol Company symbol. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function newsSentimentAsync($symbol) + { + return $this->newsSentimentAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation newsSentimentAsyncWithHttpInfo + * + * News Sentiment + * + * @param string $symbol Company symbol. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function newsSentimentAsyncWithHttpInfo($symbol) + { + $returnType = '\Finnhub\Model\NewsSentiment'; + $request = $this->newsSentimentRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'newsSentiment' + * + * @param string $symbol Company symbol. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function newsSentimentRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling newsSentiment' + ); + } + + $resourcePath = '/news-sentiment'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation patternRecognition + * + * Pattern Recognition + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\PatternRecognition + */ + public function patternRecognition($symbol, $resolution) + { + list($response) = $this->patternRecognitionWithHttpInfo($symbol, $resolution); + return $response; + } + + /** + * Operation patternRecognitionWithHttpInfo + * + * Pattern Recognition + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\PatternRecognition, HTTP status code, HTTP response headers (array of strings) + */ + public function patternRecognitionWithHttpInfo($symbol, $resolution) + { + $request = $this->patternRecognitionRequest($symbol, $resolution); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\PatternRecognition' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\PatternRecognition', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\PatternRecognition'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\PatternRecognition', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation patternRecognitionAsync + * + * Pattern Recognition + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function patternRecognitionAsync($symbol, $resolution) + { + return $this->patternRecognitionAsyncWithHttpInfo($symbol, $resolution) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation patternRecognitionAsyncWithHttpInfo + * + * Pattern Recognition + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function patternRecognitionAsyncWithHttpInfo($symbol, $resolution) + { + $returnType = '\Finnhub\Model\PatternRecognition'; + $request = $this->patternRecognitionRequest($symbol, $resolution); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'patternRecognition' + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function patternRecognitionRequest($symbol, $resolution) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling patternRecognition' + ); + } + // verify the required parameter 'resolution' is set + if ($resolution === null || (is_array($resolution) && count($resolution) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resolution when calling patternRecognition' + ); + } + + $resourcePath = '/scan/pattern'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($resolution)) { + $resolution = ObjectSerializer::serializeCollection($resolution, '', true); + } + if ($resolution !== null) { + $queryParams['resolution'] = $resolution; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation priceTarget + * + * Price Target + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\PriceTarget + */ + public function priceTarget($symbol) + { + list($response) = $this->priceTargetWithHttpInfo($symbol); + return $response; + } + + /** + * Operation priceTargetWithHttpInfo + * + * Price Target + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\PriceTarget, HTTP status code, HTTP response headers (array of strings) + */ + public function priceTargetWithHttpInfo($symbol) + { + $request = $this->priceTargetRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\PriceTarget' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\PriceTarget', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\PriceTarget'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\PriceTarget', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation priceTargetAsync + * + * Price Target + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function priceTargetAsync($symbol) + { + return $this->priceTargetAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation priceTargetAsyncWithHttpInfo + * + * Price Target + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function priceTargetAsyncWithHttpInfo($symbol) + { + $returnType = '\Finnhub\Model\PriceTarget'; + $request = $this->priceTargetRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'priceTarget' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function priceTargetRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling priceTarget' + ); + } + + $resourcePath = '/stock/price-target'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation quote + * + * Quote + * + * @param string $symbol Symbol (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\Quote + */ + public function quote($symbol) + { + list($response) = $this->quoteWithHttpInfo($symbol); + return $response; + } + + /** + * Operation quoteWithHttpInfo + * + * Quote + * + * @param string $symbol Symbol (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\Quote, HTTP status code, HTTP response headers (array of strings) + */ + public function quoteWithHttpInfo($symbol) + { + $request = $this->quoteRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\Quote' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\Quote', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\Quote'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\Quote', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation quoteAsync + * + * Quote + * + * @param string $symbol Symbol (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function quoteAsync($symbol) + { + return $this->quoteAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation quoteAsyncWithHttpInfo + * + * Quote + * + * @param string $symbol Symbol (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function quoteAsyncWithHttpInfo($symbol) + { + $returnType = '\Finnhub\Model\Quote'; + $request = $this->quoteRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'quote' + * + * @param string $symbol Symbol (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function quoteRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling quote' + ); + } + + $resourcePath = '/quote'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation recommendationTrends + * + * Recommendation Trends + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\RecommendationTrend[] + */ + public function recommendationTrends($symbol) + { + list($response) = $this->recommendationTrendsWithHttpInfo($symbol); + return $response; + } + + /** + * Operation recommendationTrendsWithHttpInfo + * + * Recommendation Trends + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\RecommendationTrend[], HTTP status code, HTTP response headers (array of strings) + */ + public function recommendationTrendsWithHttpInfo($symbol) + { + $request = $this->recommendationTrendsRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\RecommendationTrend[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\RecommendationTrend[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\RecommendationTrend[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\RecommendationTrend[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation recommendationTrendsAsync + * + * Recommendation Trends + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recommendationTrendsAsync($symbol) + { + return $this->recommendationTrendsAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation recommendationTrendsAsyncWithHttpInfo + * + * Recommendation Trends + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function recommendationTrendsAsyncWithHttpInfo($symbol) + { + $returnType = '\Finnhub\Model\RecommendationTrend[]'; + $request = $this->recommendationTrendsRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'recommendationTrends' + * + * @param string $symbol Symbol of the company: AAPL. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function recommendationTrendsRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling recommendationTrends' + ); + } + + $resourcePath = '/stock/recommendation'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation stockBidask + * + * Last Bid-Ask + * + * @param string $symbol Symbol. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\LastBidAsk + */ + public function stockBidask($symbol) + { + list($response) = $this->stockBidaskWithHttpInfo($symbol); + return $response; + } + + /** + * Operation stockBidaskWithHttpInfo + * + * Last Bid-Ask + * + * @param string $symbol Symbol. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\LastBidAsk, HTTP status code, HTTP response headers (array of strings) + */ + public function stockBidaskWithHttpInfo($symbol) + { + $request = $this->stockBidaskRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\LastBidAsk' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\LastBidAsk', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\LastBidAsk'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\LastBidAsk', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation stockBidaskAsync + * + * Last Bid-Ask + * + * @param string $symbol Symbol. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockBidaskAsync($symbol) + { + return $this->stockBidaskAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation stockBidaskAsyncWithHttpInfo + * + * Last Bid-Ask + * + * @param string $symbol Symbol. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockBidaskAsyncWithHttpInfo($symbol) + { + $returnType = '\Finnhub\Model\LastBidAsk'; + $request = $this->stockBidaskRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'stockBidask' + * + * @param string $symbol Symbol. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function stockBidaskRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling stockBidask' + ); + } + + $resourcePath = '/stock/bidask'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation stockCandles + * + * Stock Candles + * + * @param string $symbol Symbol. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $adjusted By default, <code>adjusted=false</code>. Use <code>true</code> to get adjusted data. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\StockCandles + */ + public function stockCandles($symbol, $resolution, $from, $to, $adjusted = null) + { + list($response) = $this->stockCandlesWithHttpInfo($symbol, $resolution, $from, $to, $adjusted); + return $response; + } + + /** + * Operation stockCandlesWithHttpInfo + * + * Stock Candles + * + * @param string $symbol Symbol. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $adjusted By default, <code>adjusted=false</code>. Use <code>true</code> to get adjusted data. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\StockCandles, HTTP status code, HTTP response headers (array of strings) + */ + public function stockCandlesWithHttpInfo($symbol, $resolution, $from, $to, $adjusted = null) + { + $request = $this->stockCandlesRequest($symbol, $resolution, $from, $to, $adjusted); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\StockCandles' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\StockCandles', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\StockCandles'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\StockCandles', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation stockCandlesAsync + * + * Stock Candles + * + * @param string $symbol Symbol. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $adjusted By default, <code>adjusted=false</code>. Use <code>true</code> to get adjusted data. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockCandlesAsync($symbol, $resolution, $from, $to, $adjusted = null) + { + return $this->stockCandlesAsyncWithHttpInfo($symbol, $resolution, $from, $to, $adjusted) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation stockCandlesAsyncWithHttpInfo + * + * Stock Candles + * + * @param string $symbol Symbol. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $adjusted By default, <code>adjusted=false</code>. Use <code>true</code> to get adjusted data. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockCandlesAsyncWithHttpInfo($symbol, $resolution, $from, $to, $adjusted = null) + { + $returnType = '\Finnhub\Model\StockCandles'; + $request = $this->stockCandlesRequest($symbol, $resolution, $from, $to, $adjusted); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'stockCandles' + * + * @param string $symbol Symbol. (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $adjusted By default, <code>adjusted=false</code>. Use <code>true</code> to get adjusted data. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function stockCandlesRequest($symbol, $resolution, $from, $to, $adjusted = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling stockCandles' + ); + } + // verify the required parameter 'resolution' is set + if ($resolution === null || (is_array($resolution) && count($resolution) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resolution when calling stockCandles' + ); + } + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling stockCandles' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling stockCandles' + ); + } + + $resourcePath = '/stock/candle'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($resolution)) { + $resolution = ObjectSerializer::serializeCollection($resolution, '', true); + } + if ($resolution !== null) { + $queryParams['resolution'] = $resolution; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + // query params + if (is_array($adjusted)) { + $adjusted = ObjectSerializer::serializeCollection($adjusted, '', true); + } + if ($adjusted !== null) { + $queryParams['adjusted'] = $adjusted; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation stockDividends + * + * Dividends + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\Dividends[] + */ + public function stockDividends($symbol, $from, $to) + { + list($response) = $this->stockDividendsWithHttpInfo($symbol, $from, $to); + return $response; + } + + /** + * Operation stockDividendsWithHttpInfo + * + * Dividends + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\Dividends[], HTTP status code, HTTP response headers (array of strings) + */ + public function stockDividendsWithHttpInfo($symbol, $from, $to) + { + $request = $this->stockDividendsRequest($symbol, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\Dividends[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\Dividends[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\Dividends[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\Dividends[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation stockDividendsAsync + * + * Dividends + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockDividendsAsync($symbol, $from, $to) + { + return $this->stockDividendsAsyncWithHttpInfo($symbol, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation stockDividendsAsyncWithHttpInfo + * + * Dividends + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockDividendsAsyncWithHttpInfo($symbol, $from, $to) + { + $returnType = '\Finnhub\Model\Dividends[]'; + $request = $this->stockDividendsRequest($symbol, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'stockDividends' + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function stockDividendsRequest($symbol, $from, $to) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling stockDividends' + ); + } + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling stockDividends' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling stockDividends' + ); + } + + $resourcePath = '/stock/dividend'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation stockSplits + * + * Splits + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\Split[] + */ + public function stockSplits($symbol, $from, $to) + { + list($response) = $this->stockSplitsWithHttpInfo($symbol, $from, $to); + return $response; + } + + /** + * Operation stockSplitsWithHttpInfo + * + * Splits + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\Split[], HTTP status code, HTTP response headers (array of strings) + */ + public function stockSplitsWithHttpInfo($symbol, $from, $to) + { + $request = $this->stockSplitsRequest($symbol, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\Split[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\Split[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\Split[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\Split[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation stockSplitsAsync + * + * Splits + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockSplitsAsync($symbol, $from, $to) + { + return $this->stockSplitsAsyncWithHttpInfo($symbol, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation stockSplitsAsyncWithHttpInfo + * + * Splits + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockSplitsAsyncWithHttpInfo($symbol, $from, $to) + { + $returnType = '\Finnhub\Model\Split[]'; + $request = $this->stockSplitsRequest($symbol, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'stockSplits' + * + * @param string $symbol Symbol. (required) + * @param \DateTime $from YYYY-MM-DD. (required) + * @param \DateTime $to YYYY-MM-DD. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function stockSplitsRequest($symbol, $from, $to) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling stockSplits' + ); + } + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling stockSplits' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling stockSplits' + ); + } + + $resourcePath = '/stock/split'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation stockSymbols + * + * Stock Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. List of exchanges with fundamental data can be found <a href=\"https://docs.google.com/spreadsheets/d/1I3pBxjfXB056-g_JYf_6o3Rns3BV2kMGG1nCatb91ls/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\Stock[] + */ + public function stockSymbols($exchange) + { + list($response) = $this->stockSymbolsWithHttpInfo($exchange); + return $response; + } + + /** + * Operation stockSymbolsWithHttpInfo + * + * Stock Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. List of exchanges with fundamental data can be found <a href=\"https://docs.google.com/spreadsheets/d/1I3pBxjfXB056-g_JYf_6o3Rns3BV2kMGG1nCatb91ls/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\Stock[], HTTP status code, HTTP response headers (array of strings) + */ + public function stockSymbolsWithHttpInfo($exchange) + { + $request = $this->stockSymbolsRequest($exchange); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\Stock[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\Stock[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\Stock[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\Stock[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation stockSymbolsAsync + * + * Stock Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. List of exchanges with fundamental data can be found <a href=\"https://docs.google.com/spreadsheets/d/1I3pBxjfXB056-g_JYf_6o3Rns3BV2kMGG1nCatb91ls/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockSymbolsAsync($exchange) + { + return $this->stockSymbolsAsyncWithHttpInfo($exchange) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation stockSymbolsAsyncWithHttpInfo + * + * Stock Symbol + * + * @param string $exchange Exchange you want to get the list of symbols from. List of exchanges with fundamental data can be found <a href=\"https://docs.google.com/spreadsheets/d/1I3pBxjfXB056-g_JYf_6o3Rns3BV2kMGG1nCatb91ls/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockSymbolsAsyncWithHttpInfo($exchange) + { + $returnType = '\Finnhub\Model\Stock[]'; + $request = $this->stockSymbolsRequest($exchange); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'stockSymbols' + * + * @param string $exchange Exchange you want to get the list of symbols from. List of exchanges with fundamental data can be found <a href=\"https://docs.google.com/spreadsheets/d/1I3pBxjfXB056-g_JYf_6o3Rns3BV2kMGG1nCatb91ls/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function stockSymbolsRequest($exchange) + { + // verify the required parameter 'exchange' is set + if ($exchange === null || (is_array($exchange) && count($exchange) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $exchange when calling stockSymbols' + ); + } + + $resourcePath = '/stock/symbol'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($exchange)) { + $exchange = ObjectSerializer::serializeCollection($exchange, '', true); + } + if ($exchange !== null) { + $queryParams['exchange'] = $exchange; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation stockTick + * + * Tick Data + * + * @param string $symbol Symbol. (required) + * @param \DateTime $date Date: 2020-04-02. (required) + * @param int $limit Limit number of ticks returned. Maximum value: <code>25000</code> (required) + * @param int $skip Number of ticks to skip. Use this parameter to loop through the entire data. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\TickData + */ + public function stockTick($symbol, $date, $limit, $skip) + { + list($response) = $this->stockTickWithHttpInfo($symbol, $date, $limit, $skip); + return $response; + } + + /** + * Operation stockTickWithHttpInfo + * + * Tick Data + * + * @param string $symbol Symbol. (required) + * @param \DateTime $date Date: 2020-04-02. (required) + * @param int $limit Limit number of ticks returned. Maximum value: <code>25000</code> (required) + * @param int $skip Number of ticks to skip. Use this parameter to loop through the entire data. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\TickData, HTTP status code, HTTP response headers (array of strings) + */ + public function stockTickWithHttpInfo($symbol, $date, $limit, $skip) + { + $request = $this->stockTickRequest($symbol, $date, $limit, $skip); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\TickData' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\TickData', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\TickData'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\TickData', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation stockTickAsync + * + * Tick Data + * + * @param string $symbol Symbol. (required) + * @param \DateTime $date Date: 2020-04-02. (required) + * @param int $limit Limit number of ticks returned. Maximum value: <code>25000</code> (required) + * @param int $skip Number of ticks to skip. Use this parameter to loop through the entire data. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockTickAsync($symbol, $date, $limit, $skip) + { + return $this->stockTickAsyncWithHttpInfo($symbol, $date, $limit, $skip) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation stockTickAsyncWithHttpInfo + * + * Tick Data + * + * @param string $symbol Symbol. (required) + * @param \DateTime $date Date: 2020-04-02. (required) + * @param int $limit Limit number of ticks returned. Maximum value: <code>25000</code> (required) + * @param int $skip Number of ticks to skip. Use this parameter to loop through the entire data. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function stockTickAsyncWithHttpInfo($symbol, $date, $limit, $skip) + { + $returnType = '\Finnhub\Model\TickData'; + $request = $this->stockTickRequest($symbol, $date, $limit, $skip); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'stockTick' + * + * @param string $symbol Symbol. (required) + * @param \DateTime $date Date: 2020-04-02. (required) + * @param int $limit Limit number of ticks returned. Maximum value: <code>25000</code> (required) + * @param int $skip Number of ticks to skip. Use this parameter to loop through the entire data. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function stockTickRequest($symbol, $date, $limit, $skip) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling stockTick' + ); + } + // verify the required parameter 'date' is set + if ($date === null || (is_array($date) && count($date) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $date when calling stockTick' + ); + } + // verify the required parameter 'limit' is set + if ($limit === null || (is_array($limit) && count($limit) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $limit when calling stockTick' + ); + } + // verify the required parameter 'skip' is set + if ($skip === null || (is_array($skip) && count($skip) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $skip when calling stockTick' + ); + } + + $resourcePath = '/stock/tick'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($date)) { + $date = ObjectSerializer::serializeCollection($date, '', true); + } + if ($date !== null) { + $queryParams['date'] = $date; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($skip)) { + $skip = ObjectSerializer::serializeCollection($skip, '', true); + } + if ($skip !== null) { + $queryParams['skip'] = $skip; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation supportResistance + * + * Support/Resistance + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\SupportResistance + */ + public function supportResistance($symbol, $resolution) + { + list($response) = $this->supportResistanceWithHttpInfo($symbol, $resolution); + return $response; + } + + /** + * Operation supportResistanceWithHttpInfo + * + * Support/Resistance + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\SupportResistance, HTTP status code, HTTP response headers (array of strings) + */ + public function supportResistanceWithHttpInfo($symbol, $resolution) + { + $request = $this->supportResistanceRequest($symbol, $resolution); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\SupportResistance' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\SupportResistance', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\SupportResistance'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\SupportResistance', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation supportResistanceAsync + * + * Support/Resistance + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function supportResistanceAsync($symbol, $resolution) + { + return $this->supportResistanceAsyncWithHttpInfo($symbol, $resolution) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation supportResistanceAsyncWithHttpInfo + * + * Support/Resistance + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function supportResistanceAsyncWithHttpInfo($symbol, $resolution) + { + $returnType = '\Finnhub\Model\SupportResistance'; + $request = $this->supportResistanceRequest($symbol, $resolution); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'supportResistance' + * + * @param string $symbol Symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function supportResistanceRequest($symbol, $resolution) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling supportResistance' + ); + } + // verify the required parameter 'resolution' is set + if ($resolution === null || (is_array($resolution) && count($resolution) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resolution when calling supportResistance' + ); + } + + $resourcePath = '/scan/support-resistance'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($resolution)) { + $resolution = ObjectSerializer::serializeCollection($resolution, '', true); + } + if ($resolution !== null) { + $queryParams['resolution'] = $resolution; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation technicalIndicator + * + * Technical Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $indicator Indicator name. Full list can be found <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * @param object $indicator_fields Check out <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">this page</a> to see which indicators and params are supported. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return object + */ + public function technicalIndicator($symbol, $resolution, $from, $to, $indicator, $indicator_fields = null) + { + list($response) = $this->technicalIndicatorWithHttpInfo($symbol, $resolution, $from, $to, $indicator, $indicator_fields); + return $response; + } + + /** + * Operation technicalIndicatorWithHttpInfo + * + * Technical Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $indicator Indicator name. Full list can be found <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * @param object $indicator_fields Check out <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">this page</a> to see which indicators and params are supported. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of object, HTTP status code, HTTP response headers (array of strings) + */ + public function technicalIndicatorWithHttpInfo($symbol, $resolution, $from, $to, $indicator, $indicator_fields = null) + { + $request = $this->technicalIndicatorRequest($symbol, $resolution, $from, $to, $indicator, $indicator_fields); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('object' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, 'object', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = 'object'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'object', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation technicalIndicatorAsync + * + * Technical Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $indicator Indicator name. Full list can be found <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * @param object $indicator_fields Check out <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">this page</a> to see which indicators and params are supported. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function technicalIndicatorAsync($symbol, $resolution, $from, $to, $indicator, $indicator_fields = null) + { + return $this->technicalIndicatorAsyncWithHttpInfo($symbol, $resolution, $from, $to, $indicator, $indicator_fields) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation technicalIndicatorAsyncWithHttpInfo + * + * Technical Indicators + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $indicator Indicator name. Full list can be found <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * @param object $indicator_fields Check out <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">this page</a> to see which indicators and params are supported. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function technicalIndicatorAsyncWithHttpInfo($symbol, $resolution, $from, $to, $indicator, $indicator_fields = null) + { + $returnType = 'object'; + $request = $this->technicalIndicatorRequest($symbol, $resolution, $from, $to, $indicator, $indicator_fields); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'technicalIndicator' + * + * @param string $symbol symbol (required) + * @param string $resolution Supported resolution includes <code>1, 5, 15, 30, 60, D, W, M </code>.Some timeframes might not be available depending on the exchange. (required) + * @param int $from UNIX timestamp. Interval initial value. (required) + * @param int $to UNIX timestamp. Interval end value. (required) + * @param string $indicator Indicator name. Full list can be found <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">here</a>. (required) + * @param object $indicator_fields Check out <a href=\"https://docs.google.com/spreadsheets/d/1ylUvKHVYN2E87WdwIza8ROaCpd48ggEl1k5i5SgA29k/edit?usp=sharing\" target=\"_blank\">this page</a> to see which indicators and params are supported. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function technicalIndicatorRequest($symbol, $resolution, $from, $to, $indicator, $indicator_fields = null) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling technicalIndicator' + ); + } + // verify the required parameter 'resolution' is set + if ($resolution === null || (is_array($resolution) && count($resolution) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resolution when calling technicalIndicator' + ); + } + // verify the required parameter 'from' is set + if ($from === null || (is_array($from) && count($from) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $from when calling technicalIndicator' + ); + } + // verify the required parameter 'to' is set + if ($to === null || (is_array($to) && count($to) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $to when calling technicalIndicator' + ); + } + // verify the required parameter 'indicator' is set + if ($indicator === null || (is_array($indicator) && count($indicator) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $indicator when calling technicalIndicator' + ); + } + + $resourcePath = '/indicator'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($resolution)) { + $resolution = ObjectSerializer::serializeCollection($resolution, '', true); + } + if ($resolution !== null) { + $queryParams['resolution'] = $resolution; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + // query params + if (is_array($indicator)) { + $indicator = ObjectSerializer::serializeCollection($indicator, '', true); + } + if ($indicator !== null) { + $queryParams['indicator'] = $indicator; + } + + + + // body params + $_tempBody = null; + if (isset($indicator_fields)) { + $_tempBody = $indicator_fields; + } + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'POST', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation transcripts + * + * Earnings Call Transcripts + * + * @param string $id Transcript's id obtained with <a href=\"#transcripts-list\">Transcripts List endpoint</a>. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\EarningsCallTranscripts + */ + public function transcripts($id) + { + list($response) = $this->transcriptsWithHttpInfo($id); + return $response; + } + + /** + * Operation transcriptsWithHttpInfo + * + * Earnings Call Transcripts + * + * @param string $id Transcript's id obtained with <a href=\"#transcripts-list\">Transcripts List endpoint</a>. (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\EarningsCallTranscripts, HTTP status code, HTTP response headers (array of strings) + */ + public function transcriptsWithHttpInfo($id) + { + $request = $this->transcriptsRequest($id); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\EarningsCallTranscripts' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\EarningsCallTranscripts', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\EarningsCallTranscripts'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\EarningsCallTranscripts', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transcriptsAsync + * + * Earnings Call Transcripts + * + * @param string $id Transcript's id obtained with <a href=\"#transcripts-list\">Transcripts List endpoint</a>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transcriptsAsync($id) + { + return $this->transcriptsAsyncWithHttpInfo($id) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transcriptsAsyncWithHttpInfo + * + * Earnings Call Transcripts + * + * @param string $id Transcript's id obtained with <a href=\"#transcripts-list\">Transcripts List endpoint</a>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transcriptsAsyncWithHttpInfo($id) + { + $returnType = '\Finnhub\Model\EarningsCallTranscripts'; + $request = $this->transcriptsRequest($id); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'transcripts' + * + * @param string $id Transcript's id obtained with <a href=\"#transcripts-list\">Transcripts List endpoint</a>. (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function transcriptsRequest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling transcripts' + ); + } + + $resourcePath = '/stock/transcripts'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($id)) { + $id = ObjectSerializer::serializeCollection($id, '', true); + } + if ($id !== null) { + $queryParams['id'] = $id; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation transcriptsList + * + * Earnings Call Transcripts List + * + * @param string $symbol Company symbol: AAPL. Leave empty to list the latest transcripts (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\EarningsCallTranscriptsList + */ + public function transcriptsList($symbol) + { + list($response) = $this->transcriptsListWithHttpInfo($symbol); + return $response; + } + + /** + * Operation transcriptsListWithHttpInfo + * + * Earnings Call Transcripts List + * + * @param string $symbol Company symbol: AAPL. Leave empty to list the latest transcripts (required) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\EarningsCallTranscriptsList, HTTP status code, HTTP response headers (array of strings) + */ + public function transcriptsListWithHttpInfo($symbol) + { + $request = $this->transcriptsListRequest($symbol); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\EarningsCallTranscriptsList' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\EarningsCallTranscriptsList', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\EarningsCallTranscriptsList'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\EarningsCallTranscriptsList', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation transcriptsListAsync + * + * Earnings Call Transcripts List + * + * @param string $symbol Company symbol: AAPL. Leave empty to list the latest transcripts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transcriptsListAsync($symbol) + { + return $this->transcriptsListAsyncWithHttpInfo($symbol) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation transcriptsListAsyncWithHttpInfo + * + * Earnings Call Transcripts List + * + * @param string $symbol Company symbol: AAPL. Leave empty to list the latest transcripts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function transcriptsListAsyncWithHttpInfo($symbol) + { + $returnType = '\Finnhub\Model\EarningsCallTranscriptsList'; + $request = $this->transcriptsListRequest($symbol); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'transcriptsList' + * + * @param string $symbol Company symbol: AAPL. Leave empty to list the latest transcripts (required) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function transcriptsListRequest($symbol) + { + // verify the required parameter 'symbol' is set + if ($symbol === null || (is_array($symbol) && count($symbol) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $symbol when calling transcriptsList' + ); + } + + $resourcePath = '/stock/transcripts/list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation upgradeDowngrade + * + * Stock Upgrade/Downgrade + * + * @param string $symbol Symbol of the company: AAPL. If left blank, the API will return latest stock upgrades/downgrades. (optional) + * @param \DateTime $from From date: 2000-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return \Finnhub\Model\UpgradeDowngrade[] + */ + public function upgradeDowngrade($symbol = null, $from = null, $to = null) + { + list($response) = $this->upgradeDowngradeWithHttpInfo($symbol, $from, $to); + return $response; + } + + /** + * Operation upgradeDowngradeWithHttpInfo + * + * Stock Upgrade/Downgrade + * + * @param string $symbol Symbol of the company: AAPL. If left blank, the API will return latest stock upgrades/downgrades. (optional) + * @param \DateTime $from From date: 2000-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \Finnhub\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return array of \Finnhub\Model\UpgradeDowngrade[], HTTP status code, HTTP response headers (array of strings) + */ + public function upgradeDowngradeWithHttpInfo($symbol = null, $from = null, $to = null) + { + $request = $this->upgradeDowngradeRequest($symbol, $from, $to); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } + + $statusCode = $response->getStatusCode(); + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + + $responseBody = $response->getBody(); + switch($statusCode) { + case 200: + if ('\Finnhub\Model\UpgradeDowngrade[]' === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, '\Finnhub\Model\UpgradeDowngrade[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + $returnType = '\Finnhub\Model\UpgradeDowngrade[]'; + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Finnhub\Model\UpgradeDowngrade[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation upgradeDowngradeAsync + * + * Stock Upgrade/Downgrade + * + * @param string $symbol Symbol of the company: AAPL. If left blank, the API will return latest stock upgrades/downgrades. (optional) + * @param \DateTime $from From date: 2000-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upgradeDowngradeAsync($symbol = null, $from = null, $to = null) + { + return $this->upgradeDowngradeAsyncWithHttpInfo($symbol, $from, $to) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation upgradeDowngradeAsyncWithHttpInfo + * + * Stock Upgrade/Downgrade + * + * @param string $symbol Symbol of the company: AAPL. If left blank, the API will return latest stock upgrades/downgrades. (optional) + * @param \DateTime $from From date: 2000-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function upgradeDowngradeAsyncWithHttpInfo($symbol = null, $from = null, $to = null) + { + $returnType = '\Finnhub\Model\UpgradeDowngrade[]'; + $request = $this->upgradeDowngradeRequest($symbol, $from, $to); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + $responseBody = $response->getBody(); + if ($returnType === '\SplFileObject') { + $content = $responseBody; //stream goes to serializer + } else { + $content = (string) $responseBody; + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'upgradeDowngrade' + * + * @param string $symbol Symbol of the company: AAPL. If left blank, the API will return latest stock upgrades/downgrades. (optional) + * @param \DateTime $from From date: 2000-03-15. (optional) + * @param \DateTime $to To date: 2020-03-16. (optional) + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + protected function upgradeDowngradeRequest($symbol = null, $from = null, $to = null) + { + + $resourcePath = '/stock/upgrade-downgrade'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + if (is_array($symbol)) { + $symbol = ObjectSerializer::serializeCollection($symbol, '', true); + } + if ($symbol !== null) { + $queryParams['symbol'] = $symbol; + } + // query params + if (is_array($from)) { + $from = ObjectSerializer::serializeCollection($from, '', true); + } + if ($from !== null) { + $queryParams['from'] = $from; + } + // query params + if (is_array($to)) { + $to = ObjectSerializer::serializeCollection($to, '', true); + } + if ($to !== null) { + $queryParams['to'] = $to; + } + + + + // body params + $_tempBody = null; + + if ($multipart) { + $headers = $this->headerSelector->selectHeadersForMultipart( + ['application/json'] + ); + } else { + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + } + + // for model (json/xml) + if (isset($_tempBody)) { + // $_tempBody is the method argument, if present + if ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode(ObjectSerializer::sanitizeForSerialization($_tempBody)); + } else { + $httpBody = $_tempBody; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValue + ]; + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif ($headers['Content-Type'] === 'application/json') { + $httpBody = \GuzzleHttp\json_encode($formParams); + + } else { + // for HTTP post (form) + $httpBody = \GuzzleHttp\Psr7\build_query($formParams); + } + } + + // this endpoint requires API key authentication + $apiKey = $this->config->getApiKeyWithPrefix('token'); + if ($apiKey !== null) { + $queryParams['token'] = $apiKey; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\build_query($queryParams); + return new Request( + 'GET', + $this->config->getHost() . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/lib/HeaderSelector.php b/lib/HeaderSelector.php new file mode 100644 index 0000000..ed8f42c --- /dev/null +++ b/lib/HeaderSelector.php @@ -0,0 +1,110 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + $headers['Content-Type'] = $this->selectContentTypeHeader($contentTypes); + return $headers; + } + + /** + * @param string[] $accept + * @return array + */ + public function selectHeadersForMultipart($accept) + { + $headers = $this->selectHeaders($accept, []); + + unset($headers['Content-Type']); + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided + * + * @param string[] $accept Array of header + * + * @return string Accept (e.g. application/json) + */ + private function selectAcceptHeader($accept) + { + if (count($accept) === 0 || (count($accept) === 1 && $accept[0] === '')) { + return null; + } elseif ($jsonAccept = preg_grep('~(?i)^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$~', $accept)) { + return implode(',', $jsonAccept); + } else { + return implode(',', $accept); + } + } + + /** + * Return the content type based on an array of content-type provided + * + * @param string[] $contentType Array fo content-type + * + * @return string Content-Type (e.g. application/json) + */ + private function selectContentTypeHeader($contentType) + { + if (count($contentType) === 0 || (count($contentType) === 1 && $contentType[0] === '')) { + return 'application/json'; + } elseif (preg_grep("/application\/json/i", $contentType)) { + return 'application/json'; + } else { + return implode(',', $contentType); + } + } +} + diff --git a/lib/Model/AggregateIndicators.php b/lib/Model/AggregateIndicators.php new file mode 100644 index 0000000..dd2b5b5 --- /dev/null +++ b/lib/Model/AggregateIndicators.php @@ -0,0 +1,337 @@ + '\Finnhub\Model\TechnicalAnalysis', + 'trend' => '\Finnhub\Model\Trend' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'technical_analysis' => null, + 'trend' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'technical_analysis' => 'technicalAnalysis', + 'trend' => 'trend' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'technical_analysis' => 'setTechnicalAnalysis', + 'trend' => 'setTrend' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'technical_analysis' => 'getTechnicalAnalysis', + 'trend' => 'getTrend' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['technical_analysis'] = isset($data['technical_analysis']) ? $data['technical_analysis'] : null; + $this->container['trend'] = isset($data['trend']) ? $data['trend'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets technical_analysis + * + * @return \Finnhub\Model\TechnicalAnalysis|null + */ + public function getTechnicalAnalysis() + { + return $this->container['technical_analysis']; + } + + /** + * Sets technical_analysis + * + * @param \Finnhub\Model\TechnicalAnalysis|null $technical_analysis technical_analysis + * + * @return $this + */ + public function setTechnicalAnalysis($technical_analysis) + { + $this->container['technical_analysis'] = $technical_analysis; + + return $this; + } + + /** + * Gets trend + * + * @return \Finnhub\Model\Trend|null + */ + public function getTrend() + { + return $this->container['trend']; + } + + /** + * Sets trend + * + * @param \Finnhub\Model\Trend|null $trend trend + * + * @return $this + */ + public function setTrend($trend) + { + $this->container['trend'] = $trend; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/BasicFinancials.php b/lib/Model/BasicFinancials.php new file mode 100644 index 0000000..fc46c0e --- /dev/null +++ b/lib/Model/BasicFinancials.php @@ -0,0 +1,367 @@ + 'string', + 'metric_type' => 'string', + 'metric' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'metric_type' => null, + 'metric' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'metric_type' => 'metricType', + 'metric' => 'metric' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'metric_type' => 'setMetricType', + 'metric' => 'setMetric' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'metric_type' => 'getMetricType', + 'metric' => 'getMetric' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['metric_type'] = isset($data['metric_type']) ? $data['metric_type'] : null; + $this->container['metric'] = isset($data['metric']) ? $data['metric'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol of the company. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets metric_type + * + * @return string|null + */ + public function getMetricType() + { + return $this->container['metric_type']; + } + + /** + * Sets metric_type + * + * @param string|null $metric_type Metric type. + * + * @return $this + */ + public function setMetricType($metric_type) + { + $this->container['metric_type'] = $metric_type; + + return $this; + } + + /** + * Gets metric + * + * @return object|null + */ + public function getMetric() + { + return $this->container['metric']; + } + + /** + * Sets metric + * + * @param object|null $metric metric + * + * @return $this + */ + public function setMetric($metric) + { + $this->container['metric'] = $metric; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Company.php b/lib/Model/Company.php new file mode 100644 index 0000000..1fd55da --- /dev/null +++ b/lib/Model/Company.php @@ -0,0 +1,487 @@ + 'string', + 'age' => 'int', + 'title' => 'string', + 'since' => 'string', + 'sex' => 'string', + 'compensation' => 'int', + 'currency' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'age' => 'int64', + 'title' => null, + 'since' => null, + 'sex' => null, + 'compensation' => 'int64', + 'currency' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'age' => 'age', + 'title' => 'title', + 'since' => 'since', + 'sex' => 'sex', + 'compensation' => 'compensation', + 'currency' => 'currency' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'age' => 'setAge', + 'title' => 'setTitle', + 'since' => 'setSince', + 'sex' => 'setSex', + 'compensation' => 'setCompensation', + 'currency' => 'setCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'age' => 'getAge', + 'title' => 'getTitle', + 'since' => 'getSince', + 'sex' => 'getSex', + 'compensation' => 'getCompensation', + 'currency' => 'getCurrency' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['age'] = isset($data['age']) ? $data['age'] : null; + $this->container['title'] = isset($data['title']) ? $data['title'] : null; + $this->container['since'] = isset($data['since']) ? $data['since'] : null; + $this->container['sex'] = isset($data['sex']) ? $data['sex'] : null; + $this->container['compensation'] = isset($data['compensation']) ? $data['compensation'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Executive name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets age + * + * @return int|null + */ + public function getAge() + { + return $this->container['age']; + } + + /** + * Sets age + * + * @param int|null $age Age + * + * @return $this + */ + public function setAge($age) + { + $this->container['age'] = $age; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title + * + * @return $this + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets since + * + * @return string|null + */ + public function getSince() + { + return $this->container['since']; + } + + /** + * Sets since + * + * @param string|null $since Year appointed + * + * @return $this + */ + public function setSince($since) + { + $this->container['since'] = $since; + + return $this; + } + + /** + * Gets sex + * + * @return string|null + */ + public function getSex() + { + return $this->container['sex']; + } + + /** + * Sets sex + * + * @param string|null $sex Sex + * + * @return $this + */ + public function setSex($sex) + { + $this->container['sex'] = $sex; + + return $this; + } + + /** + * Gets compensation + * + * @return int|null + */ + public function getCompensation() + { + return $this->container['compensation']; + } + + /** + * Sets compensation + * + * @param int|null $compensation Total compensation + * + * @return $this + */ + public function setCompensation($compensation) + { + $this->container['compensation'] = $compensation; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Compensation currency + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CompanyExecutive.php b/lib/Model/CompanyExecutive.php new file mode 100644 index 0000000..22e511f --- /dev/null +++ b/lib/Model/CompanyExecutive.php @@ -0,0 +1,337 @@ + 'string', + 'executive' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'executive' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'executive' => 'executive' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'executive' => 'setExecutive' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'executive' => 'getExecutive' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['executive'] = isset($data['executive']) ? $data['executive'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets executive + * + * @return object[]|null + */ + public function getExecutive() + { + return $this->container['executive']; + } + + /** + * Sets executive + * + * @param object[]|null $executive Array of company's executives and members of the Board. + * + * @return $this + */ + public function setExecutive($executive) + { + $this->container['executive'] = $executive; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CompanyNewsStatistics.php b/lib/Model/CompanyNewsStatistics.php new file mode 100644 index 0000000..5320ac3 --- /dev/null +++ b/lib/Model/CompanyNewsStatistics.php @@ -0,0 +1,367 @@ + 'int', + 'buzz' => 'float', + 'weekly_average' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'articles_in_last_week' => 'int64', + 'buzz' => 'float', + 'weekly_average' => 'float' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'articles_in_last_week' => 'articlesInLastWeek', + 'buzz' => 'buzz', + 'weekly_average' => 'weeklyAverage' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'articles_in_last_week' => 'setArticlesInLastWeek', + 'buzz' => 'setBuzz', + 'weekly_average' => 'setWeeklyAverage' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'articles_in_last_week' => 'getArticlesInLastWeek', + 'buzz' => 'getBuzz', + 'weekly_average' => 'getWeeklyAverage' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['articles_in_last_week'] = isset($data['articles_in_last_week']) ? $data['articles_in_last_week'] : null; + $this->container['buzz'] = isset($data['buzz']) ? $data['buzz'] : null; + $this->container['weekly_average'] = isset($data['weekly_average']) ? $data['weekly_average'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets articles_in_last_week + * + * @return int|null + */ + public function getArticlesInLastWeek() + { + return $this->container['articles_in_last_week']; + } + + /** + * Sets articles_in_last_week + * + * @param int|null $articles_in_last_week + * + * @return $this + */ + public function setArticlesInLastWeek($articles_in_last_week) + { + $this->container['articles_in_last_week'] = $articles_in_last_week; + + return $this; + } + + /** + * Gets buzz + * + * @return float|null + */ + public function getBuzz() + { + return $this->container['buzz']; + } + + /** + * Sets buzz + * + * @param float|null $buzz + * + * @return $this + */ + public function setBuzz($buzz) + { + $this->container['buzz'] = $buzz; + + return $this; + } + + /** + * Gets weekly_average + * + * @return float|null + */ + public function getWeeklyAverage() + { + return $this->container['weekly_average']; + } + + /** + * Sets weekly_average + * + * @param float|null $weekly_average + * + * @return $this + */ + public function setWeeklyAverage($weekly_average) + { + $this->container['weekly_average'] = $weekly_average; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CompanyProfile.php b/lib/Model/CompanyProfile.php new file mode 100644 index 0000000..b644232 --- /dev/null +++ b/lib/Model/CompanyProfile.php @@ -0,0 +1,1117 @@ + 'string', + 'city' => 'string', + 'country' => 'string', + 'currency' => 'string', + 'cusip' => 'string', + 'sedol' => 'int', + 'description' => 'string', + 'exchange' => 'string', + 'ggroup' => 'string', + 'gind' => 'string', + 'gsector' => 'string', + 'gsubind' => 'string', + 'isin' => 'string', + 'naics_national_industry' => 'string', + 'naics' => 'string', + 'naics_sector' => 'string', + 'naics_subsector' => 'string', + 'name' => 'string', + 'phone' => 'string', + 'state' => 'string', + 'ticker' => 'string', + 'weburl' => 'string', + 'ipo' => '\DateTime', + 'market_capitalization' => 'float', + 'share_outstanding' => 'float', + 'employee_total' => 'int', + 'logo' => 'string', + 'finnhub_industry' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'address' => null, + 'city' => null, + 'country' => null, + 'currency' => null, + 'cusip' => null, + 'sedol' => 'int64', + 'description' => null, + 'exchange' => null, + 'ggroup' => null, + 'gind' => null, + 'gsector' => null, + 'gsubind' => null, + 'isin' => null, + 'naics_national_industry' => null, + 'naics' => null, + 'naics_sector' => null, + 'naics_subsector' => null, + 'name' => null, + 'phone' => null, + 'state' => null, + 'ticker' => null, + 'weburl' => null, + 'ipo' => 'date', + 'market_capitalization' => 'float', + 'share_outstanding' => 'float', + 'employee_total' => 'int64', + 'logo' => null, + 'finnhub_industry' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address' => 'address', + 'city' => 'city', + 'country' => 'country', + 'currency' => 'currency', + 'cusip' => 'cusip', + 'sedol' => 'sedol', + 'description' => 'description', + 'exchange' => 'exchange', + 'ggroup' => 'ggroup', + 'gind' => 'gind', + 'gsector' => 'gsector', + 'gsubind' => 'gsubind', + 'isin' => 'isin', + 'naics_national_industry' => 'naicsNationalIndustry', + 'naics' => 'naics', + 'naics_sector' => 'naicsSector', + 'naics_subsector' => 'naicsSubsector', + 'name' => 'name', + 'phone' => 'phone', + 'state' => 'state', + 'ticker' => 'ticker', + 'weburl' => 'weburl', + 'ipo' => 'ipo', + 'market_capitalization' => 'marketCapitalization', + 'share_outstanding' => 'shareOutstanding', + 'employee_total' => 'employeeTotal', + 'logo' => 'logo', + 'finnhub_industry' => 'finnhubIndustry' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'city' => 'setCity', + 'country' => 'setCountry', + 'currency' => 'setCurrency', + 'cusip' => 'setCusip', + 'sedol' => 'setSedol', + 'description' => 'setDescription', + 'exchange' => 'setExchange', + 'ggroup' => 'setGgroup', + 'gind' => 'setGind', + 'gsector' => 'setGsector', + 'gsubind' => 'setGsubind', + 'isin' => 'setIsin', + 'naics_national_industry' => 'setNaicsNationalIndustry', + 'naics' => 'setNaics', + 'naics_sector' => 'setNaicsSector', + 'naics_subsector' => 'setNaicsSubsector', + 'name' => 'setName', + 'phone' => 'setPhone', + 'state' => 'setState', + 'ticker' => 'setTicker', + 'weburl' => 'setWeburl', + 'ipo' => 'setIpo', + 'market_capitalization' => 'setMarketCapitalization', + 'share_outstanding' => 'setShareOutstanding', + 'employee_total' => 'setEmployeeTotal', + 'logo' => 'setLogo', + 'finnhub_industry' => 'setFinnhubIndustry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'city' => 'getCity', + 'country' => 'getCountry', + 'currency' => 'getCurrency', + 'cusip' => 'getCusip', + 'sedol' => 'getSedol', + 'description' => 'getDescription', + 'exchange' => 'getExchange', + 'ggroup' => 'getGgroup', + 'gind' => 'getGind', + 'gsector' => 'getGsector', + 'gsubind' => 'getGsubind', + 'isin' => 'getIsin', + 'naics_national_industry' => 'getNaicsNationalIndustry', + 'naics' => 'getNaics', + 'naics_sector' => 'getNaicsSector', + 'naics_subsector' => 'getNaicsSubsector', + 'name' => 'getName', + 'phone' => 'getPhone', + 'state' => 'getState', + 'ticker' => 'getTicker', + 'weburl' => 'getWeburl', + 'ipo' => 'getIpo', + 'market_capitalization' => 'getMarketCapitalization', + 'share_outstanding' => 'getShareOutstanding', + 'employee_total' => 'getEmployeeTotal', + 'logo' => 'getLogo', + 'finnhub_industry' => 'getFinnhubIndustry' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['address'] = isset($data['address']) ? $data['address'] : null; + $this->container['city'] = isset($data['city']) ? $data['city'] : null; + $this->container['country'] = isset($data['country']) ? $data['country'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['cusip'] = isset($data['cusip']) ? $data['cusip'] : null; + $this->container['sedol'] = isset($data['sedol']) ? $data['sedol'] : null; + $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->container['exchange'] = isset($data['exchange']) ? $data['exchange'] : null; + $this->container['ggroup'] = isset($data['ggroup']) ? $data['ggroup'] : null; + $this->container['gind'] = isset($data['gind']) ? $data['gind'] : null; + $this->container['gsector'] = isset($data['gsector']) ? $data['gsector'] : null; + $this->container['gsubind'] = isset($data['gsubind']) ? $data['gsubind'] : null; + $this->container['isin'] = isset($data['isin']) ? $data['isin'] : null; + $this->container['naics_national_industry'] = isset($data['naics_national_industry']) ? $data['naics_national_industry'] : null; + $this->container['naics'] = isset($data['naics']) ? $data['naics'] : null; + $this->container['naics_sector'] = isset($data['naics_sector']) ? $data['naics_sector'] : null; + $this->container['naics_subsector'] = isset($data['naics_subsector']) ? $data['naics_subsector'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; + $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->container['ticker'] = isset($data['ticker']) ? $data['ticker'] : null; + $this->container['weburl'] = isset($data['weburl']) ? $data['weburl'] : null; + $this->container['ipo'] = isset($data['ipo']) ? $data['ipo'] : null; + $this->container['market_capitalization'] = isset($data['market_capitalization']) ? $data['market_capitalization'] : null; + $this->container['share_outstanding'] = isset($data['share_outstanding']) ? $data['share_outstanding'] : null; + $this->container['employee_total'] = isset($data['employee_total']) ? $data['employee_total'] : null; + $this->container['logo'] = isset($data['logo']) ? $data['logo'] : null; + $this->container['finnhub_industry'] = isset($data['finnhub_industry']) ? $data['finnhub_industry'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets address + * + * @return string|null + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string|null $address Address of company's headquarter. + * + * @return $this + */ + public function setAddress($address) + { + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets city + * + * @return string|null + */ + public function getCity() + { + return $this->container['city']; + } + + /** + * Sets city + * + * @param string|null $city City of company's headquarter. + * + * @return $this + */ + public function setCity($city) + { + $this->container['city'] = $city; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country of company's headquarter. + * + * @return $this + */ + public function setCountry($country) + { + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency used in company filings. + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets cusip + * + * @return string|null + */ + public function getCusip() + { + return $this->container['cusip']; + } + + /** + * Sets cusip + * + * @param string|null $cusip CUSIP number. + * + * @return $this + */ + public function setCusip($cusip) + { + $this->container['cusip'] = $cusip; + + return $this; + } + + /** + * Gets sedol + * + * @return int|null + */ + public function getSedol() + { + return $this->container['sedol']; + } + + /** + * Sets sedol + * + * @param int|null $sedol Sedol number. + * + * @return $this + */ + public function setSedol($sedol) + { + $this->container['sedol'] = $sedol; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Company business summary. + * + * @return $this + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets exchange + * + * @return string|null + */ + public function getExchange() + { + return $this->container['exchange']; + } + + /** + * Sets exchange + * + * @param string|null $exchange Listed exchange. + * + * @return $this + */ + public function setExchange($exchange) + { + $this->container['exchange'] = $exchange; + + return $this; + } + + /** + * Gets ggroup + * + * @return string|null + */ + public function getGgroup() + { + return $this->container['ggroup']; + } + + /** + * Sets ggroup + * + * @param string|null $ggroup GICS industry group. + * + * @return $this + */ + public function setGgroup($ggroup) + { + $this->container['ggroup'] = $ggroup; + + return $this; + } + + /** + * Gets gind + * + * @return string|null + */ + public function getGind() + { + return $this->container['gind']; + } + + /** + * Sets gind + * + * @param string|null $gind GICS industry. + * + * @return $this + */ + public function setGind($gind) + { + $this->container['gind'] = $gind; + + return $this; + } + + /** + * Gets gsector + * + * @return string|null + */ + public function getGsector() + { + return $this->container['gsector']; + } + + /** + * Sets gsector + * + * @param string|null $gsector GICS sector. + * + * @return $this + */ + public function setGsector($gsector) + { + $this->container['gsector'] = $gsector; + + return $this; + } + + /** + * Gets gsubind + * + * @return string|null + */ + public function getGsubind() + { + return $this->container['gsubind']; + } + + /** + * Sets gsubind + * + * @param string|null $gsubind GICS sub-industry. + * + * @return $this + */ + public function setGsubind($gsubind) + { + $this->container['gsubind'] = $gsubind; + + return $this; + } + + /** + * Gets isin + * + * @return string|null + */ + public function getIsin() + { + return $this->container['isin']; + } + + /** + * Sets isin + * + * @param string|null $isin ISIN number. + * + * @return $this + */ + public function setIsin($isin) + { + $this->container['isin'] = $isin; + + return $this; + } + + /** + * Gets naics_national_industry + * + * @return string|null + */ + public function getNaicsNationalIndustry() + { + return $this->container['naics_national_industry']; + } + + /** + * Sets naics_national_industry + * + * @param string|null $naics_national_industry NAICS national industry. + * + * @return $this + */ + public function setNaicsNationalIndustry($naics_national_industry) + { + $this->container['naics_national_industry'] = $naics_national_industry; + + return $this; + } + + /** + * Gets naics + * + * @return string|null + */ + public function getNaics() + { + return $this->container['naics']; + } + + /** + * Sets naics + * + * @param string|null $naics NAICS industry. + * + * @return $this + */ + public function setNaics($naics) + { + $this->container['naics'] = $naics; + + return $this; + } + + /** + * Gets naics_sector + * + * @return string|null + */ + public function getNaicsSector() + { + return $this->container['naics_sector']; + } + + /** + * Sets naics_sector + * + * @param string|null $naics_sector NAICS sector. + * + * @return $this + */ + public function setNaicsSector($naics_sector) + { + $this->container['naics_sector'] = $naics_sector; + + return $this; + } + + /** + * Gets naics_subsector + * + * @return string|null + */ + public function getNaicsSubsector() + { + return $this->container['naics_subsector']; + } + + /** + * Sets naics_subsector + * + * @param string|null $naics_subsector NAICS subsector. + * + * @return $this + */ + public function setNaicsSubsector($naics_subsector) + { + $this->container['naics_subsector'] = $naics_subsector; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Company name. + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Company phone number. + * + * @return $this + */ + public function setPhone($phone) + { + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State of company's headquarter. + * + * @return $this + */ + public function setState($state) + { + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets ticker + * + * @return string|null + */ + public function getTicker() + { + return $this->container['ticker']; + } + + /** + * Sets ticker + * + * @param string|null $ticker Company symbol/ticker as used on the listed exchange. + * + * @return $this + */ + public function setTicker($ticker) + { + $this->container['ticker'] = $ticker; + + return $this; + } + + /** + * Gets weburl + * + * @return string|null + */ + public function getWeburl() + { + return $this->container['weburl']; + } + + /** + * Sets weburl + * + * @param string|null $weburl Company website. + * + * @return $this + */ + public function setWeburl($weburl) + { + $this->container['weburl'] = $weburl; + + return $this; + } + + /** + * Gets ipo + * + * @return \DateTime|null + */ + public function getIpo() + { + return $this->container['ipo']; + } + + /** + * Sets ipo + * + * @param \DateTime|null $ipo IPO date. + * + * @return $this + */ + public function setIpo($ipo) + { + $this->container['ipo'] = $ipo; + + return $this; + } + + /** + * Gets market_capitalization + * + * @return float|null + */ + public function getMarketCapitalization() + { + return $this->container['market_capitalization']; + } + + /** + * Sets market_capitalization + * + * @param float|null $market_capitalization Market Capitalization. + * + * @return $this + */ + public function setMarketCapitalization($market_capitalization) + { + $this->container['market_capitalization'] = $market_capitalization; + + return $this; + } + + /** + * Gets share_outstanding + * + * @return float|null + */ + public function getShareOutstanding() + { + return $this->container['share_outstanding']; + } + + /** + * Sets share_outstanding + * + * @param float|null $share_outstanding Number of oustanding shares. + * + * @return $this + */ + public function setShareOutstanding($share_outstanding) + { + $this->container['share_outstanding'] = $share_outstanding; + + return $this; + } + + /** + * Gets employee_total + * + * @return int|null + */ + public function getEmployeeTotal() + { + return $this->container['employee_total']; + } + + /** + * Sets employee_total + * + * @param int|null $employee_total Number of employee. + * + * @return $this + */ + public function setEmployeeTotal($employee_total) + { + $this->container['employee_total'] = $employee_total; + + return $this; + } + + /** + * Gets logo + * + * @return string|null + */ + public function getLogo() + { + return $this->container['logo']; + } + + /** + * Sets logo + * + * @param string|null $logo Logo image. + * + * @return $this + */ + public function setLogo($logo) + { + $this->container['logo'] = $logo; + + return $this; + } + + /** + * Gets finnhub_industry + * + * @return string|null + */ + public function getFinnhubIndustry() + { + return $this->container['finnhub_industry']; + } + + /** + * Sets finnhub_industry + * + * @param string|null $finnhub_industry Finnhub industry classification. + * + * @return $this + */ + public function setFinnhubIndustry($finnhub_industry) + { + $this->container['finnhub_industry'] = $finnhub_industry; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CompanyProfile2.php b/lib/Model/CompanyProfile2.php new file mode 100644 index 0000000..6ab73a7 --- /dev/null +++ b/lib/Model/CompanyProfile2.php @@ -0,0 +1,637 @@ + 'string', + 'currency' => 'string', + 'exchange' => 'string', + 'name' => 'string', + 'ticker' => 'string', + 'ipo' => '\DateTime', + 'market_capitalization' => 'float', + 'share_outstanding' => 'float', + 'logo' => 'string', + 'phone' => 'string', + 'weburl' => 'string', + 'finnhub_industry' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'country' => null, + 'currency' => null, + 'exchange' => null, + 'name' => null, + 'ticker' => null, + 'ipo' => 'date', + 'market_capitalization' => 'float', + 'share_outstanding' => 'float', + 'logo' => null, + 'phone' => null, + 'weburl' => null, + 'finnhub_industry' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'country' => 'country', + 'currency' => 'currency', + 'exchange' => 'exchange', + 'name' => 'name', + 'ticker' => 'ticker', + 'ipo' => 'ipo', + 'market_capitalization' => 'marketCapitalization', + 'share_outstanding' => 'shareOutstanding', + 'logo' => 'logo', + 'phone' => 'phone', + 'weburl' => 'weburl', + 'finnhub_industry' => 'finnhubIndustry' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'country' => 'setCountry', + 'currency' => 'setCurrency', + 'exchange' => 'setExchange', + 'name' => 'setName', + 'ticker' => 'setTicker', + 'ipo' => 'setIpo', + 'market_capitalization' => 'setMarketCapitalization', + 'share_outstanding' => 'setShareOutstanding', + 'logo' => 'setLogo', + 'phone' => 'setPhone', + 'weburl' => 'setWeburl', + 'finnhub_industry' => 'setFinnhubIndustry' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country' => 'getCountry', + 'currency' => 'getCurrency', + 'exchange' => 'getExchange', + 'name' => 'getName', + 'ticker' => 'getTicker', + 'ipo' => 'getIpo', + 'market_capitalization' => 'getMarketCapitalization', + 'share_outstanding' => 'getShareOutstanding', + 'logo' => 'getLogo', + 'phone' => 'getPhone', + 'weburl' => 'getWeburl', + 'finnhub_industry' => 'getFinnhubIndustry' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['country'] = isset($data['country']) ? $data['country'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['exchange'] = isset($data['exchange']) ? $data['exchange'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['ticker'] = isset($data['ticker']) ? $data['ticker'] : null; + $this->container['ipo'] = isset($data['ipo']) ? $data['ipo'] : null; + $this->container['market_capitalization'] = isset($data['market_capitalization']) ? $data['market_capitalization'] : null; + $this->container['share_outstanding'] = isset($data['share_outstanding']) ? $data['share_outstanding'] : null; + $this->container['logo'] = isset($data['logo']) ? $data['logo'] : null; + $this->container['phone'] = isset($data['phone']) ? $data['phone'] : null; + $this->container['weburl'] = isset($data['weburl']) ? $data['weburl'] : null; + $this->container['finnhub_industry'] = isset($data['finnhub_industry']) ? $data['finnhub_industry'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country of company's headquarter. + * + * @return $this + */ + public function setCountry($country) + { + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency used in company filings. + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets exchange + * + * @return string|null + */ + public function getExchange() + { + return $this->container['exchange']; + } + + /** + * Sets exchange + * + * @param string|null $exchange Listed exchange. + * + * @return $this + */ + public function setExchange($exchange) + { + $this->container['exchange'] = $exchange; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Company name. + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets ticker + * + * @return string|null + */ + public function getTicker() + { + return $this->container['ticker']; + } + + /** + * Sets ticker + * + * @param string|null $ticker Company symbol/ticker as used on the listed exchange. + * + * @return $this + */ + public function setTicker($ticker) + { + $this->container['ticker'] = $ticker; + + return $this; + } + + /** + * Gets ipo + * + * @return \DateTime|null + */ + public function getIpo() + { + return $this->container['ipo']; + } + + /** + * Sets ipo + * + * @param \DateTime|null $ipo IPO date. + * + * @return $this + */ + public function setIpo($ipo) + { + $this->container['ipo'] = $ipo; + + return $this; + } + + /** + * Gets market_capitalization + * + * @return float|null + */ + public function getMarketCapitalization() + { + return $this->container['market_capitalization']; + } + + /** + * Sets market_capitalization + * + * @param float|null $market_capitalization Market Capitalization. + * + * @return $this + */ + public function setMarketCapitalization($market_capitalization) + { + $this->container['market_capitalization'] = $market_capitalization; + + return $this; + } + + /** + * Gets share_outstanding + * + * @return float|null + */ + public function getShareOutstanding() + { + return $this->container['share_outstanding']; + } + + /** + * Sets share_outstanding + * + * @param float|null $share_outstanding Number of oustanding shares. + * + * @return $this + */ + public function setShareOutstanding($share_outstanding) + { + $this->container['share_outstanding'] = $share_outstanding; + + return $this; + } + + /** + * Gets logo + * + * @return string|null + */ + public function getLogo() + { + return $this->container['logo']; + } + + /** + * Sets logo + * + * @param string|null $logo Logo image. + * + * @return $this + */ + public function setLogo($logo) + { + $this->container['logo'] = $logo; + + return $this; + } + + /** + * Gets phone + * + * @return string|null + */ + public function getPhone() + { + return $this->container['phone']; + } + + /** + * Sets phone + * + * @param string|null $phone Company phone number. + * + * @return $this + */ + public function setPhone($phone) + { + $this->container['phone'] = $phone; + + return $this; + } + + /** + * Gets weburl + * + * @return string|null + */ + public function getWeburl() + { + return $this->container['weburl']; + } + + /** + * Sets weburl + * + * @param string|null $weburl Company website. + * + * @return $this + */ + public function setWeburl($weburl) + { + $this->container['weburl'] = $weburl; + + return $this; + } + + /** + * Gets finnhub_industry + * + * @return string|null + */ + public function getFinnhubIndustry() + { + return $this->container['finnhub_industry']; + } + + /** + * Sets finnhub_industry + * + * @param string|null $finnhub_industry Finnhub industry classification. + * + * @return $this + */ + public function setFinnhubIndustry($finnhub_industry) + { + $this->container['finnhub_industry'] = $finnhub_industry; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CountryMetadata.php b/lib/Model/CountryMetadata.php new file mode 100644 index 0000000..b592d48 --- /dev/null +++ b/lib/Model/CountryMetadata.php @@ -0,0 +1,457 @@ + 'string', + 'code2' => 'string', + 'code3' => 'string', + 'code_no' => 'string', + 'currency' => 'string', + 'currency_code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'country' => null, + 'code2' => null, + 'code3' => null, + 'code_no' => null, + 'currency' => null, + 'currency_code' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'country' => 'country', + 'code2' => 'code2', + 'code3' => 'code3', + 'code_no' => 'codeNo', + 'currency' => 'currency', + 'currency_code' => 'currencyCode' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'country' => 'setCountry', + 'code2' => 'setCode2', + 'code3' => 'setCode3', + 'code_no' => 'setCodeNo', + 'currency' => 'setCurrency', + 'currency_code' => 'setCurrencyCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country' => 'getCountry', + 'code2' => 'getCode2', + 'code3' => 'getCode3', + 'code_no' => 'getCodeNo', + 'currency' => 'getCurrency', + 'currency_code' => 'getCurrencyCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['country'] = isset($data['country']) ? $data['country'] : null; + $this->container['code2'] = isset($data['code2']) ? $data['code2'] : null; + $this->container['code3'] = isset($data['code3']) ? $data['code3'] : null; + $this->container['code_no'] = isset($data['code_no']) ? $data['code_no'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + $this->container['currency_code'] = isset($data['currency_code']) ? $data['currency_code'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country name + * + * @return $this + */ + public function setCountry($country) + { + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets code2 + * + * @return string|null + */ + public function getCode2() + { + return $this->container['code2']; + } + + /** + * Sets code2 + * + * @param string|null $code2 Alpha 2 code + * + * @return $this + */ + public function setCode2($code2) + { + $this->container['code2'] = $code2; + + return $this; + } + + /** + * Gets code3 + * + * @return string|null + */ + public function getCode3() + { + return $this->container['code3']; + } + + /** + * Sets code3 + * + * @param string|null $code3 Alpha 3 code + * + * @return $this + */ + public function setCode3($code3) + { + $this->container['code3'] = $code3; + + return $this; + } + + /** + * Gets code_no + * + * @return string|null + */ + public function getCodeNo() + { + return $this->container['code_no']; + } + + /** + * Sets code_no + * + * @param string|null $code_no UN code + * + * @return $this + */ + public function setCodeNo($code_no) + { + $this->container['code_no'] = $code_no; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency name + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + + /** + * Gets currency_code + * + * @return string|null + */ + public function getCurrencyCode() + { + return $this->container['currency_code']; + } + + /** + * Sets currency_code + * + * @param string|null $currency_code Currency code + * + * @return $this + */ + public function setCurrencyCode($currency_code) + { + $this->container['currency_code'] = $currency_code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CovidInfo.php b/lib/Model/CovidInfo.php new file mode 100644 index 0000000..358508e --- /dev/null +++ b/lib/Model/CovidInfo.php @@ -0,0 +1,397 @@ + 'string', + 'case' => 'float', + 'death' => 'float', + 'updated' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'state' => null, + 'case' => 'float', + 'death' => 'float', + 'updated' => 'date-time' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'state' => 'state', + 'case' => 'case', + 'death' => 'death', + 'updated' => 'updated' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'state' => 'setState', + 'case' => 'setCase', + 'death' => 'setDeath', + 'updated' => 'setUpdated' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'state' => 'getState', + 'case' => 'getCase', + 'death' => 'getDeath', + 'updated' => 'getUpdated' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['state'] = isset($data['state']) ? $data['state'] : null; + $this->container['case'] = isset($data['case']) ? $data['case'] : null; + $this->container['death'] = isset($data['death']) ? $data['death'] : null; + $this->container['updated'] = isset($data['updated']) ? $data['updated'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets state + * + * @return string|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param string|null $state State. + * + * @return $this + */ + public function setState($state) + { + $this->container['state'] = $state; + + return $this; + } + + /** + * Gets case + * + * @return float|null + */ + public function getCase() + { + return $this->container['case']; + } + + /** + * Sets case + * + * @param float|null $case Number of confirmed cases. + * + * @return $this + */ + public function setCase($case) + { + $this->container['case'] = $case; + + return $this; + } + + /** + * Gets death + * + * @return float|null + */ + public function getDeath() + { + return $this->container['death']; + } + + /** + * Sets death + * + * @param float|null $death Number of confirmed deaths. + * + * @return $this + */ + public function setDeath($death) + { + $this->container['death'] = $death; + + return $this; + } + + /** + * Gets updated + * + * @return \DateTime|null + */ + public function getUpdated() + { + return $this->container['updated']; + } + + /** + * Sets updated + * + * @param \DateTime|null $updated Updated time. + * + * @return $this + */ + public function setUpdated($updated) + { + $this->container['updated'] = $updated; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CryptoCandles.php b/lib/Model/CryptoCandles.php new file mode 100644 index 0000000..cd9deb0 --- /dev/null +++ b/lib/Model/CryptoCandles.php @@ -0,0 +1,487 @@ + 'float[]', + 'h' => 'float[]', + 'l' => 'float[]', + 'c' => 'float[]', + 'v' => 'float[]', + 't' => 'int[]', + 's' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'o' => 'float', + 'h' => 'float', + 'l' => 'float', + 'c' => 'float', + 'v' => 'float', + 't' => 'int64', + 's' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'o' => 'o', + 'h' => 'h', + 'l' => 'l', + 'c' => 'c', + 'v' => 'v', + 't' => 't', + 's' => 's' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'o' => 'setO', + 'h' => 'setH', + 'l' => 'setL', + 'c' => 'setC', + 'v' => 'setV', + 't' => 'setT', + 's' => 'setS' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'o' => 'getO', + 'h' => 'getH', + 'l' => 'getL', + 'c' => 'getC', + 'v' => 'getV', + 't' => 'getT', + 's' => 'getS' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['o'] = isset($data['o']) ? $data['o'] : null; + $this->container['h'] = isset($data['h']) ? $data['h'] : null; + $this->container['l'] = isset($data['l']) ? $data['l'] : null; + $this->container['c'] = isset($data['c']) ? $data['c'] : null; + $this->container['v'] = isset($data['v']) ? $data['v'] : null; + $this->container['t'] = isset($data['t']) ? $data['t'] : null; + $this->container['s'] = isset($data['s']) ? $data['s'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets o + * + * @return float[]|null + */ + public function getO() + { + return $this->container['o']; + } + + /** + * Sets o + * + * @param float[]|null $o List of open prices for returned candles. + * + * @return $this + */ + public function setO($o) + { + $this->container['o'] = $o; + + return $this; + } + + /** + * Gets h + * + * @return float[]|null + */ + public function getH() + { + return $this->container['h']; + } + + /** + * Sets h + * + * @param float[]|null $h List of high prices for returned candles. + * + * @return $this + */ + public function setH($h) + { + $this->container['h'] = $h; + + return $this; + } + + /** + * Gets l + * + * @return float[]|null + */ + public function getL() + { + return $this->container['l']; + } + + /** + * Sets l + * + * @param float[]|null $l List of low prices for returned candles. + * + * @return $this + */ + public function setL($l) + { + $this->container['l'] = $l; + + return $this; + } + + /** + * Gets c + * + * @return float[]|null + */ + public function getC() + { + return $this->container['c']; + } + + /** + * Sets c + * + * @param float[]|null $c List of close prices for returned candles. + * + * @return $this + */ + public function setC($c) + { + $this->container['c'] = $c; + + return $this; + } + + /** + * Gets v + * + * @return float[]|null + */ + public function getV() + { + return $this->container['v']; + } + + /** + * Sets v + * + * @param float[]|null $v List of volume data for returned candles. + * + * @return $this + */ + public function setV($v) + { + $this->container['v'] = $v; + + return $this; + } + + /** + * Gets t + * + * @return int[]|null + */ + public function getT() + { + return $this->container['t']; + } + + /** + * Sets t + * + * @param int[]|null $t List of timestamp for returned candles. + * + * @return $this + */ + public function setT($t) + { + $this->container['t'] = $t; + + return $this; + } + + /** + * Gets s + * + * @return string|null + */ + public function getS() + { + return $this->container['s']; + } + + /** + * Sets s + * + * @param string|null $s Status of the response. This field can either be ok or no_data. + * + * @return $this + */ + public function setS($s) + { + $this->container['s'] = $s; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/CryptoSymbol.php b/lib/Model/CryptoSymbol.php new file mode 100644 index 0000000..98df154 --- /dev/null +++ b/lib/Model/CryptoSymbol.php @@ -0,0 +1,367 @@ + 'string', + 'display_symbol' => 'string', + 'symbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'description' => null, + 'display_symbol' => null, + 'symbol' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'description' => 'description', + 'display_symbol' => 'displaySymbol', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'description' => 'setDescription', + 'display_symbol' => 'setDisplaySymbol', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'description' => 'getDescription', + 'display_symbol' => 'getDisplaySymbol', + 'symbol' => 'getSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->container['display_symbol'] = isset($data['display_symbol']) ? $data['display_symbol'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Symbol description + * + * @return $this + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets display_symbol + * + * @return string|null + */ + public function getDisplaySymbol() + { + return $this->container['display_symbol']; + } + + /** + * Sets display_symbol + * + * @param string|null $display_symbol Display symbol name. + * + * @return $this + */ + public function setDisplaySymbol($display_symbol) + { + $this->container['display_symbol'] = $display_symbol; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Unique symbol used to identify this symbol used in /crypto/candle endpoint. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Development.php b/lib/Model/Development.php new file mode 100644 index 0000000..39eb92b --- /dev/null +++ b/lib/Model/Development.php @@ -0,0 +1,397 @@ + 'string', + 'datetime' => '\DateTime', + 'headline' => 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'datetime' => 'date-time', + 'headline' => null, + 'description' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'datetime' => 'datetime', + 'headline' => 'headline', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'datetime' => 'setDatetime', + 'headline' => 'setHeadline', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'datetime' => 'getDatetime', + 'headline' => 'getHeadline', + 'description' => 'getDescription' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['datetime'] = isset($data['datetime']) ? $data['datetime'] : null; + $this->container['headline'] = isset($data['headline']) ? $data['headline'] : null; + $this->container['description'] = isset($data['description']) ? $data['description'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets datetime + * + * @return \DateTime|null + */ + public function getDatetime() + { + return $this->container['datetime']; + } + + /** + * Sets datetime + * + * @param \DateTime|null $datetime Published time in YYYY-MM-DD HH:MM:SS format. + * + * @return $this + */ + public function setDatetime($datetime) + { + $this->container['datetime'] = $datetime; + + return $this; + } + + /** + * Gets headline + * + * @return string|null + */ + public function getHeadline() + { + return $this->container['headline']; + } + + /** + * Sets headline + * + * @param string|null $headline Development headline. + * + * @return $this + */ + public function setHeadline($headline) + { + $this->container['headline'] = $headline; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Development description. + * + * @return $this + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Dividends.php b/lib/Model/Dividends.php new file mode 100644 index 0000000..01e8bc9 --- /dev/null +++ b/lib/Model/Dividends.php @@ -0,0 +1,517 @@ + 'string', + 'date' => '\DateTime', + 'amount' => 'float', + 'adjusted_amount' => 'float', + 'pay_date' => '\DateTime', + 'record_date' => '\DateTime', + 'declaration_date' => '\DateTime', + 'currency' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'date' => 'date', + 'amount' => 'float', + 'adjusted_amount' => 'float', + 'pay_date' => 'date', + 'record_date' => 'date', + 'declaration_date' => 'date', + 'currency' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'date' => 'date', + 'amount' => 'amount', + 'adjusted_amount' => 'adjustedAmount', + 'pay_date' => 'payDate', + 'record_date' => 'recordDate', + 'declaration_date' => 'declarationDate', + 'currency' => 'currency' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'date' => 'setDate', + 'amount' => 'setAmount', + 'adjusted_amount' => 'setAdjustedAmount', + 'pay_date' => 'setPayDate', + 'record_date' => 'setRecordDate', + 'declaration_date' => 'setDeclarationDate', + 'currency' => 'setCurrency' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'date' => 'getDate', + 'amount' => 'getAmount', + 'adjusted_amount' => 'getAdjustedAmount', + 'pay_date' => 'getPayDate', + 'record_date' => 'getRecordDate', + 'declaration_date' => 'getDeclarationDate', + 'currency' => 'getCurrency' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['amount'] = isset($data['amount']) ? $data['amount'] : null; + $this->container['adjusted_amount'] = isset($data['adjusted_amount']) ? $data['adjusted_amount'] : null; + $this->container['pay_date'] = isset($data['pay_date']) ? $data['pay_date'] : null; + $this->container['record_date'] = isset($data['record_date']) ? $data['record_date'] : null; + $this->container['declaration_date'] = isset($data['declaration_date']) ? $data['declaration_date'] : null; + $this->container['currency'] = isset($data['currency']) ? $data['currency'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Ex-Dividend date. + * + * @return $this + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets amount + * + * @return float|null + */ + public function getAmount() + { + return $this->container['amount']; + } + + /** + * Sets amount + * + * @param float|null $amount Amount in local currency. + * + * @return $this + */ + public function setAmount($amount) + { + $this->container['amount'] = $amount; + + return $this; + } + + /** + * Gets adjusted_amount + * + * @return float|null + */ + public function getAdjustedAmount() + { + return $this->container['adjusted_amount']; + } + + /** + * Sets adjusted_amount + * + * @param float|null $adjusted_amount Adjusted dividend. + * + * @return $this + */ + public function setAdjustedAmount($adjusted_amount) + { + $this->container['adjusted_amount'] = $adjusted_amount; + + return $this; + } + + /** + * Gets pay_date + * + * @return \DateTime|null + */ + public function getPayDate() + { + return $this->container['pay_date']; + } + + /** + * Sets pay_date + * + * @param \DateTime|null $pay_date Pay date. + * + * @return $this + */ + public function setPayDate($pay_date) + { + $this->container['pay_date'] = $pay_date; + + return $this; + } + + /** + * Gets record_date + * + * @return \DateTime|null + */ + public function getRecordDate() + { + return $this->container['record_date']; + } + + /** + * Sets record_date + * + * @param \DateTime|null $record_date Record date. + * + * @return $this + */ + public function setRecordDate($record_date) + { + $this->container['record_date'] = $record_date; + + return $this; + } + + /** + * Gets declaration_date + * + * @return \DateTime|null + */ + public function getDeclarationDate() + { + return $this->container['declaration_date']; + } + + /** + * Sets declaration_date + * + * @param \DateTime|null $declaration_date Declaration date. + * + * @return $this + */ + public function setDeclarationDate($declaration_date) + { + $this->container['declaration_date'] = $declaration_date; + + return $this; + } + + /** + * Gets currency + * + * @return string|null + */ + public function getCurrency() + { + return $this->container['currency']; + } + + /** + * Sets currency + * + * @param string|null $currency Currency. + * + * @return $this + */ + public function setCurrency($currency) + { + $this->container['currency'] = $currency; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EarningEstimate.php b/lib/Model/EarningEstimate.php new file mode 100644 index 0000000..678a92f --- /dev/null +++ b/lib/Model/EarningEstimate.php @@ -0,0 +1,427 @@ + 'float', + 'eps_high' => 'float', + 'eps_low' => 'float', + 'number_analysts' => 'int', + 'period' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'eps_avg' => 'float', + 'eps_high' => 'float', + 'eps_low' => 'float', + 'number_analysts' => 'int64', + 'period' => 'date' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'eps_avg' => 'epsAvg', + 'eps_high' => 'epsHigh', + 'eps_low' => 'epsLow', + 'number_analysts' => 'numberAnalysts', + 'period' => 'period' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'eps_avg' => 'setEpsAvg', + 'eps_high' => 'setEpsHigh', + 'eps_low' => 'setEpsLow', + 'number_analysts' => 'setNumberAnalysts', + 'period' => 'setPeriod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'eps_avg' => 'getEpsAvg', + 'eps_high' => 'getEpsHigh', + 'eps_low' => 'getEpsLow', + 'number_analysts' => 'getNumberAnalysts', + 'period' => 'getPeriod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['eps_avg'] = isset($data['eps_avg']) ? $data['eps_avg'] : null; + $this->container['eps_high'] = isset($data['eps_high']) ? $data['eps_high'] : null; + $this->container['eps_low'] = isset($data['eps_low']) ? $data['eps_low'] : null; + $this->container['number_analysts'] = isset($data['number_analysts']) ? $data['number_analysts'] : null; + $this->container['period'] = isset($data['period']) ? $data['period'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets eps_avg + * + * @return float|null + */ + public function getEpsAvg() + { + return $this->container['eps_avg']; + } + + /** + * Sets eps_avg + * + * @param float|null $eps_avg Average EPS estimates. + * + * @return $this + */ + public function setEpsAvg($eps_avg) + { + $this->container['eps_avg'] = $eps_avg; + + return $this; + } + + /** + * Gets eps_high + * + * @return float|null + */ + public function getEpsHigh() + { + return $this->container['eps_high']; + } + + /** + * Sets eps_high + * + * @param float|null $eps_high Highest estimate. + * + * @return $this + */ + public function setEpsHigh($eps_high) + { + $this->container['eps_high'] = $eps_high; + + return $this; + } + + /** + * Gets eps_low + * + * @return float|null + */ + public function getEpsLow() + { + return $this->container['eps_low']; + } + + /** + * Sets eps_low + * + * @param float|null $eps_low Lowest estimate. + * + * @return $this + */ + public function setEpsLow($eps_low) + { + $this->container['eps_low'] = $eps_low; + + return $this; + } + + /** + * Gets number_analysts + * + * @return int|null + */ + public function getNumberAnalysts() + { + return $this->container['number_analysts']; + } + + /** + * Sets number_analysts + * + * @param int|null $number_analysts Number of Analysts. + * + * @return $this + */ + public function setNumberAnalysts($number_analysts) + { + $this->container['number_analysts'] = $number_analysts; + + return $this; + } + + /** + * Gets period + * + * @return \DateTime|null + */ + public function getPeriod() + { + return $this->container['period']; + } + + /** + * Sets period + * + * @param \DateTime|null $period Period. + * + * @return $this + */ + public function setPeriod($period) + { + $this->container['period'] = $period; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EarningRelease.php b/lib/Model/EarningRelease.php new file mode 100644 index 0000000..478cfab --- /dev/null +++ b/lib/Model/EarningRelease.php @@ -0,0 +1,547 @@ + 'string', + 'date' => '\DateTime', + 'hour' => 'string', + 'year' => 'int', + 'quarter' => 'int', + 'eps_estimate' => 'float', + 'eps_actual' => 'float', + 'revenue_estimate' => 'int', + 'revenue_actual' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'date' => 'date', + 'hour' => null, + 'year' => 'int64', + 'quarter' => 'int64', + 'eps_estimate' => 'float', + 'eps_actual' => 'float', + 'revenue_estimate' => 'int64', + 'revenue_actual' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'date' => 'date', + 'hour' => 'hour', + 'year' => 'year', + 'quarter' => 'quarter', + 'eps_estimate' => 'epsEstimate', + 'eps_actual' => 'epsActual', + 'revenue_estimate' => 'revenueEstimate', + 'revenue_actual' => 'revenueActual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'date' => 'setDate', + 'hour' => 'setHour', + 'year' => 'setYear', + 'quarter' => 'setQuarter', + 'eps_estimate' => 'setEpsEstimate', + 'eps_actual' => 'setEpsActual', + 'revenue_estimate' => 'setRevenueEstimate', + 'revenue_actual' => 'setRevenueActual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'date' => 'getDate', + 'hour' => 'getHour', + 'year' => 'getYear', + 'quarter' => 'getQuarter', + 'eps_estimate' => 'getEpsEstimate', + 'eps_actual' => 'getEpsActual', + 'revenue_estimate' => 'getRevenueEstimate', + 'revenue_actual' => 'getRevenueActual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['hour'] = isset($data['hour']) ? $data['hour'] : null; + $this->container['year'] = isset($data['year']) ? $data['year'] : null; + $this->container['quarter'] = isset($data['quarter']) ? $data['quarter'] : null; + $this->container['eps_estimate'] = isset($data['eps_estimate']) ? $data['eps_estimate'] : null; + $this->container['eps_actual'] = isset($data['eps_actual']) ? $data['eps_actual'] : null; + $this->container['revenue_estimate'] = isset($data['revenue_estimate']) ? $data['revenue_estimate'] : null; + $this->container['revenue_actual'] = isset($data['revenue_actual']) ? $data['revenue_actual'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Date. + * + * @return $this + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets hour + * + * @return string|null + */ + public function getHour() + { + return $this->container['hour']; + } + + /** + * Sets hour + * + * @param string|null $hour Indicates whether the earnings is announced before market open(bmo), after market close(amc), or during market hour(dmh). + * + * @return $this + */ + public function setHour($hour) + { + $this->container['hour'] = $hour; + + return $this; + } + + /** + * Gets year + * + * @return int|null + */ + public function getYear() + { + return $this->container['year']; + } + + /** + * Sets year + * + * @param int|null $year Earnings year. + * + * @return $this + */ + public function setYear($year) + { + $this->container['year'] = $year; + + return $this; + } + + /** + * Gets quarter + * + * @return int|null + */ + public function getQuarter() + { + return $this->container['quarter']; + } + + /** + * Sets quarter + * + * @param int|null $quarter Earnings quarter. + * + * @return $this + */ + public function setQuarter($quarter) + { + $this->container['quarter'] = $quarter; + + return $this; + } + + /** + * Gets eps_estimate + * + * @return float|null + */ + public function getEpsEstimate() + { + return $this->container['eps_estimate']; + } + + /** + * Sets eps_estimate + * + * @param float|null $eps_estimate EPS estimate. + * + * @return $this + */ + public function setEpsEstimate($eps_estimate) + { + $this->container['eps_estimate'] = $eps_estimate; + + return $this; + } + + /** + * Gets eps_actual + * + * @return float|null + */ + public function getEpsActual() + { + return $this->container['eps_actual']; + } + + /** + * Sets eps_actual + * + * @param float|null $eps_actual EPS actual. + * + * @return $this + */ + public function setEpsActual($eps_actual) + { + $this->container['eps_actual'] = $eps_actual; + + return $this; + } + + /** + * Gets revenue_estimate + * + * @return int|null + */ + public function getRevenueEstimate() + { + return $this->container['revenue_estimate']; + } + + /** + * Sets revenue_estimate + * + * @param int|null $revenue_estimate Revenue estimate. + * + * @return $this + */ + public function setRevenueEstimate($revenue_estimate) + { + $this->container['revenue_estimate'] = $revenue_estimate; + + return $this; + } + + /** + * Gets revenue_actual + * + * @return int|null + */ + public function getRevenueActual() + { + return $this->container['revenue_actual']; + } + + /** + * Sets revenue_actual + * + * @param int|null $revenue_actual Revenue actual. + * + * @return $this + */ + public function setRevenueActual($revenue_actual) + { + $this->container['revenue_actual'] = $revenue_actual; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EarningResult.php b/lib/Model/EarningResult.php new file mode 100644 index 0000000..2802bc9 --- /dev/null +++ b/lib/Model/EarningResult.php @@ -0,0 +1,397 @@ + 'float', + 'estimate' => 'float', + 'period' => '\DateTime', + 'symbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'actual' => 'float', + 'estimate' => 'float', + 'period' => 'date', + 'symbol' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'actual' => 'actual', + 'estimate' => 'estimate', + 'period' => 'period', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'actual' => 'setActual', + 'estimate' => 'setEstimate', + 'period' => 'setPeriod', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'actual' => 'getActual', + 'estimate' => 'getEstimate', + 'period' => 'getPeriod', + 'symbol' => 'getSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['actual'] = isset($data['actual']) ? $data['actual'] : null; + $this->container['estimate'] = isset($data['estimate']) ? $data['estimate'] : null; + $this->container['period'] = isset($data['period']) ? $data['period'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets actual + * + * @return float|null + */ + public function getActual() + { + return $this->container['actual']; + } + + /** + * Sets actual + * + * @param float|null $actual Actual earning result. + * + * @return $this + */ + public function setActual($actual) + { + $this->container['actual'] = $actual; + + return $this; + } + + /** + * Gets estimate + * + * @return float|null + */ + public function getEstimate() + { + return $this->container['estimate']; + } + + /** + * Sets estimate + * + * @param float|null $estimate Estimated earning. + * + * @return $this + */ + public function setEstimate($estimate) + { + $this->container['estimate'] = $estimate; + + return $this; + } + + /** + * Gets period + * + * @return \DateTime|null + */ + public function getPeriod() + { + return $this->container['period']; + } + + /** + * Sets period + * + * @param \DateTime|null $period Reported period. + * + * @return $this + */ + public function setPeriod($period) + { + $this->container['period'] = $period; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EarningsCalendar.php b/lib/Model/EarningsCalendar.php new file mode 100644 index 0000000..e79b5ae --- /dev/null +++ b/lib/Model/EarningsCalendar.php @@ -0,0 +1,307 @@ + 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'earnings_calendar' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'earnings_calendar' => 'earningsCalendar' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'earnings_calendar' => 'setEarningsCalendar' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'earnings_calendar' => 'getEarningsCalendar' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['earnings_calendar'] = isset($data['earnings_calendar']) ? $data['earnings_calendar'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets earnings_calendar + * + * @return object[]|null + */ + public function getEarningsCalendar() + { + return $this->container['earnings_calendar']; + } + + /** + * Sets earnings_calendar + * + * @param object[]|null $earnings_calendar Array of earnings release. + * + * @return $this + */ + public function setEarningsCalendar($earnings_calendar) + { + $this->container['earnings_calendar'] = $earnings_calendar; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EarningsCallTranscripts.php b/lib/Model/EarningsCallTranscripts.php new file mode 100644 index 0000000..034d503 --- /dev/null +++ b/lib/Model/EarningsCallTranscripts.php @@ -0,0 +1,547 @@ + 'string', + 'transcript' => 'object[]', + 'participant' => 'object[]', + 'audio' => 'string', + 'id' => 'string', + 'title' => 'string', + 'time' => '\DateTime', + 'year' => 'int', + 'quarter' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'transcript' => null, + 'participant' => null, + 'audio' => null, + 'id' => null, + 'title' => null, + 'time' => 'date-time', + 'year' => 'int64', + 'quarter' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'transcript' => 'transcript', + 'participant' => 'participant', + 'audio' => 'audio', + 'id' => 'id', + 'title' => 'title', + 'time' => 'time', + 'year' => 'year', + 'quarter' => 'quarter' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'transcript' => 'setTranscript', + 'participant' => 'setParticipant', + 'audio' => 'setAudio', + 'id' => 'setId', + 'title' => 'setTitle', + 'time' => 'setTime', + 'year' => 'setYear', + 'quarter' => 'setQuarter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'transcript' => 'getTranscript', + 'participant' => 'getParticipant', + 'audio' => 'getAudio', + 'id' => 'getId', + 'title' => 'getTitle', + 'time' => 'getTime', + 'year' => 'getYear', + 'quarter' => 'getQuarter' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['transcript'] = isset($data['transcript']) ? $data['transcript'] : null; + $this->container['participant'] = isset($data['participant']) ? $data['participant'] : null; + $this->container['audio'] = isset($data['audio']) ? $data['audio'] : null; + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['title'] = isset($data['title']) ? $data['title'] : null; + $this->container['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['year'] = isset($data['year']) ? $data['year'] : null; + $this->container['quarter'] = isset($data['quarter']) ? $data['quarter'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets transcript + * + * @return object[]|null + */ + public function getTranscript() + { + return $this->container['transcript']; + } + + /** + * Sets transcript + * + * @param object[]|null $transcript Transcript content. + * + * @return $this + */ + public function setTranscript($transcript) + { + $this->container['transcript'] = $transcript; + + return $this; + } + + /** + * Gets participant + * + * @return object[]|null + */ + public function getParticipant() + { + return $this->container['participant']; + } + + /** + * Sets participant + * + * @param object[]|null $participant Participant list + * + * @return $this + */ + public function setParticipant($participant) + { + $this->container['participant'] = $participant; + + return $this; + } + + /** + * Gets audio + * + * @return string|null + */ + public function getAudio() + { + return $this->container['audio']; + } + + /** + * Sets audio + * + * @param string|null $audio Audio link. + * + * @return $this + */ + public function setAudio($audio) + { + $this->container['audio'] = $audio; + + return $this; + } + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Transcript's ID. + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title. + * + * @return $this + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets time + * + * @return \DateTime|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime|null $time Time of the event. + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets year + * + * @return int|null + */ + public function getYear() + { + return $this->container['year']; + } + + /** + * Sets year + * + * @param int|null $year Year of earnings result in the case of earnings call transcript. + * + * @return $this + */ + public function setYear($year) + { + $this->container['year'] = $year; + + return $this; + } + + /** + * Gets quarter + * + * @return int|null + */ + public function getQuarter() + { + return $this->container['quarter']; + } + + /** + * Sets quarter + * + * @param int|null $quarter Quarter of earnings result in the case of earnings call transcript. + * + * @return $this + */ + public function setQuarter($quarter) + { + $this->container['quarter'] = $quarter; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EarningsCallTranscriptsList.php b/lib/Model/EarningsCallTranscriptsList.php new file mode 100644 index 0000000..cba93e2 --- /dev/null +++ b/lib/Model/EarningsCallTranscriptsList.php @@ -0,0 +1,337 @@ + 'string', + 'transcripts' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'transcripts' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'transcripts' => 'transcripts' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'transcripts' => 'setTranscripts' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'transcripts' => 'getTranscripts' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['transcripts'] = isset($data['transcripts']) ? $data['transcripts'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets transcripts + * + * @return object[]|null + */ + public function getTranscripts() + { + return $this->container['transcripts']; + } + + /** + * Sets transcripts + * + * @param object[]|null $transcripts Array of transcripts' metadata + * + * @return $this + */ + public function setTranscripts($transcripts) + { + $this->container['transcripts'] = $transcripts; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EarningsEstimates.php b/lib/Model/EarningsEstimates.php new file mode 100644 index 0000000..bf9a1fb --- /dev/null +++ b/lib/Model/EarningsEstimates.php @@ -0,0 +1,367 @@ + 'object[]', + 'freq' => 'string', + 'symbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'data' => null, + 'freq' => null, + 'symbol' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'freq' => 'freq', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'freq' => 'setFreq', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'freq' => 'getFreq', + 'symbol' => 'getSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['data'] = isset($data['data']) ? $data['data'] : null; + $this->container['freq'] = isset($data['freq']) ? $data['freq'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return object[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object[]|null $data List of estimates + * + * @return $this + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets freq + * + * @return string|null + */ + public function getFreq() + { + return $this->container['freq']; + } + + /** + * Sets freq + * + * @param string|null $freq Frequency: annual or quarterly. + * + * @return $this + */ + public function setFreq($freq) + { + $this->container['freq'] = $freq; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EconomicCalendar.php b/lib/Model/EconomicCalendar.php new file mode 100644 index 0000000..3768696 --- /dev/null +++ b/lib/Model/EconomicCalendar.php @@ -0,0 +1,307 @@ + 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'economic_calendar' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'economic_calendar' => 'economicCalendar' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'economic_calendar' => 'setEconomicCalendar' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'economic_calendar' => 'getEconomicCalendar' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['economic_calendar'] = isset($data['economic_calendar']) ? $data['economic_calendar'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets economic_calendar + * + * @return object[]|null + */ + public function getEconomicCalendar() + { + return $this->container['economic_calendar']; + } + + /** + * Sets economic_calendar + * + * @param object[]|null $economic_calendar Array of economic events. + * + * @return $this + */ + public function setEconomicCalendar($economic_calendar) + { + $this->container['economic_calendar'] = $economic_calendar; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EconomicCode.php b/lib/Model/EconomicCode.php new file mode 100644 index 0000000..ace5e7c --- /dev/null +++ b/lib/Model/EconomicCode.php @@ -0,0 +1,397 @@ + 'string', + 'country' => 'string', + 'name' => 'string', + 'unit' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'code' => null, + 'country' => null, + 'name' => null, + 'unit' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'code' => 'code', + 'country' => 'country', + 'name' => 'name', + 'unit' => 'unit' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'code' => 'setCode', + 'country' => 'setCountry', + 'name' => 'setName', + 'unit' => 'setUnit' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'code' => 'getCode', + 'country' => 'getCountry', + 'name' => 'getName', + 'unit' => 'getUnit' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + $this->container['country'] = isset($data['country']) ? $data['country'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['unit'] = isset($data['unit']) ? $data['unit'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Finnhub economic code used to get historical data + * + * @return $this + */ + public function setCode($code) + { + $this->container['code'] = $code; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country + * + * @return $this + */ + public function setCountry($country) + { + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Indicator name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit Unit + * + * @return $this + */ + public function setUnit($unit) + { + $this->container['unit'] = $unit; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EconomicData.php b/lib/Model/EconomicData.php new file mode 100644 index 0000000..c5b2b80 --- /dev/null +++ b/lib/Model/EconomicData.php @@ -0,0 +1,337 @@ + 'object[]', + 'code' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'data' => null, + 'code' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'code' => 'code' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'code' => 'setCode' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'code' => 'getCode' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['data'] = isset($data['data']) ? $data['data'] : null; + $this->container['code'] = isset($data['code']) ? $data['code'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return object[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object[]|null $data Array of economic data for requested code. + * + * @return $this + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets code + * + * @return string|null + */ + public function getCode() + { + return $this->container['code']; + } + + /** + * Sets code + * + * @param string|null $code Finnhub economic code + * + * @return $this + */ + public function setCode($code) + { + $this->container['code'] = $code; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/EconomicEvent.php b/lib/Model/EconomicEvent.php new file mode 100644 index 0000000..d2f91c6 --- /dev/null +++ b/lib/Model/EconomicEvent.php @@ -0,0 +1,517 @@ + 'float', + 'prev' => 'float', + 'country' => 'string', + 'unit' => 'string', + 'estimate' => 'float', + 'event' => 'string', + 'impact' => 'string', + 'time' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'actual' => 'float', + 'prev' => 'float', + 'country' => null, + 'unit' => null, + 'estimate' => 'float', + 'event' => null, + 'impact' => null, + 'time' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'actual' => 'actual', + 'prev' => 'prev', + 'country' => 'country', + 'unit' => 'unit', + 'estimate' => 'estimate', + 'event' => 'event', + 'impact' => 'impact', + 'time' => 'time' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'actual' => 'setActual', + 'prev' => 'setPrev', + 'country' => 'setCountry', + 'unit' => 'setUnit', + 'estimate' => 'setEstimate', + 'event' => 'setEvent', + 'impact' => 'setImpact', + 'time' => 'setTime' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'actual' => 'getActual', + 'prev' => 'getPrev', + 'country' => 'getCountry', + 'unit' => 'getUnit', + 'estimate' => 'getEstimate', + 'event' => 'getEvent', + 'impact' => 'getImpact', + 'time' => 'getTime' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['actual'] = isset($data['actual']) ? $data['actual'] : null; + $this->container['prev'] = isset($data['prev']) ? $data['prev'] : null; + $this->container['country'] = isset($data['country']) ? $data['country'] : null; + $this->container['unit'] = isset($data['unit']) ? $data['unit'] : null; + $this->container['estimate'] = isset($data['estimate']) ? $data['estimate'] : null; + $this->container['event'] = isset($data['event']) ? $data['event'] : null; + $this->container['impact'] = isset($data['impact']) ? $data['impact'] : null; + $this->container['time'] = isset($data['time']) ? $data['time'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets actual + * + * @return float|null + */ + public function getActual() + { + return $this->container['actual']; + } + + /** + * Sets actual + * + * @param float|null $actual Actual release + * + * @return $this + */ + public function setActual($actual) + { + $this->container['actual'] = $actual; + + return $this; + } + + /** + * Gets prev + * + * @return float|null + */ + public function getPrev() + { + return $this->container['prev']; + } + + /** + * Sets prev + * + * @param float|null $prev Previous release + * + * @return $this + */ + public function setPrev($prev) + { + $this->container['prev'] = $prev; + + return $this; + } + + /** + * Gets country + * + * @return string|null + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string|null $country Country + * + * @return $this + */ + public function setCountry($country) + { + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets unit + * + * @return string|null + */ + public function getUnit() + { + return $this->container['unit']; + } + + /** + * Sets unit + * + * @param string|null $unit Unit + * + * @return $this + */ + public function setUnit($unit) + { + $this->container['unit'] = $unit; + + return $this; + } + + /** + * Gets estimate + * + * @return float|null + */ + public function getEstimate() + { + return $this->container['estimate']; + } + + /** + * Sets estimate + * + * @param float|null $estimate Estimate + * + * @return $this + */ + public function setEstimate($estimate) + { + $this->container['estimate'] = $estimate; + + return $this; + } + + /** + * Gets event + * + * @return string|null + */ + public function getEvent() + { + return $this->container['event']; + } + + /** + * Sets event + * + * @param string|null $event Event + * + * @return $this + */ + public function setEvent($event) + { + $this->container['event'] = $event; + + return $this; + } + + /** + * Gets impact + * + * @return string|null + */ + public function getImpact() + { + return $this->container['impact']; + } + + /** + * Sets impact + * + * @param string|null $impact Impact level + * + * @return $this + */ + public function setImpact($impact) + { + $this->container['impact'] = $impact; + + return $this; + } + + /** + * Gets time + * + * @return string|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param string|null $time Release time + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Estimate.php b/lib/Model/Estimate.php new file mode 100644 index 0000000..1d7a07b --- /dev/null +++ b/lib/Model/Estimate.php @@ -0,0 +1,427 @@ + 'int', + 'revenue_high' => 'int', + 'revenue_low' => 'int', + 'number_analysts' => 'int', + 'period' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'revenue_avg' => 'int64', + 'revenue_high' => 'int64', + 'revenue_low' => 'int64', + 'number_analysts' => 'int64', + 'period' => 'date' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'revenue_avg' => 'revenueAvg', + 'revenue_high' => 'revenueHigh', + 'revenue_low' => 'revenueLow', + 'number_analysts' => 'numberAnalysts', + 'period' => 'period' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'revenue_avg' => 'setRevenueAvg', + 'revenue_high' => 'setRevenueHigh', + 'revenue_low' => 'setRevenueLow', + 'number_analysts' => 'setNumberAnalysts', + 'period' => 'setPeriod' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'revenue_avg' => 'getRevenueAvg', + 'revenue_high' => 'getRevenueHigh', + 'revenue_low' => 'getRevenueLow', + 'number_analysts' => 'getNumberAnalysts', + 'period' => 'getPeriod' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['revenue_avg'] = isset($data['revenue_avg']) ? $data['revenue_avg'] : null; + $this->container['revenue_high'] = isset($data['revenue_high']) ? $data['revenue_high'] : null; + $this->container['revenue_low'] = isset($data['revenue_low']) ? $data['revenue_low'] : null; + $this->container['number_analysts'] = isset($data['number_analysts']) ? $data['number_analysts'] : null; + $this->container['period'] = isset($data['period']) ? $data['period'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets revenue_avg + * + * @return int|null + */ + public function getRevenueAvg() + { + return $this->container['revenue_avg']; + } + + /** + * Sets revenue_avg + * + * @param int|null $revenue_avg Average revenue estimates. + * + * @return $this + */ + public function setRevenueAvg($revenue_avg) + { + $this->container['revenue_avg'] = $revenue_avg; + + return $this; + } + + /** + * Gets revenue_high + * + * @return int|null + */ + public function getRevenueHigh() + { + return $this->container['revenue_high']; + } + + /** + * Sets revenue_high + * + * @param int|null $revenue_high Highest estimate. + * + * @return $this + */ + public function setRevenueHigh($revenue_high) + { + $this->container['revenue_high'] = $revenue_high; + + return $this; + } + + /** + * Gets revenue_low + * + * @return int|null + */ + public function getRevenueLow() + { + return $this->container['revenue_low']; + } + + /** + * Sets revenue_low + * + * @param int|null $revenue_low Lowest estimate. + * + * @return $this + */ + public function setRevenueLow($revenue_low) + { + $this->container['revenue_low'] = $revenue_low; + + return $this; + } + + /** + * Gets number_analysts + * + * @return int|null + */ + public function getNumberAnalysts() + { + return $this->container['number_analysts']; + } + + /** + * Sets number_analysts + * + * @param int|null $number_analysts Number of Analysts. + * + * @return $this + */ + public function setNumberAnalysts($number_analysts) + { + $this->container['number_analysts'] = $number_analysts; + + return $this; + } + + /** + * Gets period + * + * @return \DateTime|null + */ + public function getPeriod() + { + return $this->container['period']; + } + + /** + * Sets period + * + * @param \DateTime|null $period Period. + * + * @return $this + */ + public function setPeriod($period) + { + $this->container['period'] = $period; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Filing.php b/lib/Model/Filing.php new file mode 100644 index 0000000..979f9f9 --- /dev/null +++ b/lib/Model/Filing.php @@ -0,0 +1,517 @@ + 'string', + 'symbol' => 'string', + 'cik' => 'string', + 'form' => 'string', + 'filed_date' => '\DateTime', + 'accepted_date' => '\DateTime', + 'report_url' => 'string', + 'filing_url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'access_number' => null, + 'symbol' => null, + 'cik' => null, + 'form' => null, + 'filed_date' => 'date-time', + 'accepted_date' => 'date-time', + 'report_url' => null, + 'filing_url' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_number' => 'accessNumber', + 'symbol' => 'symbol', + 'cik' => 'cik', + 'form' => 'form', + 'filed_date' => 'filedDate', + 'accepted_date' => 'acceptedDate', + 'report_url' => 'reportUrl', + 'filing_url' => 'filingUrl' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_number' => 'setAccessNumber', + 'symbol' => 'setSymbol', + 'cik' => 'setCik', + 'form' => 'setForm', + 'filed_date' => 'setFiledDate', + 'accepted_date' => 'setAcceptedDate', + 'report_url' => 'setReportUrl', + 'filing_url' => 'setFilingUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_number' => 'getAccessNumber', + 'symbol' => 'getSymbol', + 'cik' => 'getCik', + 'form' => 'getForm', + 'filed_date' => 'getFiledDate', + 'accepted_date' => 'getAcceptedDate', + 'report_url' => 'getReportUrl', + 'filing_url' => 'getFilingUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['access_number'] = isset($data['access_number']) ? $data['access_number'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['cik'] = isset($data['cik']) ? $data['cik'] : null; + $this->container['form'] = isset($data['form']) ? $data['form'] : null; + $this->container['filed_date'] = isset($data['filed_date']) ? $data['filed_date'] : null; + $this->container['accepted_date'] = isset($data['accepted_date']) ? $data['accepted_date'] : null; + $this->container['report_url'] = isset($data['report_url']) ? $data['report_url'] : null; + $this->container['filing_url'] = isset($data['filing_url']) ? $data['filing_url'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets access_number + * + * @return string|null + */ + public function getAccessNumber() + { + return $this->container['access_number']; + } + + /** + * Sets access_number + * + * @param string|null $access_number Access number. + * + * @return $this + */ + public function setAccessNumber($access_number) + { + $this->container['access_number'] = $access_number; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets cik + * + * @return string|null + */ + public function getCik() + { + return $this->container['cik']; + } + + /** + * Sets cik + * + * @param string|null $cik CIK. + * + * @return $this + */ + public function setCik($cik) + { + $this->container['cik'] = $cik; + + return $this; + } + + /** + * Gets form + * + * @return string|null + */ + public function getForm() + { + return $this->container['form']; + } + + /** + * Sets form + * + * @param string|null $form Form type. + * + * @return $this + */ + public function setForm($form) + { + $this->container['form'] = $form; + + return $this; + } + + /** + * Gets filed_date + * + * @return \DateTime|null + */ + public function getFiledDate() + { + return $this->container['filed_date']; + } + + /** + * Sets filed_date + * + * @param \DateTime|null $filed_date Filed date %Y-%m-%d %H:%M:%S. + * + * @return $this + */ + public function setFiledDate($filed_date) + { + $this->container['filed_date'] = $filed_date; + + return $this; + } + + /** + * Gets accepted_date + * + * @return \DateTime|null + */ + public function getAcceptedDate() + { + return $this->container['accepted_date']; + } + + /** + * Sets accepted_date + * + * @param \DateTime|null $accepted_date Accepted date %Y-%m-%d %H:%M:%S. + * + * @return $this + */ + public function setAcceptedDate($accepted_date) + { + $this->container['accepted_date'] = $accepted_date; + + return $this; + } + + /** + * Gets report_url + * + * @return string|null + */ + public function getReportUrl() + { + return $this->container['report_url']; + } + + /** + * Sets report_url + * + * @param string|null $report_url Report's URL. + * + * @return $this + */ + public function setReportUrl($report_url) + { + $this->container['report_url'] = $report_url; + + return $this; + } + + /** + * Gets filing_url + * + * @return string|null + */ + public function getFilingUrl() + { + return $this->container['filing_url']; + } + + /** + * Sets filing_url + * + * @param string|null $filing_url Filing's URL. + * + * @return $this + */ + public function setFilingUrl($filing_url) + { + $this->container['filing_url'] = $filing_url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/FinancialStatements.php b/lib/Model/FinancialStatements.php new file mode 100644 index 0000000..9e9c069 --- /dev/null +++ b/lib/Model/FinancialStatements.php @@ -0,0 +1,337 @@ + 'string', + 'financials' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'financials' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'financials' => 'financials' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'financials' => 'setFinancials' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'financials' => 'getFinancials' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['financials'] = isset($data['financials']) ? $data['financials'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol of the company. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets financials + * + * @return object[]|null + */ + public function getFinancials() + { + return $this->container['financials']; + } + + /** + * Sets financials + * + * @param object[]|null $financials An array of map of key, value pairs containing the data for each period. + * + * @return $this + */ + public function setFinancials($financials) + { + $this->container['financials'] = $financials; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/FinancialsAsReported.php b/lib/Model/FinancialsAsReported.php new file mode 100644 index 0000000..65c61fe --- /dev/null +++ b/lib/Model/FinancialsAsReported.php @@ -0,0 +1,367 @@ + 'string', + 'cik' => 'string', + 'data' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'cik' => null, + 'data' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'cik' => 'cik', + 'data' => 'data' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'cik' => 'setCik', + 'data' => 'setData' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'cik' => 'getCik', + 'data' => 'getData' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['cik'] = isset($data['cik']) ? $data['cik'] : null; + $this->container['data'] = isset($data['data']) ? $data['data'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets cik + * + * @return string|null + */ + public function getCik() + { + return $this->container['cik']; + } + + /** + * Sets cik + * + * @param string|null $cik CIK + * + * @return $this + */ + public function setCik($cik) + { + $this->container['cik'] = $cik; + + return $this; + } + + /** + * Gets data + * + * @return object[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object[]|null $data Array of filings. + * + * @return $this + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ForexCandles.php b/lib/Model/ForexCandles.php new file mode 100644 index 0000000..aaa758d --- /dev/null +++ b/lib/Model/ForexCandles.php @@ -0,0 +1,487 @@ + 'float[]', + 'h' => 'float[]', + 'l' => 'float[]', + 'c' => 'float[]', + 'v' => 'float[]', + 't' => 'float[]', + 's' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'o' => 'float', + 'h' => 'float', + 'l' => 'float', + 'c' => 'float', + 'v' => 'float', + 't' => 'float', + 's' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'o' => 'o', + 'h' => 'h', + 'l' => 'l', + 'c' => 'c', + 'v' => 'v', + 't' => 't', + 's' => 's' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'o' => 'setO', + 'h' => 'setH', + 'l' => 'setL', + 'c' => 'setC', + 'v' => 'setV', + 't' => 'setT', + 's' => 'setS' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'o' => 'getO', + 'h' => 'getH', + 'l' => 'getL', + 'c' => 'getC', + 'v' => 'getV', + 't' => 'getT', + 's' => 'getS' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['o'] = isset($data['o']) ? $data['o'] : null; + $this->container['h'] = isset($data['h']) ? $data['h'] : null; + $this->container['l'] = isset($data['l']) ? $data['l'] : null; + $this->container['c'] = isset($data['c']) ? $data['c'] : null; + $this->container['v'] = isset($data['v']) ? $data['v'] : null; + $this->container['t'] = isset($data['t']) ? $data['t'] : null; + $this->container['s'] = isset($data['s']) ? $data['s'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets o + * + * @return float[]|null + */ + public function getO() + { + return $this->container['o']; + } + + /** + * Sets o + * + * @param float[]|null $o List of open prices for returned candles. + * + * @return $this + */ + public function setO($o) + { + $this->container['o'] = $o; + + return $this; + } + + /** + * Gets h + * + * @return float[]|null + */ + public function getH() + { + return $this->container['h']; + } + + /** + * Sets h + * + * @param float[]|null $h List of high prices for returned candles. + * + * @return $this + */ + public function setH($h) + { + $this->container['h'] = $h; + + return $this; + } + + /** + * Gets l + * + * @return float[]|null + */ + public function getL() + { + return $this->container['l']; + } + + /** + * Sets l + * + * @param float[]|null $l List of low prices for returned candles. + * + * @return $this + */ + public function setL($l) + { + $this->container['l'] = $l; + + return $this; + } + + /** + * Gets c + * + * @return float[]|null + */ + public function getC() + { + return $this->container['c']; + } + + /** + * Sets c + * + * @param float[]|null $c List of close prices for returned candles. + * + * @return $this + */ + public function setC($c) + { + $this->container['c'] = $c; + + return $this; + } + + /** + * Gets v + * + * @return float[]|null + */ + public function getV() + { + return $this->container['v']; + } + + /** + * Sets v + * + * @param float[]|null $v List of volume data for returned candles. + * + * @return $this + */ + public function setV($v) + { + $this->container['v'] = $v; + + return $this; + } + + /** + * Gets t + * + * @return float[]|null + */ + public function getT() + { + return $this->container['t']; + } + + /** + * Sets t + * + * @param float[]|null $t List of timestamp for returned candles. + * + * @return $this + */ + public function setT($t) + { + $this->container['t'] = $t; + + return $this; + } + + /** + * Gets s + * + * @return string|null + */ + public function getS() + { + return $this->container['s']; + } + + /** + * Sets s + * + * @param string|null $s Status of the response. This field can either be ok or no_data. + * + * @return $this + */ + public function setS($s) + { + $this->container['s'] = $s; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ForexSymbol.php b/lib/Model/ForexSymbol.php new file mode 100644 index 0000000..a719bde --- /dev/null +++ b/lib/Model/ForexSymbol.php @@ -0,0 +1,367 @@ + 'string', + 'display_symbol' => 'string', + 'symbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'description' => null, + 'display_symbol' => null, + 'symbol' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'description' => 'description', + 'display_symbol' => 'displaySymbol', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'description' => 'setDescription', + 'display_symbol' => 'setDisplaySymbol', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'description' => 'getDescription', + 'display_symbol' => 'getDisplaySymbol', + 'symbol' => 'getSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->container['display_symbol'] = isset($data['display_symbol']) ? $data['display_symbol'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Symbol description + * + * @return $this + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets display_symbol + * + * @return string|null + */ + public function getDisplaySymbol() + { + return $this->container['display_symbol']; + } + + /** + * Sets display_symbol + * + * @param string|null $display_symbol Display symbol name. + * + * @return $this + */ + public function setDisplaySymbol($display_symbol) + { + $this->container['display_symbol'] = $display_symbol; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Unique symbol used to identify this symbol used in /forex/candle endpoint. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Forexrates.php b/lib/Model/Forexrates.php new file mode 100644 index 0000000..c8d8456 --- /dev/null +++ b/lib/Model/Forexrates.php @@ -0,0 +1,337 @@ + 'string', + 'quote' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'base' => null, + 'quote' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'base' => 'base', + 'quote' => 'quote' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'base' => 'setBase', + 'quote' => 'setQuote' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'base' => 'getBase', + 'quote' => 'getQuote' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['base'] = isset($data['base']) ? $data['base'] : null; + $this->container['quote'] = isset($data['quote']) ? $data['quote'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets base + * + * @return string|null + */ + public function getBase() + { + return $this->container['base']; + } + + /** + * Sets base + * + * @param string|null $base Base currency. + * + * @return $this + */ + public function setBase($base) + { + $this->container['base'] = $base; + + return $this; + } + + /** + * Gets quote + * + * @return object|null + */ + public function getQuote() + { + return $this->container['quote']; + } + + /** + * Sets quote + * + * @param object|null $quote quote + * + * @return $this + */ + public function setQuote($quote) + { + $this->container['quote'] = $quote; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/FundOwnership.php b/lib/Model/FundOwnership.php new file mode 100644 index 0000000..8c64d27 --- /dev/null +++ b/lib/Model/FundOwnership.php @@ -0,0 +1,337 @@ + 'string', + 'ownership' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'ownership' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'ownership' => 'ownership' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'ownership' => 'setOwnership' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'ownership' => 'getOwnership' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['ownership'] = isset($data['ownership']) ? $data['ownership'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol of the company. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets ownership + * + * @return object[]|null + */ + public function getOwnership() + { + return $this->container['ownership']; + } + + /** + * Sets ownership + * + * @param object[]|null $ownership Array of investors with detailed information about their holdings. + * + * @return $this + */ + public function setOwnership($ownership) + { + $this->container['ownership'] = $ownership; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/IPOCalendar.php b/lib/Model/IPOCalendar.php new file mode 100644 index 0000000..abd636a --- /dev/null +++ b/lib/Model/IPOCalendar.php @@ -0,0 +1,307 @@ + 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'ipo_calendar' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ipo_calendar' => 'ipoCalendar' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ipo_calendar' => 'setIpoCalendar' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ipo_calendar' => 'getIpoCalendar' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['ipo_calendar'] = isset($data['ipo_calendar']) ? $data['ipo_calendar'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ipo_calendar + * + * @return object[]|null + */ + public function getIpoCalendar() + { + return $this->container['ipo_calendar']; + } + + /** + * Sets ipo_calendar + * + * @param object[]|null $ipo_calendar Array of IPO events. + * + * @return $this + */ + public function setIpoCalendar($ipo_calendar) + { + $this->container['ipo_calendar'] = $ipo_calendar; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/IPOEvent.php b/lib/Model/IPOEvent.php new file mode 100644 index 0000000..1bbaffb --- /dev/null +++ b/lib/Model/IPOEvent.php @@ -0,0 +1,517 @@ + 'string', + 'date' => '\DateTime', + 'exchange' => 'string', + 'name' => 'string', + 'status' => 'string', + 'price' => 'string', + 'number_of_shares' => 'int', + 'total_shares_value' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'date' => 'date', + 'exchange' => null, + 'name' => null, + 'status' => null, + 'price' => null, + 'number_of_shares' => 'int64', + 'total_shares_value' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'date' => 'date', + 'exchange' => 'exchange', + 'name' => 'name', + 'status' => 'status', + 'price' => 'price', + 'number_of_shares' => 'numberOfShares', + 'total_shares_value' => 'totalSharesValue' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'date' => 'setDate', + 'exchange' => 'setExchange', + 'name' => 'setName', + 'status' => 'setStatus', + 'price' => 'setPrice', + 'number_of_shares' => 'setNumberOfShares', + 'total_shares_value' => 'setTotalSharesValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'date' => 'getDate', + 'exchange' => 'getExchange', + 'name' => 'getName', + 'status' => 'getStatus', + 'price' => 'getPrice', + 'number_of_shares' => 'getNumberOfShares', + 'total_shares_value' => 'getTotalSharesValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['exchange'] = isset($data['exchange']) ? $data['exchange'] : null; + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['status'] = isset($data['status']) ? $data['status'] : null; + $this->container['price'] = isset($data['price']) ? $data['price'] : null; + $this->container['number_of_shares'] = isset($data['number_of_shares']) ? $data['number_of_shares'] : null; + $this->container['total_shares_value'] = isset($data['total_shares_value']) ? $data['total_shares_value'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date IPO date. + * + * @return $this + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets exchange + * + * @return string|null + */ + public function getExchange() + { + return $this->container['exchange']; + } + + /** + * Sets exchange + * + * @param string|null $exchange Exchange. + * + * @return $this + */ + public function setExchange($exchange) + { + $this->container['exchange'] = $exchange; + + return $this; + } + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Company's name. + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets status + * + * @return string|null + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string|null $status IPO status. Can take 1 of the following values: expected,priced,withdrawn,filed + * + * @return $this + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets price + * + * @return string|null + */ + public function getPrice() + { + return $this->container['price']; + } + + /** + * Sets price + * + * @param string|null $price Projected price or price range. + * + * @return $this + */ + public function setPrice($price) + { + $this->container['price'] = $price; + + return $this; + } + + /** + * Gets number_of_shares + * + * @return int|null + */ + public function getNumberOfShares() + { + return $this->container['number_of_shares']; + } + + /** + * Sets number_of_shares + * + * @param int|null $number_of_shares Number of shares offered during the IPO. + * + * @return $this + */ + public function setNumberOfShares($number_of_shares) + { + $this->container['number_of_shares'] = $number_of_shares; + + return $this; + } + + /** + * Gets total_shares_value + * + * @return int|null + */ + public function getTotalSharesValue() + { + return $this->container['total_shares_value']; + } + + /** + * Sets total_shares_value + * + * @param int|null $total_shares_value Total shares value. + * + * @return $this + */ + public function setTotalSharesValue($total_shares_value) + { + $this->container['total_shares_value'] = $total_shares_value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Indicator.php b/lib/Model/Indicator.php new file mode 100644 index 0000000..def86f1 --- /dev/null +++ b/lib/Model/Indicator.php @@ -0,0 +1,367 @@ + 'int', + 'neutral' => 'int', + 'sell' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'buy' => 'int64', + 'neutral' => 'int64', + 'sell' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'buy' => 'buy', + 'neutral' => 'neutral', + 'sell' => 'sell' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'buy' => 'setBuy', + 'neutral' => 'setNeutral', + 'sell' => 'setSell' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'buy' => 'getBuy', + 'neutral' => 'getNeutral', + 'sell' => 'getSell' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['buy'] = isset($data['buy']) ? $data['buy'] : null; + $this->container['neutral'] = isset($data['neutral']) ? $data['neutral'] : null; + $this->container['sell'] = isset($data['sell']) ? $data['sell'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets buy + * + * @return int|null + */ + public function getBuy() + { + return $this->container['buy']; + } + + /** + * Sets buy + * + * @param int|null $buy Number of buy signals + * + * @return $this + */ + public function setBuy($buy) + { + $this->container['buy'] = $buy; + + return $this; + } + + /** + * Gets neutral + * + * @return int|null + */ + public function getNeutral() + { + return $this->container['neutral']; + } + + /** + * Sets neutral + * + * @param int|null $neutral Number of neutral signals + * + * @return $this + */ + public function setNeutral($neutral) + { + $this->container['neutral'] = $neutral; + + return $this; + } + + /** + * Gets sell + * + * @return int|null + */ + public function getSell() + { + return $this->container['sell']; + } + + /** + * Sets sell + * + * @param int|null $sell Number of sell signals + * + * @return $this + */ + public function setSell($sell) + { + $this->container['sell'] = $sell; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Investor.php b/lib/Model/Investor.php new file mode 100644 index 0000000..8bf064a --- /dev/null +++ b/lib/Model/Investor.php @@ -0,0 +1,397 @@ + 'string', + 'share' => 'int', + 'change' => 'int', + 'filing_date' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'share' => 'int64', + 'change' => 'int64', + 'filing_date' => 'date' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'share' => 'share', + 'change' => 'change', + 'filing_date' => 'filingDate' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'share' => 'setShare', + 'change' => 'setChange', + 'filing_date' => 'setFilingDate' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'share' => 'getShare', + 'change' => 'getChange', + 'filing_date' => 'getFilingDate' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['share'] = isset($data['share']) ? $data['share'] : null; + $this->container['change'] = isset($data['change']) ? $data['change'] : null; + $this->container['filing_date'] = isset($data['filing_date']) ? $data['filing_date'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Investor's name. + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets share + * + * @return int|null + */ + public function getShare() + { + return $this->container['share']; + } + + /** + * Sets share + * + * @param int|null $share Number of shares held by the investor. + * + * @return $this + */ + public function setShare($share) + { + $this->container['share'] = $share; + + return $this; + } + + /** + * Gets change + * + * @return int|null + */ + public function getChange() + { + return $this->container['change']; + } + + /** + * Sets change + * + * @param int|null $change Number of share changed (net buy or sell) from the last period. + * + * @return $this + */ + public function setChange($change) + { + $this->container['change'] = $change; + + return $this; + } + + /** + * Gets filing_date + * + * @return \DateTime|null + */ + public function getFilingDate() + { + return $this->container['filing_date']; + } + + /** + * Sets filing_date + * + * @param \DateTime|null $filing_date Filing date. + * + * @return $this + */ + public function setFilingDate($filing_date) + { + $this->container['filing_date'] = $filing_date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/InvestorsOwnership.php b/lib/Model/InvestorsOwnership.php new file mode 100644 index 0000000..99811b6 --- /dev/null +++ b/lib/Model/InvestorsOwnership.php @@ -0,0 +1,337 @@ + 'string', + 'ownership' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'ownership' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'ownership' => 'ownership' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'ownership' => 'setOwnership' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'ownership' => 'getOwnership' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['ownership'] = isset($data['ownership']) ? $data['ownership'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol of the company. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets ownership + * + * @return object[]|null + */ + public function getOwnership() + { + return $this->container['ownership']; + } + + /** + * Sets ownership + * + * @param object[]|null $ownership Array of investors with detailed information about their holdings. + * + * @return $this + */ + public function setOwnership($ownership) + { + $this->container['ownership'] = $ownership; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/LastBidAsk.php b/lib/Model/LastBidAsk.php new file mode 100644 index 0000000..792ea50 --- /dev/null +++ b/lib/Model/LastBidAsk.php @@ -0,0 +1,427 @@ + 'float', + 'a' => 'float', + 'bv' => 'float', + 'av' => 'float', + 't' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'b' => 'float', + 'a' => 'float', + 'bv' => 'float', + 'av' => 'float', + 't' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'b' => 'b', + 'a' => 'a', + 'bv' => 'bv', + 'av' => 'av', + 't' => 't' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'b' => 'setB', + 'a' => 'setA', + 'bv' => 'setBv', + 'av' => 'setAv', + 't' => 'setT' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'b' => 'getB', + 'a' => 'getA', + 'bv' => 'getBv', + 'av' => 'getAv', + 't' => 'getT' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['b'] = isset($data['b']) ? $data['b'] : null; + $this->container['a'] = isset($data['a']) ? $data['a'] : null; + $this->container['bv'] = isset($data['bv']) ? $data['bv'] : null; + $this->container['av'] = isset($data['av']) ? $data['av'] : null; + $this->container['t'] = isset($data['t']) ? $data['t'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets b + * + * @return float|null + */ + public function getB() + { + return $this->container['b']; + } + + /** + * Sets b + * + * @param float|null $b Bid price. + * + * @return $this + */ + public function setB($b) + { + $this->container['b'] = $b; + + return $this; + } + + /** + * Gets a + * + * @return float|null + */ + public function getA() + { + return $this->container['a']; + } + + /** + * Sets a + * + * @param float|null $a Ask price. + * + * @return $this + */ + public function setA($a) + { + $this->container['a'] = $a; + + return $this; + } + + /** + * Gets bv + * + * @return float|null + */ + public function getBv() + { + return $this->container['bv']; + } + + /** + * Sets bv + * + * @param float|null $bv Bid volume. + * + * @return $this + */ + public function setBv($bv) + { + $this->container['bv'] = $bv; + + return $this; + } + + /** + * Gets av + * + * @return float|null + */ + public function getAv() + { + return $this->container['av']; + } + + /** + * Sets av + * + * @param float|null $av Ask volume. + * + * @return $this + */ + public function setAv($av) + { + $this->container['av'] = $av; + + return $this; + } + + /** + * Gets t + * + * @return int|null + */ + public function getT() + { + return $this->container['t']; + } + + /** + * Sets t + * + * @param int|null $t Reference UNIX timestamp in ms. + * + * @return $this + */ + public function setT($t) + { + $this->container['t'] = $t; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/MajorDevelopments.php b/lib/Model/MajorDevelopments.php new file mode 100644 index 0000000..6de1f7d --- /dev/null +++ b/lib/Model/MajorDevelopments.php @@ -0,0 +1,337 @@ + 'string', + 'major_development' => 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'major_development' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'major_development' => 'majorDevelopment' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'major_development' => 'setMajorDevelopment' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'major_development' => 'getMajorDevelopment' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['major_development'] = isset($data['major_development']) ? $data['major_development'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets major_development + * + * @return object[]|null + */ + public function getMajorDevelopment() + { + return $this->container['major_development']; + } + + /** + * Sets major_development + * + * @param object[]|null $major_development Array of major developments. + * + * @return $this + */ + public function setMajorDevelopment($major_development) + { + $this->container['major_development'] = $major_development; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/ModelInterface.php b/lib/Model/ModelInterface.php new file mode 100644 index 0000000..2a1a46b --- /dev/null +++ b/lib/Model/ModelInterface.php @@ -0,0 +1,96 @@ + 'string', + 'datetime' => 'int', + 'headline' => 'string', + 'id' => 'int', + 'image' => 'string', + 'related' => 'string', + 'source' => 'string', + 'summary' => 'string', + 'url' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'category' => null, + 'datetime' => 'int64', + 'headline' => null, + 'id' => 'int64', + 'image' => null, + 'related' => null, + 'source' => null, + 'summary' => null, + 'url' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'category' => 'category', + 'datetime' => 'datetime', + 'headline' => 'headline', + 'id' => 'id', + 'image' => 'image', + 'related' => 'related', + 'source' => 'source', + 'summary' => 'summary', + 'url' => 'url' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'category' => 'setCategory', + 'datetime' => 'setDatetime', + 'headline' => 'setHeadline', + 'id' => 'setId', + 'image' => 'setImage', + 'related' => 'setRelated', + 'source' => 'setSource', + 'summary' => 'setSummary', + 'url' => 'setUrl' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'category' => 'getCategory', + 'datetime' => 'getDatetime', + 'headline' => 'getHeadline', + 'id' => 'getId', + 'image' => 'getImage', + 'related' => 'getRelated', + 'source' => 'getSource', + 'summary' => 'getSummary', + 'url' => 'getUrl' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['category'] = isset($data['category']) ? $data['category'] : null; + $this->container['datetime'] = isset($data['datetime']) ? $data['datetime'] : null; + $this->container['headline'] = isset($data['headline']) ? $data['headline'] : null; + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['image'] = isset($data['image']) ? $data['image'] : null; + $this->container['related'] = isset($data['related']) ? $data['related'] : null; + $this->container['source'] = isset($data['source']) ? $data['source'] : null; + $this->container['summary'] = isset($data['summary']) ? $data['summary'] : null; + $this->container['url'] = isset($data['url']) ? $data['url'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets category + * + * @return string|null + */ + public function getCategory() + { + return $this->container['category']; + } + + /** + * Sets category + * + * @param string|null $category News category. + * + * @return $this + */ + public function setCategory($category) + { + $this->container['category'] = $category; + + return $this; + } + + /** + * Gets datetime + * + * @return int|null + */ + public function getDatetime() + { + return $this->container['datetime']; + } + + /** + * Sets datetime + * + * @param int|null $datetime Published time in UNIX timestamp. + * + * @return $this + */ + public function setDatetime($datetime) + { + $this->container['datetime'] = $datetime; + + return $this; + } + + /** + * Gets headline + * + * @return string|null + */ + public function getHeadline() + { + return $this->container['headline']; + } + + /** + * Sets headline + * + * @param string|null $headline News headline. + * + * @return $this + */ + public function setHeadline($headline) + { + $this->container['headline'] = $headline; + + return $this; + } + + /** + * Gets id + * + * @return int|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int|null $id News ID. This value can be used for minId params to get the latest news only. + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets image + * + * @return string|null + */ + public function getImage() + { + return $this->container['image']; + } + + /** + * Sets image + * + * @param string|null $image Thumbnail image URL. + * + * @return $this + */ + public function setImage($image) + { + $this->container['image'] = $image; + + return $this; + } + + /** + * Gets related + * + * @return string|null + */ + public function getRelated() + { + return $this->container['related']; + } + + /** + * Sets related + * + * @param string|null $related Related stocks and companies mentioned in the article. + * + * @return $this + */ + public function setRelated($related) + { + $this->container['related'] = $related; + + return $this; + } + + /** + * Gets source + * + * @return string|null + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string|null $source News source. + * + * @return $this + */ + public function setSource($source) + { + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets summary + * + * @return string|null + */ + public function getSummary() + { + return $this->container['summary']; + } + + /** + * Sets summary + * + * @param string|null $summary News summary. + * + * @return $this + */ + public function setSummary($summary) + { + $this->container['summary'] = $summary; + + return $this; + } + + /** + * Gets url + * + * @return string|null + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string|null $url URL of the original article. + * + * @return $this + */ + public function setUrl($url) + { + $this->container['url'] = $url; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/NewsSentiment.php b/lib/Model/NewsSentiment.php new file mode 100644 index 0000000..fa40028 --- /dev/null +++ b/lib/Model/NewsSentiment.php @@ -0,0 +1,457 @@ + '\Finnhub\Model\CompanyNewsStatistics', + 'company_news_score' => 'float', + 'sector_average_bullish_percent' => 'float', + 'sector_average_news_score' => 'float', + 'sentiment' => '\Finnhub\Model\Sentiment', + 'symbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'buzz' => null, + 'company_news_score' => 'float', + 'sector_average_bullish_percent' => 'float', + 'sector_average_news_score' => 'float', + 'sentiment' => null, + 'symbol' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'buzz' => 'buzz', + 'company_news_score' => 'companyNewsScore', + 'sector_average_bullish_percent' => 'sectorAverageBullishPercent', + 'sector_average_news_score' => 'sectorAverageNewsScore', + 'sentiment' => 'sentiment', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'buzz' => 'setBuzz', + 'company_news_score' => 'setCompanyNewsScore', + 'sector_average_bullish_percent' => 'setSectorAverageBullishPercent', + 'sector_average_news_score' => 'setSectorAverageNewsScore', + 'sentiment' => 'setSentiment', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'buzz' => 'getBuzz', + 'company_news_score' => 'getCompanyNewsScore', + 'sector_average_bullish_percent' => 'getSectorAverageBullishPercent', + 'sector_average_news_score' => 'getSectorAverageNewsScore', + 'sentiment' => 'getSentiment', + 'symbol' => 'getSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['buzz'] = isset($data['buzz']) ? $data['buzz'] : null; + $this->container['company_news_score'] = isset($data['company_news_score']) ? $data['company_news_score'] : null; + $this->container['sector_average_bullish_percent'] = isset($data['sector_average_bullish_percent']) ? $data['sector_average_bullish_percent'] : null; + $this->container['sector_average_news_score'] = isset($data['sector_average_news_score']) ? $data['sector_average_news_score'] : null; + $this->container['sentiment'] = isset($data['sentiment']) ? $data['sentiment'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets buzz + * + * @return \Finnhub\Model\CompanyNewsStatistics|null + */ + public function getBuzz() + { + return $this->container['buzz']; + } + + /** + * Sets buzz + * + * @param \Finnhub\Model\CompanyNewsStatistics|null $buzz buzz + * + * @return $this + */ + public function setBuzz($buzz) + { + $this->container['buzz'] = $buzz; + + return $this; + } + + /** + * Gets company_news_score + * + * @return float|null + */ + public function getCompanyNewsScore() + { + return $this->container['company_news_score']; + } + + /** + * Sets company_news_score + * + * @param float|null $company_news_score News score. + * + * @return $this + */ + public function setCompanyNewsScore($company_news_score) + { + $this->container['company_news_score'] = $company_news_score; + + return $this; + } + + /** + * Gets sector_average_bullish_percent + * + * @return float|null + */ + public function getSectorAverageBullishPercent() + { + return $this->container['sector_average_bullish_percent']; + } + + /** + * Sets sector_average_bullish_percent + * + * @param float|null $sector_average_bullish_percent Sector average bullish percent. + * + * @return $this + */ + public function setSectorAverageBullishPercent($sector_average_bullish_percent) + { + $this->container['sector_average_bullish_percent'] = $sector_average_bullish_percent; + + return $this; + } + + /** + * Gets sector_average_news_score + * + * @return float|null + */ + public function getSectorAverageNewsScore() + { + return $this->container['sector_average_news_score']; + } + + /** + * Sets sector_average_news_score + * + * @param float|null $sector_average_news_score Sectore average score. + * + * @return $this + */ + public function setSectorAverageNewsScore($sector_average_news_score) + { + $this->container['sector_average_news_score'] = $sector_average_news_score; + + return $this; + } + + /** + * Gets sentiment + * + * @return \Finnhub\Model\Sentiment|null + */ + public function getSentiment() + { + return $this->container['sentiment']; + } + + /** + * Sets sentiment + * + * @param \Finnhub\Model\Sentiment|null $sentiment sentiment + * + * @return $this + */ + public function setSentiment($sentiment) + { + $this->container['sentiment'] = $sentiment; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Requested symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/PatternRecognition.php b/lib/Model/PatternRecognition.php new file mode 100644 index 0000000..6ca09fa --- /dev/null +++ b/lib/Model/PatternRecognition.php @@ -0,0 +1,307 @@ + 'object[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'points' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'points' => 'points' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'points' => 'setPoints' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'points' => 'getPoints' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['points'] = isset($data['points']) ? $data['points'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets points + * + * @return object[]|null + */ + public function getPoints() + { + return $this->container['points']; + } + + /** + * Sets points + * + * @param object[]|null $points Array of patterns. + * + * @return $this + */ + public function setPoints($points) + { + $this->container['points'] = $points; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/PriceTarget.php b/lib/Model/PriceTarget.php new file mode 100644 index 0000000..f2dabe9 --- /dev/null +++ b/lib/Model/PriceTarget.php @@ -0,0 +1,457 @@ + 'string', + 'target_high' => 'float', + 'target_low' => 'float', + 'target_mean' => 'float', + 'target_median' => 'float', + 'last_updated' => '\DateTime' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'target_high' => 'float', + 'target_low' => 'float', + 'target_mean' => 'float', + 'target_median' => 'float', + 'last_updated' => 'date-time' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'target_high' => 'targetHigh', + 'target_low' => 'targetLow', + 'target_mean' => 'targetMean', + 'target_median' => 'targetMedian', + 'last_updated' => 'lastUpdated' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'target_high' => 'setTargetHigh', + 'target_low' => 'setTargetLow', + 'target_mean' => 'setTargetMean', + 'target_median' => 'setTargetMedian', + 'last_updated' => 'setLastUpdated' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'target_high' => 'getTargetHigh', + 'target_low' => 'getTargetLow', + 'target_mean' => 'getTargetMean', + 'target_median' => 'getTargetMedian', + 'last_updated' => 'getLastUpdated' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['target_high'] = isset($data['target_high']) ? $data['target_high'] : null; + $this->container['target_low'] = isset($data['target_low']) ? $data['target_low'] : null; + $this->container['target_mean'] = isset($data['target_mean']) ? $data['target_mean'] : null; + $this->container['target_median'] = isset($data['target_median']) ? $data['target_median'] : null; + $this->container['last_updated'] = isset($data['last_updated']) ? $data['last_updated'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets target_high + * + * @return float|null + */ + public function getTargetHigh() + { + return $this->container['target_high']; + } + + /** + * Sets target_high + * + * @param float|null $target_high Highes analysts' target. + * + * @return $this + */ + public function setTargetHigh($target_high) + { + $this->container['target_high'] = $target_high; + + return $this; + } + + /** + * Gets target_low + * + * @return float|null + */ + public function getTargetLow() + { + return $this->container['target_low']; + } + + /** + * Sets target_low + * + * @param float|null $target_low Lowest analysts' target. + * + * @return $this + */ + public function setTargetLow($target_low) + { + $this->container['target_low'] = $target_low; + + return $this; + } + + /** + * Gets target_mean + * + * @return float|null + */ + public function getTargetMean() + { + return $this->container['target_mean']; + } + + /** + * Sets target_mean + * + * @param float|null $target_mean Mean of all analysts' targets. + * + * @return $this + */ + public function setTargetMean($target_mean) + { + $this->container['target_mean'] = $target_mean; + + return $this; + } + + /** + * Gets target_median + * + * @return float|null + */ + public function getTargetMedian() + { + return $this->container['target_median']; + } + + /** + * Sets target_median + * + * @param float|null $target_median Median of all analysts' targets. + * + * @return $this + */ + public function setTargetMedian($target_median) + { + $this->container['target_median'] = $target_median; + + return $this; + } + + /** + * Gets last_updated + * + * @return \DateTime|null + */ + public function getLastUpdated() + { + return $this->container['last_updated']; + } + + /** + * Sets last_updated + * + * @param \DateTime|null $last_updated Updated time of the data + * + * @return $this + */ + public function setLastUpdated($last_updated) + { + $this->container['last_updated'] = $last_updated; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Quote.php b/lib/Model/Quote.php new file mode 100644 index 0000000..0920077 --- /dev/null +++ b/lib/Model/Quote.php @@ -0,0 +1,427 @@ + 'float', + 'h' => 'float', + 'l' => 'float', + 'c' => 'float', + 'pc' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'o' => 'float', + 'h' => 'float', + 'l' => 'float', + 'c' => 'float', + 'pc' => 'float' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'o' => 'o', + 'h' => 'h', + 'l' => 'l', + 'c' => 'c', + 'pc' => 'pc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'o' => 'setO', + 'h' => 'setH', + 'l' => 'setL', + 'c' => 'setC', + 'pc' => 'setPc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'o' => 'getO', + 'h' => 'getH', + 'l' => 'getL', + 'c' => 'getC', + 'pc' => 'getPc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['o'] = isset($data['o']) ? $data['o'] : null; + $this->container['h'] = isset($data['h']) ? $data['h'] : null; + $this->container['l'] = isset($data['l']) ? $data['l'] : null; + $this->container['c'] = isset($data['c']) ? $data['c'] : null; + $this->container['pc'] = isset($data['pc']) ? $data['pc'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets o + * + * @return float|null + */ + public function getO() + { + return $this->container['o']; + } + + /** + * Sets o + * + * @param float|null $o Open price of the day + * + * @return $this + */ + public function setO($o) + { + $this->container['o'] = $o; + + return $this; + } + + /** + * Gets h + * + * @return float|null + */ + public function getH() + { + return $this->container['h']; + } + + /** + * Sets h + * + * @param float|null $h High price of the day + * + * @return $this + */ + public function setH($h) + { + $this->container['h'] = $h; + + return $this; + } + + /** + * Gets l + * + * @return float|null + */ + public function getL() + { + return $this->container['l']; + } + + /** + * Sets l + * + * @param float|null $l Low price of the day + * + * @return $this + */ + public function setL($l) + { + $this->container['l'] = $l; + + return $this; + } + + /** + * Gets c + * + * @return float|null + */ + public function getC() + { + return $this->container['c']; + } + + /** + * Sets c + * + * @param float|null $c Current price + * + * @return $this + */ + public function setC($c) + { + $this->container['c'] = $c; + + return $this; + } + + /** + * Gets pc + * + * @return float|null + */ + public function getPc() + { + return $this->container['pc']; + } + + /** + * Sets pc + * + * @param float|null $pc Previous close price + * + * @return $this + */ + public function setPc($pc) + { + $this->container['pc'] = $pc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/RecommendationTrend.php b/lib/Model/RecommendationTrend.php new file mode 100644 index 0000000..6e782ab --- /dev/null +++ b/lib/Model/RecommendationTrend.php @@ -0,0 +1,487 @@ + 'string', + 'buy' => 'int', + 'hold' => 'int', + 'period' => 'string', + 'sell' => 'int', + 'strong_buy' => 'int', + 'strong_sell' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'buy' => 'int64', + 'hold' => 'int64', + 'period' => null, + 'sell' => 'int64', + 'strong_buy' => 'int64', + 'strong_sell' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'buy' => 'buy', + 'hold' => 'hold', + 'period' => 'period', + 'sell' => 'sell', + 'strong_buy' => 'strongBuy', + 'strong_sell' => 'strongSell' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'buy' => 'setBuy', + 'hold' => 'setHold', + 'period' => 'setPeriod', + 'sell' => 'setSell', + 'strong_buy' => 'setStrongBuy', + 'strong_sell' => 'setStrongSell' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'buy' => 'getBuy', + 'hold' => 'getHold', + 'period' => 'getPeriod', + 'sell' => 'getSell', + 'strong_buy' => 'getStrongBuy', + 'strong_sell' => 'getStrongSell' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['buy'] = isset($data['buy']) ? $data['buy'] : null; + $this->container['hold'] = isset($data['hold']) ? $data['hold'] : null; + $this->container['period'] = isset($data['period']) ? $data['period'] : null; + $this->container['sell'] = isset($data['sell']) ? $data['sell'] : null; + $this->container['strong_buy'] = isset($data['strong_buy']) ? $data['strong_buy'] : null; + $this->container['strong_sell'] = isset($data['strong_sell']) ? $data['strong_sell'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets buy + * + * @return int|null + */ + public function getBuy() + { + return $this->container['buy']; + } + + /** + * Sets buy + * + * @param int|null $buy Number of recommendations that fall into the Buy category + * + * @return $this + */ + public function setBuy($buy) + { + $this->container['buy'] = $buy; + + return $this; + } + + /** + * Gets hold + * + * @return int|null + */ + public function getHold() + { + return $this->container['hold']; + } + + /** + * Sets hold + * + * @param int|null $hold Number of recommendations that fall into the Hold category + * + * @return $this + */ + public function setHold($hold) + { + $this->container['hold'] = $hold; + + return $this; + } + + /** + * Gets period + * + * @return string|null + */ + public function getPeriod() + { + return $this->container['period']; + } + + /** + * Sets period + * + * @param string|null $period Updated period + * + * @return $this + */ + public function setPeriod($period) + { + $this->container['period'] = $period; + + return $this; + } + + /** + * Gets sell + * + * @return int|null + */ + public function getSell() + { + return $this->container['sell']; + } + + /** + * Sets sell + * + * @param int|null $sell Number of recommendations that fall into the Sell category + * + * @return $this + */ + public function setSell($sell) + { + $this->container['sell'] = $sell; + + return $this; + } + + /** + * Gets strong_buy + * + * @return int|null + */ + public function getStrongBuy() + { + return $this->container['strong_buy']; + } + + /** + * Sets strong_buy + * + * @param int|null $strong_buy Number of recommendations that fall into the Strong Buy category + * + * @return $this + */ + public function setStrongBuy($strong_buy) + { + $this->container['strong_buy'] = $strong_buy; + + return $this; + } + + /** + * Gets strong_sell + * + * @return int|null + */ + public function getStrongSell() + { + return $this->container['strong_sell']; + } + + /** + * Sets strong_sell + * + * @param int|null $strong_sell Number of recommendations that fall into the Strong Sell category + * + * @return $this + */ + public function setStrongSell($strong_sell) + { + $this->container['strong_sell'] = $strong_sell; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Report.php b/lib/Model/Report.php new file mode 100644 index 0000000..a7fc5c1 --- /dev/null +++ b/lib/Model/Report.php @@ -0,0 +1,607 @@ + 'string', + 'symbol' => 'string', + 'cik' => 'string', + 'year' => 'int', + 'quarter' => 'int', + 'form' => 'string', + 'start_date' => '\DateTime', + 'end_date' => '\DateTime', + 'filed_date' => '\DateTime', + 'accepted_date' => '\DateTime', + 'report' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'access_number' => null, + 'symbol' => null, + 'cik' => null, + 'year' => 'int64', + 'quarter' => 'int64', + 'form' => null, + 'start_date' => 'date-time', + 'end_date' => 'date-time', + 'filed_date' => 'date-time', + 'accepted_date' => 'date-time', + 'report' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'access_number' => 'accessNumber', + 'symbol' => 'symbol', + 'cik' => 'cik', + 'year' => 'year', + 'quarter' => 'quarter', + 'form' => 'form', + 'start_date' => 'startDate', + 'end_date' => 'endDate', + 'filed_date' => 'filedDate', + 'accepted_date' => 'acceptedDate', + 'report' => 'report' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'access_number' => 'setAccessNumber', + 'symbol' => 'setSymbol', + 'cik' => 'setCik', + 'year' => 'setYear', + 'quarter' => 'setQuarter', + 'form' => 'setForm', + 'start_date' => 'setStartDate', + 'end_date' => 'setEndDate', + 'filed_date' => 'setFiledDate', + 'accepted_date' => 'setAcceptedDate', + 'report' => 'setReport' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'access_number' => 'getAccessNumber', + 'symbol' => 'getSymbol', + 'cik' => 'getCik', + 'year' => 'getYear', + 'quarter' => 'getQuarter', + 'form' => 'getForm', + 'start_date' => 'getStartDate', + 'end_date' => 'getEndDate', + 'filed_date' => 'getFiledDate', + 'accepted_date' => 'getAcceptedDate', + 'report' => 'getReport' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['access_number'] = isset($data['access_number']) ? $data['access_number'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['cik'] = isset($data['cik']) ? $data['cik'] : null; + $this->container['year'] = isset($data['year']) ? $data['year'] : null; + $this->container['quarter'] = isset($data['quarter']) ? $data['quarter'] : null; + $this->container['form'] = isset($data['form']) ? $data['form'] : null; + $this->container['start_date'] = isset($data['start_date']) ? $data['start_date'] : null; + $this->container['end_date'] = isset($data['end_date']) ? $data['end_date'] : null; + $this->container['filed_date'] = isset($data['filed_date']) ? $data['filed_date'] : null; + $this->container['accepted_date'] = isset($data['accepted_date']) ? $data['accepted_date'] : null; + $this->container['report'] = isset($data['report']) ? $data['report'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets access_number + * + * @return string|null + */ + public function getAccessNumber() + { + return $this->container['access_number']; + } + + /** + * Sets access_number + * + * @param string|null $access_number Access number. + * + * @return $this + */ + public function setAccessNumber($access_number) + { + $this->container['access_number'] = $access_number; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets cik + * + * @return string|null + */ + public function getCik() + { + return $this->container['cik']; + } + + /** + * Sets cik + * + * @param string|null $cik CIK. + * + * @return $this + */ + public function setCik($cik) + { + $this->container['cik'] = $cik; + + return $this; + } + + /** + * Gets year + * + * @return int|null + */ + public function getYear() + { + return $this->container['year']; + } + + /** + * Sets year + * + * @param int|null $year Year. + * + * @return $this + */ + public function setYear($year) + { + $this->container['year'] = $year; + + return $this; + } + + /** + * Gets quarter + * + * @return int|null + */ + public function getQuarter() + { + return $this->container['quarter']; + } + + /** + * Sets quarter + * + * @param int|null $quarter Quarter. + * + * @return $this + */ + public function setQuarter($quarter) + { + $this->container['quarter'] = $quarter; + + return $this; + } + + /** + * Gets form + * + * @return string|null + */ + public function getForm() + { + return $this->container['form']; + } + + /** + * Sets form + * + * @param string|null $form Form type. + * + * @return $this + */ + public function setForm($form) + { + $this->container['form'] = $form; + + return $this; + } + + /** + * Gets start_date + * + * @return \DateTime|null + */ + public function getStartDate() + { + return $this->container['start_date']; + } + + /** + * Sets start_date + * + * @param \DateTime|null $start_date Period start date %Y-%m-%d %H:%M:%S. + * + * @return $this + */ + public function setStartDate($start_date) + { + $this->container['start_date'] = $start_date; + + return $this; + } + + /** + * Gets end_date + * + * @return \DateTime|null + */ + public function getEndDate() + { + return $this->container['end_date']; + } + + /** + * Sets end_date + * + * @param \DateTime|null $end_date Period end date %Y-%m-%d %H:%M:%S. + * + * @return $this + */ + public function setEndDate($end_date) + { + $this->container['end_date'] = $end_date; + + return $this; + } + + /** + * Gets filed_date + * + * @return \DateTime|null + */ + public function getFiledDate() + { + return $this->container['filed_date']; + } + + /** + * Sets filed_date + * + * @param \DateTime|null $filed_date Filed date %Y-%m-%d %H:%M:%S. + * + * @return $this + */ + public function setFiledDate($filed_date) + { + $this->container['filed_date'] = $filed_date; + + return $this; + } + + /** + * Gets accepted_date + * + * @return \DateTime|null + */ + public function getAcceptedDate() + { + return $this->container['accepted_date']; + } + + /** + * Sets accepted_date + * + * @param \DateTime|null $accepted_date Accepted date %Y-%m-%d %H:%M:%S. + * + * @return $this + */ + public function setAcceptedDate($accepted_date) + { + $this->container['accepted_date'] = $accepted_date; + + return $this; + } + + /** + * Gets report + * + * @return object|null + */ + public function getReport() + { + return $this->container['report']; + } + + /** + * Sets report + * + * @param object|null $report report + * + * @return $this + */ + public function setReport($report) + { + $this->container['report'] = $report; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/RevenueEstimates.php b/lib/Model/RevenueEstimates.php new file mode 100644 index 0000000..3f7922f --- /dev/null +++ b/lib/Model/RevenueEstimates.php @@ -0,0 +1,367 @@ + 'object[]', + 'freq' => 'string', + 'symbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'data' => null, + 'freq' => null, + 'symbol' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'freq' => 'freq', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'freq' => 'setFreq', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'freq' => 'getFreq', + 'symbol' => 'getSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['data'] = isset($data['data']) ? $data['data'] : null; + $this->container['freq'] = isset($data['freq']) ? $data['freq'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return object[]|null + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param object[]|null $data List of estimates + * + * @return $this + */ + public function setData($data) + { + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets freq + * + * @return string|null + */ + public function getFreq() + { + return $this->container['freq']; + } + + /** + * Sets freq + * + * @param string|null $freq Frequency: annual or quarterly. + * + * @return $this + */ + public function setFreq($freq) + { + $this->container['freq'] = $freq; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Sentiment.php b/lib/Model/Sentiment.php new file mode 100644 index 0000000..aa39bba --- /dev/null +++ b/lib/Model/Sentiment.php @@ -0,0 +1,337 @@ + 'int', + 'bullish_percent' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'bearish_percent' => 'int64', + 'bullish_percent' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'bearish_percent' => 'bearishPercent', + 'bullish_percent' => 'bullishPercent' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bearish_percent' => 'setBearishPercent', + 'bullish_percent' => 'setBullishPercent' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bearish_percent' => 'getBearishPercent', + 'bullish_percent' => 'getBullishPercent' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['bearish_percent'] = isset($data['bearish_percent']) ? $data['bearish_percent'] : null; + $this->container['bullish_percent'] = isset($data['bullish_percent']) ? $data['bullish_percent'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets bearish_percent + * + * @return int|null + */ + public function getBearishPercent() + { + return $this->container['bearish_percent']; + } + + /** + * Sets bearish_percent + * + * @param int|null $bearish_percent + * + * @return $this + */ + public function setBearishPercent($bearish_percent) + { + $this->container['bearish_percent'] = $bearish_percent; + + return $this; + } + + /** + * Gets bullish_percent + * + * @return int|null + */ + public function getBullishPercent() + { + return $this->container['bullish_percent']; + } + + /** + * Sets bullish_percent + * + * @param int|null $bullish_percent + * + * @return $this + */ + public function setBullishPercent($bullish_percent) + { + $this->container['bullish_percent'] = $bullish_percent; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Split.php b/lib/Model/Split.php new file mode 100644 index 0000000..3d1115a --- /dev/null +++ b/lib/Model/Split.php @@ -0,0 +1,397 @@ + 'string', + 'date' => '\DateTime', + 'from_factor' => 'float', + 'to_factor' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'date' => 'date', + 'from_factor' => 'float', + 'to_factor' => 'float' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'date' => 'date', + 'from_factor' => 'fromFactor', + 'to_factor' => 'toFactor' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'date' => 'setDate', + 'from_factor' => 'setFromFactor', + 'to_factor' => 'setToFactor' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'date' => 'getDate', + 'from_factor' => 'getFromFactor', + 'to_factor' => 'getToFactor' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['date'] = isset($data['date']) ? $data['date'] : null; + $this->container['from_factor'] = isset($data['from_factor']) ? $data['from_factor'] : null; + $this->container['to_factor'] = isset($data['to_factor']) ? $data['to_factor'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets date + * + * @return \DateTime|null + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param \DateTime|null $date Split date. + * + * @return $this + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets from_factor + * + * @return float|null + */ + public function getFromFactor() + { + return $this->container['from_factor']; + } + + /** + * Sets from_factor + * + * @param float|null $from_factor From factor. + * + * @return $this + */ + public function setFromFactor($from_factor) + { + $this->container['from_factor'] = $from_factor; + + return $this; + } + + /** + * Gets to_factor + * + * @return float|null + */ + public function getToFactor() + { + return $this->container['to_factor']; + } + + /** + * Sets to_factor + * + * @param float|null $to_factor To factor. + * + * @return $this + */ + public function setToFactor($to_factor) + { + $this->container['to_factor'] = $to_factor; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Stock.php b/lib/Model/Stock.php new file mode 100644 index 0000000..fd12841 --- /dev/null +++ b/lib/Model/Stock.php @@ -0,0 +1,367 @@ + 'string', + 'display_symbol' => 'string', + 'symbol' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'description' => null, + 'display_symbol' => null, + 'symbol' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'description' => 'description', + 'display_symbol' => 'displaySymbol', + 'symbol' => 'symbol' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'description' => 'setDescription', + 'display_symbol' => 'setDisplaySymbol', + 'symbol' => 'setSymbol' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'description' => 'getDescription', + 'display_symbol' => 'getDisplaySymbol', + 'symbol' => 'getSymbol' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['description'] = isset($data['description']) ? $data['description'] : null; + $this->container['display_symbol'] = isset($data['display_symbol']) ? $data['display_symbol'] : null; + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Symbol description + * + * @return $this + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets display_symbol + * + * @return string|null + */ + public function getDisplaySymbol() + { + return $this->container['display_symbol']; + } + + /** + * Sets display_symbol + * + * @param string|null $display_symbol Display symbol name. + * + * @return $this + */ + public function setDisplaySymbol($display_symbol) + { + $this->container['display_symbol'] = $display_symbol; + + return $this; + } + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Unique symbol used to identify this symbol used in /stock/candle endpoint. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/StockCandles.php b/lib/Model/StockCandles.php new file mode 100644 index 0000000..fbcdff1 --- /dev/null +++ b/lib/Model/StockCandles.php @@ -0,0 +1,487 @@ + 'float[]', + 'h' => 'float[]', + 'l' => 'float[]', + 'c' => 'float[]', + 'v' => 'float[]', + 't' => 'int[]', + 's' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'o' => 'float', + 'h' => 'float', + 'l' => 'float', + 'c' => 'float', + 'v' => 'float', + 't' => 'int64', + 's' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'o' => 'o', + 'h' => 'h', + 'l' => 'l', + 'c' => 'c', + 'v' => 'v', + 't' => 't', + 's' => 's' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'o' => 'setO', + 'h' => 'setH', + 'l' => 'setL', + 'c' => 'setC', + 'v' => 'setV', + 't' => 'setT', + 's' => 'setS' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'o' => 'getO', + 'h' => 'getH', + 'l' => 'getL', + 'c' => 'getC', + 'v' => 'getV', + 't' => 'getT', + 's' => 'getS' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['o'] = isset($data['o']) ? $data['o'] : null; + $this->container['h'] = isset($data['h']) ? $data['h'] : null; + $this->container['l'] = isset($data['l']) ? $data['l'] : null; + $this->container['c'] = isset($data['c']) ? $data['c'] : null; + $this->container['v'] = isset($data['v']) ? $data['v'] : null; + $this->container['t'] = isset($data['t']) ? $data['t'] : null; + $this->container['s'] = isset($data['s']) ? $data['s'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets o + * + * @return float[]|null + */ + public function getO() + { + return $this->container['o']; + } + + /** + * Sets o + * + * @param float[]|null $o List of open prices for returned candles. + * + * @return $this + */ + public function setO($o) + { + $this->container['o'] = $o; + + return $this; + } + + /** + * Gets h + * + * @return float[]|null + */ + public function getH() + { + return $this->container['h']; + } + + /** + * Sets h + * + * @param float[]|null $h List of high prices for returned candles. + * + * @return $this + */ + public function setH($h) + { + $this->container['h'] = $h; + + return $this; + } + + /** + * Gets l + * + * @return float[]|null + */ + public function getL() + { + return $this->container['l']; + } + + /** + * Sets l + * + * @param float[]|null $l List of low prices for returned candles. + * + * @return $this + */ + public function setL($l) + { + $this->container['l'] = $l; + + return $this; + } + + /** + * Gets c + * + * @return float[]|null + */ + public function getC() + { + return $this->container['c']; + } + + /** + * Sets c + * + * @param float[]|null $c List of close prices for returned candles. + * + * @return $this + */ + public function setC($c) + { + $this->container['c'] = $c; + + return $this; + } + + /** + * Gets v + * + * @return float[]|null + */ + public function getV() + { + return $this->container['v']; + } + + /** + * Sets v + * + * @param float[]|null $v List of volume data for returned candles. + * + * @return $this + */ + public function setV($v) + { + $this->container['v'] = $v; + + return $this; + } + + /** + * Gets t + * + * @return int[]|null + */ + public function getT() + { + return $this->container['t']; + } + + /** + * Sets t + * + * @param int[]|null $t List of timestamp for returned candles. + * + * @return $this + */ + public function setT($t) + { + $this->container['t'] = $t; + + return $this; + } + + /** + * Gets s + * + * @return string|null + */ + public function getS() + { + return $this->container['s']; + } + + /** + * Sets s + * + * @param string|null $s Status of the response. This field can either be ok or no_data. + * + * @return $this + */ + public function setS($s) + { + $this->container['s'] = $s; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/StockTranscripts.php b/lib/Model/StockTranscripts.php new file mode 100644 index 0000000..f377f42 --- /dev/null +++ b/lib/Model/StockTranscripts.php @@ -0,0 +1,427 @@ + 'string', + 'title' => 'string', + 'time' => '\DateTime', + 'year' => 'int', + 'quarter' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'id' => null, + 'title' => null, + 'time' => 'date-time', + 'year' => 'int64', + 'quarter' => 'int64' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'id', + 'title' => 'title', + 'time' => 'time', + 'year' => 'year', + 'quarter' => 'quarter' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'title' => 'setTitle', + 'time' => 'setTime', + 'year' => 'setYear', + 'quarter' => 'setQuarter' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'title' => 'getTitle', + 'time' => 'getTime', + 'year' => 'getYear', + 'quarter' => 'getQuarter' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['id'] = isset($data['id']) ? $data['id'] : null; + $this->container['title'] = isset($data['title']) ? $data['title'] : null; + $this->container['time'] = isset($data['time']) ? $data['time'] : null; + $this->container['year'] = isset($data['year']) ? $data['year'] : null; + $this->container['quarter'] = isset($data['quarter']) ? $data['quarter'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return string|null + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string|null $id Transcript's ID used to get the full transcript. + * + * @return $this + */ + public function setId($id) + { + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets title + * + * @return string|null + */ + public function getTitle() + { + return $this->container['title']; + } + + /** + * Sets title + * + * @param string|null $title Title. + * + * @return $this + */ + public function setTitle($title) + { + $this->container['title'] = $title; + + return $this; + } + + /** + * Gets time + * + * @return \DateTime|null + */ + public function getTime() + { + return $this->container['time']; + } + + /** + * Sets time + * + * @param \DateTime|null $time Time of the event. + * + * @return $this + */ + public function setTime($time) + { + $this->container['time'] = $time; + + return $this; + } + + /** + * Gets year + * + * @return int|null + */ + public function getYear() + { + return $this->container['year']; + } + + /** + * Sets year + * + * @param int|null $year Year of earnings result in the case of earnings call transcript. + * + * @return $this + */ + public function setYear($year) + { + $this->container['year'] = $year; + + return $this; + } + + /** + * Gets quarter + * + * @return int|null + */ + public function getQuarter() + { + return $this->container['quarter']; + } + + /** + * Sets quarter + * + * @param int|null $quarter Quarter of earnings result in the case of earnings call transcript. + * + * @return $this + */ + public function setQuarter($quarter) + { + $this->container['quarter'] = $quarter; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/SupportResistance.php b/lib/Model/SupportResistance.php new file mode 100644 index 0000000..f16f5a6 --- /dev/null +++ b/lib/Model/SupportResistance.php @@ -0,0 +1,307 @@ + 'float[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'levels' => 'float' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'levels' => 'levels' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'levels' => 'setLevels' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'levels' => 'getLevels' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['levels'] = isset($data['levels']) ? $data['levels'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets levels + * + * @return float[]|null + */ + public function getLevels() + { + return $this->container['levels']; + } + + /** + * Sets levels + * + * @param float[]|null $levels Array of support and resistance levels. + * + * @return $this + */ + public function setLevels($levels) + { + $this->container['levels'] = $levels; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TechnicalAnalysis.php b/lib/Model/TechnicalAnalysis.php new file mode 100644 index 0000000..088f038 --- /dev/null +++ b/lib/Model/TechnicalAnalysis.php @@ -0,0 +1,337 @@ + '\Finnhub\Model\Indicator', + 'signal' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'count' => null, + 'signal' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'signal' => 'signal' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'signal' => 'setSignal' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'signal' => 'getSignal' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->container['signal'] = isset($data['signal']) ? $data['signal'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets count + * + * @return \Finnhub\Model\Indicator|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param \Finnhub\Model\Indicator|null $count count + * + * @return $this + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets signal + * + * @return string|null + */ + public function getSignal() + { + return $this->container['signal']; + } + + /** + * Sets signal + * + * @param string|null $signal Aggregate Signal + * + * @return $this + */ + public function setSignal($signal) + { + $this->container['signal'] = $signal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TickData.php b/lib/Model/TickData.php new file mode 100644 index 0000000..e959806 --- /dev/null +++ b/lib/Model/TickData.php @@ -0,0 +1,517 @@ + 'string', + 'skip' => 'int', + 'count' => 'int', + 'total' => 'int', + 'v' => 'float[]', + 'p' => 'float[]', + 't' => 'int[]', + 'x' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 's' => null, + 'skip' => 'int64', + 'count' => 'int64', + 'total' => 'int64', + 'v' => 'float', + 'p' => 'float', + 't' => 'int64', + 'x' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 's' => 's', + 'skip' => 'skip', + 'count' => 'count', + 'total' => 'total', + 'v' => 'v', + 'p' => 'p', + 't' => 't', + 'x' => 'x' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 's' => 'setS', + 'skip' => 'setSkip', + 'count' => 'setCount', + 'total' => 'setTotal', + 'v' => 'setV', + 'p' => 'setP', + 't' => 'setT', + 'x' => 'setX' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 's' => 'getS', + 'skip' => 'getSkip', + 'count' => 'getCount', + 'total' => 'getTotal', + 'v' => 'getV', + 'p' => 'getP', + 't' => 'getT', + 'x' => 'getX' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['s'] = isset($data['s']) ? $data['s'] : null; + $this->container['skip'] = isset($data['skip']) ? $data['skip'] : null; + $this->container['count'] = isset($data['count']) ? $data['count'] : null; + $this->container['total'] = isset($data['total']) ? $data['total'] : null; + $this->container['v'] = isset($data['v']) ? $data['v'] : null; + $this->container['p'] = isset($data['p']) ? $data['p'] : null; + $this->container['t'] = isset($data['t']) ? $data['t'] : null; + $this->container['x'] = isset($data['x']) ? $data['x'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets s + * + * @return string|null + */ + public function getS() + { + return $this->container['s']; + } + + /** + * Sets s + * + * @param string|null $s Symbol. + * + * @return $this + */ + public function setS($s) + { + $this->container['s'] = $s; + + return $this; + } + + /** + * Gets skip + * + * @return int|null + */ + public function getSkip() + { + return $this->container['skip']; + } + + /** + * Sets skip + * + * @param int|null $skip Number of ticks skipped. + * + * @return $this + */ + public function setSkip($skip) + { + $this->container['skip'] = $skip; + + return $this; + } + + /** + * Gets count + * + * @return int|null + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int|null $count Number of ticks returned. If count < limit, all data for that date has been returned. + * + * @return $this + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets total + * + * @return int|null + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int|null $total Total number of ticks for that date. + * + * @return $this + */ + public function setTotal($total) + { + $this->container['total'] = $total; + + return $this; + } + + /** + * Gets v + * + * @return float[]|null + */ + public function getV() + { + return $this->container['v']; + } + + /** + * Sets v + * + * @param float[]|null $v List of volume data. + * + * @return $this + */ + public function setV($v) + { + $this->container['v'] = $v; + + return $this; + } + + /** + * Gets p + * + * @return float[]|null + */ + public function getP() + { + return $this->container['p']; + } + + /** + * Sets p + * + * @param float[]|null $p List of price data. + * + * @return $this + */ + public function setP($p) + { + $this->container['p'] = $p; + + return $this; + } + + /** + * Gets t + * + * @return int[]|null + */ + public function getT() + { + return $this->container['t']; + } + + /** + * Sets t + * + * @param int[]|null $t List of timestamp in UNIX ms. + * + * @return $this + */ + public function setT($t) + { + $this->container['t'] = $t; + + return $this; + } + + /** + * Gets x + * + * @return string[]|null + */ + public function getX() + { + return $this->container['x']; + } + + /** + * Sets x + * + * @param string[]|null $x List of venues/exchanges. + * + * @return $this + */ + public function setX($x) + { + $this->container['x'] = $x; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TranscriptContent.php b/lib/Model/TranscriptContent.php new file mode 100644 index 0000000..be38c56 --- /dev/null +++ b/lib/Model/TranscriptContent.php @@ -0,0 +1,337 @@ + 'string', + 'speech' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'speech' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'speech' => 'speech' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'speech' => 'setSpeech' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'speech' => 'getSpeech' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['speech'] = isset($data['speech']) ? $data['speech'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Speaker's name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets speech + * + * @return string[]|null + */ + public function getSpeech() + { + return $this->container['speech']; + } + + /** + * Sets speech + * + * @param string[]|null $speech Speaker's speech + * + * @return $this + */ + public function setSpeech($speech) + { + $this->container['speech'] = $speech; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/TranscriptParticipant.php b/lib/Model/TranscriptParticipant.php new file mode 100644 index 0000000..3c4eedc --- /dev/null +++ b/lib/Model/TranscriptParticipant.php @@ -0,0 +1,337 @@ + 'string', + 'description' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'name' => null, + 'description' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'description' => 'description' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'description' => 'setDescription' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'description' => 'getDescription' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = isset($data['name']) ? $data['name'] : null; + $this->container['description'] = isset($data['description']) ? $data['description'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets name + * + * @return string|null + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string|null $name Participant's name + * + * @return $this + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description Participant's description + * + * @return $this + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/Trend.php b/lib/Model/Trend.php new file mode 100644 index 0000000..c7baa60 --- /dev/null +++ b/lib/Model/Trend.php @@ -0,0 +1,307 @@ + 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'adx' => 'float' + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'adx' => 'adx' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'adx' => 'setAdx' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'adx' => 'getAdx' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['adx'] = isset($data['adx']) ? $data['adx'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets adx + * + * @return float|null + */ + public function getAdx() + { + return $this->container['adx']; + } + + /** + * Sets adx + * + * @param float|null $adx ADX reading + * + * @return $this + */ + public function setAdx($adx) + { + $this->container['adx'] = $adx; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/Model/UpgradeDowngrade.php b/lib/Model/UpgradeDowngrade.php new file mode 100644 index 0000000..eb9aebb --- /dev/null +++ b/lib/Model/UpgradeDowngrade.php @@ -0,0 +1,457 @@ + 'string', + 'grade_time' => 'int', + 'from_grade' => 'string', + 'to_grade' => 'string', + 'company' => 'string', + 'action' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPIFormats = [ + 'symbol' => null, + 'grade_time' => 'int64', + 'from_grade' => null, + 'to_grade' => null, + 'company' => null, + 'action' => null + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'symbol' => 'symbol', + 'grade_time' => 'gradeTime', + 'from_grade' => 'fromGrade', + 'to_grade' => 'toGrade', + 'company' => 'company', + 'action' => 'action' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'symbol' => 'setSymbol', + 'grade_time' => 'setGradeTime', + 'from_grade' => 'setFromGrade', + 'to_grade' => 'setToGrade', + 'company' => 'setCompany', + 'action' => 'setAction' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'symbol' => 'getSymbol', + 'grade_time' => 'getGradeTime', + 'from_grade' => 'getFromGrade', + 'to_grade' => 'getToGrade', + 'company' => 'getCompany', + 'action' => 'getAction' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['symbol'] = isset($data['symbol']) ? $data['symbol'] : null; + $this->container['grade_time'] = isset($data['grade_time']) ? $data['grade_time'] : null; + $this->container['from_grade'] = isset($data['from_grade']) ? $data['from_grade'] : null; + $this->container['to_grade'] = isset($data['to_grade']) ? $data['to_grade'] : null; + $this->container['company'] = isset($data['company']) ? $data['company'] : null; + $this->container['action'] = isset($data['action']) ? $data['action'] : null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets symbol + * + * @return string|null + */ + public function getSymbol() + { + return $this->container['symbol']; + } + + /** + * Sets symbol + * + * @param string|null $symbol Company symbol. + * + * @return $this + */ + public function setSymbol($symbol) + { + $this->container['symbol'] = $symbol; + + return $this; + } + + /** + * Gets grade_time + * + * @return int|null + */ + public function getGradeTime() + { + return $this->container['grade_time']; + } + + /** + * Sets grade_time + * + * @param int|null $grade_time Upgrade/downgrade time in UNIX timestamp. + * + * @return $this + */ + public function setGradeTime($grade_time) + { + $this->container['grade_time'] = $grade_time; + + return $this; + } + + /** + * Gets from_grade + * + * @return string|null + */ + public function getFromGrade() + { + return $this->container['from_grade']; + } + + /** + * Sets from_grade + * + * @param string|null $from_grade From grade. + * + * @return $this + */ + public function setFromGrade($from_grade) + { + $this->container['from_grade'] = $from_grade; + + return $this; + } + + /** + * Gets to_grade + * + * @return string|null + */ + public function getToGrade() + { + return $this->container['to_grade']; + } + + /** + * Sets to_grade + * + * @param string|null $to_grade To grade. + * + * @return $this + */ + public function setToGrade($to_grade) + { + $this->container['to_grade'] = $to_grade; + + return $this; + } + + /** + * Gets company + * + * @return string|null + */ + public function getCompany() + { + return $this->container['company']; + } + + /** + * Sets company + * + * @param string|null $company Company/analyst who did the upgrade/downgrade. + * + * @return $this + */ + public function setCompany($company) + { + $this->container['company'] = $company; + + return $this; + } + + /** + * Gets action + * + * @return string|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param string|null $action Action can take any of the following values: up(upgrade), down(downgrade), main(maintains), init(initiate), reit(reiterate). + * + * @return $this + */ + public function setAction($action) + { + $this->container['action'] = $action; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * + * @param integer $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/lib/ObjectSerializer.php b/lib/ObjectSerializer.php new file mode 100644 index 0000000..81977ac --- /dev/null +++ b/lib/ObjectSerializer.php @@ -0,0 +1,352 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } elseif (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } elseif (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null + && !in_array($openAPIType, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true) + && method_exists($openAPIType, 'getAllowableEnumValues') + && !in_array($value, $openAPIType::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $openAPIType::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the query, by imploding comma-separated if it's an object. + * If it's a string, pass through unchanged. It will be url-encoded + * later. + * + * @param string[]|string|\DateTime $object an object to be serialized to a string + * + * @return string the serialized object + */ + public static function toQueryValue($object) + { + if (is_array($object)) { + return implode(',', $object); + } else { + return self::toString($object); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + if (method_exists($value, 'toHeaderValue')) { + return $value->toHeaderValue(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } else if (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } elseif (substr($class, 0, 4) === 'map[') { // for associative array e.g. map[string,int] + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } elseif (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } elseif ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + return new \DateTime($data); + } else { + return null; + } + } elseif (in_array($class, ['DateTime', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } elseif ($class === '\SplFileObject') { + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if (array_key_exists('Content-Disposition', $httpHeaders) && + preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match)) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } elseif (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Finnhub\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } + + $propertyValue = $data->{$instance::attributeMap()[$property]}; + if (isset($propertyValue)) { + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } +} diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..901f76a --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,23 @@ + + + + + ./test/Api + ./test/Model + + + + + ./lib + ./lib/Model + + + + + + diff --git a/test/Api/DefaultApiTest.php b/test/Api/DefaultApiTest.php new file mode 100644 index 0000000..7fbfdd1 --- /dev/null +++ b/test/Api/DefaultApiTest.php @@ -0,0 +1,534 @@ +