aylien_news_api 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +67 -0
  4. data/LICENSE +13 -0
  5. data/README.md +133 -0
  6. data/Rakefile +8 -0
  7. data/aylien_news_api.gemspec +33 -0
  8. data/docs/Author.md +10 -0
  9. data/docs/Autocomplete.md +9 -0
  10. data/docs/Autocompletes.md +8 -0
  11. data/docs/Category.md +13 -0
  12. data/docs/CategoryLinks.md +9 -0
  13. data/docs/Coverages.md +12 -0
  14. data/docs/DefaultApi.md +829 -0
  15. data/docs/Entities.md +9 -0
  16. data/docs/Entity.md +12 -0
  17. data/docs/EntityLinks.md +8 -0
  18. data/docs/Error.md +13 -0
  19. data/docs/ErrorLinks.md +8 -0
  20. data/docs/Errors.md +8 -0
  21. data/docs/HistogramInterval.md +9 -0
  22. data/docs/Histograms.md +12 -0
  23. data/docs/Location.md +10 -0
  24. data/docs/Media.md +9 -0
  25. data/docs/RelatedStories.md +11 -0
  26. data/docs/Scope.md +11 -0
  27. data/docs/Sentiment.md +9 -0
  28. data/docs/Sentiments.md +9 -0
  29. data/docs/ShareCount.md +9 -0
  30. data/docs/ShareCounts.md +11 -0
  31. data/docs/Source.md +13 -0
  32. data/docs/Stories.md +10 -0
  33. data/docs/Story.md +27 -0
  34. data/docs/StoryCluster.md +12 -0
  35. data/docs/StoryLinks.md +10 -0
  36. data/docs/Summary.md +8 -0
  37. data/docs/TimeSeries.md +9 -0
  38. data/docs/TimeSeriesList.md +11 -0
  39. data/docs/Trend.md +9 -0
  40. data/docs/Trends.md +9 -0
  41. data/lib/aylien_news_api.rb +74 -0
  42. data/lib/aylien_news_api/api/default_api.rb +1171 -0
  43. data/lib/aylien_news_api/api_client.rb +365 -0
  44. data/lib/aylien_news_api/api_error.rb +38 -0
  45. data/lib/aylien_news_api/configuration.rb +191 -0
  46. data/lib/aylien_news_api/models/author.rb +192 -0
  47. data/lib/aylien_news_api/models/autocomplete.rb +183 -0
  48. data/lib/aylien_news_api/models/autocompletes.rb +176 -0
  49. data/lib/aylien_news_api/models/category.rb +229 -0
  50. data/lib/aylien_news_api/models/category_links.rb +183 -0
  51. data/lib/aylien_news_api/models/coverages.rb +212 -0
  52. data/lib/aylien_news_api/models/entities.rb +187 -0
  53. data/lib/aylien_news_api/models/entity.rb +214 -0
  54. data/lib/aylien_news_api/models/entity_links.rb +174 -0
  55. data/lib/aylien_news_api/models/error.rb +213 -0
  56. data/lib/aylien_news_api/models/error_links.rb +173 -0
  57. data/lib/aylien_news_api/models/errors.rb +175 -0
  58. data/lib/aylien_news_api/models/histogram_interval.rb +183 -0
  59. data/lib/aylien_news_api/models/histograms.rb +211 -0
  60. data/lib/aylien_news_api/models/location.rb +192 -0
  61. data/lib/aylien_news_api/models/media.rb +193 -0
  62. data/lib/aylien_news_api/models/related_stories.rb +203 -0
  63. data/lib/aylien_news_api/models/scope.rb +211 -0
  64. data/lib/aylien_news_api/models/sentiment.rb +193 -0
  65. data/lib/aylien_news_api/models/sentiments.rb +183 -0
  66. data/lib/aylien_news_api/models/share_count.rb +183 -0
  67. data/lib/aylien_news_api/models/share_counts.rb +209 -0
  68. data/lib/aylien_news_api/models/source.rb +223 -0
  69. data/lib/aylien_news_api/models/stories.rb +196 -0
  70. data/lib/aylien_news_api/models/story.rb +353 -0
  71. data/lib/aylien_news_api/models/story_cluster.rb +214 -0
  72. data/lib/aylien_news_api/models/story_links.rb +192 -0
  73. data/lib/aylien_news_api/models/summary.rb +176 -0
  74. data/lib/aylien_news_api/models/time_series.rb +183 -0
  75. data/lib/aylien_news_api/models/time_series_list.rb +203 -0
  76. data/lib/aylien_news_api/models/trend.rb +183 -0
  77. data/lib/aylien_news_api/models/trends.rb +185 -0
  78. data/lib/aylien_news_api/version.rb +17 -0
  79. data/spec/api/default_api_spec.rb +357 -0
  80. data/spec/models/author_spec.rb +66 -0
  81. data/spec/models/autocomplete_spec.rb +56 -0
  82. data/spec/models/autocompletes_spec.rb +46 -0
  83. data/spec/models/category_links_spec.rb +56 -0
  84. data/spec/models/category_spec.rb +96 -0
  85. data/spec/models/coverages_spec.rb +86 -0
  86. data/spec/models/entities_spec.rb +56 -0
  87. data/spec/models/entity_links_spec.rb +46 -0
  88. data/spec/models/entity_spec.rb +86 -0
  89. data/spec/models/error_links_spec.rb +46 -0
  90. data/spec/models/error_spec.rb +96 -0
  91. data/spec/models/errors_spec.rb +46 -0
  92. data/spec/models/histogram_interval_spec.rb +56 -0
  93. data/spec/models/histograms_spec.rb +86 -0
  94. data/spec/models/location_spec.rb +66 -0
  95. data/spec/models/media_spec.rb +56 -0
  96. data/spec/models/related_stories_spec.rb +76 -0
  97. data/spec/models/scope_spec.rb +76 -0
  98. data/spec/models/sentiment_spec.rb +56 -0
  99. data/spec/models/sentiments_spec.rb +56 -0
  100. data/spec/models/share_count_spec.rb +56 -0
  101. data/spec/models/share_counts_spec.rb +76 -0
  102. data/spec/models/source_spec.rb +96 -0
  103. data/spec/models/stories_spec.rb +66 -0
  104. data/spec/models/story_cluster_spec.rb +86 -0
  105. data/spec/models/story_links_spec.rb +66 -0
  106. data/spec/models/story_spec.rb +236 -0
  107. data/spec/models/summary_spec.rb +46 -0
  108. data/spec/models/time_series_list_spec.rb +76 -0
  109. data/spec/models/time_series_spec.rb +56 -0
  110. data/spec/models/trend_spec.rb +56 -0
  111. data/spec/models/trends_spec.rb +56 -0
  112. metadata +391 -0
data/docs/Entities.md ADDED
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::Entities
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **title** | [**Array<Entity>**](Entity.md) | An array of extracted entities from the story title | [optional]
7
+ **body** | [**Array<Entity>**](Entity.md) | An array of extracted entities from the story body | [optional]
8
+
9
+
data/docs/Entity.md ADDED
@@ -0,0 +1,12 @@
1
+ # AylienNewsApi::Entity
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **text** | **String** | The entity text | [optional]
7
+ **score** | **Float** | The entity score | [optional]
8
+ **types** | **Array<String>** | An array of the dbpedia types | [optional]
9
+ **links** | [**EntityLinks**](EntityLinks.md) | Related links to the entity | [optional]
10
+ **indices** | **Array<Array<Integer>>** | The indices of the entity text | [optional]
11
+
12
+
@@ -0,0 +1,8 @@
1
+ # AylienNewsApi::EntityLinks
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **dbpedia** | **String** | A dbpedia resource URL | [optional]
7
+
8
+
data/docs/Error.md ADDED
@@ -0,0 +1,13 @@
1
+ # AylienNewsApi::Error
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **String** | | [optional]
7
+ **links** | [**ErrorLinks**](ErrorLinks.md) | | [optional]
8
+ **status** | **String** | | [optional]
9
+ **code** | **String** | | [optional]
10
+ **title** | **String** | | [optional]
11
+ **detail** | **String** | | [optional]
12
+
13
+
@@ -0,0 +1,8 @@
1
+ # AylienNewsApi::ErrorLinks
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **about** | **String** | | [optional]
7
+
8
+
data/docs/Errors.md ADDED
@@ -0,0 +1,8 @@
1
+ # AylienNewsApi::Errors
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **errors** | [**Array<Error>**](Error.md) | | [optional]
7
+
8
+
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::HistogramInterval
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **bin** | **Integer** | Histogram bin | [optional]
7
+ **count** | **Integer** | Histogram bin size | [optional]
8
+
9
+
@@ -0,0 +1,12 @@
1
+ # AylienNewsApi::Histograms
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **intervals** | [**Array<HistogramInterval>**](HistogramInterval.md) | The intervals of the histograms | [optional]
7
+ **interval_start** | **Integer** | The start interval of the histogram | [optional]
8
+ **interval_end** | **Integer** | The end interval of the histogram | [optional]
9
+ **interval_width** | **Integer** | The width of the histogram | [optional]
10
+ **field** | **String** | | [optional]
11
+
12
+
data/docs/Location.md ADDED
@@ -0,0 +1,10 @@
1
+ # AylienNewsApi::Location
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **country** | **String** | The country code of the location. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes. | [optional]
7
+ **state** | **String** | The state of the location | [optional]
8
+ **city** | **String** | The city of the location | [optional]
9
+
10
+
data/docs/Media.md ADDED
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::Media
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **type** | **String** | Type of the media | [optional]
7
+ **url** | **String** | A URL which points to the media file | [optional]
8
+
9
+
@@ -0,0 +1,11 @@
1
+ # AylienNewsApi::RelatedStories
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **story_title** | **String** | The input story title | [optional]
7
+ **story_body** | **String** | The input story body | [optional]
8
+ **story_language** | **String** | The input story language | [optional]
9
+ **related_stories** | [**Array<Story>**](Story.md) | An array of related stories for the input story | [optional]
10
+
11
+
data/docs/Scope.md ADDED
@@ -0,0 +1,11 @@
1
+ # AylienNewsApi::Scope
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **country** | **String** | The country code of the scope. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes. | [optional]
7
+ **state** | **String** | The state of the scope | [optional]
8
+ **city** | **String** | The city of the scope | [optional]
9
+ **level** | **String** | The level of the scope | [optional]
10
+
11
+
data/docs/Sentiment.md ADDED
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::Sentiment
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **polarity** | **String** | Polarity of the sentiment | [optional]
7
+ **score** | **Float** | Polarity score of the sentiment | [optional]
8
+
9
+
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::Sentiments
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **title** | [**Sentiment**](Sentiment.md) | The sentiment for the story title | [optional]
7
+ **body** | [**Sentiment**](Sentiment.md) | The sentiment for the story body | [optional]
8
+
9
+
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::ShareCount
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **count** | **Integer** | The number of shares | [optional]
7
+ **fetched_at** | **DateTime** | The fetched date of the shares | [optional]
8
+
9
+
@@ -0,0 +1,11 @@
1
+ # AylienNewsApi::ShareCounts
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **facebook** | [**Array<ShareCount>**](ShareCount.md) | Facebook shares count | [optional]
7
+ **google_plus** | [**Array<ShareCount>**](ShareCount.md) | Google Plus shares count | [optional]
8
+ **linkedin** | [**Array<ShareCount>**](ShareCount.md) | LinkedIn shares count | [optional]
9
+ **reddit** | [**Array<ShareCount>**](ShareCount.md) | Reddit shares count | [optional]
10
+
11
+
data/docs/Source.md ADDED
@@ -0,0 +1,13 @@
1
+ # AylienNewsApi::Source
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | The source id which is a unique value | [optional]
7
+ **name** | **String** | The source name | [optional]
8
+ **domain** | **String** | Domain name of the source which is extracted from the source URL | [optional]
9
+ **logo_url** | **String** | A URL which points to the source logo | [optional]
10
+ **locations** | [**Array<Location>**](Location.md) | The source locations which are tend to be the physical locations of the source, e.g. BBC headquarter is located in London. | [optional]
11
+ **scopes** | [**Array<Scope>**](Scope.md) | The source scopes which is tend to be scope locations of the source, e.g. BBC scopes is international. | [optional]
12
+
13
+
data/docs/Stories.md ADDED
@@ -0,0 +1,10 @@
1
+ # AylienNewsApi::Stories
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **stories** | [**Array<Story>**](Story.md) | An array of stories | [optional]
7
+ **clusters** | [**Array<StoryCluster>**](StoryCluster.md) | An array of clusters | [optional]
8
+ **next_page_cursor** | **String** | The next page cursor | [optional]
9
+
10
+
data/docs/Story.md ADDED
@@ -0,0 +1,27 @@
1
+ # AylienNewsApi::Story
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | ID of the story which is unique identification | [optional]
7
+ **title** | **String** | Title of the story | [optional]
8
+ **body** | **String** | Body of the story | [optional]
9
+ **summary** | [**Summary**](Summary.md) | The suggested story summary | [optional]
10
+ **source** | [**Source**](Source.md) | The story source | [optional]
11
+ **author** | [**Author**](Author.md) | The story author | [optional]
12
+ **entities** | [**Entities**](Entities.md) | Extracted entities from the story title or body | [optional]
13
+ **keywords** | **Array<String>** | Extracted keywords mentioned in the story title or body | [optional]
14
+ **hashtags** | **Array<String>** | An array of suggested Story hashtags | [optional]
15
+ **characters_count** | **Integer** | Characters count of the story body | [optional]
16
+ **words_count** | **Integer** | Words count of the story body | [optional]
17
+ **sentences_count** | **Integer** | Sentences count of the story body | [optional]
18
+ **paragraphs_count** | **Integer** | Paragraphs count of the story body | [optional]
19
+ **categories** | [**Array<Category>**](Category.md) | Suggested categories for the story | [optional]
20
+ **social_shares_count** | [**ShareCounts**](ShareCounts.md) | Social shares count for the story | [optional]
21
+ **media** | [**Array<Media>**](Media.md) | An array of extracted media such as images and videos | [optional]
22
+ **sentiment** | [**Sentiments**](Sentiments.md) | Suggested sentiments for the story title or body | [optional]
23
+ **language** | **String** | Language of the story | [optional]
24
+ **published_at** | **DateTime** | Published date of the story | [optional]
25
+ **links** | [**StoryLinks**](StoryLinks.md) | Links which is related to the story | [optional]
26
+
27
+
@@ -0,0 +1,12 @@
1
+ # AylienNewsApi::StoryCluster
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **id** | **Integer** | A unique identification for the cluster | [optional]
7
+ **phrases** | **Array<String>** | Suggested labels for the cluster | [optional]
8
+ **size** | **Integer** | Size of the cluster | [optional]
9
+ **stories** | **Array<Integer>** | Story ids which are in the cluster | [optional]
10
+ **score** | **Float** | The cluster score | [optional]
11
+
12
+
@@ -0,0 +1,10 @@
1
+ # AylienNewsApi::StoryLinks
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **permalink** | **String** | The story permalink URL | [optional]
7
+ **related_stories** | **String** | The related stories URL | [optional]
8
+ **coverages** | **String** | The coverages URL | [optional]
9
+
10
+
data/docs/Summary.md ADDED
@@ -0,0 +1,8 @@
1
+ # AylienNewsApi::Summary
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **sentences** | **Array<String>** | An array of the suggested summary sentences | [optional]
7
+
8
+
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::TimeSeries
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **published_at** | **DateTime** | The published date of the time series bin | [optional]
7
+ **count** | **Integer** | The count of time series bin | [optional]
8
+
9
+
@@ -0,0 +1,11 @@
1
+ # AylienNewsApi::TimeSeriesList
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **time_series** | [**Array<TimeSeries>**](TimeSeries.md) | An array of time series | [optional]
7
+ **period** | **String** | The size of each date range expressed as an interval to be added to the lower bound. | [optional]
8
+ **published_at_start** | **DateTime** | The start published date of the time series | [optional]
9
+ **published_at_end** | **DateTime** | The end published date of the time series | [optional]
10
+
11
+
data/docs/Trend.md ADDED
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::Trend
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **value** | **String** | The value of the trend | [optional]
7
+ **count** | **Integer** | The count of the trend | [optional]
8
+
9
+
data/docs/Trends.md ADDED
@@ -0,0 +1,9 @@
1
+ # AylienNewsApi::Trends
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **trends** | [**Array<Trend>**](Trend.md) | An array of trends | [optional]
7
+ **field** | **String** | The field of trends | [optional]
8
+
9
+
@@ -0,0 +1,74 @@
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ # Common files
16
+ require 'aylien_news_api/api_client'
17
+ require 'aylien_news_api/api_error'
18
+ require 'aylien_news_api/version'
19
+ require 'aylien_news_api/configuration'
20
+
21
+ # Models
22
+ require 'aylien_news_api/models/author'
23
+ require 'aylien_news_api/models/autocomplete'
24
+ require 'aylien_news_api/models/autocompletes'
25
+ require 'aylien_news_api/models/category'
26
+ require 'aylien_news_api/models/category_links'
27
+ require 'aylien_news_api/models/coverages'
28
+ require 'aylien_news_api/models/entities'
29
+ require 'aylien_news_api/models/entity'
30
+ require 'aylien_news_api/models/entity_links'
31
+ require 'aylien_news_api/models/error'
32
+ require 'aylien_news_api/models/error_links'
33
+ require 'aylien_news_api/models/errors'
34
+ require 'aylien_news_api/models/histogram_interval'
35
+ require 'aylien_news_api/models/histograms'
36
+ require 'aylien_news_api/models/location'
37
+ require 'aylien_news_api/models/media'
38
+ require 'aylien_news_api/models/related_stories'
39
+ require 'aylien_news_api/models/scope'
40
+ require 'aylien_news_api/models/sentiment'
41
+ require 'aylien_news_api/models/sentiments'
42
+ require 'aylien_news_api/models/share_count'
43
+ require 'aylien_news_api/models/share_counts'
44
+ require 'aylien_news_api/models/source'
45
+ require 'aylien_news_api/models/stories'
46
+ require 'aylien_news_api/models/story'
47
+ require 'aylien_news_api/models/story_cluster'
48
+ require 'aylien_news_api/models/story_links'
49
+ require 'aylien_news_api/models/summary'
50
+ require 'aylien_news_api/models/time_series'
51
+ require 'aylien_news_api/models/time_series_list'
52
+ require 'aylien_news_api/models/trend'
53
+ require 'aylien_news_api/models/trends'
54
+
55
+ # APIs
56
+ require 'aylien_news_api/api/default_api'
57
+
58
+ module AylienNewsApi
59
+ class << self
60
+ # Customize default settings for the SDK using block.
61
+ # AylienNewsApi.configure do |config|
62
+ # config.username = "xxx"
63
+ # config.password = "xxx"
64
+ # end
65
+ # If no block given, return the default Configuration object.
66
+ def configure
67
+ if block_given?
68
+ yield(Configuration.default)
69
+ else
70
+ Configuration.default
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,1171 @@
1
+ # Copyright 2016 Aylien, Inc. All Rights Reserved.
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ require "uri"
16
+
17
+ module AylienNewsApi
18
+ class DefaultApi
19
+ attr_accessor :api_client
20
+
21
+ def initialize(api_client = ApiClient.default)
22
+ @api_client = api_client
23
+ end
24
+
25
+ # List autocompletes
26
+ # This endpoint is used for getting list of autocompletes by providing a specific term and type.
27
+ # @param type This parameter is used for defining the type of autocompletes.
28
+ # @param term This parameter is used for finding autocomplete objects whose contains the specified value.
29
+ # @param [Hash] opts the optional parameters
30
+ # @option opts [String] :language This parameter is used for autocompletes whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes. (default to en)
31
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page. (default to 3)
32
+ # @return [Autocompletes]
33
+ def list_autocompletes(type, term, opts = {})
34
+ data, _status_code, _headers = list_autocompletes_with_http_info(type, term, opts)
35
+ return data
36
+ end
37
+
38
+ # List autocompletes
39
+ # This endpoint is used for getting list of autocompletes by providing a specific term and type.
40
+ # @param type This parameter is used for defining the type of autocompletes.
41
+ # @param term This parameter is used for finding autocomplete objects whose contains the specified value.
42
+ # @param [Hash] opts the optional parameters
43
+ # @option opts [String] :language This parameter is used for autocompletes whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
44
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page.
45
+ # @return [Array<(Autocompletes, Fixnum, Hash)>] Autocompletes data, response status code and response headers
46
+ def list_autocompletes_with_http_info(type, term, opts = {})
47
+ if @api_client.config.debugging
48
+ @api_client.config.logger.debug "Calling API: DefaultApi#list_autocompletes ..."
49
+ end
50
+
51
+ # verify the required parameter 'type' is set
52
+ fail "Missing the required parameter 'type' when calling list_autocompletes" if type.nil?
53
+ unless ['source_names', 'source_domains', 'entity_types', 'dbpedia_resources'].include?(type)
54
+ fail "invalid value for 'type', must be one of source_names, source_domains, entity_types, dbpedia_resources"
55
+ end
56
+
57
+ # verify the required parameter 'term' is set
58
+ fail "Missing the required parameter 'term' when calling list_autocompletes" if term.nil?
59
+
60
+ if opts[:'language'] && !['en', 'de', 'fr', 'it', 'es', 'pt'].include?(opts[:'language'])
61
+ fail 'invalid value for "language", must be one of en, de, fr, it, es, pt'
62
+ end
63
+
64
+ # resource path
65
+ local_var_path = "/autocompletes".sub('{format}','json')
66
+
67
+ # query parameters
68
+ query_params = {}
69
+ query_params[:'type'] = type
70
+ query_params[:'term'] = term
71
+ query_params[:'language'] = opts[:'language'] if opts[:'language']
72
+ query_params[:'per_page'] = opts[:'per_page'] if opts[:'per_page']
73
+
74
+ # header parameters
75
+ header_params = {}
76
+
77
+ # HTTP header 'Accept' (if needed)
78
+ local_header_accept = ['application/json', 'text/xml']
79
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
80
+
81
+ # HTTP header 'Content-Type'
82
+ local_header_content_type = ['application/x-www-form-urlencoded']
83
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
84
+
85
+ # form parameters
86
+ form_params = {}
87
+
88
+ # http body (model)
89
+ post_body = nil
90
+ auth_names = ['app_key', 'app_id']
91
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
92
+ :header_params => header_params,
93
+ :query_params => query_params,
94
+ :form_params => form_params,
95
+ :body => post_body,
96
+ :auth_names => auth_names,
97
+ :return_type => 'Autocompletes')
98
+ if @api_client.config.debugging
99
+ @api_client.config.logger.debug "API called: DefaultApi#list_autocompletes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
100
+ end
101
+ return data, status_code, headers
102
+ end
103
+
104
+ # List coverages
105
+ # This endpoint is used for finding story coverages based on provided parameters. The number of coverages to return, up to a maximum of 100.
106
+ # @param [Hash] opts the optional parameters
107
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
108
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
109
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
110
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
111
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
112
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
113
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
114
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
115
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident. (default to true)
116
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
117
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
118
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
119
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
120
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
121
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
122
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
123
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
124
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
125
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
126
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
127
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
128
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
129
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
130
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
131
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
132
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
133
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
134
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
135
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
136
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
137
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
138
+ # @option opts [Integer] :story_id A story id
139
+ # @option opts [String] :story_url An article or webpage
140
+ # @option opts [String] :story_title Title of the article
141
+ # @option opts [String] :story_body Body of the article
142
+ # @option opts [DateTime] :story_published_at Publish date of the article. If you use url or title and body for getting coverages, this parameter is required. The format used is a restricted form of the canonical representation of dateTime in the [XML Schema specification (ISO 8601)](https://www.w3.org/TR/xmlschema-2/#dateTime).
143
+ # @option opts [String] :story_language This parameter is used for setting language of the story. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes. (default to auto)
144
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page. (default to 3)
145
+ # @return [Coverages]
146
+ def list_coverages(opts = {})
147
+ data, _status_code, _headers = list_coverages_with_http_info(opts)
148
+ return data
149
+ end
150
+
151
+ # List coverages
152
+ # This endpoint is used for finding story coverages based on provided parameters. The number of coverages to return, up to a maximum of 100.
153
+ # @param [Hash] opts the optional parameters
154
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
155
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
156
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
157
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
158
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
159
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
160
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
161
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
162
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident.
163
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
164
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
165
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
166
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
167
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
168
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
169
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
170
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
171
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
172
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
173
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
174
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
175
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
176
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
177
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
178
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
179
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
180
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
181
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
182
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
183
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
184
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
185
+ # @option opts [Integer] :story_id A story id
186
+ # @option opts [String] :story_url An article or webpage
187
+ # @option opts [String] :story_title Title of the article
188
+ # @option opts [String] :story_body Body of the article
189
+ # @option opts [DateTime] :story_published_at Publish date of the article. If you use url or title and body for getting coverages, this parameter is required. The format used is a restricted form of the canonical representation of dateTime in the [XML Schema specification (ISO 8601)](https://www.w3.org/TR/xmlschema-2/#dateTime).
190
+ # @option opts [String] :story_language This parameter is used for setting language of the story. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
191
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page.
192
+ # @return [Array<(Coverages, Fixnum, Hash)>] Coverages data, response status code and response headers
193
+ def list_coverages_with_http_info(opts = {})
194
+ if @api_client.config.debugging
195
+ @api_client.config.logger.debug "Calling API: DefaultApi#list_coverages ..."
196
+ end
197
+
198
+ if opts[:'categories_taxonomy'] && !['iab-qag', 'iptc-subjectcode'].include?(opts[:'categories_taxonomy'])
199
+ fail 'invalid value for "categories_taxonomy", must be one of iab-qag, iptc-subjectcode'
200
+ end
201
+
202
+ if opts[:'sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_title_polarity'])
203
+ fail 'invalid value for "sentiment_title_polarity", must be one of positive, neutral, negative'
204
+ end
205
+
206
+ if opts[:'sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_body_polarity'])
207
+ fail 'invalid value for "sentiment_body_polarity", must be one of positive, neutral, negative'
208
+ end
209
+
210
+ if opts[:'story_language'] && !['auto', 'en', 'de', 'fr', 'it', 'es', 'pt'].include?(opts[:'story_language'])
211
+ fail 'invalid value for "story_language", must be one of auto, en, de, fr, it, es, pt'
212
+ end
213
+
214
+ # resource path
215
+ local_var_path = "/coverages".sub('{format}','json')
216
+
217
+ # query parameters
218
+ query_params = {}
219
+
220
+ # header parameters
221
+ header_params = {}
222
+
223
+ # HTTP header 'Accept' (if needed)
224
+ local_header_accept = ['application/json', 'text/xml']
225
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
226
+
227
+ # HTTP header 'Content-Type'
228
+ local_header_content_type = ['application/x-www-form-urlencoded']
229
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
230
+
231
+ # form parameters
232
+ form_params = {}
233
+ form_params["id[]"] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']
234
+ form_params["title"] = opts[:'title'] if opts[:'title']
235
+ form_params["body"] = opts[:'body'] if opts[:'body']
236
+ form_params["text"] = opts[:'text'] if opts[:'text']
237
+ form_params["language[]"] = @api_client.build_collection_param(opts[:'language'], :multi) if opts[:'language']
238
+ form_params["published_at.start"] = opts[:'published_at_start'] if opts[:'published_at_start']
239
+ form_params["published_at.end"] = opts[:'published_at_end'] if opts[:'published_at_end']
240
+ form_params["categories.taxonomy"] = opts[:'categories_taxonomy'] if opts[:'categories_taxonomy']
241
+ form_params["categories.confident"] = opts[:'categories_confident'] if opts[:'categories_confident']
242
+ form_params["categories.id[]"] = @api_client.build_collection_param(opts[:'categories_id'], :multi) if opts[:'categories_id']
243
+ form_params["categories.level[]"] = @api_client.build_collection_param(opts[:'categories_level'], :multi) if opts[:'categories_level']
244
+ form_params["entities.title.text[]"] = @api_client.build_collection_param(opts[:'entities_title_text'], :multi) if opts[:'entities_title_text']
245
+ form_params["entities.title.type[]"] = @api_client.build_collection_param(opts[:'entities_title_type'], :multi) if opts[:'entities_title_type']
246
+ form_params["entities.title.links.dbpedia[]"] = @api_client.build_collection_param(opts[:'entities_title_links_dbpedia'], :multi) if opts[:'entities_title_links_dbpedia']
247
+ form_params["entities.body.text[]"] = @api_client.build_collection_param(opts[:'entities_body_text'], :multi) if opts[:'entities_body_text']
248
+ form_params["entities.body.type[]"] = @api_client.build_collection_param(opts[:'entities_body_type'], :multi) if opts[:'entities_body_type']
249
+ form_params["entities.body.links.dbpedia[]"] = @api_client.build_collection_param(opts[:'entities_body_links_dbpedia'], :multi) if opts[:'entities_body_links_dbpedia']
250
+ form_params["sentiment.title.polarity"] = opts[:'sentiment_title_polarity'] if opts[:'sentiment_title_polarity']
251
+ form_params["sentiment.body.polarity"] = opts[:'sentiment_body_polarity'] if opts[:'sentiment_body_polarity']
252
+ form_params["author.id[]"] = @api_client.build_collection_param(opts[:'author_id'], :multi) if opts[:'author_id']
253
+ form_params["author.name"] = opts[:'author_name'] if opts[:'author_name']
254
+ form_params["source.id[]"] = @api_client.build_collection_param(opts[:'source_id'], :multi) if opts[:'source_id']
255
+ form_params["source.name[]"] = @api_client.build_collection_param(opts[:'source_name'], :multi) if opts[:'source_name']
256
+ form_params["source.domain[]"] = @api_client.build_collection_param(opts[:'source_domain'], :multi) if opts[:'source_domain']
257
+ form_params["source.locations.country[]"] = @api_client.build_collection_param(opts[:'source_locations_country'], :multi) if opts[:'source_locations_country']
258
+ form_params["source.locations.state[]"] = @api_client.build_collection_param(opts[:'source_locations_state'], :multi) if opts[:'source_locations_state']
259
+ form_params["source.locations.city[]"] = @api_client.build_collection_param(opts[:'source_locations_city'], :multi) if opts[:'source_locations_city']
260
+ form_params["source.scopes.country[]"] = @api_client.build_collection_param(opts[:'source_scopes_country'], :multi) if opts[:'source_scopes_country']
261
+ form_params["source.scopes.state[]"] = @api_client.build_collection_param(opts[:'source_scopes_state'], :multi) if opts[:'source_scopes_state']
262
+ form_params["source.scopes.city[]"] = @api_client.build_collection_param(opts[:'source_scopes_city'], :multi) if opts[:'source_scopes_city']
263
+ form_params["source.scopes.level[]"] = @api_client.build_collection_param(opts[:'source_scopes_level'], :multi) if opts[:'source_scopes_level']
264
+ form_params["story_id"] = opts[:'story_id'] if opts[:'story_id']
265
+ form_params["story_url"] = opts[:'story_url'] if opts[:'story_url']
266
+ form_params["story_title"] = opts[:'story_title'] if opts[:'story_title']
267
+ form_params["story_body"] = opts[:'story_body'] if opts[:'story_body']
268
+ form_params["story_published_at"] = opts[:'story_published_at'] if opts[:'story_published_at']
269
+ form_params["story_language"] = opts[:'story_language'] if opts[:'story_language']
270
+ form_params["per_page"] = opts[:'per_page'] if opts[:'per_page']
271
+
272
+ # http body (model)
273
+ post_body = nil
274
+ auth_names = ['app_key', 'app_id']
275
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
276
+ :header_params => header_params,
277
+ :query_params => query_params,
278
+ :form_params => form_params,
279
+ :body => post_body,
280
+ :auth_names => auth_names,
281
+ :return_type => 'Coverages')
282
+ if @api_client.config.debugging
283
+ @api_client.config.logger.debug "API called: DefaultApi#list_coverages\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
284
+ end
285
+ return data, status_code, headers
286
+ end
287
+
288
+ # List histograms
289
+ # This endpoint is used for getting histograms based on the field parameter is passed.
290
+ # @param [Hash] opts the optional parameters
291
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
292
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
293
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
294
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
295
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
296
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
297
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
298
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
299
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident. (default to true)
300
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
301
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
302
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
303
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
304
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
305
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
306
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
307
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
308
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
309
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
310
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
311
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
312
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
313
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
314
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
315
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
316
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
317
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
318
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
319
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
320
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
321
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
322
+ # @option opts [Integer] :interval_start This parameter is used for setting the start data point of histogram intervals.
323
+ # @option opts [Integer] :interval_end This parameter is used for setting the end data point of histogram intervals.
324
+ # @option opts [Integer] :interval_width This parameter is used for setting the width of histogram intervals.
325
+ # @option opts [String] :field This parameter is used for specifying the y-axis variable for the histogram. (default to social_shares_count)
326
+ # @return [Histograms]
327
+ def list_histograms(opts = {})
328
+ data, _status_code, _headers = list_histograms_with_http_info(opts)
329
+ return data
330
+ end
331
+
332
+ # List histograms
333
+ # This endpoint is used for getting histograms based on the field parameter is passed.
334
+ # @param [Hash] opts the optional parameters
335
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
336
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
337
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
338
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
339
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
340
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
341
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
342
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
343
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident.
344
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
345
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
346
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
347
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
348
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
349
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
350
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
351
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
352
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
353
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
354
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
355
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
356
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
357
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
358
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
359
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
360
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
361
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
362
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
363
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
364
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
365
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
366
+ # @option opts [Integer] :interval_start This parameter is used for setting the start data point of histogram intervals.
367
+ # @option opts [Integer] :interval_end This parameter is used for setting the end data point of histogram intervals.
368
+ # @option opts [Integer] :interval_width This parameter is used for setting the width of histogram intervals.
369
+ # @option opts [String] :field This parameter is used for specifying the y-axis variable for the histogram.
370
+ # @return [Array<(Histograms, Fixnum, Hash)>] Histograms data, response status code and response headers
371
+ def list_histograms_with_http_info(opts = {})
372
+ if @api_client.config.debugging
373
+ @api_client.config.logger.debug "Calling API: DefaultApi#list_histograms ..."
374
+ end
375
+
376
+ if opts[:'categories_taxonomy'] && !['iab-qag', 'iptc-subjectcode'].include?(opts[:'categories_taxonomy'])
377
+ fail 'invalid value for "categories_taxonomy", must be one of iab-qag, iptc-subjectcode'
378
+ end
379
+
380
+ if opts[:'sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_title_polarity'])
381
+ fail 'invalid value for "sentiment_title_polarity", must be one of positive, neutral, negative'
382
+ end
383
+
384
+ if opts[:'sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_body_polarity'])
385
+ fail 'invalid value for "sentiment_body_polarity", must be one of positive, neutral, negative'
386
+ end
387
+
388
+ if opts[:'field'] && !['social_shares_count', 'social_shares_count.facebook', 'social_shares_count.linkedin', 'social_shares_count.reddit', 'social_shares_count.google_plus', 'characters_count', 'words_count', 'sentences_count', 'paragraphs_count'].include?(opts[:'field'])
389
+ fail 'invalid value for "field", must be one of social_shares_count, social_shares_count.facebook, social_shares_count.linkedin, social_shares_count.reddit, social_shares_count.google_plus, characters_count, words_count, sentences_count, paragraphs_count'
390
+ end
391
+
392
+ # resource path
393
+ local_var_path = "/histograms".sub('{format}','json')
394
+
395
+ # query parameters
396
+ query_params = {}
397
+ query_params[:'id[]'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']
398
+ query_params[:'title'] = opts[:'title'] if opts[:'title']
399
+ query_params[:'body'] = opts[:'body'] if opts[:'body']
400
+ query_params[:'text'] = opts[:'text'] if opts[:'text']
401
+ query_params[:'language[]'] = @api_client.build_collection_param(opts[:'language'], :multi) if opts[:'language']
402
+ query_params[:'published_at.start'] = opts[:'published_at_start'] if opts[:'published_at_start']
403
+ query_params[:'published_at.end'] = opts[:'published_at_end'] if opts[:'published_at_end']
404
+ query_params[:'categories.taxonomy'] = opts[:'categories_taxonomy'] if opts[:'categories_taxonomy']
405
+ query_params[:'categories.confident'] = opts[:'categories_confident'] if opts[:'categories_confident']
406
+ query_params[:'categories.id[]'] = @api_client.build_collection_param(opts[:'categories_id'], :multi) if opts[:'categories_id']
407
+ query_params[:'categories.level[]'] = @api_client.build_collection_param(opts[:'categories_level'], :multi) if opts[:'categories_level']
408
+ query_params[:'entities.title.text[]'] = @api_client.build_collection_param(opts[:'entities_title_text'], :multi) if opts[:'entities_title_text']
409
+ query_params[:'entities.title.type[]'] = @api_client.build_collection_param(opts[:'entities_title_type'], :multi) if opts[:'entities_title_type']
410
+ query_params[:'entities.title.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_title_links_dbpedia'], :multi) if opts[:'entities_title_links_dbpedia']
411
+ query_params[:'entities.body.text[]'] = @api_client.build_collection_param(opts[:'entities_body_text'], :multi) if opts[:'entities_body_text']
412
+ query_params[:'entities.body.type[]'] = @api_client.build_collection_param(opts[:'entities_body_type'], :multi) if opts[:'entities_body_type']
413
+ query_params[:'entities.body.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_body_links_dbpedia'], :multi) if opts[:'entities_body_links_dbpedia']
414
+ query_params[:'sentiment.title.polarity'] = opts[:'sentiment_title_polarity'] if opts[:'sentiment_title_polarity']
415
+ query_params[:'sentiment.body.polarity'] = opts[:'sentiment_body_polarity'] if opts[:'sentiment_body_polarity']
416
+ query_params[:'author.id[]'] = @api_client.build_collection_param(opts[:'author_id'], :multi) if opts[:'author_id']
417
+ query_params[:'author.name'] = opts[:'author_name'] if opts[:'author_name']
418
+ query_params[:'source.id[]'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if opts[:'source_id']
419
+ query_params[:'source.name[]'] = @api_client.build_collection_param(opts[:'source_name'], :multi) if opts[:'source_name']
420
+ query_params[:'source.domain[]'] = @api_client.build_collection_param(opts[:'source_domain'], :multi) if opts[:'source_domain']
421
+ query_params[:'source.locations.country[]'] = @api_client.build_collection_param(opts[:'source_locations_country'], :multi) if opts[:'source_locations_country']
422
+ query_params[:'source.locations.state[]'] = @api_client.build_collection_param(opts[:'source_locations_state'], :multi) if opts[:'source_locations_state']
423
+ query_params[:'source.locations.city[]'] = @api_client.build_collection_param(opts[:'source_locations_city'], :multi) if opts[:'source_locations_city']
424
+ query_params[:'source.scopes.country[]'] = @api_client.build_collection_param(opts[:'source_scopes_country'], :multi) if opts[:'source_scopes_country']
425
+ query_params[:'source.scopes.state[]'] = @api_client.build_collection_param(opts[:'source_scopes_state'], :multi) if opts[:'source_scopes_state']
426
+ query_params[:'source.scopes.city[]'] = @api_client.build_collection_param(opts[:'source_scopes_city'], :multi) if opts[:'source_scopes_city']
427
+ query_params[:'source.scopes.level[]'] = @api_client.build_collection_param(opts[:'source_scopes_level'], :multi) if opts[:'source_scopes_level']
428
+ query_params[:'interval.start'] = opts[:'interval_start'] if opts[:'interval_start']
429
+ query_params[:'interval.end'] = opts[:'interval_end'] if opts[:'interval_end']
430
+ query_params[:'interval.width'] = opts[:'interval_width'] if opts[:'interval_width']
431
+ query_params[:'field'] = opts[:'field'] if opts[:'field']
432
+
433
+ # header parameters
434
+ header_params = {}
435
+
436
+ # HTTP header 'Accept' (if needed)
437
+ local_header_accept = ['application/json', 'text/xml']
438
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
439
+
440
+ # HTTP header 'Content-Type'
441
+ local_header_content_type = ['application/x-www-form-urlencoded']
442
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
443
+
444
+ # form parameters
445
+ form_params = {}
446
+
447
+ # http body (model)
448
+ post_body = nil
449
+ auth_names = ['app_key', 'app_id']
450
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
451
+ :header_params => header_params,
452
+ :query_params => query_params,
453
+ :form_params => form_params,
454
+ :body => post_body,
455
+ :auth_names => auth_names,
456
+ :return_type => 'Histograms')
457
+ if @api_client.config.debugging
458
+ @api_client.config.logger.debug "API called: DefaultApi#list_histograms\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
459
+ end
460
+ return data, status_code, headers
461
+ end
462
+
463
+ # List related stories
464
+ # This endpoint is used for finding related stories based on provided parameters. The number of related stories to return, up to a maximum of 100.
465
+ # @param [Hash] opts the optional parameters
466
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
467
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
468
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
469
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
470
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
471
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
472
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
473
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
474
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident. (default to true)
475
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
476
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
477
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
478
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
479
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
480
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
481
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
482
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
483
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
484
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
485
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
486
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
487
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
488
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
489
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
490
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
491
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
492
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
493
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
494
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
495
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
496
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
497
+ # @option opts [Integer] :story_id A story id
498
+ # @option opts [String] :story_url An article or webpage
499
+ # @option opts [String] :story_title Title of the article
500
+ # @option opts [String] :story_body Body of the article
501
+ # @option opts [String] :boost_by This parameter is used for boosting result by the specified value.
502
+ # @option opts [String] :story_language This parameter is used for setting language of the story. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes. (default to auto)
503
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page. (default to 3)
504
+ # @return [RelatedStories]
505
+ def list_related_stories(opts = {})
506
+ data, _status_code, _headers = list_related_stories_with_http_info(opts)
507
+ return data
508
+ end
509
+
510
+ # List related stories
511
+ # This endpoint is used for finding related stories based on provided parameters. The number of related stories to return, up to a maximum of 100.
512
+ # @param [Hash] opts the optional parameters
513
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
514
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
515
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
516
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
517
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
518
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
519
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
520
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
521
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident.
522
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
523
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
524
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
525
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
526
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
527
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
528
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
529
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
530
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
531
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
532
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
533
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
534
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
535
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
536
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
537
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
538
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
539
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
540
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
541
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
542
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
543
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
544
+ # @option opts [Integer] :story_id A story id
545
+ # @option opts [String] :story_url An article or webpage
546
+ # @option opts [String] :story_title Title of the article
547
+ # @option opts [String] :story_body Body of the article
548
+ # @option opts [String] :boost_by This parameter is used for boosting result by the specified value.
549
+ # @option opts [String] :story_language This parameter is used for setting language of the story. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
550
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page.
551
+ # @return [Array<(RelatedStories, Fixnum, Hash)>] RelatedStories data, response status code and response headers
552
+ def list_related_stories_with_http_info(opts = {})
553
+ if @api_client.config.debugging
554
+ @api_client.config.logger.debug "Calling API: DefaultApi#list_related_stories ..."
555
+ end
556
+
557
+ if opts[:'categories_taxonomy'] && !['iab-qag', 'iptc-subjectcode'].include?(opts[:'categories_taxonomy'])
558
+ fail 'invalid value for "categories_taxonomy", must be one of iab-qag, iptc-subjectcode'
559
+ end
560
+
561
+ if opts[:'sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_title_polarity'])
562
+ fail 'invalid value for "sentiment_title_polarity", must be one of positive, neutral, negative'
563
+ end
564
+
565
+ if opts[:'sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_body_polarity'])
566
+ fail 'invalid value for "sentiment_body_polarity", must be one of positive, neutral, negative'
567
+ end
568
+
569
+ if opts[:'boost_by'] && !['recency', 'popularity'].include?(opts[:'boost_by'])
570
+ fail 'invalid value for "boost_by", must be one of recency, popularity'
571
+ end
572
+
573
+ if opts[:'story_language'] && !['auto', 'en', 'de', 'fr', 'it', 'es', 'pt'].include?(opts[:'story_language'])
574
+ fail 'invalid value for "story_language", must be one of auto, en, de, fr, it, es, pt'
575
+ end
576
+
577
+ # resource path
578
+ local_var_path = "/related_stories".sub('{format}','json')
579
+
580
+ # query parameters
581
+ query_params = {}
582
+
583
+ # header parameters
584
+ header_params = {}
585
+
586
+ # HTTP header 'Accept' (if needed)
587
+ local_header_accept = ['application/json', 'text/xml']
588
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
589
+
590
+ # HTTP header 'Content-Type'
591
+ local_header_content_type = ['application/x-www-form-urlencoded']
592
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
593
+
594
+ # form parameters
595
+ form_params = {}
596
+ form_params["id[]"] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']
597
+ form_params["title"] = opts[:'title'] if opts[:'title']
598
+ form_params["body"] = opts[:'body'] if opts[:'body']
599
+ form_params["text"] = opts[:'text'] if opts[:'text']
600
+ form_params["language[]"] = @api_client.build_collection_param(opts[:'language'], :multi) if opts[:'language']
601
+ form_params["published_at.start"] = opts[:'published_at_start'] if opts[:'published_at_start']
602
+ form_params["published_at.end"] = opts[:'published_at_end'] if opts[:'published_at_end']
603
+ form_params["categories.taxonomy"] = opts[:'categories_taxonomy'] if opts[:'categories_taxonomy']
604
+ form_params["categories.confident"] = opts[:'categories_confident'] if opts[:'categories_confident']
605
+ form_params["categories.id[]"] = @api_client.build_collection_param(opts[:'categories_id'], :multi) if opts[:'categories_id']
606
+ form_params["categories.level[]"] = @api_client.build_collection_param(opts[:'categories_level'], :multi) if opts[:'categories_level']
607
+ form_params["entities.title.text[]"] = @api_client.build_collection_param(opts[:'entities_title_text'], :multi) if opts[:'entities_title_text']
608
+ form_params["entities.title.type[]"] = @api_client.build_collection_param(opts[:'entities_title_type'], :multi) if opts[:'entities_title_type']
609
+ form_params["entities.title.links.dbpedia[]"] = @api_client.build_collection_param(opts[:'entities_title_links_dbpedia'], :multi) if opts[:'entities_title_links_dbpedia']
610
+ form_params["entities.body.text[]"] = @api_client.build_collection_param(opts[:'entities_body_text'], :multi) if opts[:'entities_body_text']
611
+ form_params["entities.body.type[]"] = @api_client.build_collection_param(opts[:'entities_body_type'], :multi) if opts[:'entities_body_type']
612
+ form_params["entities.body.links.dbpedia[]"] = @api_client.build_collection_param(opts[:'entities_body_links_dbpedia'], :multi) if opts[:'entities_body_links_dbpedia']
613
+ form_params["sentiment.title.polarity"] = opts[:'sentiment_title_polarity'] if opts[:'sentiment_title_polarity']
614
+ form_params["sentiment.body.polarity"] = opts[:'sentiment_body_polarity'] if opts[:'sentiment_body_polarity']
615
+ form_params["author.id[]"] = @api_client.build_collection_param(opts[:'author_id'], :multi) if opts[:'author_id']
616
+ form_params["author.name"] = opts[:'author_name'] if opts[:'author_name']
617
+ form_params["source.id[]"] = @api_client.build_collection_param(opts[:'source_id'], :multi) if opts[:'source_id']
618
+ form_params["source.name[]"] = @api_client.build_collection_param(opts[:'source_name'], :multi) if opts[:'source_name']
619
+ form_params["source.domain[]"] = @api_client.build_collection_param(opts[:'source_domain'], :multi) if opts[:'source_domain']
620
+ form_params["source.locations.country[]"] = @api_client.build_collection_param(opts[:'source_locations_country'], :multi) if opts[:'source_locations_country']
621
+ form_params["source.locations.state[]"] = @api_client.build_collection_param(opts[:'source_locations_state'], :multi) if opts[:'source_locations_state']
622
+ form_params["source.locations.city[]"] = @api_client.build_collection_param(opts[:'source_locations_city'], :multi) if opts[:'source_locations_city']
623
+ form_params["source.scopes.country[]"] = @api_client.build_collection_param(opts[:'source_scopes_country'], :multi) if opts[:'source_scopes_country']
624
+ form_params["source.scopes.state[]"] = @api_client.build_collection_param(opts[:'source_scopes_state'], :multi) if opts[:'source_scopes_state']
625
+ form_params["source.scopes.city[]"] = @api_client.build_collection_param(opts[:'source_scopes_city'], :multi) if opts[:'source_scopes_city']
626
+ form_params["source.scopes.level[]"] = @api_client.build_collection_param(opts[:'source_scopes_level'], :multi) if opts[:'source_scopes_level']
627
+ form_params["story_id"] = opts[:'story_id'] if opts[:'story_id']
628
+ form_params["story_url"] = opts[:'story_url'] if opts[:'story_url']
629
+ form_params["story_title"] = opts[:'story_title'] if opts[:'story_title']
630
+ form_params["story_body"] = opts[:'story_body'] if opts[:'story_body']
631
+ form_params["boost_by"] = opts[:'boost_by'] if opts[:'boost_by']
632
+ form_params["story_language"] = opts[:'story_language'] if opts[:'story_language']
633
+ form_params["per_page"] = opts[:'per_page'] if opts[:'per_page']
634
+
635
+ # http body (model)
636
+ post_body = nil
637
+ auth_names = ['app_key', 'app_id']
638
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path,
639
+ :header_params => header_params,
640
+ :query_params => query_params,
641
+ :form_params => form_params,
642
+ :body => post_body,
643
+ :auth_names => auth_names,
644
+ :return_type => 'RelatedStories')
645
+ if @api_client.config.debugging
646
+ @api_client.config.logger.debug "API called: DefaultApi#list_related_stories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
647
+ end
648
+ return data, status_code, headers
649
+ end
650
+
651
+ # List Stories
652
+ # This endpoint is used for getting list of stories.
653
+ # @param [Hash] opts the optional parameters
654
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
655
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
656
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
657
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
658
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
659
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
660
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
661
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
662
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident. (default to true)
663
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
664
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
665
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
666
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
667
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
668
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
669
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
670
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
671
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
672
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
673
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
674
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
675
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
676
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
677
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
678
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
679
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
680
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
681
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
682
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
683
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
684
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
685
+ # @option opts [BOOLEAN] :cluster This parameter enables clustering for the returned stories. (default to false)
686
+ # @option opts [String] :cluster_algorithm This parameter is used for specifying the clustering algorithm. It supprts STC, Lingo and [k-means](https://en.wikipedia.org/wiki/K-means_clustering) algorithms. (default to lingo)
687
+ # @option opts [Array<String>] :_return This parameter is used for specifying return fields.
688
+ # @option opts [String] :sort_by This parameter is used for changing the order column of the result. (default to published_at)
689
+ # @option opts [String] :sort_direction This parameter is used for changing the order direction of the result. (default to desc)
690
+ # @option opts [String] :cursor This parameter is used for finding a specific page. (default to *)
691
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page. (default to 10)
692
+ # @return [Stories]
693
+ def list_stories(opts = {})
694
+ data, _status_code, _headers = list_stories_with_http_info(opts)
695
+ return data
696
+ end
697
+
698
+ # List Stories
699
+ # This endpoint is used for getting list of stories.
700
+ # @param [Hash] opts the optional parameters
701
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
702
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
703
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
704
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
705
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
706
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
707
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
708
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
709
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident.
710
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
711
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
712
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
713
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
714
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
715
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
716
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
717
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
718
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
719
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
720
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
721
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
722
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
723
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
724
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
725
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
726
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
727
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
728
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
729
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
730
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
731
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
732
+ # @option opts [BOOLEAN] :cluster This parameter enables clustering for the returned stories.
733
+ # @option opts [String] :cluster_algorithm This parameter is used for specifying the clustering algorithm. It supprts STC, Lingo and [k-means](https://en.wikipedia.org/wiki/K-means_clustering) algorithms.
734
+ # @option opts [Array<String>] :_return This parameter is used for specifying return fields.
735
+ # @option opts [String] :sort_by This parameter is used for changing the order column of the result.
736
+ # @option opts [String] :sort_direction This parameter is used for changing the order direction of the result.
737
+ # @option opts [String] :cursor This parameter is used for finding a specific page.
738
+ # @option opts [Integer] :per_page This parameter is used for specifying number of the items in each page.
739
+ # @return [Array<(Stories, Fixnum, Hash)>] Stories data, response status code and response headers
740
+ def list_stories_with_http_info(opts = {})
741
+ if @api_client.config.debugging
742
+ @api_client.config.logger.debug "Calling API: DefaultApi#list_stories ..."
743
+ end
744
+
745
+ if opts[:'categories_taxonomy'] && !['iab-qag', 'iptc-subjectcode'].include?(opts[:'categories_taxonomy'])
746
+ fail 'invalid value for "categories_taxonomy", must be one of iab-qag, iptc-subjectcode'
747
+ end
748
+
749
+ if opts[:'sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_title_polarity'])
750
+ fail 'invalid value for "sentiment_title_polarity", must be one of positive, neutral, negative'
751
+ end
752
+
753
+ if opts[:'sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_body_polarity'])
754
+ fail 'invalid value for "sentiment_body_polarity", must be one of positive, neutral, negative'
755
+ end
756
+
757
+ if opts[:'cluster_algorithm'] && !['stc', 'lingo', 'kmeans'].include?(opts[:'cluster_algorithm'])
758
+ fail 'invalid value for "cluster_algorithm", must be one of stc, lingo, kmeans'
759
+ end
760
+
761
+ if opts[:'sort_by'] && !['relevance', 'recency', 'hotness', 'published_at', 'social_shares_count', 'social_shares_count.facebook', 'social_shares_count.linkedin', 'social_shares_count.google_plus', 'social_shares_count.reddit'].include?(opts[:'sort_by'])
762
+ fail 'invalid value for "sort_by", must be one of relevance, recency, hotness, published_at, social_shares_count, social_shares_count.facebook, social_shares_count.linkedin, social_shares_count.google_plus, social_shares_count.reddit'
763
+ end
764
+
765
+ if opts[:'sort_direction'] && !['asc', 'desc'].include?(opts[:'sort_direction'])
766
+ fail 'invalid value for "sort_direction", must be one of asc, desc'
767
+ end
768
+
769
+ # resource path
770
+ local_var_path = "/stories".sub('{format}','json')
771
+
772
+ # query parameters
773
+ query_params = {}
774
+ query_params[:'id[]'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']
775
+ query_params[:'title'] = opts[:'title'] if opts[:'title']
776
+ query_params[:'body'] = opts[:'body'] if opts[:'body']
777
+ query_params[:'text'] = opts[:'text'] if opts[:'text']
778
+ query_params[:'language[]'] = @api_client.build_collection_param(opts[:'language'], :multi) if opts[:'language']
779
+ query_params[:'published_at.start'] = opts[:'published_at_start'] if opts[:'published_at_start']
780
+ query_params[:'published_at.end'] = opts[:'published_at_end'] if opts[:'published_at_end']
781
+ query_params[:'categories.taxonomy'] = opts[:'categories_taxonomy'] if opts[:'categories_taxonomy']
782
+ query_params[:'categories.confident'] = opts[:'categories_confident'] if opts[:'categories_confident']
783
+ query_params[:'categories.id[]'] = @api_client.build_collection_param(opts[:'categories_id'], :multi) if opts[:'categories_id']
784
+ query_params[:'categories.level[]'] = @api_client.build_collection_param(opts[:'categories_level'], :multi) if opts[:'categories_level']
785
+ query_params[:'entities.title.text[]'] = @api_client.build_collection_param(opts[:'entities_title_text'], :multi) if opts[:'entities_title_text']
786
+ query_params[:'entities.title.type[]'] = @api_client.build_collection_param(opts[:'entities_title_type'], :multi) if opts[:'entities_title_type']
787
+ query_params[:'entities.title.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_title_links_dbpedia'], :multi) if opts[:'entities_title_links_dbpedia']
788
+ query_params[:'entities.body.text[]'] = @api_client.build_collection_param(opts[:'entities_body_text'], :multi) if opts[:'entities_body_text']
789
+ query_params[:'entities.body.type[]'] = @api_client.build_collection_param(opts[:'entities_body_type'], :multi) if opts[:'entities_body_type']
790
+ query_params[:'entities.body.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_body_links_dbpedia'], :multi) if opts[:'entities_body_links_dbpedia']
791
+ query_params[:'sentiment.title.polarity'] = opts[:'sentiment_title_polarity'] if opts[:'sentiment_title_polarity']
792
+ query_params[:'sentiment.body.polarity'] = opts[:'sentiment_body_polarity'] if opts[:'sentiment_body_polarity']
793
+ query_params[:'author.id[]'] = @api_client.build_collection_param(opts[:'author_id'], :multi) if opts[:'author_id']
794
+ query_params[:'author.name'] = opts[:'author_name'] if opts[:'author_name']
795
+ query_params[:'source.id[]'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if opts[:'source_id']
796
+ query_params[:'source.name[]'] = @api_client.build_collection_param(opts[:'source_name'], :multi) if opts[:'source_name']
797
+ query_params[:'source.domain[]'] = @api_client.build_collection_param(opts[:'source_domain'], :multi) if opts[:'source_domain']
798
+ query_params[:'source.locations.country[]'] = @api_client.build_collection_param(opts[:'source_locations_country'], :multi) if opts[:'source_locations_country']
799
+ query_params[:'source.locations.state[]'] = @api_client.build_collection_param(opts[:'source_locations_state'], :multi) if opts[:'source_locations_state']
800
+ query_params[:'source.locations.city[]'] = @api_client.build_collection_param(opts[:'source_locations_city'], :multi) if opts[:'source_locations_city']
801
+ query_params[:'source.scopes.country[]'] = @api_client.build_collection_param(opts[:'source_scopes_country'], :multi) if opts[:'source_scopes_country']
802
+ query_params[:'source.scopes.state[]'] = @api_client.build_collection_param(opts[:'source_scopes_state'], :multi) if opts[:'source_scopes_state']
803
+ query_params[:'source.scopes.city[]'] = @api_client.build_collection_param(opts[:'source_scopes_city'], :multi) if opts[:'source_scopes_city']
804
+ query_params[:'source.scopes.level[]'] = @api_client.build_collection_param(opts[:'source_scopes_level'], :multi) if opts[:'source_scopes_level']
805
+ query_params[:'cluster'] = opts[:'cluster'] if opts[:'cluster']
806
+ query_params[:'cluster.algorithm'] = opts[:'cluster_algorithm'] if opts[:'cluster_algorithm']
807
+ query_params[:'return[]'] = @api_client.build_collection_param(opts[:'_return'], :multi) if opts[:'_return']
808
+ query_params[:'sort_by'] = opts[:'sort_by'] if opts[:'sort_by']
809
+ query_params[:'sort_direction'] = opts[:'sort_direction'] if opts[:'sort_direction']
810
+ query_params[:'cursor'] = opts[:'cursor'] if opts[:'cursor']
811
+ query_params[:'per_page'] = opts[:'per_page'] if opts[:'per_page']
812
+
813
+ # header parameters
814
+ header_params = {}
815
+
816
+ # HTTP header 'Accept' (if needed)
817
+ local_header_accept = ['application/json', 'text/xml']
818
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
819
+
820
+ # HTTP header 'Content-Type'
821
+ local_header_content_type = ['application/x-www-form-urlencoded']
822
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
823
+
824
+ # form parameters
825
+ form_params = {}
826
+
827
+ # http body (model)
828
+ post_body = nil
829
+ auth_names = ['app_key', 'app_id']
830
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
831
+ :header_params => header_params,
832
+ :query_params => query_params,
833
+ :form_params => form_params,
834
+ :body => post_body,
835
+ :auth_names => auth_names,
836
+ :return_type => 'Stories')
837
+ if @api_client.config.debugging
838
+ @api_client.config.logger.debug "API called: DefaultApi#list_stories\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
839
+ end
840
+ return data, status_code, headers
841
+ end
842
+
843
+ # List time series
844
+ # This endpoint is used for getting time series by stories.
845
+ # @param [Hash] opts the optional parameters
846
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
847
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
848
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
849
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
850
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
851
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
852
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident. (default to true)
853
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
854
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
855
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
856
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
857
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
858
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
859
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
860
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
861
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
862
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
863
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
864
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
865
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
866
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
867
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
868
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
869
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
870
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
871
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
872
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
873
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
874
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
875
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates). (default to NOW-7DAYS/DAY)
876
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates). (default to NOW/DAY)
877
+ # @option opts [String] :period The size of each date range expressed as an interval to be added to the lower bound. It supports Date Math Syntax. Valid options are &#x60;+&#x60; following an integer number greater than 0 and one of the Date Math keywords. e.g. &#x60;+1DAY&#x60;, &#x60;+2MINUTES&#x60; and &#x60;+1MONTH&#x60;. Here are [Supported keywords](https://newsapi.aylien.com/docs/working-with-dates#date-math). (default to +1DAY)
878
+ # @return [TimeSeriesList]
879
+ def list_time_series(opts = {})
880
+ data, _status_code, _headers = list_time_series_with_http_info(opts)
881
+ return data
882
+ end
883
+
884
+ # List time series
885
+ # This endpoint is used for getting time series by stories.
886
+ # @param [Hash] opts the optional parameters
887
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
888
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
889
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
890
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
891
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
892
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
893
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident.
894
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
895
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
896
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
897
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
898
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
899
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
900
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
901
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
902
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
903
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
904
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
905
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
906
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
907
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
908
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
909
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
910
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
911
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
912
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
913
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
914
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
915
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
916
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
917
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
918
+ # @option opts [String] :period The size of each date range expressed as an interval to be added to the lower bound. It supports Date Math Syntax. Valid options are &#x60;+&#x60; following an integer number greater than 0 and one of the Date Math keywords. e.g. &#x60;+1DAY&#x60;, &#x60;+2MINUTES&#x60; and &#x60;+1MONTH&#x60;. Here are [Supported keywords](https://newsapi.aylien.com/docs/working-with-dates#date-math).
919
+ # @return [Array<(TimeSeriesList, Fixnum, Hash)>] TimeSeriesList data, response status code and response headers
920
+ def list_time_series_with_http_info(opts = {})
921
+ if @api_client.config.debugging
922
+ @api_client.config.logger.debug "Calling API: DefaultApi#list_time_series ..."
923
+ end
924
+
925
+ if opts[:'categories_taxonomy'] && !['iab-qag', 'iptc-subjectcode'].include?(opts[:'categories_taxonomy'])
926
+ fail 'invalid value for "categories_taxonomy", must be one of iab-qag, iptc-subjectcode'
927
+ end
928
+
929
+ if opts[:'sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_title_polarity'])
930
+ fail 'invalid value for "sentiment_title_polarity", must be one of positive, neutral, negative'
931
+ end
932
+
933
+ if opts[:'sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_body_polarity'])
934
+ fail 'invalid value for "sentiment_body_polarity", must be one of positive, neutral, negative'
935
+ end
936
+
937
+ # resource path
938
+ local_var_path = "/time_series".sub('{format}','json')
939
+
940
+ # query parameters
941
+ query_params = {}
942
+ query_params[:'id[]'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']
943
+ query_params[:'title'] = opts[:'title'] if opts[:'title']
944
+ query_params[:'body'] = opts[:'body'] if opts[:'body']
945
+ query_params[:'text'] = opts[:'text'] if opts[:'text']
946
+ query_params[:'language[]'] = @api_client.build_collection_param(opts[:'language'], :multi) if opts[:'language']
947
+ query_params[:'categories.taxonomy'] = opts[:'categories_taxonomy'] if opts[:'categories_taxonomy']
948
+ query_params[:'categories.confident'] = opts[:'categories_confident'] if opts[:'categories_confident']
949
+ query_params[:'categories.id[]'] = @api_client.build_collection_param(opts[:'categories_id'], :multi) if opts[:'categories_id']
950
+ query_params[:'categories.level[]'] = @api_client.build_collection_param(opts[:'categories_level'], :multi) if opts[:'categories_level']
951
+ query_params[:'entities.title.text[]'] = @api_client.build_collection_param(opts[:'entities_title_text'], :multi) if opts[:'entities_title_text']
952
+ query_params[:'entities.title.type[]'] = @api_client.build_collection_param(opts[:'entities_title_type'], :multi) if opts[:'entities_title_type']
953
+ query_params[:'entities.title.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_title_links_dbpedia'], :multi) if opts[:'entities_title_links_dbpedia']
954
+ query_params[:'entities.body.text[]'] = @api_client.build_collection_param(opts[:'entities_body_text'], :multi) if opts[:'entities_body_text']
955
+ query_params[:'entities.body.type[]'] = @api_client.build_collection_param(opts[:'entities_body_type'], :multi) if opts[:'entities_body_type']
956
+ query_params[:'entities.body.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_body_links_dbpedia'], :multi) if opts[:'entities_body_links_dbpedia']
957
+ query_params[:'sentiment.title.polarity'] = opts[:'sentiment_title_polarity'] if opts[:'sentiment_title_polarity']
958
+ query_params[:'sentiment.body.polarity'] = opts[:'sentiment_body_polarity'] if opts[:'sentiment_body_polarity']
959
+ query_params[:'author.id[]'] = @api_client.build_collection_param(opts[:'author_id'], :multi) if opts[:'author_id']
960
+ query_params[:'author.name'] = opts[:'author_name'] if opts[:'author_name']
961
+ query_params[:'source.id[]'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if opts[:'source_id']
962
+ query_params[:'source.name[]'] = @api_client.build_collection_param(opts[:'source_name'], :multi) if opts[:'source_name']
963
+ query_params[:'source.domain[]'] = @api_client.build_collection_param(opts[:'source_domain'], :multi) if opts[:'source_domain']
964
+ query_params[:'source.locations.country[]'] = @api_client.build_collection_param(opts[:'source_locations_country'], :multi) if opts[:'source_locations_country']
965
+ query_params[:'source.locations.state[]'] = @api_client.build_collection_param(opts[:'source_locations_state'], :multi) if opts[:'source_locations_state']
966
+ query_params[:'source.locations.city[]'] = @api_client.build_collection_param(opts[:'source_locations_city'], :multi) if opts[:'source_locations_city']
967
+ query_params[:'source.scopes.country[]'] = @api_client.build_collection_param(opts[:'source_scopes_country'], :multi) if opts[:'source_scopes_country']
968
+ query_params[:'source.scopes.state[]'] = @api_client.build_collection_param(opts[:'source_scopes_state'], :multi) if opts[:'source_scopes_state']
969
+ query_params[:'source.scopes.city[]'] = @api_client.build_collection_param(opts[:'source_scopes_city'], :multi) if opts[:'source_scopes_city']
970
+ query_params[:'source.scopes.level[]'] = @api_client.build_collection_param(opts[:'source_scopes_level'], :multi) if opts[:'source_scopes_level']
971
+ query_params[:'published_at.start'] = opts[:'published_at_start'] if opts[:'published_at_start']
972
+ query_params[:'published_at.end'] = opts[:'published_at_end'] if opts[:'published_at_end']
973
+ query_params[:'period'] = opts[:'period'] if opts[:'period']
974
+
975
+ # header parameters
976
+ header_params = {}
977
+
978
+ # HTTP header 'Accept' (if needed)
979
+ local_header_accept = ['application/json', 'text/xml']
980
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
981
+
982
+ # HTTP header 'Content-Type'
983
+ local_header_content_type = ['application/x-www-form-urlencoded']
984
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
985
+
986
+ # form parameters
987
+ form_params = {}
988
+
989
+ # http body (model)
990
+ post_body = nil
991
+ auth_names = ['app_key', 'app_id']
992
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
993
+ :header_params => header_params,
994
+ :query_params => query_params,
995
+ :form_params => form_params,
996
+ :body => post_body,
997
+ :auth_names => auth_names,
998
+ :return_type => 'TimeSeriesList')
999
+ if @api_client.config.debugging
1000
+ @api_client.config.logger.debug "API called: DefaultApi#list_time_series\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1001
+ end
1002
+ return data, status_code, headers
1003
+ end
1004
+
1005
+ # List trends
1006
+ # This endpoint is used for finding news trendings based on stories resource.
1007
+ # @param [Hash] opts the optional parameters
1008
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
1009
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
1010
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
1011
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
1012
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
1013
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
1014
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
1015
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
1016
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident. (default to true)
1017
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
1018
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
1019
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
1020
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
1021
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
1022
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
1023
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
1024
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
1025
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
1026
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
1027
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
1028
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
1029
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
1030
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
1031
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
1032
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
1033
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
1034
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
1035
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
1036
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
1037
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
1038
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
1039
+ # @option opts [String] :field This parameter is used to specify the trend field.
1040
+ # @return [Trends]
1041
+ def list_trends(opts = {})
1042
+ data, _status_code, _headers = list_trends_with_http_info(opts)
1043
+ return data
1044
+ end
1045
+
1046
+ # List trends
1047
+ # This endpoint is used for finding news trendings based on stories resource.
1048
+ # @param [Hash] opts the optional parameters
1049
+ # @option opts [Array<Integer>] :id This parameter is used for finding stroies by story id.
1050
+ # @option opts [String] :title This parameter is used for finding stories whose title contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
1051
+ # @option opts [String] :body This parameter is used for finding stories whose body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
1052
+ # @option opts [String] :text This parameter is used for finding stories whose title or body contains a specfic keyword. It supports [boolean operators](https://newsapi.aylien.com/docs/boolean-operators).
1053
+ # @option opts [Array<String>] :language This parameter is used for finding stories whose language is the specified value. It supports [ISO 639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language codes.
1054
+ # @option opts [String] :published_at_start This parameter is used for finding stories whose published at is greater than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
1055
+ # @option opts [String] :published_at_end This parameter is used for finding stories whose published at is less than the specified value. [Here](https://newsapi.aylien.com/docs/working-with-dates) you can find more information about how [to work with dates](https://newsapi.aylien.com/docs/working-with-dates).
1056
+ # @option opts [String] :categories_taxonomy This parameter is used for defining type of the taxonomy for the rest of categories queries.
1057
+ # @option opts [BOOLEAN] :categories_confident This parameter is used for finding stories whose categories are confident.
1058
+ # @option opts [Array<String>] :categories_id This parameter is used for finding stories whose categories id is the specified value.
1059
+ # @option opts [Array<Integer>] :categories_level This parameter is used for finding stories whose categories level is the specified value.
1060
+ # @option opts [Array<String>] :entities_title_text This parameter is used for finding stories whose entities text in title is the specified value.
1061
+ # @option opts [Array<String>] :entities_title_type This parameter is used for finding stories whose entities type in title is the specified value.
1062
+ # @option opts [Array<String>] :entities_title_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in title is the specified value.
1063
+ # @option opts [Array<String>] :entities_body_text This parameter is used for finding stories whose entities text in body is the specified value.
1064
+ # @option opts [Array<String>] :entities_body_type This parameter is used for finding stories whose entities type in body is the specified value.
1065
+ # @option opts [Array<String>] :entities_body_links_dbpedia This parameter is used for finding stories whose entities dbpedia url in body is the specified value.
1066
+ # @option opts [String] :sentiment_title_polarity This parameter is used for finding stories whose title sentiment is the specified value.
1067
+ # @option opts [String] :sentiment_body_polarity This parameter is used for finding stories whose body sentiment is the specified value.
1068
+ # @option opts [Array<Integer>] :author_id This parameter is used for finding stories whose author id is the specified value.
1069
+ # @option opts [String] :author_name This parameter is used for finding stories whose author full name contains the specified value.
1070
+ # @option opts [Array<Integer>] :source_id This parameter is used for finding stories whose source id is the specified value.
1071
+ # @option opts [Array<String>] :source_name This parameter is used for finding stories whose source name contains the specified value.
1072
+ # @option opts [Array<String>] :source_domain This parameter is used for finding stories whose source domain is the specified value.
1073
+ # @option opts [Array<String>] :source_locations_country This parameter is used for finding stories whose source country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
1074
+ # @option opts [Array<String>] :source_locations_state This parameter is used for finding stories whose source state/province is the specified value.
1075
+ # @option opts [Array<String>] :source_locations_city This parameter is used for finding stories whose source city is the specified value.
1076
+ # @option opts [Array<String>] :source_scopes_country This parameter is used for finding stories whose source scopes country is the specified value. It supports [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes.
1077
+ # @option opts [Array<String>] :source_scopes_state This parameter is used for finding stories whose source scopes state/province is the specified value.
1078
+ # @option opts [Array<String>] :source_scopes_city This parameter is used for finding stories whose source scopes city is the specified value.
1079
+ # @option opts [Array<String>] :source_scopes_level This parameter is used for finding stories whose source scopes level is the specified value.
1080
+ # @option opts [String] :field This parameter is used to specify the trend field.
1081
+ # @return [Array<(Trends, Fixnum, Hash)>] Trends data, response status code and response headers
1082
+ def list_trends_with_http_info(opts = {})
1083
+ if @api_client.config.debugging
1084
+ @api_client.config.logger.debug "Calling API: DefaultApi#list_trends ..."
1085
+ end
1086
+
1087
+ if opts[:'categories_taxonomy'] && !['iab-qag', 'iptc-subjectcode'].include?(opts[:'categories_taxonomy'])
1088
+ fail 'invalid value for "categories_taxonomy", must be one of iab-qag, iptc-subjectcode'
1089
+ end
1090
+
1091
+ if opts[:'sentiment_title_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_title_polarity'])
1092
+ fail 'invalid value for "sentiment_title_polarity", must be one of positive, neutral, negative'
1093
+ end
1094
+
1095
+ if opts[:'sentiment_body_polarity'] && !['positive', 'neutral', 'negative'].include?(opts[:'sentiment_body_polarity'])
1096
+ fail 'invalid value for "sentiment_body_polarity", must be one of positive, neutral, negative'
1097
+ end
1098
+
1099
+ if opts[:'field'] && !['author.name', 'source.name', 'source.domain', 'keywords', 'entities.title.text', 'entities.title.type', 'entities.title.links.dbpedia', 'entities.body.text', 'entities.body.type', 'entities.body.links.dbpedia', 'hashtags', 'categories.id', 'sentiment.title.polarity', 'sentiment.body.polarity'].include?(opts[:'field'])
1100
+ fail 'invalid value for "field", must be one of author.name, source.name, source.domain, keywords, entities.title.text, entities.title.type, entities.title.links.dbpedia, entities.body.text, entities.body.type, entities.body.links.dbpedia, hashtags, categories.id, sentiment.title.polarity, sentiment.body.polarity'
1101
+ end
1102
+
1103
+ # resource path
1104
+ local_var_path = "/trends".sub('{format}','json')
1105
+
1106
+ # query parameters
1107
+ query_params = {}
1108
+ query_params[:'id[]'] = @api_client.build_collection_param(opts[:'id'], :multi) if opts[:'id']
1109
+ query_params[:'title'] = opts[:'title'] if opts[:'title']
1110
+ query_params[:'body'] = opts[:'body'] if opts[:'body']
1111
+ query_params[:'text'] = opts[:'text'] if opts[:'text']
1112
+ query_params[:'language[]'] = @api_client.build_collection_param(opts[:'language'], :multi) if opts[:'language']
1113
+ query_params[:'published_at.start'] = opts[:'published_at_start'] if opts[:'published_at_start']
1114
+ query_params[:'published_at.end'] = opts[:'published_at_end'] if opts[:'published_at_end']
1115
+ query_params[:'categories.taxonomy'] = opts[:'categories_taxonomy'] if opts[:'categories_taxonomy']
1116
+ query_params[:'categories.confident'] = opts[:'categories_confident'] if opts[:'categories_confident']
1117
+ query_params[:'categories.id[]'] = @api_client.build_collection_param(opts[:'categories_id'], :multi) if opts[:'categories_id']
1118
+ query_params[:'categories.level[]'] = @api_client.build_collection_param(opts[:'categories_level'], :multi) if opts[:'categories_level']
1119
+ query_params[:'entities.title.text[]'] = @api_client.build_collection_param(opts[:'entities_title_text'], :multi) if opts[:'entities_title_text']
1120
+ query_params[:'entities.title.type[]'] = @api_client.build_collection_param(opts[:'entities_title_type'], :multi) if opts[:'entities_title_type']
1121
+ query_params[:'entities.title.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_title_links_dbpedia'], :multi) if opts[:'entities_title_links_dbpedia']
1122
+ query_params[:'entities.body.text[]'] = @api_client.build_collection_param(opts[:'entities_body_text'], :multi) if opts[:'entities_body_text']
1123
+ query_params[:'entities.body.type[]'] = @api_client.build_collection_param(opts[:'entities_body_type'], :multi) if opts[:'entities_body_type']
1124
+ query_params[:'entities.body.links.dbpedia[]'] = @api_client.build_collection_param(opts[:'entities_body_links_dbpedia'], :multi) if opts[:'entities_body_links_dbpedia']
1125
+ query_params[:'sentiment.title.polarity'] = opts[:'sentiment_title_polarity'] if opts[:'sentiment_title_polarity']
1126
+ query_params[:'sentiment.body.polarity'] = opts[:'sentiment_body_polarity'] if opts[:'sentiment_body_polarity']
1127
+ query_params[:'author.id[]'] = @api_client.build_collection_param(opts[:'author_id'], :multi) if opts[:'author_id']
1128
+ query_params[:'author.name'] = opts[:'author_name'] if opts[:'author_name']
1129
+ query_params[:'source.id[]'] = @api_client.build_collection_param(opts[:'source_id'], :multi) if opts[:'source_id']
1130
+ query_params[:'source.name[]'] = @api_client.build_collection_param(opts[:'source_name'], :multi) if opts[:'source_name']
1131
+ query_params[:'source.domain[]'] = @api_client.build_collection_param(opts[:'source_domain'], :multi) if opts[:'source_domain']
1132
+ query_params[:'source.locations.country[]'] = @api_client.build_collection_param(opts[:'source_locations_country'], :multi) if opts[:'source_locations_country']
1133
+ query_params[:'source.locations.state[]'] = @api_client.build_collection_param(opts[:'source_locations_state'], :multi) if opts[:'source_locations_state']
1134
+ query_params[:'source.locations.city[]'] = @api_client.build_collection_param(opts[:'source_locations_city'], :multi) if opts[:'source_locations_city']
1135
+ query_params[:'source.scopes.country[]'] = @api_client.build_collection_param(opts[:'source_scopes_country'], :multi) if opts[:'source_scopes_country']
1136
+ query_params[:'source.scopes.state[]'] = @api_client.build_collection_param(opts[:'source_scopes_state'], :multi) if opts[:'source_scopes_state']
1137
+ query_params[:'source.scopes.city[]'] = @api_client.build_collection_param(opts[:'source_scopes_city'], :multi) if opts[:'source_scopes_city']
1138
+ query_params[:'source.scopes.level[]'] = @api_client.build_collection_param(opts[:'source_scopes_level'], :multi) if opts[:'source_scopes_level']
1139
+ query_params[:'field'] = opts[:'field'] if opts[:'field']
1140
+
1141
+ # header parameters
1142
+ header_params = {}
1143
+
1144
+ # HTTP header 'Accept' (if needed)
1145
+ local_header_accept = ['application/json', 'text/xml']
1146
+ local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result
1147
+
1148
+ # HTTP header 'Content-Type'
1149
+ local_header_content_type = ['application/x-www-form-urlencoded']
1150
+ header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)
1151
+
1152
+ # form parameters
1153
+ form_params = {}
1154
+
1155
+ # http body (model)
1156
+ post_body = nil
1157
+ auth_names = ['app_key', 'app_id']
1158
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
1159
+ :header_params => header_params,
1160
+ :query_params => query_params,
1161
+ :form_params => form_params,
1162
+ :body => post_body,
1163
+ :auth_names => auth_names,
1164
+ :return_type => 'Trends')
1165
+ if @api_client.config.debugging
1166
+ @api_client.config.logger.debug "API called: DefaultApi#list_trends\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1167
+ end
1168
+ return data, status_code, headers
1169
+ end
1170
+ end
1171
+ end