emergentmethods/asknews-php-sdk
Composer 安装命令:
composer require emergentmethods/asknews-php-sdk
包简介
AskNews API [](https://status.asknews.app/status/prod)
README 文档
README
Installation & Usage
Requirements
PHP 8.0 and later.
Composer
To install the bindings via Composer, add the following to composer.json:
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/emergentmethods/asknews-php-sdk.git"
}
],
"require": {
"emergentmethods/asknews-php-sdk": "*@dev"
}
}
Then run composer install
Manual Installation
Download the files and include autoload.php:
<?php require_once('/path/to/asknews-php-sdk/vendor/autoload.php');
Getting Started
Please follow the installation procedure and then run the following:
<?php require_once(__DIR__ . '/vendor/autoload.php'); $apiInstance = new AskNews\Api\AlertsApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $create_alert_request = new \AskNews\Model\CreateAlertRequest(); // \AskNews\Model\CreateAlertRequest try { $result = $apiInstance->createAlert($create_alert_request); print_r($result); } catch (Exception $e) { echo 'Exception when calling AlertsApi->createAlert: ', $e->getMessage(), PHP_EOL; }
API Endpoints
All URIs are relative to https://api.asknews.app
| Class | Method | HTTP request | Description |
|---|---|---|---|
| AlertsApi | createAlert | POST /v1/chat/alerts | Create an alert |
| AlertsApi | deleteAlert | DELETE /v1/chat/alerts/{alert_id} | Delete an alert |
| AlertsApi | getAlert | GET /v1/chat/alerts/{alert_id} | Get an alert |
| AlertsApi | getAlertLogs | GET /v1/chat/alerts/{alert_id}/logs | Get alert logs |
| AlertsApi | getAlerts | GET /v1/chat/alerts | Get all created alerts |
| AlertsApi | getAllAlertLogs | GET /v1/chat/alerts/logs | Get all alert logs |
| AlertsApi | putAlert | PUT /v1/chat/alerts/{alert_id} | Update an alert |
| AlertsApi | runAlert | GET /v1/chat/alerts/{alert_id}/run | Run an existing alert |
| AnalyticsApi | getAssetSentiment | GET /v1/analytics/finance/sentiment | Get a timeseries of finance news sentiment for assets |
| AutofilterApi | autofilter | GET /v1/chat/autofilter | Generate filter params for AskNews endpoints |
| ByokApi | deleteByokKey | DELETE /v1/chat/byok/{provider} | Delete a stored BYOK API key for a provider |
| ByokApi | getByokKey | GET /v1/chat/byok/{provider} | Get a stored BYOK API key hint for a provider |
| ByokApi | upsertByokKey | PUT /v1/chat/byok/{provider} | Store a BYOK API key for a provider |
| ChartsApi | createChartsEndpoint | POST /v1/chat/charts | Create a chart |
| ChatApi | deepNews | POST /v1/chat/deepnews | Deep research into real-time news, archive news, and Google. |
| ChatApi | getChatCompletions | POST /v1/openai/chat/completions | Get chat completions from a news-infused AI assistant |
| ChatApi | listDeepnewsModels | GET /v1/chat/deepnews-models | List available DeepNews models |
| DistributionApi | domainHitShare | GET /v1/distribution/stats/hit_share | Get the hit share for a list of domains in a time period |
| DistributionApi | findDomains | GET /v1/distribution/domains | Find domains |
| DistributionApi | getArticleHits | GET /v1/distribution/stats/count | Get article hits |
| DistributionApi | getDomain | GET /v1/distribution/domains/{name} | Get a domain by name |
| DistributionApi | getDomainHitsSurface | GET /v1/distribution/articles/domain_hits_surface | Get total hits and surfaced articles for domains |
| DistributionApi | getDomainHitsSurfaceTimewindow | GET /v1/distribution/articles/domain_hits_surface_timewindow | Get hits and surfaced articles per day for domains |
| DistributionApi | getDomainQueries | GET /v1/distribution/articles/domain_queries | Get queries that surfaced domain articles |
| DistributionApi | topNArticlesByHits | GET /v1/distribution/articles/top_n | Get the top N articles by hits |
| DistributionApi | topNArticlesForDomainTimeseries | GET /v1/distribution/articles/top_n_for_domain_timeseries | Get the top N articles by hits for domain with daily breakdown |
| DistributionApi | topNArticlesForDomains | GET /v1/distribution/articles/top_n_for_domains | Get the top N articles by hits for domains |
| DistributionApi | topNDomainsByHits | GET /v1/distribution/domains/top_n | Get the top N domains by hits |
| DistributionApi | updateDomain | PUT /v1/distribution/domains/{name} | Update an existing domain |
| ForecastApi | getForecast | GET /v1/chat/forecast | Make an expert forecast for a news event. |
| GraphApi | buildGraph | POST /v1/news/graph | Build a custom mega-news-knowledge graph |
| IndexUrlsApi | indexUrls | POST /v1/news/index_urls | Index a list of URLs into AskNews |
| NewsApi | getArticle | GET /v1/news/{article_id} | Get an article by its UUID |
| NewsApi | getArticles | GET /v1/news | Get multiple articles by UUID |
| NewsApi | getIndexCounts | GET /v1/index_counts | Get the index counts underlying AskNews |
| NewsApi | getSourcesReport | GET /v1/sources | Get the sources underlying AskNews |
| NewsApi | searchNews | GET /v1/news/search | Search for enriched real-time news context |
| NewslettersApi | deleteNewsletter | DELETE /v1/chat/newsletters/{newsletter_id} | Delete a newsletter |
| NewslettersApi | deleteNewsletterContact | DELETE /v1/chat/newsletters/{newsletter_id}/contacts/{contact_id} | Delete a newsletter contact |
| NewslettersApi | getNewsletter | GET /v1/chat/newsletters/{newsletter_id} | Get a newsletter |
| NewslettersApi | getNewsletterContact | GET /v1/chat/newsletters/{newsletter_id}/contacts/{contact_id} | Get a newsletter contact |
| NewslettersApi | getNewsletterContacts | GET /v1/chat/newsletters/{newsletter_id}/contacts | Get newsletter contacts |
| NewslettersApi | getNewsletters | GET /v1/chat/newsletters | Get all created newsletters |
| NewslettersApi | getPublicNewsletters | GET /v1/chat/newsletters/public | Get all public newsletters |
| NewslettersApi | patchNewsletterContact | PATCH /v1/chat/newsletters/{newsletter_id}/contacts/{contact_id} | Update a newsletter contact |
| NewslettersApi | postNewsletter | POST /v1/chat/newsletters | Create a newsletter |
| NewslettersApi | postNewsletterContacts | POST /v1/chat/newsletters/{newsletter_id}/contacts | Create a newsletter contact |
| NewslettersApi | putNewsletter | PUT /v1/chat/newsletters/{newsletter_id} | Update a newsletter |
| NewslettersApi | unsubscribeNewsletter | POST /v1/chat/newsletters/{newsletter_id}/unsubscribe | Unsubscribe from a newsletter |
| PingApi | ping | GET / | Ping |
| ProfileApi | getRateLimitStatus | GET /v1/profiles/me/limits | Get the current user's rate limit status |
| ProfileApi | getUserProfile | GET /v1/profiles/me | Get the current user's profile |
| RedditApi | searchReddit | GET /v1/reddit/search | Search Reddit, summarize threads, and return analysis. |
| StoriesApi | getStories | GET /v1/stories | Filter and search for top news narratives |
| StoriesApi | getStory | GET /v1/stories/{story_id} | Get a story containing updates |
| WebsearchApi | liveWebSearch | GET /v1/chat/websearch | Run a live websearch. |
| WikiApi | searchWiki | GET /v1/wiki/search | Search for Wikipedia context with natural language |
Models
- AbcAPIErrorModel1
- AbcAPIErrorModel10
- AbcAPIErrorModel100
- AbcAPIErrorModel101
- AbcAPIErrorModel102
- AbcAPIErrorModel103
- AbcAPIErrorModel104
- AbcAPIErrorModel105
- AbcAPIErrorModel106
- AbcAPIErrorModel107
- AbcAPIErrorModel108
- AbcAPIErrorModel109
- AbcAPIErrorModel11
- AbcAPIErrorModel110
- AbcAPIErrorModel111
- AbcAPIErrorModel112
- AbcAPIErrorModel12
- AbcAPIErrorModel13
- AbcAPIErrorModel14
- AbcAPIErrorModel15
- AbcAPIErrorModel16
- AbcAPIErrorModel17
- AbcAPIErrorModel18
- AbcAPIErrorModel19
- AbcAPIErrorModel2
- AbcAPIErrorModel20
- AbcAPIErrorModel21
- AbcAPIErrorModel22
- AbcAPIErrorModel23
- AbcAPIErrorModel24
- AbcAPIErrorModel25
- AbcAPIErrorModel26
- AbcAPIErrorModel27
- AbcAPIErrorModel28
- AbcAPIErrorModel29
- AbcAPIErrorModel3
- AbcAPIErrorModel30
- AbcAPIErrorModel31
- AbcAPIErrorModel32
- AbcAPIErrorModel33
- AbcAPIErrorModel34
- AbcAPIErrorModel35
- AbcAPIErrorModel36
- AbcAPIErrorModel37
- AbcAPIErrorModel38
- AbcAPIErrorModel39
- AbcAPIErrorModel4
- AbcAPIErrorModel40
- AbcAPIErrorModel41
- AbcAPIErrorModel42
- AbcAPIErrorModel43
- AbcAPIErrorModel44
- AbcAPIErrorModel45
- AbcAPIErrorModel46
- AbcAPIErrorModel47
- AbcAPIErrorModel48
- AbcAPIErrorModel49
- AbcAPIErrorModel5
- AbcAPIErrorModel50
- AbcAPIErrorModel51
- AbcAPIErrorModel52
- AbcAPIErrorModel53
- AbcAPIErrorModel54
- AbcAPIErrorModel55
- AbcAPIErrorModel56
- AbcAPIErrorModel57
- AbcAPIErrorModel58
- AbcAPIErrorModel59
- AbcAPIErrorModel6
- AbcAPIErrorModel60
- AbcAPIErrorModel61
- AbcAPIErrorModel62
- AbcAPIErrorModel63
- AbcAPIErrorModel64
- AbcAPIErrorModel65
- AbcAPIErrorModel66
- AbcAPIErrorModel67
- AbcAPIErrorModel68
- AbcAPIErrorModel69
- AbcAPIErrorModel7
- AbcAPIErrorModel70
- AbcAPIErrorModel71
- AbcAPIErrorModel72
- AbcAPIErrorModel73
- AbcAPIErrorModel74
- AbcAPIErrorModel75
- AbcAPIErrorModel76
- AbcAPIErrorModel77
- AbcAPIErrorModel78
- AbcAPIErrorModel79
- AbcAPIErrorModel8
- AbcAPIErrorModel80
- AbcAPIErrorModel81
- AbcAPIErrorModel82
- AbcAPIErrorModel83
- AbcAPIErrorModel84
- AbcAPIErrorModel85
- AbcAPIErrorModel86
- AbcAPIErrorModel87
- AbcAPIErrorModel88
- AbcAPIErrorModel89
- AbcAPIErrorModel9
- AbcAPIErrorModel90
- AbcAPIErrorModel91
- AbcAPIErrorModel92
- AbcAPIErrorModel93
- AbcAPIErrorModel94
- AbcAPIErrorModel95
- AbcAPIErrorModel96
- AbcAPIErrorModel97
- AbcAPIErrorModel98
- AbcAPIErrorModel99
- AlertLog
- AlertResponse
- AnthropicInputJsonDelta
- AnthropicInputJsonDelta1
- AnthropicTextBlock
- AnthropicTextBlock1
- AnthropicTextDelta
- AnthropicTextDelta1
- AnthropicThinkingBlock
- AnthropicThinkingBlock1
- AnthropicThinkingDelta
- AnthropicThinkingDelta1
- AnthropicToolUseBlock
- AnthropicToolUseBlock1
- ApiKeyResponse
- Article
- AskNewsSource
- AsknewsApiErrorsAPIErrorModel
- AsknewsApiSchemaV1CommonGraphRelationships
- AsknewsApiSchemaV1StoriesGraphRelationships
- Assets
- Assets1
- Author
- Author1
- BadDomainUrl
- BadDomainUrl1
- BadDomainUrl2
- BlueskySource
- BlueskySourceParams
- BodyBuildGraph
- ChartParameters
- ChartParameters1
- ChartResponse
- ChartResponse1
- Choice
- CirrusMetadata
- Classification
- ClusterProbabilitiesValue
- ContentBlock
- ContentBlock1
- ContentBlockDeltaEvent
- ContentBlockDeltaEvent1
- ContentBlockStartEvent
- ContentBlockStartEvent1
- ContentBlockStopEvent
- ContentBlockStopEvent1
- Continent
- CountResponse
- CreateAlertRequest
- CreateChartRequest
- CreateChatCompletionRequest
- CreateChatCompletionRequestMessage
- CreateChatCompletionRequestMessage1
- CreateChatCompletionResponse
- CreateChatCompletionResponse1
- CreateChatCompletionResponseChoice
- CreateChatCompletionResponseChoice1
- CreateChatCompletionResponseStream
- CreateChatCompletionResponseStream1
- CreateChatCompletionResponseStreamChoice
- CreateChatCompletionResponseStreamChoice1
- CreateChatCompletionResponseUsage
- CreateChatCompletionResponseUsage1
- CreateDeepNewsRequest
- CreateDeepNewsRequestMessage
- CreateDeepNewsRequestMessage1
- CreateDeepNewsRequestModel
- CreateDeepNewsResponse
- CreateDeepNewsResponse1
- CreateDeepNewsResponseChoice
- CreateDeepNewsResponseChoice1
- CreateDeepNewsResponseStreamChunk
- CreateDeepNewsResponseStreamChunk1
- CreateDeepNewsResponseStreamChunkChoice
- CreateDeepNewsResponseStreamChunkChoice1
- CreateDeepNewsResponseStreamChunkChoiceV2
- CreateDeepNewsResponseStreamChunkChoiceV21
- CreateDeepNewsResponseStreamChunkV2
- CreateDeepNewsResponseStreamChunkV21
- CreateDeepNewsResponseStreamSource
- CreateDeepNewsResponseStreamSource1
- CreateDeepNewsResponseStreamSourcesChartSource
- CreateDeepNewsResponseStreamSourcesChartSource1
- CreateDeepNewsResponseStreamSourcesGraphSource
- CreateDeepNewsResponseStreamSourcesGraphSource1
- CreateDeepNewsResponseStreamSourcesNewsSource
- CreateDeepNewsResponseStreamSourcesNewsSource1
- CreateDeepNewsResponseStreamSourcesWebSource
- CreateDeepNewsResponseStreamSourcesWebSource1
- CreateDeepNewsResponseUsage
- CreateDeepNewsResponseUsage1
- CreateDeepNewsResponseUsage2
- CreateNewsletterRequest
- CutoffDatetime
- DeepNews200Response
- DeepNewsModel
- DeepNewsModelItem
- DeepNewsReportParams
- DeepNewsReportRequest
- DeepNewsResponseSources
- DeepNewsResponseSources1
- DeepNewsSource
- DeepNewsSourceParams
- Delta
- Delta1
- Delta2
- DisplayImageUrl
- DomainHitsSurfaceDayItem
- DomainHitsSurfaceResponse
- DomainHitsSurfaceTimeWindowResponse
- DomainQueriesResponse
- DomainQueryArticleItem
- DomainQueryClusterItem
- DomainQueryItem
- DomainUrl
- DomainUrl1
- EmailAction
- EmailParams
- Entities
- Entities1
- FilterParams
- FilterParams1
- FilterParamsMetadata
- FilterParamsResponse
- FinanceResponse
- FinanceResponseTimeSeries
- FinanceResponseTimeSeriesData
- ForecastResponse
- GeoCoordinate
- GeoCoordinate1
- GoogleDocsAction
- GoogleDocsParams
- GraphRelationships
- GraphResponse
- HTTPValidationError
- HitShareItem
- HitShareResponse
- IndexCountItem
- IndexUrlsResponse
- IntraClusterStatistics
- KeyPerson
- LegacyReportRequest
- ListDeepNewsModelResponse
- MCPFilterParams
- MessageStartEvent
- MessageStartEvent1
- MessageStopEvent
- MessageStopEvent1
- NewsletterContactCreateResponse
- NewsletterContactRequest
- NewsletterContactResponse
- NewsletterContactUpdateResponse
- NewsletterPublicResponse
- NewsletterResponse
- Offset
- Offset1
- Offset2
- Offset3
- Offset4
- Offset5
- OrganizationProfile
- OrganizationProfileSubscription
- PaginatedResponseAlertLog
- PaginatedResponseAlertResponse
- PaginatedResponseNewsletterPublicResponse
- PaginatedResponseNewsletterResponse
- PaginatedResponseReadDomainResponse
- PingModel
- Profile
- ProfileResponse
- RateLimitStatusResponse
- ReadDomainResponse
- RedditComment
- RedditEntities
- RedditPerspective
- RedditResponse
- RedditThread
- ReferralItem
- ReplyTo
- Report
- Report1
- Report1AnyOf
- Report2
- Report2AnyOfInner
- ReportingVoice
- ReportingVoice1
- ReportingVoice2
- ResendBroadcastAction
- ResendBroadcastParams
- ScrapeDataItem
- ScrapeItem
- ScrapedURLItem
- SearchResponse
- SearchResponseDictItem
- SearchResponseDictItem1
- Sentiment
- SeriesConfig
- SeriesConfig1
- Source
- Source1
- SourceReportItem
- Sources1
- Sources2
- SourcesInner
- Stop
- Stop1
- StoriesResponse
- StoryResponse
- StoryUpdate
- StoryUpdateDisplayImageUrlsInner
- TelegramSource
- TelegramSourceParams
- ThreadId
- ThreadId1
- TopNArticlesByHitsItem
- TopNArticlesByHitsResponse
- TopNArticlesForDomainItem
- TopNArticlesForDomainResponse
- TopNArticlesTimeseriesDayItem
- TopNArticlesTimeseriesItem
- TopNArticlesTimeseriesResponse
- TopNDomainsByHitsItem
- TopNDomainsByHitsResponse
- TriggersInner
- URLIndexingRequest
- UpdateAlertRequest
- UpdateDomainRequest
- UpdateNewsletterRequest
- UpsertApiKeyRequest
- User
- User1
- UserProfile
- UserProfileOrganization
- UserProfileSubscription
- ValidationError
- ValidationErrorItem
- ValidationErrorLocInner
- ValidationErrorModel
- Value
- WebSearchResponse
- WebSearchResult
- WebSearchResult1
- WebSearchResult2
- WebSource
- WebSourceParams
- WebhookAction
- WebhookParams
- WikiResponseDictItem
- WikiSearchResponse
Authorization
Find full details at the AskNews API documentation.
Support
Join our Discord to see what other people are building, and to get support with your projects.
emergentmethods/asknews-php-sdk 适用场景与选型建议
emergentmethods/asknews-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 18.94k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 08 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「news」 「newsapi」 「llm」 「rag」 「syntheticdata」 「asknews」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 emergentmethods/asknews-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 emergentmethods/asknews-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 emergentmethods/asknews-php-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PHP client for NewsApi
Extend news to use them also as event
This TYPO3 distribution provides a sample website using bootstrap and the extensions pizpalue and container_elements. The distribution tailors Swiss market featuring German as default language and additional translations to French, English and Finnish.
PHP unofficial client to cryptopanic.com API
News feature for Clara.
Extend news by a sub headline
统计信息
- 总下载量: 18.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-16