From 8b8671459a0894642f7dd5b84019e6d95d51c684 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 19 Jun 2026 20:59:47 +0000 Subject: [PATCH 001/130] chore: configure new SDK language --- .gitattributes | 16 + .github/workflows/ci.yml | 54 + .github/workflows/release-doctor.yml | 22 + .gitignore | 13 + .php-cs-fixer.dist.php | 19 + .phpactor.json | 6 + .release-please-manifest.json | 3 + .stats.yml | 4 + LICENSE | 201 + README.md | 171 +- SECURITY.md | 27 + bin/check-release-environment | 25 + composer.json | 56 + composer.lock | 7054 +++++++++++++++++ phpstan.dist.neon | 14 + phpunit.xml.dist | 18 + release-please-config.json | 67 + scripts/bootstrap | 8 + scripts/clean | 8 + scripts/format | 8 + scripts/lint | 8 + scripts/test | 9 + src/AI/AIAIQueryParams.php | 153 + src/AI/AIAIQueryParams/DataToExtract.php | 203 + .../DataToExtract/DatapointListType.php | 27 + .../DataToExtract/DatapointObjectSchema.php | 16 + .../DataToExtract/DatapointType.php | 23 + src/AI/AIAIQueryParams/SpecificPages.php | 219 + src/AI/AIAIQueryResponse.php | 156 + src/AI/AIAIQueryResponse/DataExtracted.php | 87 + .../DataExtracted/DatapointValue.php | 36 + src/AI/AIAIQueryResponse/KeyMetadata.php | 92 + src/AI/AIExtractProductParams.php | 117 + src/AI/AIExtractProductResponse.php | 135 + .../AIExtractProductResponse/KeyMetadata.php | 92 + src/AI/AIExtractProductResponse/Platform.php | 19 + src/AI/AIExtractProductResponse/Product.php | 389 + .../Product/BillingFrequency.php | 19 + .../Product/PricingModel.php | 21 + src/AI/AIExtractProductsParams.php | 159 + src/AI/AIExtractProductsResponse.php | 91 + .../AIExtractProductsResponse/KeyMetadata.php | 92 + src/AI/AIExtractProductsResponse/Product.php | 387 + .../Product/BillingFrequency.php | 19 + .../Product/PricingModel.php | 21 + src/Brand/BrandGetByEmailResponse.php | 129 + src/Brand/BrandGetByEmailResponse/Brand.php | 416 + .../BrandGetByEmailResponse/Brand/Address.php | 179 + .../Brand/Backdrop.php | 113 + .../Brand/Backdrop/Color.php | 72 + .../Brand/Backdrop/Resolution.php | 97 + .../BrandGetByEmailResponse/Brand/Color.php | 72 + .../Brand/Industries.php | 65 + .../Brand/Industries/Eic.php | 104 + .../Brand/Industries/Eic/Industry.php | 59 + .../Brand/Industries/Eic/Subindustry.php | 451 ++ .../BrandGetByEmailResponse/Brand/Links.php | 159 + .../BrandGetByEmailResponse/Brand/Logo.php | 165 + .../Brand/Logo/Color.php | 72 + .../Brand/Logo/Mode.php | 17 + .../Brand/Logo/Resolution.php | 97 + .../Brand/Logo/Type.php | 15 + .../Brand/PrimaryLanguage.php | 251 + .../BrandGetByEmailResponse/Brand/Social.php | 83 + .../Brand/Social/Type.php | 73 + .../BrandGetByEmailResponse/Brand/Stock.php | 76 + .../BrandGetByEmailResponse/KeyMetadata.php | 92 + src/Brand/BrandGetByIsinResponse.php | 129 + src/Brand/BrandGetByIsinResponse/Brand.php | 416 + .../BrandGetByIsinResponse/Brand/Address.php | 179 + .../BrandGetByIsinResponse/Brand/Backdrop.php | 113 + .../Brand/Backdrop/Color.php | 72 + .../Brand/Backdrop/Resolution.php | 97 + .../BrandGetByIsinResponse/Brand/Color.php | 72 + .../Brand/Industries.php | 65 + .../Brand/Industries/Eic.php | 104 + .../Brand/Industries/Eic/Industry.php | 59 + .../Brand/Industries/Eic/Subindustry.php | 451 ++ .../BrandGetByIsinResponse/Brand/Links.php | 159 + .../BrandGetByIsinResponse/Brand/Logo.php | 165 + .../Brand/Logo/Color.php | 72 + .../Brand/Logo/Mode.php | 17 + .../Brand/Logo/Resolution.php | 97 + .../Brand/Logo/Type.php | 15 + .../Brand/PrimaryLanguage.php | 251 + .../BrandGetByIsinResponse/Brand/Social.php | 83 + .../Brand/Social/Type.php | 73 + .../BrandGetByIsinResponse/Brand/Stock.php | 76 + .../BrandGetByIsinResponse/KeyMetadata.php | 92 + src/Brand/BrandGetByNameResponse.php | 129 + src/Brand/BrandGetByNameResponse/Brand.php | 416 + .../BrandGetByNameResponse/Brand/Address.php | 179 + .../BrandGetByNameResponse/Brand/Backdrop.php | 113 + .../Brand/Backdrop/Color.php | 72 + .../Brand/Backdrop/Resolution.php | 97 + .../BrandGetByNameResponse/Brand/Color.php | 72 + .../Brand/Industries.php | 65 + .../Brand/Industries/Eic.php | 104 + .../Brand/Industries/Eic/Industry.php | 59 + .../Brand/Industries/Eic/Subindustry.php | 451 ++ .../BrandGetByNameResponse/Brand/Links.php | 159 + .../BrandGetByNameResponse/Brand/Logo.php | 165 + .../Brand/Logo/Color.php | 72 + .../Brand/Logo/Mode.php | 17 + .../Brand/Logo/Resolution.php | 97 + .../Brand/Logo/Type.php | 15 + .../Brand/PrimaryLanguage.php | 251 + .../BrandGetByNameResponse/Brand/Social.php | 83 + .../Brand/Social/Type.php | 73 + .../BrandGetByNameResponse/Brand/Stock.php | 76 + .../BrandGetByNameResponse/KeyMetadata.php | 92 + src/Brand/BrandGetByTickerResponse.php | 129 + src/Brand/BrandGetByTickerResponse/Brand.php | 416 + .../Brand/Address.php | 179 + .../Brand/Backdrop.php | 113 + .../Brand/Backdrop/Color.php | 72 + .../Brand/Backdrop/Resolution.php | 97 + .../BrandGetByTickerResponse/Brand/Color.php | 72 + .../Brand/Industries.php | 65 + .../Brand/Industries/Eic.php | 104 + .../Brand/Industries/Eic/Industry.php | 59 + .../Brand/Industries/Eic/Subindustry.php | 451 ++ .../BrandGetByTickerResponse/Brand/Links.php | 159 + .../BrandGetByTickerResponse/Brand/Logo.php | 165 + .../Brand/Logo/Color.php | 72 + .../Brand/Logo/Mode.php | 17 + .../Brand/Logo/Resolution.php | 97 + .../Brand/Logo/Type.php | 15 + .../Brand/PrimaryLanguage.php | 251 + .../BrandGetByTickerResponse/Brand/Social.php | 83 + .../Brand/Social/Type.php | 73 + .../BrandGetByTickerResponse/Brand/Stock.php | 76 + .../BrandGetByTickerResponse/KeyMetadata.php | 92 + src/Brand/BrandGetResponse.php | 129 + src/Brand/BrandGetResponse/Brand.php | 416 + src/Brand/BrandGetResponse/Brand/Address.php | 179 + src/Brand/BrandGetResponse/Brand/Backdrop.php | 113 + .../BrandGetResponse/Brand/Backdrop/Color.php | 72 + .../Brand/Backdrop/Resolution.php | 97 + src/Brand/BrandGetResponse/Brand/Color.php | 72 + .../BrandGetResponse/Brand/Industries.php | 65 + .../BrandGetResponse/Brand/Industries/Eic.php | 104 + .../Brand/Industries/Eic/Industry.php | 59 + .../Brand/Industries/Eic/Subindustry.php | 451 ++ src/Brand/BrandGetResponse/Brand/Links.php | 159 + src/Brand/BrandGetResponse/Brand/Logo.php | 163 + .../BrandGetResponse/Brand/Logo/Color.php | 72 + .../BrandGetResponse/Brand/Logo/Mode.php | 17 + .../Brand/Logo/Resolution.php | 97 + .../BrandGetResponse/Brand/Logo/Type.php | 15 + .../Brand/PrimaryLanguage.php | 251 + src/Brand/BrandGetResponse/Brand/Social.php | 83 + .../BrandGetResponse/Brand/Social/Type.php | 73 + src/Brand/BrandGetResponse/Brand/Stock.php | 76 + src/Brand/BrandGetResponse/KeyMetadata.php | 92 + src/Brand/BrandGetSimplifiedResponse.php | 129 + .../BrandGetSimplifiedResponse/Brand.php | 162 + .../Brand/Backdrop.php | 113 + .../Brand/Backdrop/Color.php | 72 + .../Brand/Backdrop/Resolution.php | 97 + .../Brand/Color.php | 72 + .../BrandGetSimplifiedResponse/Brand/Logo.php | 165 + .../Brand/Logo/Color.php | 72 + .../Brand/Logo/Mode.php | 17 + .../Brand/Logo/Resolution.php | 97 + .../Brand/Logo/Type.php | 15 + .../KeyMetadata.php | 92 + .../BrandIdentifyFromTransactionParams.php | 252 + .../CountryGl.php | 489 ++ .../ForceLanguage.php | 251 + .../BrandIdentifyFromTransactionResponse.php | 129 + .../Brand.php | 416 + .../Brand/Address.php | 179 + .../Brand/Backdrop.php | 113 + .../Brand/Backdrop/Color.php | 72 + .../Brand/Backdrop/Resolution.php | 97 + .../Brand/Color.php | 72 + .../Brand/Industries.php | 65 + .../Brand/Industries/Eic.php | 104 + .../Brand/Industries/Eic/Industry.php | 59 + .../Brand/Industries/Eic/Subindustry.php | 451 ++ .../Brand/Links.php | 159 + .../Brand/Logo.php | 165 + .../Brand/Logo/Color.php | 72 + .../Brand/Logo/Mode.php | 17 + .../Brand/Logo/Resolution.php | 97 + .../Brand/Logo/Type.php | 15 + .../Brand/PrimaryLanguage.php | 251 + .../Brand/Social.php | 83 + .../Brand/Social/Type.php | 73 + .../Brand/Stock.php | 76 + .../KeyMetadata.php | 92 + src/Brand/BrandRetrieveByEmailParams.php | 166 + .../ForceLanguage.php | 251 + src/Brand/BrandRetrieveByIsinParams.php | 166 + .../ForceLanguage.php | 251 + src/Brand/BrandRetrieveByNameParams.php | 192 + .../BrandRetrieveByNameParams/CountryGl.php | 489 ++ .../ForceLanguage.php | 251 + src/Brand/BrandRetrieveByTickerParams.php | 193 + .../ForceLanguage.php | 251 + .../TickerExchange.php | 155 + src/Brand/BrandRetrieveParams.php | 166 + .../BrandRetrieveParams/ForceLanguage.php | 251 + src/Brand/BrandRetrieveSimplifiedParams.php | 117 + src/Client.php | 149 + src/Core.php | 5 + src/Core/Attributes/Optional.php | 35 + src/Core/Attributes/Required.php | 60 + src/Core/BaseClient.php | 287 + src/Core/Concerns/ResponseProxy.php | 101 + src/Core/Concerns/SdkEnum.php | 34 + src/Core/Concerns/SdkModel.php | 285 + src/Core/Concerns/SdkPage.php | 102 + src/Core/Concerns/SdkParams.php | 36 + src/Core/Concerns/SdkUnion.php | 39 + src/Core/Contracts/BaseModel.php | 18 + src/Core/Contracts/BasePage.php | 34 + src/Core/Contracts/BaseResponse.php | 21 + src/Core/Contracts/BaseStream.php | 33 + src/Core/Conversion.php | 229 + src/Core/Conversion/CoerceState.php | 19 + src/Core/Conversion/Concerns/ArrayOf.php | 79 + src/Core/Conversion/Contracts/Converter.php | 24 + .../Conversion/Contracts/ConverterSource.php | 13 + src/Core/Conversion/DumpState.php | 20 + src/Core/Conversion/EnumOf.php | 64 + src/Core/Conversion/ListOf.php | 22 + src/Core/Conversion/MapOf.php | 16 + src/Core/Conversion/ModelOf.php | 137 + src/Core/Conversion/PropertyInfo.php | 79 + src/Core/Conversion/UnionOf.php | 132 + .../Exceptions/APIConnectionException.php | 9 + src/Core/Exceptions/APIException.php | 23 + src/Core/Exceptions/APIStatusException.php | 55 + src/Core/Exceptions/APITimeoutException.php | 19 + .../Exceptions/AuthenticationException.php | 9 + src/Core/Exceptions/BadRequestException.php | 9 + src/Core/Exceptions/ConflictException.php | 9 + src/Core/Exceptions/ContextDevException.php | 14 + .../Exceptions/InternalServerException.php | 9 + src/Core/Exceptions/NotFoundException.php | 9 + .../Exceptions/PermissionDeniedException.php | 9 + src/Core/Exceptions/RateLimitException.php | 9 + .../UnprocessableEntityException.php | 9 + src/Core/FileParam.php | 63 + src/Core/Implementation/RawResponse.php | 106 + .../Implementation/StreamingHttpClient.php | 29 + src/Core/Util.php | 577 ++ src/Industry/IndustryGetNaicsResponse.php | 151 + .../IndustryGetNaicsResponse/Code.php | 116 + .../Code/Confidence.php | 17 + .../IndustryGetNaicsResponse/KeyMetadata.php | 92 + src/Industry/IndustryGetSicResponse.php | 178 + .../IndustryGetSicResponse/Classification.php | 15 + src/Industry/IndustryGetSicResponse/Code.php | 180 + .../Code/Confidence.php | 17 + .../IndustryGetSicResponse/KeyMetadata.php | 92 + src/Industry/IndustryRetrieveNaicsParams.php | 139 + src/Industry/IndustryRetrieveSicParams.php | 166 + .../IndustryRetrieveSicParams/Type.php | 15 + src/RequestOptions.php | 236 + src/ServiceContracts/AIContract.php | 78 + src/ServiceContracts/AIRawContract.php | 66 + src/ServiceContracts/BrandContract.php | 179 + src/ServiceContracts/BrandRawContract.php | 134 + src/ServiceContracts/IndustryContract.php | 57 + src/ServiceContracts/IndustryRawContract.php | 49 + src/ServiceContracts/UtilityContract.php | 46 + src/ServiceContracts/UtilityRawContract.php | 49 + src/ServiceContracts/WebContract.php | 349 + src/ServiceContracts/WebRawContract.php | 202 + src/Services/AIRawService.php | 139 + src/Services/AIService.php | 138 + src/Services/BrandRawService.php | 334 + src/Services/BrandService.php | 314 + src/Services/IndustryRawService.php | 99 + src/Services/IndustryService.php | 106 + src/Services/UtilityRawService.php | 91 + src/Services/UtilityService.php | 82 + src/Services/WebRawService.php | 505 ++ src/Services/WebService.php | 588 ++ src/Utility/UtilityPrefetchByEmailParams.php | 96 + .../UtilityPrefetchByEmailResponse.php | 124 + .../KeyMetadata.php | 92 + src/Utility/UtilityPrefetchParams.php | 96 + src/Utility/UtilityPrefetchResponse.php | 124 + .../UtilityPrefetchResponse/KeyMetadata.php | 92 + src/Version.php | 9 + src/Web/WebExtractCompetitorsParams.php | 117 + src/Web/WebExtractCompetitorsResponse.php | 184 + .../Competitor.php | 196 + .../Competitor/Confidence.php | 15 + .../KeyMetadata.php | 92 + .../WebExtractCompetitorsResponse/Status.php | 13 + .../WebExtractCompetitorsResponse/Target.php | 139 + src/Web/WebExtractFontsParams.php | 123 + src/Web/WebExtractFontsResponse.php | 198 + src/Web/WebExtractFontsResponse/Font.php | 217 + src/Web/WebExtractFontsResponse/FontLink.php | 139 + .../WebExtractFontsResponse/FontLink/Type.php | 12 + .../WebExtractFontsResponse/KeyMetadata.php | 92 + src/Web/WebExtractParams.php | 326 + src/Web/WebExtractParams/Pdf.php | 95 + src/Web/WebExtractResponse.php | 197 + src/Web/WebExtractResponse/KeyMetadata.php | 92 + src/Web/WebExtractResponse/Metadata.php | 132 + src/Web/WebExtractStyleguideParams.php | 123 + src/Web/WebExtractStyleguideResponse.php | 149 + .../KeyMetadata.php | 92 + .../Styleguide.php | 249 + .../Styleguide/Colors.php | 111 + .../Styleguide/Components.php | 106 + .../Styleguide/Components/Button.php | 101 + .../Styleguide/Components/Button/Link.php | 374 + .../Styleguide/Components/Button/Primary.php | 374 + .../Components/Button/Secondary.php | 374 + .../Styleguide/Components/Card.php | 210 + .../Styleguide/ElementSpacing.php | 124 + .../Styleguide/FontLink.php | 139 + .../Styleguide/FontLink/Type.php | 12 + .../Styleguide/Mode.php | 15 + .../Styleguide/Shadows.php | 124 + .../Styleguide/Typography.php | 101 + .../Styleguide/Typography/Headings.php | 121 + .../Styleguide/Typography/Headings/H1.php | 166 + .../Styleguide/Typography/Headings/H2.php | 166 + .../Styleguide/Typography/Headings/H3.php | 166 + .../Styleguide/Typography/Headings/H4.php | 166 + .../Styleguide/Typography/P.php | 166 + src/Web/WebScreenshotParams.php | 250 + .../WebScreenshotParams/FullScreenshot.php | 15 + .../WebScreenshotParams/HandleCookiePopup.php | 15 + src/Web/WebScreenshotParams/Page.php | 27 + src/Web/WebScreenshotParams/Viewport.php | 74 + src/Web/WebScreenshotResponse.php | 211 + src/Web/WebScreenshotResponse/KeyMetadata.php | 92 + .../WebScreenshotResponse/ScreenshotType.php | 15 + src/Web/WebSearchParams.php | 223 + src/Web/WebSearchParams/Freshness.php | 19 + src/Web/WebSearchParams/MarkdownOptions.php | 246 + .../WebSearchParams/MarkdownOptions/Pdf.php | 97 + src/Web/WebSearchResponse.php | 121 + src/Web/WebSearchResponse/KeyMetadata.php | 92 + src/Web/WebSearchResponse/Result.php | 171 + src/Web/WebSearchResponse/Result/Markdown.php | 97 + .../Result/Markdown/Code.php | 21 + .../WebSearchResponse/Result/Relevance.php | 17 + src/Web/WebWebCrawlMdParams.php | 416 + src/Web/WebWebCrawlMdParams/Pdf.php | 97 + src/Web/WebWebCrawlMdResponse.php | 121 + src/Web/WebWebCrawlMdResponse/KeyMetadata.php | 92 + src/Web/WebWebCrawlMdResponse/Metadata.php | 162 + src/Web/WebWebCrawlMdResponse/Result.php | 94 + .../WebWebCrawlMdResponse/Result/Metadata.php | 572 ++ .../Result/Metadata/AdditionalMeta.php | 27 + .../Result/Metadata/Alternate.php | 130 + .../Result/Metadata/OpenGraph.php | 27 + .../Result/Metadata/Twitter.php | 27 + src/Web/WebWebScrapeHTMLParams.php | 281 + src/Web/WebWebScrapeHTMLParams/Pdf.php | 97 + src/Web/WebWebScrapeHTMLResponse.php | 198 + .../WebWebScrapeHTMLResponse/KeyMetadata.php | 92 + src/Web/WebWebScrapeHTMLResponse/Metadata.php | 479 ++ .../Metadata/AdditionalMeta.php | 27 + .../Metadata/Alternate.php | 130 + .../Metadata/OpenGraph.php | 27 + .../Metadata/Twitter.php | 27 + src/Web/WebWebScrapeHTMLResponse/Type.php | 31 + src/Web/WebWebScrapeImagesParams.php | 191 + .../WebWebScrapeImagesParams/Enrichment.php | 119 + src/Web/WebWebScrapeImagesResponse.php | 150 + src/Web/WebWebScrapeImagesResponse/Image.php | 172 + .../Image/Element.php | 29 + .../Image/Enrichment.php | 149 + .../Image/Enrichment/Type.php | 27 + .../WebWebScrapeImagesResponse/Image/Type.php | 17 + .../KeyMetadata.php | 92 + src/Web/WebWebScrapeMdParams.php | 341 + src/Web/WebWebScrapeMdParams/Pdf.php | 97 + src/Web/WebWebScrapeMdResponse.php | 171 + .../WebWebScrapeMdResponse/KeyMetadata.php | 92 + src/Web/WebWebScrapeMdResponse/Metadata.php | 479 ++ .../Metadata/AdditionalMeta.php | 27 + .../Metadata/Alternate.php | 130 + .../Metadata/OpenGraph.php | 27 + .../Metadata/Twitter.php | 27 + src/Web/WebWebScrapeSitemapParams.php | 165 + src/Web/WebWebScrapeSitemapResponse.php | 176 + .../KeyMetadata.php | 92 + src/Web/WebWebScrapeSitemapResponse/Meta.php | 142 + tests/ClientTest.php | 44 + tests/Core/ModelTest.php | 144 + tests/Core/StreamingTransportTest.php | 122 + tests/Core/UtilTest.php | 90 + tests/Services/AITest.php | 159 + tests/Services/BrandTest.php | 272 + tests/Services/IndustryTest.php | 94 + tests/Services/UtilityTest.php | 91 + tests/Services/WebTest.php | 398 + tests/UnsupportedMockTests.php | 8 + 401 files changed, 56608 insertions(+), 1 deletion(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release-doctor.yml create mode 100644 .gitignore create mode 100644 .php-cs-fixer.dist.php create mode 100644 .phpactor.json create mode 100644 .release-please-manifest.json create mode 100644 .stats.yml create mode 100644 LICENSE create mode 100644 SECURITY.md create mode 100644 bin/check-release-environment create mode 100644 composer.json create mode 100644 composer.lock create mode 100644 phpstan.dist.neon create mode 100644 phpunit.xml.dist create mode 100644 release-please-config.json create mode 100755 scripts/bootstrap create mode 100755 scripts/clean create mode 100755 scripts/format create mode 100755 scripts/lint create mode 100755 scripts/test create mode 100644 src/AI/AIAIQueryParams.php create mode 100644 src/AI/AIAIQueryParams/DataToExtract.php create mode 100644 src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php create mode 100644 src/AI/AIAIQueryParams/DataToExtract/DatapointObjectSchema.php create mode 100644 src/AI/AIAIQueryParams/DataToExtract/DatapointType.php create mode 100644 src/AI/AIAIQueryParams/SpecificPages.php create mode 100644 src/AI/AIAIQueryResponse.php create mode 100644 src/AI/AIAIQueryResponse/DataExtracted.php create mode 100644 src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php create mode 100644 src/AI/AIAIQueryResponse/KeyMetadata.php create mode 100644 src/AI/AIExtractProductParams.php create mode 100644 src/AI/AIExtractProductResponse.php create mode 100644 src/AI/AIExtractProductResponse/KeyMetadata.php create mode 100644 src/AI/AIExtractProductResponse/Platform.php create mode 100644 src/AI/AIExtractProductResponse/Product.php create mode 100644 src/AI/AIExtractProductResponse/Product/BillingFrequency.php create mode 100644 src/AI/AIExtractProductResponse/Product/PricingModel.php create mode 100644 src/AI/AIExtractProductsParams.php create mode 100644 src/AI/AIExtractProductsResponse.php create mode 100644 src/AI/AIExtractProductsResponse/KeyMetadata.php create mode 100644 src/AI/AIExtractProductsResponse/Product.php create mode 100644 src/AI/AIExtractProductsResponse/Product/BillingFrequency.php create mode 100644 src/AI/AIExtractProductsResponse/Product/PricingModel.php create mode 100644 src/Brand/BrandGetByEmailResponse.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Address.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Color.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Subindustry.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Links.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Resolution.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/PrimaryLanguage.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Social.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php create mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Stock.php create mode 100644 src/Brand/BrandGetByEmailResponse/KeyMetadata.php create mode 100644 src/Brand/BrandGetByIsinResponse.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Address.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Color.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Subindustry.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Links.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Resolution.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/PrimaryLanguage.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Social.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php create mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Stock.php create mode 100644 src/Brand/BrandGetByIsinResponse/KeyMetadata.php create mode 100644 src/Brand/BrandGetByNameResponse.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Address.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Backdrop.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Color.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Subindustry.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Links.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Resolution.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/PrimaryLanguage.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Social.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Social/Type.php create mode 100644 src/Brand/BrandGetByNameResponse/Brand/Stock.php create mode 100644 src/Brand/BrandGetByNameResponse/KeyMetadata.php create mode 100644 src/Brand/BrandGetByTickerResponse.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Address.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Color.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Subindustry.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Links.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Resolution.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/PrimaryLanguage.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Social.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php create mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Stock.php create mode 100644 src/Brand/BrandGetByTickerResponse/KeyMetadata.php create mode 100644 src/Brand/BrandGetResponse.php create mode 100644 src/Brand/BrandGetResponse/Brand.php create mode 100644 src/Brand/BrandGetResponse/Brand/Address.php create mode 100644 src/Brand/BrandGetResponse/Brand/Backdrop.php create mode 100644 src/Brand/BrandGetResponse/Brand/Backdrop/Color.php create mode 100644 src/Brand/BrandGetResponse/Brand/Backdrop/Resolution.php create mode 100644 src/Brand/BrandGetResponse/Brand/Color.php create mode 100644 src/Brand/BrandGetResponse/Brand/Industries.php create mode 100644 src/Brand/BrandGetResponse/Brand/Industries/Eic.php create mode 100644 src/Brand/BrandGetResponse/Brand/Industries/Eic/Industry.php create mode 100644 src/Brand/BrandGetResponse/Brand/Industries/Eic/Subindustry.php create mode 100644 src/Brand/BrandGetResponse/Brand/Links.php create mode 100644 src/Brand/BrandGetResponse/Brand/Logo.php create mode 100644 src/Brand/BrandGetResponse/Brand/Logo/Color.php create mode 100644 src/Brand/BrandGetResponse/Brand/Logo/Mode.php create mode 100644 src/Brand/BrandGetResponse/Brand/Logo/Resolution.php create mode 100644 src/Brand/BrandGetResponse/Brand/Logo/Type.php create mode 100644 src/Brand/BrandGetResponse/Brand/PrimaryLanguage.php create mode 100644 src/Brand/BrandGetResponse/Brand/Social.php create mode 100644 src/Brand/BrandGetResponse/Brand/Social/Type.php create mode 100644 src/Brand/BrandGetResponse/Brand/Stock.php create mode 100644 src/Brand/BrandGetResponse/KeyMetadata.php create mode 100644 src/Brand/BrandGetSimplifiedResponse.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Color.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Resolution.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Color.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Logo.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Color.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Mode.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Resolution.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Type.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/KeyMetadata.php create mode 100644 src/Brand/BrandIdentifyFromTransactionParams.php create mode 100644 src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php create mode 100644 src/Brand/BrandIdentifyFromTransactionParams/ForceLanguage.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Subindustry.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Links.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Resolution.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/PrimaryLanguage.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Stock.php create mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php create mode 100644 src/Brand/BrandRetrieveByEmailParams.php create mode 100644 src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php create mode 100644 src/Brand/BrandRetrieveByIsinParams.php create mode 100644 src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php create mode 100644 src/Brand/BrandRetrieveByNameParams.php create mode 100644 src/Brand/BrandRetrieveByNameParams/CountryGl.php create mode 100644 src/Brand/BrandRetrieveByNameParams/ForceLanguage.php create mode 100644 src/Brand/BrandRetrieveByTickerParams.php create mode 100644 src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php create mode 100644 src/Brand/BrandRetrieveByTickerParams/TickerExchange.php create mode 100644 src/Brand/BrandRetrieveParams.php create mode 100644 src/Brand/BrandRetrieveParams/ForceLanguage.php create mode 100644 src/Brand/BrandRetrieveSimplifiedParams.php create mode 100644 src/Client.php create mode 100644 src/Core.php create mode 100644 src/Core/Attributes/Optional.php create mode 100644 src/Core/Attributes/Required.php create mode 100644 src/Core/BaseClient.php create mode 100644 src/Core/Concerns/ResponseProxy.php create mode 100644 src/Core/Concerns/SdkEnum.php create mode 100644 src/Core/Concerns/SdkModel.php create mode 100644 src/Core/Concerns/SdkPage.php create mode 100644 src/Core/Concerns/SdkParams.php create mode 100644 src/Core/Concerns/SdkUnion.php create mode 100644 src/Core/Contracts/BaseModel.php create mode 100644 src/Core/Contracts/BasePage.php create mode 100644 src/Core/Contracts/BaseResponse.php create mode 100644 src/Core/Contracts/BaseStream.php create mode 100644 src/Core/Conversion.php create mode 100644 src/Core/Conversion/CoerceState.php create mode 100644 src/Core/Conversion/Concerns/ArrayOf.php create mode 100644 src/Core/Conversion/Contracts/Converter.php create mode 100644 src/Core/Conversion/Contracts/ConverterSource.php create mode 100644 src/Core/Conversion/DumpState.php create mode 100644 src/Core/Conversion/EnumOf.php create mode 100644 src/Core/Conversion/ListOf.php create mode 100644 src/Core/Conversion/MapOf.php create mode 100644 src/Core/Conversion/ModelOf.php create mode 100644 src/Core/Conversion/PropertyInfo.php create mode 100644 src/Core/Conversion/UnionOf.php create mode 100644 src/Core/Exceptions/APIConnectionException.php create mode 100644 src/Core/Exceptions/APIException.php create mode 100644 src/Core/Exceptions/APIStatusException.php create mode 100644 src/Core/Exceptions/APITimeoutException.php create mode 100644 src/Core/Exceptions/AuthenticationException.php create mode 100644 src/Core/Exceptions/BadRequestException.php create mode 100644 src/Core/Exceptions/ConflictException.php create mode 100644 src/Core/Exceptions/ContextDevException.php create mode 100644 src/Core/Exceptions/InternalServerException.php create mode 100644 src/Core/Exceptions/NotFoundException.php create mode 100644 src/Core/Exceptions/PermissionDeniedException.php create mode 100644 src/Core/Exceptions/RateLimitException.php create mode 100644 src/Core/Exceptions/UnprocessableEntityException.php create mode 100644 src/Core/FileParam.php create mode 100644 src/Core/Implementation/RawResponse.php create mode 100644 src/Core/Implementation/StreamingHttpClient.php create mode 100644 src/Core/Util.php create mode 100644 src/Industry/IndustryGetNaicsResponse.php create mode 100644 src/Industry/IndustryGetNaicsResponse/Code.php create mode 100644 src/Industry/IndustryGetNaicsResponse/Code/Confidence.php create mode 100644 src/Industry/IndustryGetNaicsResponse/KeyMetadata.php create mode 100644 src/Industry/IndustryGetSicResponse.php create mode 100644 src/Industry/IndustryGetSicResponse/Classification.php create mode 100644 src/Industry/IndustryGetSicResponse/Code.php create mode 100644 src/Industry/IndustryGetSicResponse/Code/Confidence.php create mode 100644 src/Industry/IndustryGetSicResponse/KeyMetadata.php create mode 100644 src/Industry/IndustryRetrieveNaicsParams.php create mode 100644 src/Industry/IndustryRetrieveSicParams.php create mode 100644 src/Industry/IndustryRetrieveSicParams/Type.php create mode 100644 src/RequestOptions.php create mode 100644 src/ServiceContracts/AIContract.php create mode 100644 src/ServiceContracts/AIRawContract.php create mode 100644 src/ServiceContracts/BrandContract.php create mode 100644 src/ServiceContracts/BrandRawContract.php create mode 100644 src/ServiceContracts/IndustryContract.php create mode 100644 src/ServiceContracts/IndustryRawContract.php create mode 100644 src/ServiceContracts/UtilityContract.php create mode 100644 src/ServiceContracts/UtilityRawContract.php create mode 100644 src/ServiceContracts/WebContract.php create mode 100644 src/ServiceContracts/WebRawContract.php create mode 100644 src/Services/AIRawService.php create mode 100644 src/Services/AIService.php create mode 100644 src/Services/BrandRawService.php create mode 100644 src/Services/BrandService.php create mode 100644 src/Services/IndustryRawService.php create mode 100644 src/Services/IndustryService.php create mode 100644 src/Services/UtilityRawService.php create mode 100644 src/Services/UtilityService.php create mode 100644 src/Services/WebRawService.php create mode 100644 src/Services/WebService.php create mode 100644 src/Utility/UtilityPrefetchByEmailParams.php create mode 100644 src/Utility/UtilityPrefetchByEmailResponse.php create mode 100644 src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php create mode 100644 src/Utility/UtilityPrefetchParams.php create mode 100644 src/Utility/UtilityPrefetchResponse.php create mode 100644 src/Utility/UtilityPrefetchResponse/KeyMetadata.php create mode 100644 src/Version.php create mode 100644 src/Web/WebExtractCompetitorsParams.php create mode 100644 src/Web/WebExtractCompetitorsResponse.php create mode 100644 src/Web/WebExtractCompetitorsResponse/Competitor.php create mode 100644 src/Web/WebExtractCompetitorsResponse/Competitor/Confidence.php create mode 100644 src/Web/WebExtractCompetitorsResponse/KeyMetadata.php create mode 100644 src/Web/WebExtractCompetitorsResponse/Status.php create mode 100644 src/Web/WebExtractCompetitorsResponse/Target.php create mode 100644 src/Web/WebExtractFontsParams.php create mode 100644 src/Web/WebExtractFontsResponse.php create mode 100644 src/Web/WebExtractFontsResponse/Font.php create mode 100644 src/Web/WebExtractFontsResponse/FontLink.php create mode 100644 src/Web/WebExtractFontsResponse/FontLink/Type.php create mode 100644 src/Web/WebExtractFontsResponse/KeyMetadata.php create mode 100644 src/Web/WebExtractParams.php create mode 100644 src/Web/WebExtractParams/Pdf.php create mode 100644 src/Web/WebExtractResponse.php create mode 100644 src/Web/WebExtractResponse/KeyMetadata.php create mode 100644 src/Web/WebExtractResponse/Metadata.php create mode 100644 src/Web/WebExtractStyleguideParams.php create mode 100644 src/Web/WebExtractStyleguideResponse.php create mode 100644 src/Web/WebExtractStyleguideResponse/KeyMetadata.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Colors.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Components.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Link.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Primary.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Secondary.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Components/Card.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/ElementSpacing.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/FontLink.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/FontLink/Type.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Mode.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Shadows.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Typography.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H1.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H2.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H3.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H4.php create mode 100644 src/Web/WebExtractStyleguideResponse/Styleguide/Typography/P.php create mode 100644 src/Web/WebScreenshotParams.php create mode 100644 src/Web/WebScreenshotParams/FullScreenshot.php create mode 100644 src/Web/WebScreenshotParams/HandleCookiePopup.php create mode 100644 src/Web/WebScreenshotParams/Page.php create mode 100644 src/Web/WebScreenshotParams/Viewport.php create mode 100644 src/Web/WebScreenshotResponse.php create mode 100644 src/Web/WebScreenshotResponse/KeyMetadata.php create mode 100644 src/Web/WebScreenshotResponse/ScreenshotType.php create mode 100644 src/Web/WebSearchParams.php create mode 100644 src/Web/WebSearchParams/Freshness.php create mode 100644 src/Web/WebSearchParams/MarkdownOptions.php create mode 100644 src/Web/WebSearchParams/MarkdownOptions/Pdf.php create mode 100644 src/Web/WebSearchResponse.php create mode 100644 src/Web/WebSearchResponse/KeyMetadata.php create mode 100644 src/Web/WebSearchResponse/Result.php create mode 100644 src/Web/WebSearchResponse/Result/Markdown.php create mode 100644 src/Web/WebSearchResponse/Result/Markdown/Code.php create mode 100644 src/Web/WebSearchResponse/Result/Relevance.php create mode 100644 src/Web/WebWebCrawlMdParams.php create mode 100644 src/Web/WebWebCrawlMdParams/Pdf.php create mode 100644 src/Web/WebWebCrawlMdResponse.php create mode 100644 src/Web/WebWebCrawlMdResponse/KeyMetadata.php create mode 100644 src/Web/WebWebCrawlMdResponse/Metadata.php create mode 100644 src/Web/WebWebCrawlMdResponse/Result.php create mode 100644 src/Web/WebWebCrawlMdResponse/Result/Metadata.php create mode 100644 src/Web/WebWebCrawlMdResponse/Result/Metadata/AdditionalMeta.php create mode 100644 src/Web/WebWebCrawlMdResponse/Result/Metadata/Alternate.php create mode 100644 src/Web/WebWebCrawlMdResponse/Result/Metadata/OpenGraph.php create mode 100644 src/Web/WebWebCrawlMdResponse/Result/Metadata/Twitter.php create mode 100644 src/Web/WebWebScrapeHTMLParams.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf.php create mode 100644 src/Web/WebWebScrapeHTMLResponse.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/KeyMetadata.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/Metadata.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/Metadata/AdditionalMeta.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/Metadata/Alternate.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/Metadata/OpenGraph.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/Metadata/Twitter.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/Type.php create mode 100644 src/Web/WebWebScrapeImagesParams.php create mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment.php create mode 100644 src/Web/WebWebScrapeImagesResponse.php create mode 100644 src/Web/WebWebScrapeImagesResponse/Image.php create mode 100644 src/Web/WebWebScrapeImagesResponse/Image/Element.php create mode 100644 src/Web/WebWebScrapeImagesResponse/Image/Enrichment.php create mode 100644 src/Web/WebWebScrapeImagesResponse/Image/Enrichment/Type.php create mode 100644 src/Web/WebWebScrapeImagesResponse/Image/Type.php create mode 100644 src/Web/WebWebScrapeImagesResponse/KeyMetadata.php create mode 100644 src/Web/WebWebScrapeMdParams.php create mode 100644 src/Web/WebWebScrapeMdParams/Pdf.php create mode 100644 src/Web/WebWebScrapeMdResponse.php create mode 100644 src/Web/WebWebScrapeMdResponse/KeyMetadata.php create mode 100644 src/Web/WebWebScrapeMdResponse/Metadata.php create mode 100644 src/Web/WebWebScrapeMdResponse/Metadata/AdditionalMeta.php create mode 100644 src/Web/WebWebScrapeMdResponse/Metadata/Alternate.php create mode 100644 src/Web/WebWebScrapeMdResponse/Metadata/OpenGraph.php create mode 100644 src/Web/WebWebScrapeMdResponse/Metadata/Twitter.php create mode 100644 src/Web/WebWebScrapeSitemapParams.php create mode 100644 src/Web/WebWebScrapeSitemapResponse.php create mode 100644 src/Web/WebWebScrapeSitemapResponse/KeyMetadata.php create mode 100644 src/Web/WebWebScrapeSitemapResponse/Meta.php create mode 100644 tests/ClientTest.php create mode 100644 tests/Core/ModelTest.php create mode 100644 tests/Core/StreamingTransportTest.php create mode 100644 tests/Core/UtilTest.php create mode 100644 tests/Services/AITest.php create mode 100644 tests/Services/BrandTest.php create mode 100644 tests/Services/IndustryTest.php create mode 100644 tests/Services/UtilityTest.php create mode 100644 tests/Services/WebTest.php create mode 100644 tests/UnsupportedMockTests.php diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..3e7d094a --- /dev/null +++ b/.gitattributes @@ -0,0 +1,16 @@ +*.php diff=php + +/.github export-ignore +/bin export-ignore +/scripts export-ignore +/tests export-ignore + +/.gitattributes export-ignore +/.gitignore export-ignore +/.php-cs-fixer.dist.php export-ignore +/.phpactor.json export-ignore +/.release-please-manifest.json export-ignore +/.stats.yml export-ignore +/phpstan.dist.neon export-ignore +/phpunit.xml.dist export-ignore +/release-please-config.json export-ignore diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..243cf423 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI +on: + push: + branches: + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' + pull_request: + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' + +jobs: + lint: + timeout-minutes: 10 + name: lint + runs-on: ${{ github.repository == 'stainless-sdks/context.dev-php' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Set up PHP + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 + with: + php-version: '8.3' + + - name: Run Bootstrap + run: ./scripts/bootstrap + + - name: Run lints + run: ./scripts/lint + test: + timeout-minutes: 10 + name: test + runs-on: ${{ github.repository == 'stainless-sdks/context.dev-php' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Set up PHP + uses: shivammathur/setup-php@accd6127cb78bee3e8082180cb391013d204ef9f # 2.37.0 + with: + php-version: '8.3' + + - name: Run bootstrap + run: ./scripts/bootstrap + + - name: Run tests + run: ./scripts/test diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml new file mode 100644 index 00000000..966c967a --- /dev/null +++ b/.github/workflows/release-doctor.yml @@ -0,0 +1,22 @@ +name: Release Doctor +on: + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + release_doctor: + name: release doctor + runs-on: ubuntu-latest + if: github.repository == 'stainless-sdks/context.dev-php' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Check release environment + run: | + bash ./bin/check-release-environment + env: + PACKAGIST_USERNAME: ${{ secrets.CONTEXT_DEV_PACKAGIST_USERNAME || secrets.PACKAGIST_USERNAME }} + PACKAGIST_SAFE_KEY: ${{ secrets.CONTEXT_DEV_PACKAGIST_SAFE_KEY || secrets.PACKAGIST_SAFE_KEY }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..71d6d159 --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +docs/ +.idea/ +.php-cs-fixer.cache +.php-cs-fixer.php +.phpunit.cache +phpunit.xml +playground/ +*.swo +*.swp +vendor/ + +# do not edit! excludes generated files used internally +.artifacts/ diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php new file mode 100644 index 00000000..d46a37f9 --- /dev/null +++ b/.php-cs-fixer.dist.php @@ -0,0 +1,19 @@ +setParallelConfig(ParallelConfigFactory::detect()) + ->setFinder(Finder::create()->in([__DIR__.'/src', __DIR__.'/tests'])) + ->setRules([ + '@PhpCsFixer' => true, + 'phpdoc_align' => false, + 'new_with_parentheses' => ['named_class' => false], + 'ordered_types' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + ]) +; diff --git a/.phpactor.json b/.phpactor.json new file mode 100644 index 00000000..97fdd060 --- /dev/null +++ b/.phpactor.json @@ -0,0 +1,6 @@ +{ + "indexer.exclude_patterns": ["vendor"], + "language_server_completion.trim_leading_dollar": true, + "language_server_php_cs_fixer.enabled": false, + "language_server_phpstan.enabled": true +} diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 00000000..1332969b --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.1" +} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml new file mode 100644 index 00000000..052ef103 --- /dev/null +++ b/.stats.yml @@ -0,0 +1,4 @@ +configured_endpoints: 25 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e10718ebeb5bc263af75fe2341f7d1e91442f3e64b703bf7d416f8e7f328d2f9.yml +openapi_spec_hash: ab3a6473e575381cacd245bf54dcf0f7 +config_hash: 48c9231dff85f546e8210338751ccb41 diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..dde764dc --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2026 Context Dev + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index e14e6bc6..821c95fc 100644 --- a/README.md +++ b/README.md @@ -1 +1,170 @@ -# context.dev-php \ No newline at end of file +# Context Dev PHP API library + +The Context Dev PHP library provides convenient access to the Context Dev REST API from any PHP 8.1.0+ application. + +It is generated with [Stainless](https://www.stainless.com/). + +## Documentation + +The REST API documentation can be found on [docs.context.dev](https://docs.context.dev/). + +## Installation + +To use this package, install via Composer by adding the following to your application's `composer.json`: + +```json +{ + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:stainless-sdks/context.dev-php.git" + } + ], + "require": { + "org-placeholder/context-dev": "dev-main" + } +} +``` + +## Usage + +This library uses named parameters to specify optional arguments. +Parameters with a default value must be set by name. + +```php +brand->retrieve(domain: 'REPLACE_ME'); + +var_dump($brand->brand); +``` + +### Value Objects + +It is recommended to use the static `with` constructor `Dog::with(name: "Joey")` +and named parameters to initialize value objects. + +However, builders are also provided `(new Dog)->withName("Joey")`. + +### Handling errors + +When the library is unable to connect to the API, or if the API returns a non-success status code (i.e., 4xx or 5xx response), a subclass of `ContextDev\Core\Exceptions\APIException` will be thrown: + +```php +brand->retrieve(domain: 'REPLACE_ME'); +} catch (APIConnectionException $e) { + echo "The server could not be reached", PHP_EOL; + var_dump($e->getPrevious()); +} catch (RateLimitException $e) { + echo "A 429 status code was received; we should back off a bit.", PHP_EOL; +} catch (APIStatusException $e) { + echo "Another non-200-range status code was received", PHP_EOL; + echo $e->getMessage(); +} +``` + +Error codes are as follows: + +| Cause | Error Type | +| ---------------- | ------------------------------ | +| HTTP 400 | `BadRequestException` | +| HTTP 401 | `AuthenticationException` | +| HTTP 403 | `PermissionDeniedException` | +| HTTP 404 | `NotFoundException` | +| HTTP 409 | `ConflictException` | +| HTTP 422 | `UnprocessableEntityException` | +| HTTP 429 | `RateLimitException` | +| HTTP >= 500 | `InternalServerException` | +| Other HTTP error | `APIStatusException` | +| Timeout | `APITimeoutException` | +| Network error | `APIConnectionException` | + +### Retries + +Certain errors will be automatically retried 2 times by default, with a short exponential backoff. + +Connection errors (for example, due to a network connectivity problem), 408 Request Timeout, 409 Conflict, 429 Rate Limit, >=500 Internal errors, and timeouts will all be retried by default. + +You can use the `maxRetries` option to configure or disable this: + +```php + 0]); + +// Or, configure per-request: +$result = $client->brand->retrieve( + domain: 'REPLACE_ME', requestOptions: ['maxRetries' => 5] +); +``` + +## Advanced concepts + +### Making custom or undocumented requests + +#### Undocumented properties + +You can send undocumented parameters to any endpoint, and read undocumented response properties, like so: + +Note: the `extra*` parameters of the same name overrides the documented parameters. + +```php +brand->retrieve( + domain: 'REPLACE_ME', + requestOptions: [ + 'extraQueryParams' => ['my_query_parameter' => 'value'], + 'extraBodyParams' => ['my_body_parameter' => 'value'], + 'extraHeaders' => ['my-header' => 'value'], + ], +); +``` + +#### Undocumented request params + +If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above. + +#### Undocumented endpoints + +To make requests to undocumented endpoints while retaining the benefit of auth, retries, and so on, you can make requests using `client.request`, like so: + +```php +request( + method: "post", + path: '/undocumented/endpoint', + query: ['dog' => 'woof'], + headers: ['useful-header' => 'interesting-value'], + body: ['hello' => 'world'] +); +``` + +## Versioning + +This package follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions. As the library is in initial development and has a major version of `0`, APIs may change at any time. + +This package considers improvements to the (non-runtime) PHPDoc type definitions to be non-breaking changes. + +## Requirements + +PHP 8.1.0 or higher. + +## Contributing + +See [the contributing documentation](https://github.com/stainless-sdks/context.dev-php/tree/main/CONTRIBUTING.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 00000000..22d7755f --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainless.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +before making any information public. + +## Reporting Non-SDK Related Security Issues + +If you encounter security issues that are not directly related to SDKs but pertain to the services +or products provided by Context Dev, please follow the respective company's security reporting guidelines. + +### Context Dev Terms and Policies + +Please contact hello@context.dev for any questions or concerns regarding the security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/bin/check-release-environment b/bin/check-release-environment new file mode 100644 index 00000000..cf571b62 --- /dev/null +++ b/bin/check-release-environment @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +errors=() + +if [ -z "${PACKAGIST_USERNAME}" ]; then + errors+=("The PACKAGIST_USERNAME secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +if [ -z "${PACKAGIST_SAFE_KEY}" ]; then + errors+=("The PACKAGIST_SAFE_KEY secret has not been set. Please set it in either this repository's secrets or your organization secrets") +fi + +lenErrors=${#errors[@]} + +if [[ lenErrors -gt 0 ]]; then + echo -e "Found the following errors in the release environment:\n" + + for error in "${errors[@]}"; do + echo -e "- $error\n" + done + + exit 1 +fi + +echo "The environment is ready to push releases!" diff --git a/composer.json b/composer.json new file mode 100644 index 00000000..efc976e0 --- /dev/null +++ b/composer.json @@ -0,0 +1,56 @@ +{ + "$schema": "https://getcomposer.org/schema.json", + "license": "Apache-2.0", + "autoload": { + "files": [ + "src/Version.php" + ], + "psr-4": { + "ContextDev\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests/" + } + }, + "config": { + "allow-plugins": { + "pestphp/pest-plugin": true, + "php-http/discovery": false, + "phpstan/extension-installer": true + }, + "platform": { + "php": "8.3" + }, + "preferred-install": "dist", + "sort-packages": true + }, + "description": "Context Dev PHP SDK", + "name": "org-placeholder/context-dev", + "require": { + "php": "^8.1", + "php-http/discovery": "^1", + "psr/http-client": "^1", + "psr/http-client-implementation": "^1", + "psr/http-factory-implementation": "^1", + "psr/http-message": "^1|^2" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3", + "guzzlehttp/guzzle": "^7", + "nyholm/psr7": "^1", + "pestphp/pest": "^3", + "php-http/mock-client": "^1", + "phpstan/extension-installer": "^1", + "phpstan/phpstan": "^2", + "phpstan/phpstan-phpunit": "^2", + "phpunit/phpunit": "^11", + "symfony/http-client": "^7" + }, + "scripts": { + "build:docs": "curl --etag-save ./vendor/ag.etags --etag-compare ./vendor/ag.etags --create-dirs --remote-name --output-dir ./vendor/bin --no-progress-meter -- https://github.com/ApiGen/ApiGen/releases/latest/download/apigen.phar && php ./vendor/bin/apigen.phar --output docs -- src", + "lint": "./scripts/lint", + "test": "./scripts/test" + } +} diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..b0e22835 --- /dev/null +++ b/composer.lock @@ -0,0 +1,7054 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "bbae64cb4d21c987158bc3723eda4226", + "packages": [ + { + "name": "php-http/discovery", + "version": "1.20.0", + "source": { + "type": "git", + "url": "https://github.com/php-http/discovery.git", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/discovery/zipball/82fe4c73ef3363caed49ff8dd1539ba06044910d", + "reference": "82fe4c73ef3363caed49ff8dd1539ba06044910d", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0|^2.0", + "php": "^7.1 || ^8.0" + }, + "conflict": { + "nyholm/psr7": "<1.0", + "zendframework/zend-diactoros": "*" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "*", + "psr/http-factory-implementation": "*", + "psr/http-message-implementation": "*" + }, + "require-dev": { + "composer/composer": "^1.0.2|^2.0", + "graham-campbell/phpspec-skip-example-extension": "^5.0", + "php-http/httplug": "^1.0 || ^2.0", + "php-http/message-factory": "^1.0", + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3", + "sebastian/comparator": "^3.0.5 || ^4.0.8", + "symfony/phpunit-bridge": "^6.4.4 || ^7.0.1" + }, + "type": "composer-plugin", + "extra": { + "class": "Http\\Discovery\\Composer\\Plugin", + "plugin-optional": true + }, + "autoload": { + "psr-4": { + "Http\\Discovery\\": "src/" + }, + "exclude-from-classmap": [ + "src/Composer/Plugin.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations", + "homepage": "http://php-http.org", + "keywords": [ + "adapter", + "client", + "discovery", + "factory", + "http", + "message", + "psr17", + "psr7" + ], + "support": { + "issues": "https://github.com/php-http/discovery/issues", + "source": "https://github.com/php-http/discovery/tree/1.20.0" + }, + "time": "2024-10-02T11:20:13+00:00" + }, + { + "name": "psr/http-client", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-client.git", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-client/zipball/bb5906edc1c324c9a05aa0873d40117941e5fa90", + "reference": "bb5906edc1c324c9a05aa0873d40117941e5fa90", + "shasum": "" + }, + "require": { + "php": "^7.0 || ^8.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP clients", + "homepage": "https://github.com/php-fig/http-client", + "keywords": [ + "http", + "http-client", + "psr", + "psr-18" + ], + "support": { + "source": "https://github.com/php-fig/http-client" + }, + "time": "2023-09-23T14:17:50+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-message/tree/2.0" + }, + "time": "2023-04-04T09:54:51+00:00" + } + ], + "packages-dev": [ + { + "name": "brianium/paratest", + "version": "v7.8.5", + "source": { + "type": "git", + "url": "https://github.com/paratestphp/paratest.git", + "reference": "9b324c8fc319cf9728b581c7a90e1c8f6361c5e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paratestphp/paratest/zipball/9b324c8fc319cf9728b581c7a90e1c8f6361c5e5", + "reference": "9b324c8fc319cf9728b581c7a90e1c8f6361c5e5", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-simplexml": "*", + "fidry/cpu-core-counter": "^1.3.0", + "jean85/pretty-package-versions": "^2.1.1", + "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0", + "phpunit/php-code-coverage": "^11.0.12", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-timer": "^7.0.1", + "phpunit/phpunit": "^11.5.46", + "sebastian/environment": "^7.2.1", + "symfony/console": "^6.4.22 || ^7.3.4 || ^8.0.3", + "symfony/process": "^6.4.20 || ^7.3.4 || ^8.0.3" + }, + "require-dev": { + "doctrine/coding-standard": "^12.0.0", + "ext-pcov": "*", + "ext-posix": "*", + "phpstan/phpstan": "^2.1.33", + "phpstan/phpstan-deprecation-rules": "^2.0.3", + "phpstan/phpstan-phpunit": "^2.0.11", + "phpstan/phpstan-strict-rules": "^2.0.7", + "squizlabs/php_codesniffer": "^3.13.5", + "symfony/filesystem": "^6.4.13 || ^7.3.2 || ^8.0.1" + }, + "bin": [ + "bin/paratest", + "bin/paratest_for_phpstorm" + ], + "type": "library", + "autoload": { + "psr-4": { + "ParaTest\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Scaturro", + "email": "scaturrob@gmail.com", + "role": "Developer" + }, + { + "name": "Filippo Tessarotto", + "email": "zoeslam@gmail.com", + "role": "Developer" + } + ], + "description": "Parallel testing for PHP", + "homepage": "https://github.com/paratestphp/paratest", + "keywords": [ + "concurrent", + "parallel", + "phpunit", + "testing" + ], + "support": { + "issues": "https://github.com/paratestphp/paratest/issues", + "source": "https://github.com/paratestphp/paratest/tree/v7.8.5" + }, + "funding": [ + { + "url": "https://github.com/sponsors/Slamdunk", + "type": "github" + }, + { + "url": "https://paypal.me/filippotessarotto", + "type": "paypal" + } + ], + "time": "2026-01-08T08:02:38+00:00" + }, + { + "name": "clue/ndjson-react", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/clue/reactphp-ndjson.git", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/reactphp-ndjson/zipball/392dc165fce93b5bb5c637b67e59619223c931b0", + "reference": "392dc165fce93b5bb5c637b67e59619223c931b0", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/event-loop": "^1.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Clue\\React\\NDJson\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.", + "homepage": "https://github.com/clue/reactphp-ndjson", + "keywords": [ + "NDJSON", + "json", + "jsonlines", + "newline", + "reactphp", + "streaming" + ], + "support": { + "issues": "https://github.com/clue/reactphp-ndjson/issues", + "source": "https://github.com/clue/reactphp-ndjson/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2022-12-23T10:58:28+00:00" + }, + { + "name": "clue/stream-filter", + "version": "v1.7.0", + "source": { + "type": "git", + "url": "https://github.com/clue/stream-filter.git", + "reference": "049509fef80032cb3f051595029ab75b49a3c2f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/clue/stream-filter/zipball/049509fef80032cb3f051595029ab75b49a3c2f7", + "reference": "049509fef80032cb3f051595029ab75b49a3c2f7", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "Clue\\StreamFilter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + } + ], + "description": "A simple and modern approach to stream filtering in PHP", + "homepage": "https://github.com/clue/stream-filter", + "keywords": [ + "bucket brigade", + "callback", + "filter", + "php_user_filter", + "stream", + "stream_filter_append", + "stream_filter_register" + ], + "support": { + "issues": "https://github.com/clue/stream-filter/issues", + "source": "https://github.com/clue/stream-filter/tree/v1.7.0" + }, + "funding": [ + { + "url": "https://clue.engineering/support", + "type": "custom" + }, + { + "url": "https://github.com/clue", + "type": "github" + } + ], + "time": "2023-12-20T15:40:13+00:00" + }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.4" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2025-08-20T19:15:30+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-06T16:37:16+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.5", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "reference": "459c2f5dd3d6a4633d3b5f46ee2b1c40f57d3f38", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=13" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^12 || ^13", + "phpstan/phpstan": "1.4.10 || 2.1.11", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12", + "psr/log": "^1 || ^2 || ^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.5" + }, + "time": "2025-04-07T20:06:18+00:00" + }, + { + "name": "evenement/evenement", + "version": "v3.0.2", + "source": { + "type": "git", + "url": "https://github.com/igorw/evenement.git", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/evenement/zipball/0a16b0d71ab13284339abb99d9d2bd813640efbc", + "reference": "0a16b0d71ab13284339abb99d9d2bd813640efbc", + "shasum": "" + }, + "require": { + "php": ">=7.0" + }, + "require-dev": { + "phpunit/phpunit": "^9 || ^6" + }, + "type": "library", + "autoload": { + "psr-4": { + "Evenement\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Événement is a very simple event dispatching library for PHP", + "keywords": [ + "event-dispatcher", + "event-emitter" + ], + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/v3.0.2" + }, + "time": "2023-08-08T05:53:35+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.3.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2025-08-14T07:29:31+00:00" + }, + { + "name": "filp/whoops", + "version": "2.18.4", + "source": { + "type": "git", + "url": "https://github.com/filp/whoops.git", + "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/filp/whoops/zipball/d2102955e48b9fd9ab24280a7ad12ed552752c4d", + "reference": "d2102955e48b9fd9ab24280a7ad12ed552752c4d", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" + }, + "require-dev": { + "mockery/mockery": "^1.0", + "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.3.3", + "symfony/var-dumper": "^4.0 || ^5.0" + }, + "suggest": { + "symfony/var-dumper": "Pretty print complex values better with var-dumper available", + "whoops/soap": "Formats errors as SOAP responses" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7-dev" + } + }, + "autoload": { + "psr-4": { + "Whoops\\": "src/Whoops/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Filipe Dobreira", + "homepage": "https://github.com/filp", + "role": "Developer" + } + ], + "description": "php error handling for cool kids", + "homepage": "https://filp.github.io/whoops/", + "keywords": [ + "error", + "exception", + "handling", + "library", + "throwable", + "whoops" + ], + "support": { + "issues": "https://github.com/filp/whoops/issues", + "source": "https://github.com/filp/whoops/tree/2.18.4" + }, + "funding": [ + { + "url": "https://github.com/denis-sokolov", + "type": "github" + } + ], + "time": "2025-08-08T12:00:00+00:00" + }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v3.92.5", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", + "reference": "260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58", + "reference": "260cc8c4a1d2f6d2f22cd4f9c70aa72e55ebac58", + "shasum": "" + }, + "require": { + "clue/ndjson-react": "^1.3", + "composer/semver": "^3.4", + "composer/xdebug-handler": "^3.0.5", + "ext-filter": "*", + "ext-hash": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "fidry/cpu-core-counter": "^1.3", + "php": "^7.4 || ^8.0", + "react/child-process": "^0.6.6", + "react/event-loop": "^1.5", + "react/socket": "^1.16", + "react/stream": "^1.4", + "sebastian/diff": "^4.0.6 || ^5.1.1 || ^6.0.2 || ^7.0", + "symfony/console": "^5.4.47 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/event-dispatcher": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/filesystem": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/finder": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/options-resolver": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0", + "symfony/polyfill-mbstring": "^1.33", + "symfony/polyfill-php80": "^1.33", + "symfony/polyfill-php81": "^1.33", + "symfony/polyfill-php84": "^1.33", + "symfony/process": "^5.4.47 || ^6.4.24 || ^7.2 || ^8.0", + "symfony/stopwatch": "^5.4.45 || ^6.4.24 || ^7.0 || ^8.0" + }, + "require-dev": { + "facile-it/paraunit": "^1.3.1 || ^2.7", + "infection/infection": "^0.31", + "justinrainbow/json-schema": "^6.6", + "keradus/cli-executor": "^2.3", + "mikey179/vfsstream": "^1.6.12", + "php-coveralls/php-coveralls": "^2.9", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.6", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.6", + "phpunit/phpunit": "^9.6.31 || ^10.5.60 || ^11.5.46", + "symfony/polyfill-php85": "^1.33", + "symfony/var-dumper": "^5.4.48 || ^6.4.26 || ^7.4.0 || ^8.0", + "symfony/yaml": "^5.4.45 || ^6.4.30 || ^7.4.1 || ^8.0" + }, + "suggest": { + "ext-dom": "For handling output formats in XML", + "ext-mbstring": "For handling non-UTF8 characters." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "exclude-from-classmap": [ + "src/**/Internal/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Dariusz Rumiński", + "email": "dariusz.ruminski@gmail.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "keywords": [ + "Static code analysis", + "fixer", + "standards", + "static analysis" + ], + "support": { + "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", + "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.92.5" + }, + "funding": [ + { + "url": "https://github.com/keradus", + "type": "github" + } + ], + "time": "2026-01-08T21:57:37+00:00" + }, + { + "name": "guzzlehttp/guzzle", + "version": "7.10.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle.git", + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "reference": "b51ac707cfa420b7bfd4e4d5e510ba8008e822b4", + "shasum": "" + }, + "require": { + "ext-json": "*", + "guzzlehttp/promises": "^2.3", + "guzzlehttp/psr7": "^2.8", + "php": "^7.2.5 || ^8.0", + "psr/http-client": "^1.0", + "symfony/deprecation-contracts": "^2.2 || ^3.0" + }, + "provide": { + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "ext-curl": "*", + "guzzle/client-integration-tests": "3.0.2", + "php-http/message-factory": "^1.1", + "phpunit/phpunit": "^8.5.39 || ^9.6.20", + "psr/log": "^1.1 || ^2.0 || ^3.0" + }, + "suggest": { + "ext-curl": "Required for CURL handler support", + "ext-intl": "Required for Internationalized Domain Name (IDN) support", + "psr/log": "Required for using the Log middleware" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "GuzzleHttp\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Jeremy Lindblom", + "email": "jeremeamia@gmail.com", + "homepage": "https://github.com/jeremeamia" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle is a PHP HTTP client library", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "psr-18", + "psr-7", + "rest", + "web service" + ], + "support": { + "issues": "https://github.com/guzzle/guzzle/issues", + "source": "https://github.com/guzzle/guzzle/tree/7.10.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/guzzle", + "type": "tidelift" + } + ], + "time": "2025-08-23T22:36:01+00:00" + }, + { + "name": "guzzlehttp/promises", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/promises.git", + "reference": "481557b130ef3790cf82b713667b43030dc9c957" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/promises/zipball/481557b130ef3790cf82b713667b43030dc9c957", + "reference": "481557b130ef3790cf82b713667b43030dc9c957", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.44 || ^9.6.25" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + } + ], + "description": "Guzzle promises library", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/guzzle/promises/issues", + "source": "https://github.com/guzzle/promises/tree/2.3.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/promises", + "type": "tidelift" + } + ], + "time": "2025-08-22T14:34:08+00:00" + }, + { + "name": "guzzlehttp/psr7", + "version": "2.9.0", + "source": { + "type": "git", + "url": "https://github.com/guzzle/psr7.git", + "reference": "7d0ed42f28e42d61352a7a79de682e5e67fec884" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/7d0ed42f28e42d61352a7a79de682e5e67fec884", + "reference": "7d0ed42f28e42d61352a7a79de682e5e67fec884", + "shasum": "" + }, + "require": { + "php": "^7.2.5 || ^8.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "ralouphie/getallheaders": "^3.0" + }, + "provide": { + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "bamarni/composer-bin-plugin": "^1.8.2", + "http-interop/http-factory-tests": "0.9.0", + "jshttp/mime-db": "1.54.0.1", + "phpunit/phpunit": "^8.5.44 || ^9.6.25" + }, + "suggest": { + "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" + }, + "type": "library", + "extra": { + "bamarni-bin": { + "bin-links": true, + "forward-command": false + } + }, + "autoload": { + "psr-4": { + "GuzzleHttp\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Graham Campbell", + "email": "hello@gjcampbell.co.uk", + "homepage": "https://github.com/GrahamCampbell" + }, + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "George Mponos", + "email": "gmponos@gmail.com", + "homepage": "https://github.com/gmponos" + }, + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com", + "homepage": "https://github.com/Nyholm" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://github.com/sagikazarmark" + }, + { + "name": "Tobias Schultze", + "email": "webmaster@tubo-world.de", + "homepage": "https://github.com/Tobion" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "PSR-7 message implementation that also provides common utility methods", + "keywords": [ + "http", + "message", + "psr-7", + "request", + "response", + "stream", + "uri", + "url" + ], + "support": { + "issues": "https://github.com/guzzle/psr7/issues", + "source": "https://github.com/guzzle/psr7/tree/2.9.0" + }, + "funding": [ + { + "url": "https://github.com/GrahamCampbell", + "type": "github" + }, + { + "url": "https://github.com/Nyholm", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/guzzlehttp/psr7", + "type": "tidelift" + } + ], + "time": "2026-03-10T16:41:02+00:00" + }, + { + "name": "jean85/pretty-package-versions", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/Jean85/pretty-package-versions.git", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/4d7aa5dab42e2a76d99559706022885de0e18e1a", + "reference": "4d7aa5dab42e2a76d99559706022885de0e18e1a", + "shasum": "" + }, + "require": { + "composer-runtime-api": "^2.1.0", + "php": "^7.4|^8.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.2", + "jean85/composer-provided-replaced-stub-package": "^1.0", + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^7.5|^8.5|^9.6", + "rector/rector": "^2.0", + "vimeo/psalm": "^4.3 || ^5.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Jean85\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Alessandro Lai", + "email": "alessandro.lai85@gmail.com" + } + ], + "description": "A library to get pretty versions strings of installed dependencies", + "keywords": [ + "composer", + "package", + "release", + "versions" + ], + "support": { + "issues": "https://github.com/Jean85/pretty-package-versions/issues", + "source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.1" + }, + "time": "2025-03-19T14:43:43+00:00" + }, + { + "name": "myclabs/deep-copy", + "version": "1.13.4", + "source": { + "type": "git", + "url": "https://github.com/myclabs/DeepCopy.git", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "doctrine/collections": "<1.6.8", + "doctrine/common": "<2.13.3 || >=3 <3.2.2" + }, + "require-dev": { + "doctrine/collections": "^1.6.8", + "doctrine/common": "^2.13.3 || ^3.2.2", + "phpspec/prophecy": "^1.10", + "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13" + }, + "type": "library", + "autoload": { + "files": [ + "src/DeepCopy/deep_copy.php" + ], + "psr-4": { + "DeepCopy\\": "src/DeepCopy/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Create deep copies (clones) of your objects", + "keywords": [ + "clone", + "copy", + "duplicate", + "object", + "object graph" + ], + "support": { + "issues": "https://github.com/myclabs/DeepCopy/issues", + "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4" + }, + "funding": [ + { + "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy", + "type": "tidelift" + } + ], + "time": "2025-08-01T08:46:24+00:00" + }, + { + "name": "nikic/php-parser", + "version": "v5.7.0", + "source": { + "type": "git", + "url": "https://github.com/nikic/PHP-Parser.git", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-json": "*", + "ext-tokenizer": "*", + "php": ">=7.4" + }, + "require-dev": { + "ircmaxell/php-yacc": "^0.0.7", + "phpunit/phpunit": "^9.0" + }, + "bin": [ + "bin/php-parse" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "PhpParser\\": "lib/PhpParser" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Nikita Popov" + } + ], + "description": "A PHP parser written in PHP", + "keywords": [ + "parser", + "php" + ], + "support": { + "issues": "https://github.com/nikic/PHP-Parser/issues", + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" + }, + "time": "2025-12-06T11:56:16+00:00" + }, + { + "name": "nunomaduro/collision", + "version": "v8.8.3", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/collision.git", + "reference": "1dc9e88d105699d0fee8bb18890f41b274f6b4c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/collision/zipball/1dc9e88d105699d0fee8bb18890f41b274f6b4c4", + "reference": "1dc9e88d105699d0fee8bb18890f41b274f6b4c4", + "shasum": "" + }, + "require": { + "filp/whoops": "^2.18.1", + "nunomaduro/termwind": "^2.3.1", + "php": "^8.2.0", + "symfony/console": "^7.3.0" + }, + "conflict": { + "laravel/framework": "<11.44.2 || >=13.0.0", + "phpunit/phpunit": "<11.5.15 || >=13.0.0" + }, + "require-dev": { + "brianium/paratest": "^7.8.3", + "larastan/larastan": "^3.4.2", + "laravel/framework": "^11.44.2 || ^12.18", + "laravel/pint": "^1.22.1", + "laravel/sail": "^1.43.1", + "laravel/sanctum": "^4.1.1", + "laravel/tinker": "^2.10.1", + "orchestra/testbench-core": "^9.12.0 || ^10.4", + "pestphp/pest": "^3.8.2 || ^4.0.0", + "sebastian/environment": "^7.2.1 || ^8.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "NunoMaduro\\Collision\\Adapters\\Laravel\\CollisionServiceProvider" + ] + }, + "branch-alias": { + "dev-8.x": "8.x-dev" + } + }, + "autoload": { + "files": [ + "./src/Adapters/Phpunit/Autoload.php" + ], + "psr-4": { + "NunoMaduro\\Collision\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Cli error handling for console/command-line PHP applications.", + "keywords": [ + "artisan", + "cli", + "command-line", + "console", + "dev", + "error", + "handling", + "laravel", + "laravel-zero", + "php", + "symfony" + ], + "support": { + "issues": "https://github.com/nunomaduro/collision/issues", + "source": "https://github.com/nunomaduro/collision" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2025-11-20T02:55:25+00:00" + }, + { + "name": "nunomaduro/termwind", + "version": "v2.3.3", + "source": { + "type": "git", + "url": "https://github.com/nunomaduro/termwind.git", + "reference": "6fb2a640ff502caace8e05fd7be3b503a7e1c017" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nunomaduro/termwind/zipball/6fb2a640ff502caace8e05fd7be3b503a7e1c017", + "reference": "6fb2a640ff502caace8e05fd7be3b503a7e1c017", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": "^8.2", + "symfony/console": "^7.3.6" + }, + "require-dev": { + "illuminate/console": "^11.46.1", + "laravel/pint": "^1.25.1", + "mockery/mockery": "^1.6.12", + "pestphp/pest": "^2.36.0 || ^3.8.4 || ^4.1.3", + "phpstan/phpstan": "^1.12.32", + "phpstan/phpstan-strict-rules": "^1.6.2", + "symfony/var-dumper": "^7.3.5", + "thecodingmachine/phpstan-strict-rules": "^1.0.0" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Termwind\\Laravel\\TermwindServiceProvider" + ] + }, + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "files": [ + "src/Functions.php" + ], + "psr-4": { + "Termwind\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Its like Tailwind CSS, but for the console.", + "keywords": [ + "cli", + "console", + "css", + "package", + "php", + "style" + ], + "support": { + "issues": "https://github.com/nunomaduro/termwind/issues", + "source": "https://github.com/nunomaduro/termwind/tree/v2.3.3" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://github.com/xiCO2k", + "type": "github" + } + ], + "time": "2025-11-20T02:34:59+00:00" + }, + { + "name": "nyholm/psr7", + "version": "1.8.2", + "source": { + "type": "git", + "url": "https://github.com/Nyholm/psr7.git", + "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Nyholm/psr7/zipball/a71f2b11690f4b24d099d6b16690a90ae14fc6f3", + "reference": "a71f2b11690f4b24d099d6b16690a90ae14fc6f3", + "shasum": "" + }, + "require": { + "php": ">=7.2", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0" + }, + "provide": { + "php-http/message-factory-implementation": "1.0", + "psr/http-factory-implementation": "1.0", + "psr/http-message-implementation": "1.0" + }, + "require-dev": { + "http-interop/http-factory-tests": "^0.9", + "php-http/message-factory": "^1.0", + "php-http/psr7-integration-tests": "^1.0", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.4", + "symfony/error-handler": "^4.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.8-dev" + } + }, + "autoload": { + "psr-4": { + "Nyholm\\Psr7\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Tobias Nyholm", + "email": "tobias.nyholm@gmail.com" + }, + { + "name": "Martijn van der Ven", + "email": "martijn@vanderven.se" + } + ], + "description": "A fast PHP7 implementation of PSR-7", + "homepage": "https://tnyholm.se", + "keywords": [ + "psr-17", + "psr-7" + ], + "support": { + "issues": "https://github.com/Nyholm/psr7/issues", + "source": "https://github.com/Nyholm/psr7/tree/1.8.2" + }, + "funding": [ + { + "url": "https://github.com/Zegnat", + "type": "github" + }, + { + "url": "https://github.com/nyholm", + "type": "github" + } + ], + "time": "2024-09-09T07:06:30+00:00" + }, + { + "name": "pestphp/pest", + "version": "v3.8.5", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest.git", + "reference": "7796630eafcfd1c02660cecdde3bc6984fbf01f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest/zipball/7796630eafcfd1c02660cecdde3bc6984fbf01f4", + "reference": "7796630eafcfd1c02660cecdde3bc6984fbf01f4", + "shasum": "" + }, + "require": { + "brianium/paratest": "^7.8.5", + "nunomaduro/collision": "^8.8.3", + "nunomaduro/termwind": "^2.3.3", + "pestphp/pest-plugin": "^3.0.0", + "pestphp/pest-plugin-arch": "^3.1.1", + "pestphp/pest-plugin-mutate": "^3.0.5", + "php": "^8.2.0", + "phpunit/phpunit": "^11.5.50" + }, + "conflict": { + "filp/whoops": "<2.16.0", + "phpunit/phpunit": ">11.5.50", + "sebastian/exporter": "<6.0.0", + "webmozart/assert": "<1.11.0" + }, + "require-dev": { + "pestphp/pest-dev-tools": "^3.4.0", + "pestphp/pest-plugin-type-coverage": "^3.6.1", + "symfony/process": "^7.4.4" + }, + "bin": [ + "bin/pest" + ], + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Mutate\\Plugins\\Mutate", + "Pest\\Plugins\\Configuration", + "Pest\\Plugins\\Bail", + "Pest\\Plugins\\Cache", + "Pest\\Plugins\\Coverage", + "Pest\\Plugins\\Init", + "Pest\\Plugins\\Environment", + "Pest\\Plugins\\Help", + "Pest\\Plugins\\Memory", + "Pest\\Plugins\\Only", + "Pest\\Plugins\\Printer", + "Pest\\Plugins\\ProcessIsolation", + "Pest\\Plugins\\Profile", + "Pest\\Plugins\\Retry", + "Pest\\Plugins\\Snapshot", + "Pest\\Plugins\\Verbose", + "Pest\\Plugins\\Version", + "Pest\\Plugins\\Parallel" + ] + }, + "phpstan": { + "includes": [ + "extension.neon" + ] + } + }, + "autoload": { + "files": [ + "src/Functions.php", + "src/Pest.php" + ], + "psr-4": { + "Pest\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "The elegant PHP Testing Framework.", + "keywords": [ + "framework", + "pest", + "php", + "test", + "testing", + "unit" + ], + "support": { + "issues": "https://github.com/pestphp/pest/issues", + "source": "https://github.com/pestphp/pest/tree/v3.8.5" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2026-01-28T01:33:45+00:00" + }, + { + "name": "pestphp/pest-plugin", + "version": "v3.0.0", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin.git", + "reference": "e79b26c65bc11c41093b10150c1341cc5cdbea83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin/zipball/e79b26c65bc11c41093b10150c1341cc5cdbea83", + "reference": "e79b26c65bc11c41093b10150c1341cc5cdbea83", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0.0", + "composer-runtime-api": "^2.2.2", + "php": "^8.2" + }, + "conflict": { + "pestphp/pest": "<3.0.0" + }, + "require-dev": { + "composer/composer": "^2.7.9", + "pestphp/pest": "^3.0.0", + "pestphp/pest-dev-tools": "^3.0.0" + }, + "type": "composer-plugin", + "extra": { + "class": "Pest\\Plugin\\Manager" + }, + "autoload": { + "psr-4": { + "Pest\\Plugin\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Pest plugin manager", + "keywords": [ + "framework", + "manager", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin/tree/v3.0.0" + }, + "funding": [ + { + "url": "https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=66BYDWAT92N6L", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + }, + { + "url": "https://www.patreon.com/nunomaduro", + "type": "patreon" + } + ], + "time": "2024-09-08T23:21:41+00:00" + }, + { + "name": "pestphp/pest-plugin-arch", + "version": "v3.1.1", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-arch.git", + "reference": "db7bd9cb1612b223e16618d85475c6f63b9c8daa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-arch/zipball/db7bd9cb1612b223e16618d85475c6f63b9c8daa", + "reference": "db7bd9cb1612b223e16618d85475c6f63b9c8daa", + "shasum": "" + }, + "require": { + "pestphp/pest-plugin": "^3.0.0", + "php": "^8.2", + "ta-tikoma/phpunit-architecture-test": "^0.8.4" + }, + "require-dev": { + "pestphp/pest": "^3.8.1", + "pestphp/pest-dev-tools": "^3.4.0" + }, + "type": "library", + "extra": { + "pest": { + "plugins": [ + "Pest\\Arch\\Plugin" + ] + } + }, + "autoload": { + "files": [ + "src/Autoload.php" + ], + "psr-4": { + "Pest\\Arch\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The Arch plugin for Pest PHP.", + "keywords": [ + "arch", + "architecture", + "framework", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-arch/tree/v3.1.1" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2025-04-16T22:59:48+00:00" + }, + { + "name": "pestphp/pest-plugin-mutate", + "version": "v3.0.5", + "source": { + "type": "git", + "url": "https://github.com/pestphp/pest-plugin-mutate.git", + "reference": "e10dbdc98c9e2f3890095b4fe2144f63a5717e08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pestphp/pest-plugin-mutate/zipball/e10dbdc98c9e2f3890095b4fe2144f63a5717e08", + "reference": "e10dbdc98c9e2f3890095b4fe2144f63a5717e08", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.2.0", + "pestphp/pest-plugin": "^3.0.0", + "php": "^8.2", + "psr/simple-cache": "^3.0.0" + }, + "require-dev": { + "pestphp/pest": "^3.0.8", + "pestphp/pest-dev-tools": "^3.0.0", + "pestphp/pest-plugin-type-coverage": "^3.0.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Pest\\Mutate\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Sandro Gehri", + "email": "sandrogehri@gmail.com" + } + ], + "description": "Mutates your code to find untested cases", + "keywords": [ + "framework", + "mutate", + "mutation", + "pest", + "php", + "plugin", + "test", + "testing", + "unit" + ], + "support": { + "source": "https://github.com/pestphp/pest-plugin-mutate/tree/v3.0.5" + }, + "funding": [ + { + "url": "https://www.paypal.com/paypalme/enunomaduro", + "type": "custom" + }, + { + "url": "https://github.com/gehrisandro", + "type": "github" + }, + { + "url": "https://github.com/nunomaduro", + "type": "github" + } + ], + "time": "2024-09-22T07:54:40+00:00" + }, + { + "name": "phar-io/manifest", + "version": "2.0.4", + "source": { + "type": "git", + "url": "https://github.com/phar-io/manifest.git", + "reference": "54750ef60c58e43759730615a392c31c80e23176" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-phar": "*", + "ext-xmlwriter": "*", + "phar-io/version": "^3.0.1", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", + "support": { + "issues": "https://github.com/phar-io/manifest/issues", + "source": "https://github.com/phar-io/manifest/tree/2.0.4" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" + }, + { + "name": "phar-io/version", + "version": "3.2.1", + "source": { + "type": "git", + "url": "https://github.com/phar-io/version.git", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + }, + { + "name": "Sebastian Heuer", + "email": "sebastian@phpeople.de", + "role": "Developer" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "Developer" + } + ], + "description": "Library for handling version information and constraints", + "support": { + "issues": "https://github.com/phar-io/version/issues", + "source": "https://github.com/phar-io/version/tree/3.2.1" + }, + "time": "2022-02-21T01:04:05+00:00" + }, + { + "name": "php-http/client-common", + "version": "2.7.3", + "source": { + "type": "git", + "url": "https://github.com/php-http/client-common.git", + "reference": "dcc6de29c90dd74faab55f71b79d89409c4bf0c1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/client-common/zipball/dcc6de29c90dd74faab55f71b79d89409c4bf0c1", + "reference": "dcc6de29c90dd74faab55f71b79d89409c4bf0c1", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "php-http/httplug": "^2.0", + "php-http/message": "^1.6", + "psr/http-client": "^1.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.0 || ^2.0", + "symfony/options-resolver": "~4.0.15 || ~4.1.9 || ^4.2.1 || ^5.0 || ^6.0 || ^7.0 || ^8.0", + "symfony/polyfill-php80": "^1.17" + }, + "require-dev": { + "doctrine/instantiator": "^1.1", + "guzzlehttp/psr7": "^1.4", + "nyholm/psr7": "^1.2", + "phpunit/phpunit": "^7.5.20 || ^8.5.33 || ^9.6.7" + }, + "suggest": { + "ext-json": "To detect JSON responses with the ContentTypePlugin", + "ext-libxml": "To detect XML responses with the ContentTypePlugin", + "php-http/cache-plugin": "PSR-6 Cache plugin", + "php-http/logger-plugin": "PSR-3 Logger plugin", + "php-http/stopwatch-plugin": "Symfony Stopwatch plugin" + }, + "type": "library", + "autoload": { + "psr-4": { + "Http\\Client\\Common\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Common HTTP Client implementations and tools for HTTPlug", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "common", + "http", + "httplug" + ], + "support": { + "issues": "https://github.com/php-http/client-common/issues", + "source": "https://github.com/php-http/client-common/tree/2.7.3" + }, + "time": "2025-11-29T19:12:34+00:00" + }, + { + "name": "php-http/httplug", + "version": "2.4.1", + "source": { + "type": "git", + "url": "https://github.com/php-http/httplug.git", + "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/httplug/zipball/5cad731844891a4c282f3f3e1b582c46839d22f4", + "reference": "5cad731844891a4c282f3f3e1b582c46839d22f4", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "php-http/promise": "^1.1", + "psr/http-client": "^1.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "require-dev": { + "friends-of-phpspec/phpspec-code-coverage": "^4.1 || ^5.0 || ^6.0", + "phpspec/phpspec": "^5.1 || ^6.0 || ^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Http\\Client\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Eric GELOEN", + "email": "geloen.eric@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com", + "homepage": "https://sagikazarmark.hu" + } + ], + "description": "HTTPlug, the HTTP client abstraction for PHP", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "http" + ], + "support": { + "issues": "https://github.com/php-http/httplug/issues", + "source": "https://github.com/php-http/httplug/tree/2.4.1" + }, + "time": "2024-09-23T11:39:58+00:00" + }, + { + "name": "php-http/message", + "version": "1.16.2", + "source": { + "type": "git", + "url": "https://github.com/php-http/message.git", + "reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/message/zipball/06dd5e8562f84e641bf929bfe699ee0f5ce8080a", + "reference": "06dd5e8562f84e641bf929bfe699ee0f5ce8080a", + "shasum": "" + }, + "require": { + "clue/stream-filter": "^1.5", + "php": "^7.2 || ^8.0", + "psr/http-message": "^1.1 || ^2.0" + }, + "provide": { + "php-http/message-factory-implementation": "1.0" + }, + "require-dev": { + "ergebnis/composer-normalize": "^2.6", + "ext-zlib": "*", + "guzzlehttp/psr7": "^1.0 || ^2.0", + "laminas/laminas-diactoros": "^2.0 || ^3.0", + "php-http/message-factory": "^1.0.2", + "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", + "slim/slim": "^3.0" + }, + "suggest": { + "ext-zlib": "Used with compressor/decompressor streams", + "guzzlehttp/psr7": "Used with Guzzle PSR-7 Factories", + "laminas/laminas-diactoros": "Used with Diactoros Factories", + "slim/slim": "Used with Slim Framework PSR-7 implementation" + }, + "type": "library", + "autoload": { + "files": [ + "src/filters.php" + ], + "psr-4": { + "Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "HTTP Message related tools", + "homepage": "http://php-http.org", + "keywords": [ + "http", + "message", + "psr-7" + ], + "support": { + "issues": "https://github.com/php-http/message/issues", + "source": "https://github.com/php-http/message/tree/1.16.2" + }, + "time": "2024-10-02T11:34:13+00:00" + }, + { + "name": "php-http/mock-client", + "version": "1.6.1", + "source": { + "type": "git", + "url": "https://github.com/php-http/mock-client.git", + "reference": "81f558234421f7da58ed015604a03808996017d0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/mock-client/zipball/81f558234421f7da58ed015604a03808996017d0", + "reference": "81f558234421f7da58ed015604a03808996017d0", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0", + "php-http/client-common": "^2.0", + "php-http/discovery": "^1.16", + "php-http/httplug": "^2.0", + "psr/http-client": "^1.0", + "psr/http-factory-implementation": "^1.0", + "psr/http-message": "^1.0 || ^2.0", + "symfony/polyfill-php80": "^1.17" + }, + "provide": { + "php-http/async-client-implementation": "1.0", + "php-http/client-implementation": "1.0", + "psr/http-client-implementation": "1.0" + }, + "require-dev": { + "phpspec/phpspec": "^5.1 || ^6.1 || ^7.3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Http\\Mock\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "David de Boer", + "email": "david@ddeboer.nl" + } + ], + "description": "Mock HTTP client", + "homepage": "http://httplug.io", + "keywords": [ + "client", + "http", + "mock", + "psr7" + ], + "support": { + "issues": "https://github.com/php-http/mock-client/issues", + "source": "https://github.com/php-http/mock-client/tree/1.6.1" + }, + "time": "2024-10-31T10:30:18+00:00" + }, + { + "name": "php-http/promise", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/php-http/promise.git", + "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-http/promise/zipball/fc85b1fba37c169a69a07ef0d5a8075770cc1f83", + "reference": "fc85b1fba37c169a69a07ef0d5a8075770cc1f83", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "require-dev": { + "friends-of-phpspec/phpspec-code-coverage": "^4.3.2 || ^6.3", + "phpspec/phpspec": "^5.1.2 || ^6.2 || ^7.4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Http\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Joel Wurtz", + "email": "joel.wurtz@gmail.com" + }, + { + "name": "Márk Sági-Kazár", + "email": "mark.sagikazar@gmail.com" + } + ], + "description": "Promise used for asynchronous HTTP requests", + "homepage": "http://httplug.io", + "keywords": [ + "promise" + ], + "support": { + "issues": "https://github.com/php-http/promise/issues", + "source": "https://github.com/php-http/promise/tree/1.3.1" + }, + "time": "2024-03-15T13:55:21+00:00" + }, + { + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "5.6.6", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/5cee1d3dfc2d2aa6599834520911d246f656bcb8", + "reference": "5cee1d3dfc2d2aa6599834520911d246f656bcb8", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.1", + "ext-filter": "*", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^1.7", + "phpstan/phpdoc-parser": "^1.7|^2.0", + "webmozart/assert": "^1.9.1 || ^2" + }, + "require-dev": { + "mockery/mockery": "~1.3.5 || ~1.6.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^5.26" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/5.6.6" + }, + "time": "2025-12-22T21:13:58+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "1.12.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "92a98ada2b93d9b201a613cb5a33584dde25f195" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/92a98ada2b93d9b201a613cb5a33584dde25f195", + "reference": "92a98ada2b93d9b201a613cb5a33584dde25f195", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.3 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^1.18|^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.1", + "phpunit/phpunit": "^9.5", + "rector/rector": "^0.13.9", + "vimeo/psalm": "^4.25" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } + ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "support": { + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.12.0" + }, + "time": "2025-11-21T15:09:14+00:00" + }, + { + "name": "phpstan/extension-installer", + "version": "1.4.3", + "source": { + "type": "git", + "url": "https://github.com/phpstan/extension-installer.git", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/extension-installer/zipball/85e90b3942d06b2326fba0403ec24fe912372936", + "reference": "85e90b3942d06b2326fba0403ec24fe912372936", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2.0", + "php": "^7.2 || ^8.0", + "phpstan/phpstan": "^1.9.0 || ^2.0" + }, + "require-dev": { + "composer/composer": "^2.0", + "php-parallel-lint/php-parallel-lint": "^1.2.0", + "phpstan/phpstan-strict-rules": "^0.11 || ^0.12 || ^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "PHPStan\\ExtensionInstaller\\Plugin" + }, + "autoload": { + "psr-4": { + "PHPStan\\ExtensionInstaller\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Composer plugin for automatic installation of PHPStan extensions", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpstan/extension-installer/issues", + "source": "https://github.com/phpstan/extension-installer/tree/1.4.3" + }, + "time": "2024-09-04T20:21:43+00:00" + }, + { + "name": "phpstan/phpdoc-parser", + "version": "2.3.0", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/1e0cd5370df5dd2e556a36b9c62f62e555870495", + "reference": "1e0cd5370df5dd2e556a36b9c62f62e555870495", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^5.3.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.0" + }, + "time": "2025-08-30T15:50:23+00:00" + }, + { + "name": "phpstan/phpstan", + "version": "2.1.33", + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/9e800e6bee7d5bd02784d4c6069b48032d16224f", + "reference": "9e800e6bee7d5bd02784d4c6069b48032d16224f", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2025-12-05T10:24:31+00:00" + }, + { + "name": "phpstan/phpstan-phpunit", + "version": "2.0.11", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan-phpunit.git", + "reference": "5e30669bef866eff70db8b58d72a5c185aa82414" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan-phpunit/zipball/5e30669bef866eff70db8b58d72a5c185aa82414", + "reference": "5e30669bef866eff70db8b58d72a5c185aa82414", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.1.32" + }, + "conflict": { + "phpunit/phpunit": "<7.0" + }, + "require-dev": { + "nikic/php-parser": "^5", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6" + }, + "type": "phpstan-extension", + "extra": { + "phpstan": { + "includes": [ + "extension.neon", + "rules.neon" + ] + } + }, + "autoload": { + "psr-4": { + "PHPStan\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPUnit extensions and rules for PHPStan", + "support": { + "issues": "https://github.com/phpstan/phpstan-phpunit/issues", + "source": "https://github.com/phpstan/phpstan-phpunit/tree/2.0.11" + }, + "time": "2025-12-19T09:05:35+00:00" + }, + { + "name": "phpunit/php-code-coverage", + "version": "11.0.12", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "2c1ed04922802c15e1de5d7447b4856de949cf56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2c1ed04922802c15e1de5d7447b4856de949cf56", + "reference": "2c1ed04922802c15e1de5d7447b4856de949cf56", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-libxml": "*", + "ext-xmlwriter": "*", + "nikic/php-parser": "^5.7.0", + "php": ">=8.2", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-text-template": "^4.0.1", + "sebastian/code-unit-reverse-lookup": "^4.0.1", + "sebastian/complexity": "^4.0.1", + "sebastian/environment": "^7.2.1", + "sebastian/lines-of-code": "^3.0.1", + "sebastian/version": "^5.0.2", + "theseer/tokenizer": "^1.3.1" + }, + "require-dev": { + "phpunit/phpunit": "^11.5.46" + }, + "suggest": { + "ext-pcov": "PHP extension that provides line coverage", + "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "11.0.x-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", + "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/11.0.12" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-code-coverage", + "type": "tidelift" + } + ], + "time": "2025-12-24T07:01:01+00:00" + }, + { + "name": "phpunit/php-file-iterator", + "version": "5.1.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/2f3a64888c814fc235386b7387dd5b5ed92ad903", + "reference": "2f3a64888c814fc235386b7387dd5b5ed92ad903", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", + "keywords": [ + "filesystem", + "iterator" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues", + "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy", + "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/5.1.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/php-file-iterator", + "type": "tidelift" + } + ], + "time": "2026-02-02T13:52:54+00:00" + }, + { + "name": "phpunit/php-invoker", + "version": "5.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-invoker.git", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/c1ca3814734c07492b3d4c5f794f4b0995333da2", + "reference": "c1ca3814734c07492b3d4c5f794f4b0995333da2", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "ext-pcntl": "*", + "phpunit/phpunit": "^11.0" + }, + "suggest": { + "ext-pcntl": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Invoke callables with a timeout", + "homepage": "https://github.com/sebastianbergmann/php-invoker/", + "keywords": [ + "process" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-invoker/issues", + "security": "https://github.com/sebastianbergmann/php-invoker/security/policy", + "source": "https://github.com/sebastianbergmann/php-invoker/tree/5.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:07:44+00:00" + }, + { + "name": "phpunit/php-text-template", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "reference": "3e0404dc6b300e6bf56415467ebcb3fe4f33e964", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-text-template/issues", + "security": "https://github.com/sebastianbergmann/php-text-template/security/policy", + "source": "https://github.com/sebastianbergmann/php-text-template/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:08:43+00:00" + }, + { + "name": "phpunit/php-timer", + "version": "7.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "reference": "3b415def83fbcb41f991d9ebf16ae4ad8b7837b3", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/php-timer/issues", + "security": "https://github.com/sebastianbergmann/php-timer/security/policy", + "source": "https://github.com/sebastianbergmann/php-timer/tree/7.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:09:35+00:00" + }, + { + "name": "phpunit/phpunit", + "version": "11.5.50", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", + "reference": "fdfc727f0fcacfeb8fcb30c7e5da173125b58be3", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-json": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", + "ext-xmlwriter": "*", + "myclabs/deep-copy": "^1.13.4", + "phar-io/manifest": "^2.0.4", + "phar-io/version": "^3.2.1", + "php": ">=8.2", + "phpunit/php-code-coverage": "^11.0.12", + "phpunit/php-file-iterator": "^5.1.0", + "phpunit/php-invoker": "^5.0.1", + "phpunit/php-text-template": "^4.0.1", + "phpunit/php-timer": "^7.0.1", + "sebastian/cli-parser": "^3.0.2", + "sebastian/code-unit": "^3.0.3", + "sebastian/comparator": "^6.3.3", + "sebastian/diff": "^6.0.2", + "sebastian/environment": "^7.2.1", + "sebastian/exporter": "^6.3.2", + "sebastian/global-state": "^7.0.2", + "sebastian/object-enumerator": "^6.0.1", + "sebastian/type": "^5.1.3", + "sebastian/version": "^5.0.2", + "staabm/side-effects-detector": "^1.0.5" + }, + "suggest": { + "ext-soap": "To be able to generate mocks based on WSDL files" + }, + "bin": [ + "phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "11.5-dev" + } + }, + "autoload": { + "files": [ + "src/Framework/Assert/Functions.php" + ], + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "https://phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/phpunit/issues", + "security": "https://github.com/sebastianbergmann/phpunit/security/policy", + "source": "https://github.com/sebastianbergmann/phpunit/tree/11.5.50" + }, + "funding": [ + { + "url": "https://phpunit.de/sponsors.html", + "type": "custom" + }, + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit", + "type": "tidelift" + } + ], + "time": "2026-01-27T05:59:18+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "shasum": "" + }, + "require": { + "php": ">=7.4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", + "keywords": [ + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" + ], + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" + }, + "time": "2021-11-05T16:47:00+00:00" + }, + { + "name": "psr/event-dispatcher", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/event-dispatcher.git", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/event-dispatcher/zipball/dbefd12671e8a14ec7f180cab83036ed26714bb0", + "reference": "dbefd12671e8a14ec7f180cab83036ed26714bb0", + "shasum": "" + }, + "require": { + "php": ">=7.2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\EventDispatcher\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Standard interfaces for event handling.", + "keywords": [ + "events", + "psr", + "psr-14" + ], + "support": { + "issues": "https://github.com/php-fig/event-dispatcher/issues", + "source": "https://github.com/php-fig/event-dispatcher/tree/1.0.0" + }, + "time": "2019-01-08T18:20:26+00:00" + }, + { + "name": "psr/http-factory", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "shasum": "" + }, + "require": { + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "support": { + "source": "https://github.com/php-fig/http-factory" + }, + "time": "2024-04-15T12:06:14+00:00" + }, + { + "name": "psr/log", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "support": { + "source": "https://github.com/php-fig/log/tree/3.0.2" + }, + "time": "2024-09-11T13:17:53+00:00" + }, + { + "name": "psr/simple-cache", + "version": "3.0.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/764e0b3939f5ca87cb904f570ef9be2d78a07865", + "reference": "764e0b3939f5ca87cb904f570ef9be2d78a07865", + "shasum": "" + }, + "require": { + "php": ">=8.0.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\SimpleCache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", + "keywords": [ + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" + ], + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/3.0.0" + }, + "time": "2021-10-29T13:26:27+00:00" + }, + { + "name": "ralouphie/getallheaders", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/ralouphie/getallheaders.git", + "reference": "120b605dfeb996808c31b6477290a714d356e822" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ralouphie/getallheaders/zipball/120b605dfeb996808c31b6477290a714d356e822", + "reference": "120b605dfeb996808c31b6477290a714d356e822", + "shasum": "" + }, + "require": { + "php": ">=5.6" + }, + "require-dev": { + "php-coveralls/php-coveralls": "^2.1", + "phpunit/phpunit": "^5 || ^6.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/getallheaders.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ralph Khattar", + "email": "ralph.khattar@gmail.com" + } + ], + "description": "A polyfill for getallheaders.", + "support": { + "issues": "https://github.com/ralouphie/getallheaders/issues", + "source": "https://github.com/ralouphie/getallheaders/tree/develop" + }, + "time": "2019-03-08T08:55:37+00:00" + }, + { + "name": "react/cache", + "version": "v1.2.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Cache\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", + "keywords": [ + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2022-11-30T15:59:55+00:00" + }, + { + "name": "react/child-process", + "version": "v0.6.7", + "source": { + "type": "git", + "url": "https://github.com/reactphp/child-process.git", + "reference": "970f0e71945556422ee4570ccbabaedc3cf04ad3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/child-process/zipball/970f0e71945556422ee4570ccbabaedc3cf04ad3", + "reference": "970f0e71945556422ee4570ccbabaedc3cf04ad3", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/event-loop": "^1.2", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/socket": "^1.16", + "sebastian/environment": "^5.0 || ^3.0 || ^2.0 || ^1.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\ChildProcess\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven library for executing child processes with ReactPHP.", + "keywords": [ + "event-driven", + "process", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/child-process/issues", + "source": "https://github.com/reactphp/child-process/tree/v0.6.7" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-12-23T15:25:20+00:00" + }, + { + "name": "react/dns", + "version": "v1.14.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/dns.git", + "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/dns/zipball/7562c05391f42701c1fccf189c8225fece1cd7c3", + "reference": "7562c05391f42701c1fccf189c8225fece1cd7c3", + "shasum": "" + }, + "require": { + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.7 || ^1.2.1" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3 || ^2", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Dns\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.14.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-11-18T19:34:28+00:00" + }, + { + "name": "react/event-loop", + "version": "v1.6.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/event-loop.git", + "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/ba276bda6083df7e0050fd9b33f66ad7a4ac747a", + "reference": "ba276bda6083df7e0050fd9b33f66ad7a4ac747a", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\EventLoop\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", + "keywords": [ + "asynchronous", + "event-loop" + ], + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.6.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-11-17T20:46:25+00:00" + }, + { + "name": "react/promise", + "version": "v3.3.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/promise.git", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/promise/zipball/23444f53a813a3296c1368bb104793ce8d88f04a", + "reference": "23444f53a813a3296c1368bb104793ce8d88f04a", + "shasum": "" + }, + "require": { + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.12.28 || 1.4.10", + "phpunit/phpunit": "^9.6 || ^7.5" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-08-19T18:57:03+00:00" + }, + { + "name": "react/socket", + "version": "v1.17.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/ef5b17b81f6f60504c539313f94f2d826c5faa08", + "reference": "ef5b17b81f6f60504c539313f94f2d826c5faa08", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.13", + "react/event-loop": "^1.2", + "react/promise": "^3.2 || ^2.6 || ^1.2.1", + "react/stream": "^1.4" + }, + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36", + "react/async": "^4.3 || ^3.3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.11" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Socket\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", + "keywords": [ + "Connection", + "Socket", + "async", + "reactphp", + "stream" + ], + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.17.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2025-11-19T20:47:34+00:00" + }, + { + "name": "react/stream", + "version": "v1.4.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/stream.git", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/stream/zipball/1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "reference": "1e5b0acb8fe55143b5b426817155190eb6f5b18d", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" + }, + "require-dev": { + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" + }, + "type": "library", + "autoload": { + "psr-4": { + "React\\Stream\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", + "keywords": [ + "event-driven", + "io", + "non-blocking", + "pipe", + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2024-06-11T12:45:25+00:00" + }, + { + "name": "sebastian/cli-parser", + "version": "3.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/cli-parser.git", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/15c5dd40dc4f38794d383bb95465193f5e0ae180", + "reference": "15c5dd40dc4f38794d383bb95465193f5e0ae180", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for parsing CLI options", + "homepage": "https://github.com/sebastianbergmann/cli-parser", + "support": { + "issues": "https://github.com/sebastianbergmann/cli-parser/issues", + "security": "https://github.com/sebastianbergmann/cli-parser/security/policy", + "source": "https://github.com/sebastianbergmann/cli-parser/tree/3.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:41:36+00:00" + }, + { + "name": "sebastian/code-unit", + "version": "3.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit.git", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "reference": "54391c61e4af8078e5b276ab082b6d3c54c9ad64", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the PHP code units", + "homepage": "https://github.com/sebastianbergmann/code-unit", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit/issues", + "security": "https://github.com/sebastianbergmann/code-unit/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit/tree/3.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2025-03-19T07:56:08+00:00" + }, + { + "name": "sebastian/code-unit-reverse-lookup", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/183a9b2632194febd219bb9246eee421dad8d45e", + "reference": "183a9b2632194febd219bb9246eee421dad8d45e", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Looks up which function or method a line of code belongs to", + "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", + "support": { + "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues", + "security": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/security/policy", + "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:45:54+00:00" + }, + { + "name": "sebastian/comparator", + "version": "6.3.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/comparator.git", + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", + "reference": "2c95e1e86cb8dd41beb8d502057d1081ccc8eca9", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/diff": "^6.0", + "sebastian/exporter": "^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.4" + }, + "suggest": { + "ext-bcmath": "For comparing BcMath\\Number objects" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@2bepublished.at" + } + ], + "description": "Provides the functionality to compare PHP values for equality", + "homepage": "https://github.com/sebastianbergmann/comparator", + "keywords": [ + "comparator", + "compare", + "equality" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/comparator/issues", + "security": "https://github.com/sebastianbergmann/comparator/security/policy", + "source": "https://github.com/sebastianbergmann/comparator/tree/6.3.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator", + "type": "tidelift" + } + ], + "time": "2026-01-24T09:26:40+00:00" + }, + { + "name": "sebastian/complexity", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/complexity.git", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/ee41d384ab1906c68852636b6de493846e13e5a0", + "reference": "ee41d384ab1906c68852636b6de493846e13e5a0", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for calculating the complexity of PHP code units", + "homepage": "https://github.com/sebastianbergmann/complexity", + "support": { + "issues": "https://github.com/sebastianbergmann/complexity/issues", + "security": "https://github.com/sebastianbergmann/complexity/security/policy", + "source": "https://github.com/sebastianbergmann/complexity/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:49:50+00:00" + }, + { + "name": "sebastian/diff", + "version": "6.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/diff.git", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/b4ccd857127db5d41a5b676f24b51371d76d8544", + "reference": "b4ccd857127db5d41a5b676f24b51371d76d8544", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0", + "symfony/process": "^4.2 || ^5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + } + ], + "description": "Diff implementation", + "homepage": "https://github.com/sebastianbergmann/diff", + "keywords": [ + "diff", + "udiff", + "unidiff", + "unified diff" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/diff/issues", + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/6.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:53:05+00:00" + }, + { + "name": "sebastian/environment", + "version": "7.2.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/environment.git", + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/a5c75038693ad2e8d4b6c15ba2403532647830c4", + "reference": "a5c75038693ad2e8d4b6c15ba2403532647830c4", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.3" + }, + "suggest": { + "ext-posix": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.2-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Provides functionality to handle HHVM/PHP environments", + "homepage": "https://github.com/sebastianbergmann/environment", + "keywords": [ + "Xdebug", + "environment", + "hhvm" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/environment/issues", + "security": "https://github.com/sebastianbergmann/environment/security/policy", + "source": "https://github.com/sebastianbergmann/environment/tree/7.2.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/environment", + "type": "tidelift" + } + ], + "time": "2025-05-21T11:55:47+00:00" + }, + { + "name": "sebastian/exporter", + "version": "6.3.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/exporter.git", + "reference": "70a298763b40b213ec087c51c739efcaa90bcd74" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/70a298763b40b213ec087c51c739efcaa90bcd74", + "reference": "70a298763b40b213ec087c51c739efcaa90bcd74", + "shasum": "" + }, + "require": { + "ext-mbstring": "*", + "php": ">=8.2", + "sebastian/recursion-context": "^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.3-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Volker Dusch", + "email": "github@wallbash.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + }, + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + } + ], + "description": "Provides the functionality to export PHP variables for visualization", + "homepage": "https://www.github.com/sebastianbergmann/exporter", + "keywords": [ + "export", + "exporter" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/exporter/issues", + "security": "https://github.com/sebastianbergmann/exporter/security/policy", + "source": "https://github.com/sebastianbergmann/exporter/tree/6.3.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter", + "type": "tidelift" + } + ], + "time": "2025-09-24T06:12:51+00:00" + }, + { + "name": "sebastian/global-state", + "version": "7.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/global-state.git", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/3be331570a721f9a4b5917f4209773de17f747d7", + "reference": "3be331570a721f9a4b5917f4209773de17f747d7", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" + }, + "require-dev": { + "ext-dom": "*", + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "7.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Snapshotting of global state", + "homepage": "https://www.github.com/sebastianbergmann/global-state", + "keywords": [ + "global state" + ], + "support": { + "issues": "https://github.com/sebastianbergmann/global-state/issues", + "security": "https://github.com/sebastianbergmann/global-state/security/policy", + "source": "https://github.com/sebastianbergmann/global-state/tree/7.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:57:36+00:00" + }, + { + "name": "sebastian/lines-of-code", + "version": "3.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/lines-of-code.git", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "reference": "d36ad0d782e5756913e42ad87cb2890f4ffe467a", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^5.0", + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library for counting the lines of code in PHP source code", + "homepage": "https://github.com/sebastianbergmann/lines-of-code", + "support": { + "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", + "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy", + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/3.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T04:58:38+00:00" + }, + { + "name": "sebastian/object-enumerator", + "version": "6.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-enumerator.git", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/f5b498e631a74204185071eb41f33f38d64608aa", + "reference": "f5b498e631a74204185071eb41f33f38d64608aa", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "sebastian/object-reflector": "^4.0", + "sebastian/recursion-context": "^6.0" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Traverses array structures and object graphs to enumerate all referenced objects", + "homepage": "https://github.com/sebastianbergmann/object-enumerator/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-enumerator/issues", + "security": "https://github.com/sebastianbergmann/object-enumerator/security/policy", + "source": "https://github.com/sebastianbergmann/object-enumerator/tree/6.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:00:13+00:00" + }, + { + "name": "sebastian/object-reflector", + "version": "4.0.1", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/object-reflector.git", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "reference": "6e1a43b411b2ad34146dee7524cb13a068bb35f9", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "4.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + } + ], + "description": "Allows reflection of object attributes, including inherited and non-public ones", + "homepage": "https://github.com/sebastianbergmann/object-reflector/", + "support": { + "issues": "https://github.com/sebastianbergmann/object-reflector/issues", + "security": "https://github.com/sebastianbergmann/object-reflector/security/policy", + "source": "https://github.com/sebastianbergmann/object-reflector/tree/4.0.1" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-07-03T05:01:32+00:00" + }, + { + "name": "sebastian/recursion-context", + "version": "6.0.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/recursion-context.git", + "reference": "f6458abbf32a6c8174f8f26261475dc133b3d9dc" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/f6458abbf32a6c8174f8f26261475dc133b3d9dc", + "reference": "f6458abbf32a6c8174f8f26261475dc133b3d9dc", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "6.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "Jeff Welch", + "email": "whatthejeff@gmail.com" + }, + { + "name": "Adam Harvey", + "email": "aharvey@php.net" + } + ], + "description": "Provides functionality to recursively process PHP variables", + "homepage": "https://github.com/sebastianbergmann/recursion-context", + "support": { + "issues": "https://github.com/sebastianbergmann/recursion-context/issues", + "security": "https://github.com/sebastianbergmann/recursion-context/security/policy", + "source": "https://github.com/sebastianbergmann/recursion-context/tree/6.0.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context", + "type": "tidelift" + } + ], + "time": "2025-08-13T04:42:22+00:00" + }, + { + "name": "sebastian/type", + "version": "5.1.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/type.git", + "reference": "f77d2d4e78738c98d9a68d2596fe5e8fa380f449" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/f77d2d4e78738c98d9a68d2596fe5e8fa380f449", + "reference": "f77d2d4e78738c98d9a68d2596fe5e8fa380f449", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "phpunit/phpunit": "^11.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.1-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Collection of value objects that represent the types of the PHP type system", + "homepage": "https://github.com/sebastianbergmann/type", + "support": { + "issues": "https://github.com/sebastianbergmann/type/issues", + "security": "https://github.com/sebastianbergmann/type/security/policy", + "source": "https://github.com/sebastianbergmann/type/tree/5.1.3" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + }, + { + "url": "https://liberapay.com/sebastianbergmann", + "type": "liberapay" + }, + { + "url": "https://thanks.dev/u/gh/sebastianbergmann", + "type": "thanks_dev" + }, + { + "url": "https://tidelift.com/funding/github/packagist/sebastian/type", + "type": "tidelift" + } + ], + "time": "2025-08-09T06:55:48+00:00" + }, + { + "name": "sebastian/version", + "version": "5.0.2", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/version.git", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c687e3387b99f5b03b6caa64c74b63e2936ff874", + "reference": "c687e3387b99f5b03b6caa64c74b63e2936ff874", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "5.0-dev" + } + }, + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "Library that helps with managing the version number of Git-hosted PHP projects", + "homepage": "https://github.com/sebastianbergmann/version", + "support": { + "issues": "https://github.com/sebastianbergmann/version/issues", + "security": "https://github.com/sebastianbergmann/version/security/policy", + "source": "https://github.com/sebastianbergmann/version/tree/5.0.2" + }, + "funding": [ + { + "url": "https://github.com/sebastianbergmann", + "type": "github" + } + ], + "time": "2024-10-09T05:16:32+00:00" + }, + { + "name": "staabm/side-effects-detector", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/staabm/side-effects-detector.git", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/staabm/side-effects-detector/zipball/d8334211a140ce329c13726d4a715adbddd0a163", + "reference": "d8334211a140ce329c13726d4a715adbddd0a163", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "phpstan/extension-installer": "^1.4.3", + "phpstan/phpstan": "^1.12.6", + "phpunit/phpunit": "^9.6.21", + "symfony/var-dumper": "^5.4.43", + "tomasvotruba/type-coverage": "1.0.0", + "tomasvotruba/unused-public": "1.0.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "lib/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A static analysis tool to detect side effects in PHP code", + "keywords": [ + "static analysis" + ], + "support": { + "issues": "https://github.com/staabm/side-effects-detector/issues", + "source": "https://github.com/staabm/side-effects-detector/tree/1.0.5" + }, + "funding": [ + { + "url": "https://github.com/staabm", + "type": "github" + } + ], + "time": "2024-10-20T05:08:20+00:00" + }, + { + "name": "symfony/console", + "version": "v7.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/732a9ca6cd9dfd940c639062d5edbde2f6727fb6", + "reference": "732a9ca6cd9dfd940c639062d5edbde2f6727fb6", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/polyfill-mbstring": "~1.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^7.2|^8.0" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/dotenv": "<6.4", + "symfony/event-dispatcher": "<6.4", + "symfony/lock": "<6.4", + "symfony/process": "<6.4" + }, + "provide": { + "psr/log-implementation": "1.0|2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0|^8.0", + "symfony/dependency-injection": "^6.4|^7.0|^8.0", + "symfony/event-dispatcher": "^6.4|^7.0|^8.0", + "symfony/http-foundation": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^6.4|^7.0|^8.0", + "symfony/lock": "^6.4|^7.0|^8.0", + "symfony/messenger": "^6.4|^7.0|^8.0", + "symfony/process": "^6.4|^7.0|^8.0", + "symfony/stopwatch": "^6.4|^7.0|^8.0", + "symfony/var-dumper": "^6.4|^7.0|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Console\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Eases the creation of beautiful and testable command line interfaces", + "homepage": "https://symfony.com", + "keywords": [ + "cli", + "command-line", + "console", + "terminal" + ], + "support": { + "source": "https://github.com/symfony/console/tree/v7.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-12-23T14:50:43+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62", + "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" + }, + { + "name": "symfony/event-dispatcher", + "version": "v7.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher.git", + "reference": "9dddcddff1ef974ad87b3708e4b442dc38b2261d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9dddcddff1ef974ad87b3708e4b442dc38b2261d", + "reference": "9dddcddff1ef974ad87b3708e4b442dc38b2261d", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/event-dispatcher-contracts": "^2.5|^3" + }, + "conflict": { + "symfony/dependency-injection": "<6.4", + "symfony/service-contracts": "<2.5" + }, + "provide": { + "psr/event-dispatcher-implementation": "1.0", + "symfony/event-dispatcher-implementation": "2.0|3.0" + }, + "require-dev": { + "psr/log": "^1|^2|^3", + "symfony/config": "^6.4|^7.0|^8.0", + "symfony/dependency-injection": "^6.4|^7.0|^8.0", + "symfony/error-handler": "^6.4|^7.0|^8.0", + "symfony/expression-language": "^6.4|^7.0|^8.0", + "symfony/framework-bundle": "^6.4|^7.0|^8.0", + "symfony/http-foundation": "^6.4|^7.0|^8.0", + "symfony/service-contracts": "^2.5|^3", + "symfony/stopwatch": "^6.4|^7.0|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\EventDispatcher\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/event-dispatcher/tree/v7.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-10-28T09:38:46+00:00" + }, + { + "name": "symfony/event-dispatcher-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/event-dispatcher-contracts.git", + "reference": "59eb412e93815df44f05f342958efa9f46b1e586" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/59eb412e93815df44f05f342958efa9f46b1e586", + "reference": "59eb412e93815df44f05f342958efa9f46b1e586", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/event-dispatcher": "^1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\EventDispatcher\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to dispatching event", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-25T14:21:43+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v7.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "d551b38811096d0be9c4691d406991b47c0c630a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/d551b38811096d0be9c4691d406991b47c0c630a", + "reference": "d551b38811096d0be9c4691d406991b47c0c630a", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { + "symfony/process": "^6.4|^7.0|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides basic utilities for the filesystem", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/filesystem/tree/v7.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-11-27T13:27:24+00:00" + }, + { + "name": "symfony/finder", + "version": "v7.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/finder.git", + "reference": "fffe05569336549b20a1be64250b40516d6e8d06" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/finder/zipball/fffe05569336549b20a1be64250b40516d6e8d06", + "reference": "fffe05569336549b20a1be64250b40516d6e8d06", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "require-dev": { + "symfony/filesystem": "^6.4|^7.0|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Finder\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Finds files and directories via an intuitive fluent interface", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/finder/tree/v7.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-12-23T14:50:43+00:00" + }, + { + "name": "symfony/http-client", + "version": "v7.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client.git", + "reference": "d01dfac1e0dc99f18da48b18101c23ce57929616" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client/zipball/d01dfac1e0dc99f18da48b18101c23ce57929616", + "reference": "d01dfac1e0dc99f18da48b18101c23ce57929616", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "psr/log": "^1|^2|^3", + "symfony/deprecation-contracts": "^2.5|^3", + "symfony/http-client-contracts": "~3.4.4|^3.5.2", + "symfony/polyfill-php83": "^1.29", + "symfony/service-contracts": "^2.5|^3" + }, + "conflict": { + "amphp/amp": "<2.5", + "amphp/socket": "<1.1", + "php-http/discovery": "<1.15", + "symfony/http-foundation": "<6.4" + }, + "provide": { + "php-http/async-client-implementation": "*", + "php-http/client-implementation": "*", + "psr/http-client-implementation": "1.0", + "symfony/http-client-implementation": "3.0" + }, + "require-dev": { + "amphp/http-client": "^4.2.1|^5.0", + "amphp/http-tunnel": "^1.0|^2.0", + "guzzlehttp/promises": "^1.4|^2.0", + "nyholm/psr7": "^1.0", + "php-http/httplug": "^1.0|^2.0", + "psr/http-client": "^1.0", + "symfony/amphp-http-client-meta": "^1.0|^2.0", + "symfony/cache": "^6.4|^7.0|^8.0", + "symfony/dependency-injection": "^6.4|^7.0|^8.0", + "symfony/http-kernel": "^6.4|^7.0|^8.0", + "symfony/messenger": "^6.4|^7.0|^8.0", + "symfony/process": "^6.4|^7.0|^8.0", + "symfony/rate-limiter": "^6.4|^7.0|^8.0", + "symfony/stopwatch": "^6.4|^7.0|^8.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides powerful methods to fetch HTTP resources synchronously or asynchronously", + "homepage": "https://symfony.com", + "keywords": [ + "http" + ], + "support": { + "source": "https://github.com/symfony/http-client/tree/v7.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-12-23T14:50:43+00:00" + }, + { + "name": "symfony/http-client-contracts", + "version": "v3.6.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/http-client-contracts.git", + "reference": "75d7043853a42837e68111812f4d964b01e5101c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/http-client-contracts/zipball/75d7043853a42837e68111812f4d964b01e5101c", + "reference": "75d7043853a42837e68111812f4d964b01e5101c", + "shasum": "" + }, + "require": { + "php": ">=8.1" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\HttpClient\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to HTTP clients", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/http-client-contracts/tree/v3.6.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-04-29T11:18:49+00:00" + }, + { + "name": "symfony/options-resolver", + "version": "v7.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/options-resolver.git", + "reference": "b38026df55197f9e39a44f3215788edf83187b80" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/b38026df55197f9e39a44f3215788edf83187b80", + "reference": "b38026df55197f9e39a44f3215788edf83187b80", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\OptionsResolver\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an improved replacement for the array_replace PHP function", + "homepage": "https://symfony.com", + "keywords": [ + "config", + "configuration", + "options" + ], + "support": { + "source": "https://github.com/symfony/options-resolver/tree/v7.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-11-12T15:39:26+00:00" + }, + { + "name": "symfony/polyfill-ctype", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-ctype.git", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" + }, + "suggest": { + "ext-ctype": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Gert de Pagter", + "email": "BackEndTea@gmail.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for ctype functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "ctype", + "polyfill", + "portable" + ], + "support": { + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-intl-grapheme", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-grapheme.git", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/380872130d3a5dd3ace2f4010d95125fde5d5c70", + "reference": "380872130d3a5dd3ace2f4010d95125fde5d5c70", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's grapheme_* functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "grapheme", + "intl", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-27T09:58:17+00:00" + }, + { + "name": "symfony/polyfill-intl-normalizer", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-intl-normalizer.git", + "reference": "3833d7255cc303546435cb650316bff708a1c75c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "suggest": { + "ext-intl": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for intl's Normalizer class and related functions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "intl", + "normalizer", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/6d857f4d76bd4b343eac26d6b539585d2bc56493", + "reference": "6d857f4d76bd4b343eac26d6b539585d2bc56493", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" + }, + "suggest": { + "ext-mbstring": "For best performance" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill for the Mbstring extension", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "mbstring", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-12-23T08:48:59+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-01-02T08:10:11+00:00" + }, + { + "name": "symfony/polyfill-php81", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php81\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php81/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-09-09T11:45:10+00:00" + }, + { + "name": "symfony/polyfill-php83", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php83.git", + "reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/17f6f9a6b1735c0f163024d959f700cfbc5155e5", + "reference": "17f6f9a6b1735c0f163024d959f700cfbc5155e5", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php83\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.3+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php83/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-07-08T02:45:35+00:00" + }, + { + "name": "symfony/polyfill-php84", + "version": "v1.33.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/d8ced4d875142b6a7426000426b8abc631d6b191", + "reference": "d8ced4d875142b6a7426000426b8abc631d6b191", + "shasum": "" + }, + "require": { + "php": ">=7.2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "support": { + "source": "https://github.com/symfony/polyfill-php84/tree/v1.33.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-06-24T13:30:11+00:00" + }, + { + "name": "symfony/process", + "version": "v7.4.3", + "source": { + "type": "git", + "url": "https://github.com/symfony/process.git", + "reference": "2f8e1a6cdf590ca63715da4d3a7a3327404a523f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/process/zipball/2f8e1a6cdf590ca63715da4d3a7a3327404a523f", + "reference": "2f8e1a6cdf590ca63715da4d3a7a3327404a523f", + "shasum": "" + }, + "require": { + "php": ">=8.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Process\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Executes commands in sub-processes", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/process/tree/v7.4.3" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-12-19T10:00:43+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v3.6.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/45112560a3ba2d715666a509a0bc9521d10b6c43", + "reference": "45112560a3ba2d715666a509a0bc9521d10b6c43", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "type": "library", + "extra": { + "thanks": { + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.6-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + }, + "exclude-from-classmap": [ + "/Test/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "support": { + "source": "https://github.com/symfony/service-contracts/tree/v3.6.1" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-07-15T11:30:57+00:00" + }, + { + "name": "symfony/stopwatch", + "version": "v7.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "8a24af0a2e8a872fb745047180649b8418303084" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/8a24af0a2e8a872fb745047180649b8418303084", + "reference": "8a24af0a2e8a872fb745047180649b8418303084", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/service-contracts": "^2.5|^3" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides a way to profile code", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/stopwatch/tree/v7.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-08-04T07:05:15+00:00" + }, + { + "name": "symfony/string", + "version": "v7.4.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/string.git", + "reference": "d50e862cb0a0e0886f73ca1f31b865efbb795003" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/string/zipball/d50e862cb0a0e0886f73ca1f31b865efbb795003", + "reference": "d50e862cb0a0e0886f73ca1f31b865efbb795003", + "shasum": "" + }, + "require": { + "php": ">=8.2", + "symfony/deprecation-contracts": "^2.5|^3.0", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-intl-grapheme": "~1.33", + "symfony/polyfill-intl-normalizer": "~1.0", + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" + }, + "require-dev": { + "symfony/emoji": "^7.1|^8.0", + "symfony/http-client": "^6.4|^7.0|^8.0", + "symfony/intl": "^6.4|^7.0|^8.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^6.4|^7.0|^8.0" + }, + "type": "library", + "autoload": { + "files": [ + "Resources/functions.php" + ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way", + "homepage": "https://symfony.com", + "keywords": [ + "grapheme", + "i18n", + "string", + "unicode", + "utf-8", + "utf8" + ], + "support": { + "source": "https://github.com/symfony/string/tree/v7.4.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2025-11-27T13:27:24+00:00" + }, + { + "name": "ta-tikoma/phpunit-architecture-test", + "version": "0.8.5", + "source": { + "type": "git", + "url": "https://github.com/ta-tikoma/phpunit-architecture-test.git", + "reference": "cf6fb197b676ba716837c886baca842e4db29005" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/ta-tikoma/phpunit-architecture-test/zipball/cf6fb197b676ba716837c886baca842e4db29005", + "reference": "cf6fb197b676ba716837c886baca842e4db29005", + "shasum": "" + }, + "require": { + "nikic/php-parser": "^4.18.0 || ^5.0.0", + "php": "^8.1.0", + "phpdocumentor/reflection-docblock": "^5.3.0", + "phpunit/phpunit": "^10.5.5 || ^11.0.0 || ^12.0.0", + "symfony/finder": "^6.4.0 || ^7.0.0" + }, + "require-dev": { + "laravel/pint": "^1.13.7", + "phpstan/phpstan": "^1.10.52" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPUnit\\Architecture\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ni Shi", + "email": "futik0ma011@gmail.com" + }, + { + "name": "Nuno Maduro", + "email": "enunomaduro@gmail.com" + } + ], + "description": "Methods for testing application architecture", + "keywords": [ + "architecture", + "phpunit", + "stucture", + "test", + "testing" + ], + "support": { + "issues": "https://github.com/ta-tikoma/phpunit-architecture-test/issues", + "source": "https://github.com/ta-tikoma/phpunit-architecture-test/tree/0.8.5" + }, + "time": "2025-04-20T20:23:40+00:00" + }, + { + "name": "theseer/tokenizer", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/theseer/tokenizer.git", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c", + "reference": "b7489ce515e168639d17feec34b8847c326b0b3c", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": "^7.2 || ^8.0" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Arne Blankerts", + "email": "arne@blankerts.de", + "role": "Developer" + } + ], + "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", + "support": { + "issues": "https://github.com/theseer/tokenizer/issues", + "source": "https://github.com/theseer/tokenizer/tree/1.3.1" + }, + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2025-11-17T20:03:58+00:00" + }, + { + "name": "webmozart/assert", + "version": "2.1.1", + "source": { + "type": "git", + "url": "https://github.com/webmozarts/assert.git", + "reference": "bdbabc199a7ba9965484e4725d66170e5711323b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/bdbabc199a7ba9965484e4725d66170e5711323b", + "reference": "bdbabc199a7ba9965484e4725d66170e5711323b", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-date": "*", + "ext-filter": "*", + "php": "^8.2" + }, + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-feature/2-0": "2.0-dev" + } + }, + "autoload": { + "psr-4": { + "Webmozart\\Assert\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Bernhard Schussek", + "email": "bschussek@gmail.com" + }, + { + "name": "Woody Gilk", + "email": "woody.gilk@gmail.com" + } + ], + "description": "Assertions to validate method input/output with nice error messages.", + "keywords": [ + "assert", + "check", + "validate" + ], + "support": { + "issues": "https://github.com/webmozarts/assert/issues", + "source": "https://github.com/webmozarts/assert/tree/2.1.1" + }, + "time": "2026-01-08T11:28:40+00:00" + } + ], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": {}, + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": "^8.1" + }, + "platform-dev": {}, + "platform-overrides": { + "php": "8.3" + }, + "plugin-api-version": "2.6.0" +} diff --git a/phpstan.dist.neon b/phpstan.dist.neon new file mode 100644 index 00000000..1cdf47d8 --- /dev/null +++ b/phpstan.dist.neon @@ -0,0 +1,14 @@ +parameters: + level: max + phpVersion: + min: 80100 + max: 80499 + paths: + - src + - tests + ignoreErrors: + - identifier: parameter.defaultValue + - identifier: trait.unused + - identifier: property.onlyWritten + + reportUnmatchedIgnoredErrors: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 00000000..41860103 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + ./src + + + + + ./tests + + + diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 00000000..83bea623 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,67 @@ +{ + "packages": { + ".": {} + }, + "$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json", + "include-v-in-tag": true, + "include-component-in-tag": false, + "versioning": "prerelease", + "prerelease": true, + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": false, + "pull-request-header": "Automated Release PR", + "pull-request-title-pattern": "release: ${version}", + "changelog-sections": [ + { + "type": "feat", + "section": "Features" + }, + { + "type": "fix", + "section": "Bug Fixes" + }, + { + "type": "perf", + "section": "Performance Improvements" + }, + { + "type": "revert", + "section": "Reverts" + }, + { + "type": "chore", + "section": "Chores" + }, + { + "type": "docs", + "section": "Documentation" + }, + { + "type": "style", + "section": "Styles" + }, + { + "type": "refactor", + "section": "Refactors" + }, + { + "type": "test", + "section": "Tests", + "hidden": true + }, + { + "type": "build", + "section": "Build System" + }, + { + "type": "ci", + "section": "Continuous Integration", + "hidden": true + } + ], + "release-type": "php", + "extra-files": [ + "README.md", + "src/Version.php" + ] +} \ No newline at end of file diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 00000000..0010226e --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Running composer install" +exec -- composer install --no-interaction diff --git a/scripts/clean b/scripts/clean new file mode 100755 index 00000000..5d9a765b --- /dev/null +++ b/scripts/clean @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Cleaning up..." +exec -- rm -fr -- ./vendor/ ./.php-cs-fixer.cache diff --git a/scripts/format b/scripts/format new file mode 100755 index 00000000..8e633516 --- /dev/null +++ b/scripts/format @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Running php-cs-fixer" +exec -- ./vendor/bin/php-cs-fixer fix diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 00000000..211ce906 --- /dev/null +++ b/scripts/lint @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd -- "$(dirname -- "$0")/.." + +echo "==> Running PHPStan" +exec -- ./vendor/bin/phpstan analyse --memory-limit=12G diff --git a/scripts/test b/scripts/test new file mode 100755 index 00000000..63df1370 --- /dev/null +++ b/scripts/test @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + + + +exec -- ./vendor/bin/pest --colors=always diff --git a/src/AI/AIAIQueryParams.php b/src/AI/AIAIQueryParams.php new file mode 100644 index 00000000..16a3684a --- /dev/null +++ b/src/AI/AIAIQueryParams.php @@ -0,0 +1,153 @@ +, + * domain: string, + * specificPages?: null|SpecificPages|SpecificPagesShape, + * timeoutMs?: int|null, + * } + */ +final class AIAIQueryParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Array of data points to extract from the website. + * + * @var list $dataToExtract + */ + #[Required('data_to_extract', list: DataToExtract::class)] + public array $dataToExtract; + + /** + * The domain name to analyze. + */ + #[Required] + public string $domain; + + /** + * Optional object specifying which pages to analyze. + */ + #[Optional('specific_pages')] + public ?SpecificPages $specificPages; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * `new AIAIQueryParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AIAIQueryParams::with(dataToExtract: ..., domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AIAIQueryParams)->withDataToExtract(...)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $dataToExtract + * @param SpecificPages|SpecificPagesShape|null $specificPages + */ + public static function with( + array $dataToExtract, + string $domain, + SpecificPages|array|null $specificPages = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['dataToExtract'] = $dataToExtract; + $self['domain'] = $domain; + + null !== $specificPages && $self['specificPages'] = $specificPages; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Array of data points to extract from the website. + * + * @param list $dataToExtract + */ + public function withDataToExtract(array $dataToExtract): self + { + $self = clone $this; + $self['dataToExtract'] = $dataToExtract; + + return $self; + } + + /** + * The domain name to analyze. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Optional object specifying which pages to analyze. + * + * @param SpecificPages|SpecificPagesShape $specificPages + */ + public function withSpecificPages(SpecificPages|array $specificPages): self + { + $self = clone $this; + $self['specificPages'] = $specificPages; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/AI/AIAIQueryParams/DataToExtract.php b/src/AI/AIAIQueryParams/DataToExtract.php new file mode 100644 index 00000000..1678796f --- /dev/null +++ b/src/AI/AIAIQueryParams/DataToExtract.php @@ -0,0 +1,203 @@ +, + * datapointListType?: null|DatapointListType|value-of, + * datapointObjectSchema?: array>|null, + * } + */ +final class DataToExtract implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Description of what to extract. + */ + #[Required('datapoint_description')] + public string $datapointDescription; + + /** + * Example of the expected value. + */ + #[Required('datapoint_example')] + public string $datapointExample; + + /** + * Name of the data point to extract. + */ + #[Required('datapoint_name')] + public string $datapointName; + + /** + * Type of the data point. + * + * @var value-of $datapointType + */ + #[Required('datapoint_type', enum: DatapointType::class)] + public string $datapointType; + + /** + * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. Use 'object' to extract an array of objects matching a schema. + * + * @var value-of|null $datapointListType + */ + #[Optional('datapoint_list_type', enum: DatapointListType::class)] + public ?string $datapointListType; + + /** + * Schema definition for objects when datapoint_list_type is 'object'. Provide a map of field names to their scalar types. + * + * @var array>|null $datapointObjectSchema + */ + #[Optional('datapoint_object_schema', map: DatapointObjectSchema::class)] + public ?array $datapointObjectSchema; + + /** + * `new DataToExtract()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * DataToExtract::with( + * datapointDescription: ..., + * datapointExample: ..., + * datapointName: ..., + * datapointType: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new DataToExtract) + * ->withDatapointDescription(...) + * ->withDatapointExample(...) + * ->withDatapointName(...) + * ->withDatapointType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param DatapointType|value-of $datapointType + * @param DatapointListType|value-of|null $datapointListType + * @param array>|null $datapointObjectSchema + */ + public static function with( + string $datapointDescription, + string $datapointExample, + string $datapointName, + DatapointType|string $datapointType, + DatapointListType|string|null $datapointListType = null, + ?array $datapointObjectSchema = null, + ): self { + $self = new self; + + $self['datapointDescription'] = $datapointDescription; + $self['datapointExample'] = $datapointExample; + $self['datapointName'] = $datapointName; + $self['datapointType'] = $datapointType; + + null !== $datapointListType && $self['datapointListType'] = $datapointListType; + null !== $datapointObjectSchema && $self['datapointObjectSchema'] = $datapointObjectSchema; + + return $self; + } + + /** + * Description of what to extract. + */ + public function withDatapointDescription(string $datapointDescription): self + { + $self = clone $this; + $self['datapointDescription'] = $datapointDescription; + + return $self; + } + + /** + * Example of the expected value. + */ + public function withDatapointExample(string $datapointExample): self + { + $self = clone $this; + $self['datapointExample'] = $datapointExample; + + return $self; + } + + /** + * Name of the data point to extract. + */ + public function withDatapointName(string $datapointName): self + { + $self = clone $this; + $self['datapointName'] = $datapointName; + + return $self; + } + + /** + * Type of the data point. + * + * @param DatapointType|value-of $datapointType + */ + public function withDatapointType(DatapointType|string $datapointType): self + { + $self = clone $this; + $self['datapointType'] = $datapointType; + + return $self; + } + + /** + * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. Use 'object' to extract an array of objects matching a schema. + * + * @param DatapointListType|value-of $datapointListType + */ + public function withDatapointListType( + DatapointListType|string $datapointListType + ): self { + $self = clone $this; + $self['datapointListType'] = $datapointListType; + + return $self; + } + + /** + * Schema definition for objects when datapoint_list_type is 'object'. Provide a map of field names to their scalar types. + * + * @param array> $datapointObjectSchema + */ + public function withDatapointObjectSchema( + array $datapointObjectSchema + ): self { + $self = clone $this; + $self['datapointObjectSchema'] = $datapointObjectSchema; + + return $self; + } +} diff --git a/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php b/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php new file mode 100644 index 00000000..940605fb --- /dev/null +++ b/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php @@ -0,0 +1,27 @@ + */ + use SdkModel; + + /** + * Whether to analyze the about us page. + */ + #[Optional('about_us')] + public ?bool $aboutUs; + + /** + * Whether to analyze the blog. + */ + #[Optional] + public ?bool $blog; + + /** + * Whether to analyze the careers page. + */ + #[Optional] + public ?bool $careers; + + /** + * Whether to analyze the contact us page. + */ + #[Optional('contact_us')] + public ?bool $contactUs; + + /** + * Whether to analyze the FAQ page. + */ + #[Optional] + public ?bool $faq; + + /** + * Whether to analyze the home page. + */ + #[Optional('home_page')] + public ?bool $homePage; + + /** + * Whether to analyze the pricing page. + */ + #[Optional] + public ?bool $pricing; + + /** + * Whether to analyze the privacy policy page. + */ + #[Optional('privacy_policy')] + public ?bool $privacyPolicy; + + /** + * Whether to analyze the terms and conditions page. + */ + #[Optional('terms_and_conditions')] + public ?bool $termsAndConditions; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?bool $aboutUs = null, + ?bool $blog = null, + ?bool $careers = null, + ?bool $contactUs = null, + ?bool $faq = null, + ?bool $homePage = null, + ?bool $pricing = null, + ?bool $privacyPolicy = null, + ?bool $termsAndConditions = null, + ): self { + $self = new self; + + null !== $aboutUs && $self['aboutUs'] = $aboutUs; + null !== $blog && $self['blog'] = $blog; + null !== $careers && $self['careers'] = $careers; + null !== $contactUs && $self['contactUs'] = $contactUs; + null !== $faq && $self['faq'] = $faq; + null !== $homePage && $self['homePage'] = $homePage; + null !== $pricing && $self['pricing'] = $pricing; + null !== $privacyPolicy && $self['privacyPolicy'] = $privacyPolicy; + null !== $termsAndConditions && $self['termsAndConditions'] = $termsAndConditions; + + return $self; + } + + /** + * Whether to analyze the about us page. + */ + public function withAboutUs(bool $aboutUs): self + { + $self = clone $this; + $self['aboutUs'] = $aboutUs; + + return $self; + } + + /** + * Whether to analyze the blog. + */ + public function withBlog(bool $blog): self + { + $self = clone $this; + $self['blog'] = $blog; + + return $self; + } + + /** + * Whether to analyze the careers page. + */ + public function withCareers(bool $careers): self + { + $self = clone $this; + $self['careers'] = $careers; + + return $self; + } + + /** + * Whether to analyze the contact us page. + */ + public function withContactUs(bool $contactUs): self + { + $self = clone $this; + $self['contactUs'] = $contactUs; + + return $self; + } + + /** + * Whether to analyze the FAQ page. + */ + public function withFaq(bool $faq): self + { + $self = clone $this; + $self['faq'] = $faq; + + return $self; + } + + /** + * Whether to analyze the home page. + */ + public function withHomePage(bool $homePage): self + { + $self = clone $this; + $self['homePage'] = $homePage; + + return $self; + } + + /** + * Whether to analyze the pricing page. + */ + public function withPricing(bool $pricing): self + { + $self = clone $this; + $self['pricing'] = $pricing; + + return $self; + } + + /** + * Whether to analyze the privacy policy page. + */ + public function withPrivacyPolicy(bool $privacyPolicy): self + { + $self = clone $this; + $self['privacyPolicy'] = $privacyPolicy; + + return $self; + } + + /** + * Whether to analyze the terms and conditions page. + */ + public function withTermsAndConditions(bool $termsAndConditions): self + { + $self = clone $this; + $self['termsAndConditions'] = $termsAndConditions; + + return $self; + } +} diff --git a/src/AI/AIAIQueryResponse.php b/src/AI/AIAIQueryResponse.php new file mode 100644 index 00000000..0ef34b18 --- /dev/null +++ b/src/AI/AIAIQueryResponse.php @@ -0,0 +1,156 @@ +|null, + * domain?: string|null, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * status?: string|null, + * urlsAnalyzed?: list|null, + * } + */ +final class AIAIQueryResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of extracted data points. + * + * @var list|null $dataExtracted + */ + #[Optional('data_extracted', list: DataExtracted::class)] + public ?array $dataExtracted; + + /** + * The domain that was analyzed. + */ + #[Optional] + public ?string $domain; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + /** + * List of URLs that were analyzed. + * + * @var list|null $urlsAnalyzed + */ + #[Optional('urls_analyzed', list: 'string')] + public ?array $urlsAnalyzed; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $dataExtracted + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + * @param list|null $urlsAnalyzed + */ + public static function with( + ?array $dataExtracted = null, + ?string $domain = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ?array $urlsAnalyzed = null, + ): self { + $self = new self; + + null !== $dataExtracted && $self['dataExtracted'] = $dataExtracted; + null !== $domain && $self['domain'] = $domain; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + null !== $urlsAnalyzed && $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } + + /** + * Array of extracted data points. + * + * @param list $dataExtracted + */ + public function withDataExtracted(array $dataExtracted): self + { + $self = clone $this; + $self['dataExtracted'] = $dataExtracted; + + return $self; + } + + /** + * The domain that was analyzed. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * List of URLs that were analyzed. + * + * @param list $urlsAnalyzed + */ + public function withURLsAnalyzed(array $urlsAnalyzed): self + { + $self = clone $this; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } +} diff --git a/src/AI/AIAIQueryResponse/DataExtracted.php b/src/AI/AIAIQueryResponse/DataExtracted.php new file mode 100644 index 00000000..f99ac9af --- /dev/null +++ b/src/AI/AIAIQueryResponse/DataExtracted.php @@ -0,0 +1,87 @@ + */ + use SdkModel; + + /** + * Name of the extracted data point. + */ + #[Optional('datapoint_name')] + public ?string $datapointName; + + /** + * Value of the extracted data point. Can be a primitive type, an array of primitives, or an array of objects when datapoint_list_type is 'object'. + * + * @var DatapointValueVariants|null $datapointValue + */ + #[Optional('datapoint_value', union: DatapointValue::class)] + public string|float|bool|array|null $datapointValue; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param DatapointValueShape|null $datapointValue + */ + public static function with( + ?string $datapointName = null, + string|float|bool|array|null $datapointValue = null + ): self { + $self = new self; + + null !== $datapointName && $self['datapointName'] = $datapointName; + null !== $datapointValue && $self['datapointValue'] = $datapointValue; + + return $self; + } + + /** + * Name of the extracted data point. + */ + public function withDatapointName(string $datapointName): self + { + $self = clone $this; + $self['datapointName'] = $datapointName; + + return $self; + } + + /** + * Value of the extracted data point. Can be a primitive type, an array of primitives, or an array of objects when datapoint_list_type is 'object'. + * + * @param DatapointValueShape $datapointValue + */ + public function withDatapointValue( + string|float|bool|array $datapointValue + ): self { + $self = clone $this; + $self['datapointValue'] = $datapointValue; + + return $self; + } +} diff --git a/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php b/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php new file mode 100644 index 00000000..e312347e --- /dev/null +++ b/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php @@ -0,0 +1,36 @@ +|list|list + * @phpstan-type DatapointValueShape = DatapointValueVariants + */ +final class DatapointValue implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return [ + 'string', + 'float', + 'bool', + new ListOf('string'), + new ListOf('float'), + new ListOf('mixed'), + ]; + } +} diff --git a/src/AI/AIAIQueryResponse/KeyMetadata.php b/src/AI/AIAIQueryResponse/KeyMetadata.php new file mode 100644 index 00000000..e4568c26 --- /dev/null +++ b/src/AI/AIAIQueryResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/AI/AIExtractProductParams.php b/src/AI/AIExtractProductParams.php new file mode 100644 index 00000000..52baa9b8 --- /dev/null +++ b/src/AI/AIExtractProductParams.php @@ -0,0 +1,117 @@ + */ + use SdkModel; + use SdkParams; + + /** + * The product page URL to extract product data from. + */ + #[Required] + public string $url; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * `new AIExtractProductParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AIExtractProductParams::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AIExtractProductParams)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?int $maxAgeMs = null, + ?int $timeoutMs = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * The product page URL to extract product data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/AI/AIExtractProductResponse.php b/src/AI/AIExtractProductResponse.php new file mode 100644 index 00000000..07f9605a --- /dev/null +++ b/src/AI/AIExtractProductResponse.php @@ -0,0 +1,135 @@ +, + * product?: null|Product|ProductShape, + * } + */ +final class AIExtractProductResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Whether the given URL is a product detail page. + */ + #[Optional('is_product_page')] + public ?bool $isProductPage; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * The detected ecommerce platform, or null if not a product page. + * + * @var value-of|null $platform + */ + #[Optional(enum: Platform::class, nullable: true)] + public ?string $platform; + + /** + * The extracted product data, or null if not a product page. + */ + #[Optional(nullable: true)] + public ?Product $product; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + * @param Platform|value-of|null $platform + * @param Product|ProductShape|null $product + */ + public static function with( + ?bool $isProductPage = null, + KeyMetadata|array|null $keyMetadata = null, + Platform|string|null $platform = null, + Product|array|null $product = null, + ): self { + $self = new self; + + null !== $isProductPage && $self['isProductPage'] = $isProductPage; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $platform && $self['platform'] = $platform; + null !== $product && $self['product'] = $product; + + return $self; + } + + /** + * Whether the given URL is a product detail page. + */ + public function withIsProductPage(bool $isProductPage): self + { + $self = clone $this; + $self['isProductPage'] = $isProductPage; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * The detected ecommerce platform, or null if not a product page. + * + * @param Platform|value-of|null $platform + */ + public function withPlatform(Platform|string|null $platform): self + { + $self = clone $this; + $self['platform'] = $platform; + + return $self; + } + + /** + * The extracted product data, or null if not a product page. + * + * @param Product|ProductShape|null $product + */ + public function withProduct(Product|array|null $product): self + { + $self = clone $this; + $self['product'] = $product; + + return $self; + } +} diff --git a/src/AI/AIExtractProductResponse/KeyMetadata.php b/src/AI/AIExtractProductResponse/KeyMetadata.php new file mode 100644 index 00000000..e2e691dc --- /dev/null +++ b/src/AI/AIExtractProductResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/AI/AIExtractProductResponse/Platform.php b/src/AI/AIExtractProductResponse/Platform.php new file mode 100644 index 00000000..9d6bd0ef --- /dev/null +++ b/src/AI/AIExtractProductResponse/Platform.php @@ -0,0 +1,19 @@ +, + * images: list, + * name: string, + * sku: string|null, + * tags: list, + * targetAudience: list, + * billingFrequency?: null|BillingFrequency|value-of, + * category?: string|null, + * currency?: string|null, + * imageURL?: string|null, + * price?: float|null, + * pricingModel?: null|PricingModel|value-of, + * url?: string|null, + * } + */ +final class Product implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Description of the product. + */ + #[Required] + public string $description; + + /** + * List of product features. + * + * @var list $features + */ + #[Required(list: 'string')] + public array $features; + + /** + * URLs to product images on the page (up to 7). + * + * @var list $images + */ + #[Required(list: 'string')] + public array $images; + + /** + * Name of the product. + */ + #[Required] + public string $name; + + /** + * Stock Keeping Unit (product identifier). Null if no identifier is found. + */ + #[Required] + public ?string $sku; + + /** + * Tags associated with the product. + * + * @var list $tags + */ + #[Required(list: 'string')] + public array $tags; + + /** + * Target audience for the product (array of strings). + * + * @var list $targetAudience + */ + #[Required('target_audience', list: 'string')] + public array $targetAudience; + + /** + * Billing frequency for the product. + * + * @var value-of|null $billingFrequency + */ + #[Optional( + 'billing_frequency', + enum: BillingFrequency::class, + nullable: true + )] + public ?string $billingFrequency; + + /** + * Category of the product. + */ + #[Optional(nullable: true)] + public ?string $category; + + /** + * Currency code for the price (e.g., USD, EUR). + */ + #[Optional(nullable: true)] + public ?string $currency; + + /** + * URL to the product image. + */ + #[Optional('image_url', nullable: true)] + public ?string $imageURL; + + /** + * Price of the product. + */ + #[Optional(nullable: true)] + public ?float $price; + + /** + * Pricing model for the product. + * + * @var value-of|null $pricingModel + */ + #[Optional('pricing_model', enum: PricingModel::class, nullable: true)] + public ?string $pricingModel; + + /** + * URL to the product page. + */ + #[Optional(nullable: true)] + public ?string $url; + + /** + * `new Product()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Product::with( + * description: ..., + * features: ..., + * images: ..., + * name: ..., + * sku: ..., + * tags: ..., + * targetAudience: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Product) + * ->withDescription(...) + * ->withFeatures(...) + * ->withImages(...) + * ->withName(...) + * ->withSKU(...) + * ->withTags(...) + * ->withTargetAudience(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $features + * @param list $images + * @param list $tags + * @param list $targetAudience + * @param BillingFrequency|value-of|null $billingFrequency + * @param PricingModel|value-of|null $pricingModel + */ + public static function with( + string $description, + array $features, + array $images, + string $name, + ?string $sku, + array $tags, + array $targetAudience, + BillingFrequency|string|null $billingFrequency = null, + ?string $category = null, + ?string $currency = null, + ?string $imageURL = null, + ?float $price = null, + PricingModel|string|null $pricingModel = null, + ?string $url = null, + ): self { + $self = new self; + + $self['description'] = $description; + $self['features'] = $features; + $self['images'] = $images; + $self['name'] = $name; + $self['sku'] = $sku; + $self['tags'] = $tags; + $self['targetAudience'] = $targetAudience; + + null !== $billingFrequency && $self['billingFrequency'] = $billingFrequency; + null !== $category && $self['category'] = $category; + null !== $currency && $self['currency'] = $currency; + null !== $imageURL && $self['imageURL'] = $imageURL; + null !== $price && $self['price'] = $price; + null !== $pricingModel && $self['pricingModel'] = $pricingModel; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Description of the product. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * List of product features. + * + * @param list $features + */ + public function withFeatures(array $features): self + { + $self = clone $this; + $self['features'] = $features; + + return $self; + } + + /** + * URLs to product images on the page (up to 7). + * + * @param list $images + */ + public function withImages(array $images): self + { + $self = clone $this; + $self['images'] = $images; + + return $self; + } + + /** + * Name of the product. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Stock Keeping Unit (product identifier). Null if no identifier is found. + */ + public function withSKU(?string $sku): self + { + $self = clone $this; + $self['sku'] = $sku; + + return $self; + } + + /** + * Tags associated with the product. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * Target audience for the product (array of strings). + * + * @param list $targetAudience + */ + public function withTargetAudience(array $targetAudience): self + { + $self = clone $this; + $self['targetAudience'] = $targetAudience; + + return $self; + } + + /** + * Billing frequency for the product. + * + * @param BillingFrequency|value-of|null $billingFrequency + */ + public function withBillingFrequency( + BillingFrequency|string|null $billingFrequency + ): self { + $self = clone $this; + $self['billingFrequency'] = $billingFrequency; + + return $self; + } + + /** + * Category of the product. + */ + public function withCategory(?string $category): self + { + $self = clone $this; + $self['category'] = $category; + + return $self; + } + + /** + * Currency code for the price (e.g., USD, EUR). + */ + public function withCurrency(?string $currency): self + { + $self = clone $this; + $self['currency'] = $currency; + + return $self; + } + + /** + * URL to the product image. + */ + public function withImageURL(?string $imageURL): self + { + $self = clone $this; + $self['imageURL'] = $imageURL; + + return $self; + } + + /** + * Price of the product. + */ + public function withPrice(?float $price): self + { + $self = clone $this; + $self['price'] = $price; + + return $self; + } + + /** + * Pricing model for the product. + * + * @param PricingModel|value-of|null $pricingModel + */ + public function withPricingModel( + PricingModel|string|null $pricingModel + ): self { + $self = clone $this; + $self['pricingModel'] = $pricingModel; + + return $self; + } + + /** + * URL to the product page. + */ + public function withURL(?string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/AI/AIExtractProductResponse/Product/BillingFrequency.php b/src/AI/AIExtractProductResponse/Product/BillingFrequency.php new file mode 100644 index 00000000..eb65da20 --- /dev/null +++ b/src/AI/AIExtractProductResponse/Product/BillingFrequency.php @@ -0,0 +1,19 @@ + */ + use SdkModel; + use SdkParams; + + /** + * The domain name to analyze. + */ + #[Required] + public string $domain; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Maximum number of products to extract. + */ + #[Optional] + public ?int $maxProducts; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * A specific URL to use directly as the starting point for extraction without domain resolution. + */ + #[Required('directUrl')] + public string $directURL; + + /** + * `new AIExtractProductsParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AIExtractProductsParams::with(domain: ..., directURL: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AIExtractProductsParams)->withDomain(...)->withDirectURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $domain, + string $directURL, + ?int $maxAgeMs = null, + ?int $maxProducts = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['domain'] = $domain; + $self['directURL'] = $directURL; + + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxProducts && $self['maxProducts'] = $maxProducts; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * The domain name to analyze. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Maximum number of products to extract. + */ + public function withMaxProducts(int $maxProducts): self + { + $self = clone $this; + $self['maxProducts'] = $maxProducts; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * A specific URL to use directly as the starting point for extraction without domain resolution. + */ + public function withDirectURL(string $directURL): self + { + $self = clone $this; + $self['directURL'] = $directURL; + + return $self; + } +} diff --git a/src/AI/AIExtractProductsResponse.php b/src/AI/AIExtractProductsResponse.php new file mode 100644 index 00000000..708fdeaf --- /dev/null +++ b/src/AI/AIExtractProductsResponse.php @@ -0,0 +1,91 @@ +|null, + * } + */ +final class AIExtractProductsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Array of products extracted from the website. + * + * @var list|null $products + */ + #[Optional(list: Product::class)] + public ?array $products; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + * @param list|null $products + */ + public static function with( + KeyMetadata|array|null $keyMetadata = null, + ?array $products = null + ): self { + $self = new self; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $products && $self['products'] = $products; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Array of products extracted from the website. + * + * @param list $products + */ + public function withProducts(array $products): self + { + $self = clone $this; + $self['products'] = $products; + + return $self; + } +} diff --git a/src/AI/AIExtractProductsResponse/KeyMetadata.php b/src/AI/AIExtractProductsResponse/KeyMetadata.php new file mode 100644 index 00000000..53f16397 --- /dev/null +++ b/src/AI/AIExtractProductsResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/AI/AIExtractProductsResponse/Product.php b/src/AI/AIExtractProductsResponse/Product.php new file mode 100644 index 00000000..9719eb02 --- /dev/null +++ b/src/AI/AIExtractProductsResponse/Product.php @@ -0,0 +1,387 @@ +, + * images: list, + * name: string, + * sku: string|null, + * tags: list, + * targetAudience: list, + * billingFrequency?: null|BillingFrequency|value-of, + * category?: string|null, + * currency?: string|null, + * imageURL?: string|null, + * price?: float|null, + * pricingModel?: null|PricingModel|value-of, + * url?: string|null, + * } + */ +final class Product implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Description of the product. + */ + #[Required] + public string $description; + + /** + * List of product features. + * + * @var list $features + */ + #[Required(list: 'string')] + public array $features; + + /** + * URLs to product images on the page (up to 7). + * + * @var list $images + */ + #[Required(list: 'string')] + public array $images; + + /** + * Name of the product. + */ + #[Required] + public string $name; + + /** + * Stock Keeping Unit (product identifier). Null if no identifier is found. + */ + #[Required] + public ?string $sku; + + /** + * Tags associated with the product. + * + * @var list $tags + */ + #[Required(list: 'string')] + public array $tags; + + /** + * Target audience for the product (array of strings). + * + * @var list $targetAudience + */ + #[Required('target_audience', list: 'string')] + public array $targetAudience; + + /** + * Billing frequency for the product. + * + * @var value-of|null $billingFrequency + */ + #[Optional( + 'billing_frequency', + enum: BillingFrequency::class, + nullable: true + )] + public ?string $billingFrequency; + + /** + * Category of the product. + */ + #[Optional(nullable: true)] + public ?string $category; + + /** + * Currency code for the price (e.g., USD, EUR). + */ + #[Optional(nullable: true)] + public ?string $currency; + + /** + * URL to the product image. + */ + #[Optional('image_url', nullable: true)] + public ?string $imageURL; + + /** + * Price of the product. + */ + #[Optional(nullable: true)] + public ?float $price; + + /** + * Pricing model for the product. + * + * @var value-of|null $pricingModel + */ + #[Optional('pricing_model', enum: PricingModel::class, nullable: true)] + public ?string $pricingModel; + + /** + * URL to the product page. + */ + #[Optional(nullable: true)] + public ?string $url; + + /** + * `new Product()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Product::with( + * description: ..., + * features: ..., + * images: ..., + * name: ..., + * sku: ..., + * tags: ..., + * targetAudience: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Product) + * ->withDescription(...) + * ->withFeatures(...) + * ->withImages(...) + * ->withName(...) + * ->withSKU(...) + * ->withTags(...) + * ->withTargetAudience(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $features + * @param list $images + * @param list $tags + * @param list $targetAudience + * @param BillingFrequency|value-of|null $billingFrequency + * @param PricingModel|value-of|null $pricingModel + */ + public static function with( + string $description, + array $features, + array $images, + string $name, + ?string $sku, + array $tags, + array $targetAudience, + BillingFrequency|string|null $billingFrequency = null, + ?string $category = null, + ?string $currency = null, + ?string $imageURL = null, + ?float $price = null, + PricingModel|string|null $pricingModel = null, + ?string $url = null, + ): self { + $self = new self; + + $self['description'] = $description; + $self['features'] = $features; + $self['images'] = $images; + $self['name'] = $name; + $self['sku'] = $sku; + $self['tags'] = $tags; + $self['targetAudience'] = $targetAudience; + + null !== $billingFrequency && $self['billingFrequency'] = $billingFrequency; + null !== $category && $self['category'] = $category; + null !== $currency && $self['currency'] = $currency; + null !== $imageURL && $self['imageURL'] = $imageURL; + null !== $price && $self['price'] = $price; + null !== $pricingModel && $self['pricingModel'] = $pricingModel; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Description of the product. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * List of product features. + * + * @param list $features + */ + public function withFeatures(array $features): self + { + $self = clone $this; + $self['features'] = $features; + + return $self; + } + + /** + * URLs to product images on the page (up to 7). + * + * @param list $images + */ + public function withImages(array $images): self + { + $self = clone $this; + $self['images'] = $images; + + return $self; + } + + /** + * Name of the product. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Stock Keeping Unit (product identifier). Null if no identifier is found. + */ + public function withSKU(?string $sku): self + { + $self = clone $this; + $self['sku'] = $sku; + + return $self; + } + + /** + * Tags associated with the product. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * Target audience for the product (array of strings). + * + * @param list $targetAudience + */ + public function withTargetAudience(array $targetAudience): self + { + $self = clone $this; + $self['targetAudience'] = $targetAudience; + + return $self; + } + + /** + * Billing frequency for the product. + * + * @param BillingFrequency|value-of|null $billingFrequency + */ + public function withBillingFrequency( + BillingFrequency|string|null $billingFrequency + ): self { + $self = clone $this; + $self['billingFrequency'] = $billingFrequency; + + return $self; + } + + /** + * Category of the product. + */ + public function withCategory(?string $category): self + { + $self = clone $this; + $self['category'] = $category; + + return $self; + } + + /** + * Currency code for the price (e.g., USD, EUR). + */ + public function withCurrency(?string $currency): self + { + $self = clone $this; + $self['currency'] = $currency; + + return $self; + } + + /** + * URL to the product image. + */ + public function withImageURL(?string $imageURL): self + { + $self = clone $this; + $self['imageURL'] = $imageURL; + + return $self; + } + + /** + * Price of the product. + */ + public function withPrice(?float $price): self + { + $self = clone $this; + $self['price'] = $price; + + return $self; + } + + /** + * Pricing model for the product. + * + * @param PricingModel|value-of|null $pricingModel + */ + public function withPricingModel( + PricingModel|string|null $pricingModel + ): self { + $self = clone $this; + $self['pricingModel'] = $pricingModel; + + return $self; + } + + /** + * URL to the product page. + */ + public function withURL(?string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/AI/AIExtractProductsResponse/Product/BillingFrequency.php b/src/AI/AIExtractProductsResponse/Product/BillingFrequency.php new file mode 100644 index 00000000..534c8442 --- /dev/null +++ b/src/AI/AIExtractProductsResponse/Product/BillingFrequency.php @@ -0,0 +1,19 @@ + */ + use SdkModel; + + /** + * Detailed brand information. + */ + #[Optional] + public ?Brand $brand; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Brand|BrandShape|null $brand + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Brand|array|null $brand = null, + ?int $code = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $brand && $self['brand'] = $brand; + null !== $code && $self['code'] = $code; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * Detailed brand information. + * + * @param Brand|BrandShape $brand + */ + public function withBrand(Brand|array $brand): self + { + $self = clone $this; + $self['brand'] = $brand; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand.php b/src/Brand/BrandGetByEmailResponse/Brand.php new file mode 100644 index 00000000..3d952722 --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand.php @@ -0,0 +1,416 @@ +|null, + * colors?: list|null, + * description?: string|null, + * domain?: string|null, + * email?: string|null, + * industries?: null|Industries|IndustriesShape, + * isNsfw?: bool|null, + * links?: null|Links|LinksShape, + * logos?: list|null, + * phone?: string|null, + * primaryLanguage?: null|PrimaryLanguage|value-of, + * slogan?: string|null, + * socials?: list|null, + * stock?: null|Stock|StockShape, + * title?: string|null, + * } + */ +final class Brand implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Physical address of the brand. + */ + #[Optional] + public ?Address $address; + + /** + * An array of backdrop images for the brand. + * + * @var list|null $backdrops + */ + #[Optional(list: Backdrop::class)] + public ?array $backdrops; + + /** + * An array of brand colors. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * A brief description of the brand. + */ + #[Optional] + public ?string $description; + + /** + * The domain name of the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Company email address. + */ + #[Optional] + public ?string $email; + + /** + * Industry classification information for the brand. + */ + #[Optional] + public ?Industries $industries; + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + #[Optional('is_nsfw')] + public ?bool $isNsfw; + + /** + * Important website links for the brand. + */ + #[Optional] + public ?Links $links; + + /** + * An array of logos associated with the brand. + * + * @var list|null $logos + */ + #[Optional(list: Logo::class)] + public ?array $logos; + + /** + * Company phone number. + */ + #[Optional] + public ?string $phone; + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @var value-of|null $primaryLanguage + */ + #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] + public ?string $primaryLanguage; + + /** + * The brand's slogan. + */ + #[Optional] + public ?string $slogan; + + /** + * An array of social media links for the brand. + * + * @var list|null $socials + */ + #[Optional(list: Social::class)] + public ?array $socials; + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + */ + #[Optional] + public ?Stock $stock; + + /** + * The title or name of the brand. + */ + #[Optional] + public ?string $title; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Address|AddressShape|null $address + * @param list|null $backdrops + * @param list|null $colors + * @param Industries|IndustriesShape|null $industries + * @param Links|LinksShape|null $links + * @param list|null $logos + * @param PrimaryLanguage|value-of|null $primaryLanguage + * @param list|null $socials + * @param Stock|StockShape|null $stock + */ + public static function with( + Address|array|null $address = null, + ?array $backdrops = null, + ?array $colors = null, + ?string $description = null, + ?string $domain = null, + ?string $email = null, + Industries|array|null $industries = null, + ?bool $isNsfw = null, + Links|array|null $links = null, + ?array $logos = null, + ?string $phone = null, + PrimaryLanguage|string|null $primaryLanguage = null, + ?string $slogan = null, + ?array $socials = null, + Stock|array|null $stock = null, + ?string $title = null, + ): self { + $self = new self; + + null !== $address && $self['address'] = $address; + null !== $backdrops && $self['backdrops'] = $backdrops; + null !== $colors && $self['colors'] = $colors; + null !== $description && $self['description'] = $description; + null !== $domain && $self['domain'] = $domain; + null !== $email && $self['email'] = $email; + null !== $industries && $self['industries'] = $industries; + null !== $isNsfw && $self['isNsfw'] = $isNsfw; + null !== $links && $self['links'] = $links; + null !== $logos && $self['logos'] = $logos; + null !== $phone && $self['phone'] = $phone; + null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; + null !== $slogan && $self['slogan'] = $slogan; + null !== $socials && $self['socials'] = $socials; + null !== $stock && $self['stock'] = $stock; + null !== $title && $self['title'] = $title; + + return $self; + } + + /** + * Physical address of the brand. + * + * @param Address|AddressShape $address + */ + public function withAddress(Address|array $address): self + { + $self = clone $this; + $self['address'] = $address; + + return $self; + } + + /** + * An array of backdrop images for the brand. + * + * @param list $backdrops + */ + public function withBackdrops(array $backdrops): self + { + $self = clone $this; + $self['backdrops'] = $backdrops; + + return $self; + } + + /** + * An array of brand colors. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * A brief description of the brand. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * The domain name of the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Company email address. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Industry classification information for the brand. + * + * @param Industries|IndustriesShape $industries + */ + public function withIndustries(Industries|array $industries): self + { + $self = clone $this; + $self['industries'] = $industries; + + return $self; + } + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + public function withIsNsfw(bool $isNsfw): self + { + $self = clone $this; + $self['isNsfw'] = $isNsfw; + + return $self; + } + + /** + * Important website links for the brand. + * + * @param Links|LinksShape $links + */ + public function withLinks(Links|array $links): self + { + $self = clone $this; + $self['links'] = $links; + + return $self; + } + + /** + * An array of logos associated with the brand. + * + * @param list $logos + */ + public function withLogos(array $logos): self + { + $self = clone $this; + $self['logos'] = $logos; + + return $self; + } + + /** + * Company phone number. + */ + public function withPhone(string $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @param PrimaryLanguage|value-of|null $primaryLanguage + */ + public function withPrimaryLanguage( + PrimaryLanguage|string|null $primaryLanguage + ): self { + $self = clone $this; + $self['primaryLanguage'] = $primaryLanguage; + + return $self; + } + + /** + * The brand's slogan. + */ + public function withSlogan(string $slogan): self + { + $self = clone $this; + $self['slogan'] = $slogan; + + return $self; + } + + /** + * An array of social media links for the brand. + * + * @param list $socials + */ + public function withSocials(array $socials): self + { + $self = clone $this; + $self['socials'] = $socials; + + return $self; + } + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + * + * @param Stock|StockShape $stock + */ + public function withStock(Stock|array $stock): self + { + $self = clone $this; + $self['stock'] = $stock; + + return $self; + } + + /** + * The title or name of the brand. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Address.php b/src/Brand/BrandGetByEmailResponse/Brand/Address.php new file mode 100644 index 00000000..4d2134e4 --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Address.php @@ -0,0 +1,179 @@ + */ + use SdkModel; + + /** + * City name. + */ + #[Optional] + public ?string $city; + + /** + * Country name. + */ + #[Optional] + public ?string $country; + + /** + * Country code. + */ + #[Optional('country_code')] + public ?string $countryCode; + + /** + * Postal or ZIP code. + */ + #[Optional('postal_code')] + public ?string $postalCode; + + /** + * State or province code. + */ + #[Optional('state_code')] + public ?string $stateCode; + + /** + * State or province name. + */ + #[Optional('state_province')] + public ?string $stateProvince; + + /** + * Street address. + */ + #[Optional] + public ?string $street; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $countryCode = null, + ?string $postalCode = null, + ?string $stateCode = null, + ?string $stateProvince = null, + ?string $street = null, + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $postalCode && $self['postalCode'] = $postalCode; + null !== $stateCode && $self['stateCode'] = $stateCode; + null !== $stateProvince && $self['stateProvince'] = $stateProvince; + null !== $street && $self['street'] = $street; + + return $self; + } + + /** + * City name. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * Country name. + */ + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Country code. + */ + public function withCountryCode(string $countryCode): self + { + $self = clone $this; + $self['countryCode'] = $countryCode; + + return $self; + } + + /** + * Postal or ZIP code. + */ + public function withPostalCode(string $postalCode): self + { + $self = clone $this; + $self['postalCode'] = $postalCode; + + return $self; + } + + /** + * State or province code. + */ + public function withStateCode(string $stateCode): self + { + $self = clone $this; + $self['stateCode'] = $stateCode; + + return $self; + } + + /** + * State or province name. + */ + public function withStateProvince(string $stateProvince): self + { + $self = clone $this; + $self['stateProvince'] = $stateProvince; + + return $self; + } + + /** + * Street address. + */ + public function withStreet(string $street): self + { + $self = clone $this; + $self['street'] = $street; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php new file mode 100644 index 00000000..1d48570c --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php @@ -0,0 +1,113 @@ +|null, + * resolution?: null|Resolution|ResolutionShape, + * url?: string|null, + * } + */ +final class Backdrop implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the backdrop image. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Resolution of the backdrop image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * URL of the backdrop image. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Resolution|ResolutionShape|null $resolution + */ + public static function with( + ?array $colors = null, + Resolution|array|null $resolution = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $resolution && $self['resolution'] = $resolution; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the backdrop image. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Resolution of the backdrop image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * URL of the backdrop image. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php new file mode 100644 index 00000000..c958a53f --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php new file mode 100644 index 00000000..002ac653 --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Color.php new file mode 100644 index 00000000..9a5543cb --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries.php new file mode 100644 index 00000000..a0dd9d3c --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Industries.php @@ -0,0 +1,65 @@ +|null} + */ +final class Industries implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @var list|null $eic + */ + #[Optional(list: Eic::class)] + public ?array $eic; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $eic + */ + public static function with(?array $eic = null): self + { + $self = new self; + + null !== $eic && $self['eic'] = $eic; + + return $self; + } + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @param list $eic + */ + public function withEic(array $eic): self + { + $self = clone $this; + $self['eic'] = $eic; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php new file mode 100644 index 00000000..9718fbdf --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php @@ -0,0 +1,104 @@ +, + * subindustry: Subindustry|value-of, + * } + */ +final class Eic implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Industry classification enum. + * + * @var value-of $industry + */ + #[Required(enum: Industry::class)] + public string $industry; + + /** + * Subindustry classification enum. + * + * @var value-of $subindustry + */ + #[Required(enum: Subindustry::class)] + public string $subindustry; + + /** + * `new Eic()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Eic::with(industry: ..., subindustry: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Eic)->withIndustry(...)->withSubindustry(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Industry|value-of $industry + * @param Subindustry|value-of $subindustry + */ + public static function with( + Industry|string $industry, + Subindustry|string $subindustry + ): self { + $self = new self; + + $self['industry'] = $industry; + $self['subindustry'] = $subindustry; + + return $self; + } + + /** + * Industry classification enum. + * + * @param Industry|value-of $industry + */ + public function withIndustry(Industry|string $industry): self + { + $self = clone $this; + $self['industry'] = $industry; + + return $self; + } + + /** + * Subindustry classification enum. + * + * @param Subindustry|value-of $subindustry + */ + public function withSubindustry(Subindustry|string $subindustry): self + { + $self = clone $this; + $self['subindustry'] = $subindustry; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php new file mode 100644 index 00000000..6f4810de --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php @@ -0,0 +1,59 @@ + */ + use SdkModel; + + /** + * URL to the brand's blog or news page. + */ + #[Optional(nullable: true)] + public ?string $blog; + + /** + * URL to the brand's careers or job opportunities page. + */ + #[Optional(nullable: true)] + public ?string $careers; + + /** + * URL to the brand's contact or contact us page. + */ + #[Optional(nullable: true)] + public ?string $contact; + + /** + * URL to the brand's pricing or plans page. + */ + #[Optional(nullable: true)] + public ?string $pricing; + + /** + * URL to the brand's privacy policy page. + */ + #[Optional(nullable: true)] + public ?string $privacy; + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + #[Optional(nullable: true)] + public ?string $terms; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $blog = null, + ?string $careers = null, + ?string $contact = null, + ?string $pricing = null, + ?string $privacy = null, + ?string $terms = null, + ): self { + $self = new self; + + null !== $blog && $self['blog'] = $blog; + null !== $careers && $self['careers'] = $careers; + null !== $contact && $self['contact'] = $contact; + null !== $pricing && $self['pricing'] = $pricing; + null !== $privacy && $self['privacy'] = $privacy; + null !== $terms && $self['terms'] = $terms; + + return $self; + } + + /** + * URL to the brand's blog or news page. + */ + public function withBlog(?string $blog): self + { + $self = clone $this; + $self['blog'] = $blog; + + return $self; + } + + /** + * URL to the brand's careers or job opportunities page. + */ + public function withCareers(?string $careers): self + { + $self = clone $this; + $self['careers'] = $careers; + + return $self; + } + + /** + * URL to the brand's contact or contact us page. + */ + public function withContact(?string $contact): self + { + $self = clone $this; + $self['contact'] = $contact; + + return $self; + } + + /** + * URL to the brand's pricing or plans page. + */ + public function withPricing(?string $pricing): self + { + $self = clone $this; + $self['pricing'] = $pricing; + + return $self; + } + + /** + * URL to the brand's privacy policy page. + */ + public function withPrivacy(?string $privacy): self + { + $self = clone $this; + $self['privacy'] = $privacy; + + return $self; + } + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + public function withTerms(?string $terms): self + { + $self = clone $this; + $self['terms'] = $terms; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo.php new file mode 100644 index 00000000..5247070a --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Logo.php @@ -0,0 +1,165 @@ +|null, + * mode?: null|Mode|value-of, + * resolution?: null|Resolution|ResolutionShape, + * type?: null|Type|value-of, + * url?: string|null, + * } + */ +final class Logo implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the logo. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Resolution of the logo image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * CDN hosted url of the logo (ready for display). + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Mode|value-of|null $mode + * @param Resolution|ResolutionShape|null $resolution + * @param Type|value-of|null $type + */ + public static function with( + ?array $colors = null, + Mode|string|null $mode = null, + Resolution|array|null $resolution = null, + Type|string|null $type = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $mode && $self['mode'] = $mode; + null !== $resolution && $self['resolution'] = $resolution; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the logo. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Resolution of the logo image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * CDN hosted url of the logo (ready for display). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php new file mode 100644 index 00000000..1d224b05 --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php new file mode 100644 index 00000000..a46d7d56 --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php new file mode 100644 index 00000000..255db91c --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php @@ -0,0 +1,15 @@ +, url?: string|null + * } + */ +final class Social implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Type of social media platform. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * URL of the social media page. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + Type|string|null $type = null, + ?string $url = null + ): self { + $self = new self; + + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Type of social media platform. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * URL of the social media page. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php b/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php new file mode 100644 index 00000000..bd6c1e43 --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php @@ -0,0 +1,73 @@ + */ + use SdkModel; + + /** + * Stock exchange name. + */ + #[Optional] + public ?string $exchange; + + /** + * Stock ticker symbol. + */ + #[Optional] + public ?string $ticker; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $exchange = null, + ?string $ticker = null + ): self { + $self = new self; + + null !== $exchange && $self['exchange'] = $exchange; + null !== $ticker && $self['ticker'] = $ticker; + + return $self; + } + + /** + * Stock exchange name. + */ + public function withExchange(string $exchange): self + { + $self = clone $this; + $self['exchange'] = $exchange; + + return $self; + } + + /** + * Stock ticker symbol. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } +} diff --git a/src/Brand/BrandGetByEmailResponse/KeyMetadata.php b/src/Brand/BrandGetByEmailResponse/KeyMetadata.php new file mode 100644 index 00000000..88c559b6 --- /dev/null +++ b/src/Brand/BrandGetByEmailResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse.php b/src/Brand/BrandGetByIsinResponse.php new file mode 100644 index 00000000..d1d1c379 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse.php @@ -0,0 +1,129 @@ + */ + use SdkModel; + + /** + * Detailed brand information. + */ + #[Optional] + public ?Brand $brand; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Brand|BrandShape|null $brand + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Brand|array|null $brand = null, + ?int $code = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $brand && $self['brand'] = $brand; + null !== $code && $self['code'] = $code; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * Detailed brand information. + * + * @param Brand|BrandShape $brand + */ + public function withBrand(Brand|array $brand): self + { + $self = clone $this; + $self['brand'] = $brand; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand.php b/src/Brand/BrandGetByIsinResponse/Brand.php new file mode 100644 index 00000000..75c7a32e --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand.php @@ -0,0 +1,416 @@ +|null, + * colors?: list|null, + * description?: string|null, + * domain?: string|null, + * email?: string|null, + * industries?: null|Industries|IndustriesShape, + * isNsfw?: bool|null, + * links?: null|Links|LinksShape, + * logos?: list|null, + * phone?: string|null, + * primaryLanguage?: null|PrimaryLanguage|value-of, + * slogan?: string|null, + * socials?: list|null, + * stock?: null|Stock|StockShape, + * title?: string|null, + * } + */ +final class Brand implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Physical address of the brand. + */ + #[Optional] + public ?Address $address; + + /** + * An array of backdrop images for the brand. + * + * @var list|null $backdrops + */ + #[Optional(list: Backdrop::class)] + public ?array $backdrops; + + /** + * An array of brand colors. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * A brief description of the brand. + */ + #[Optional] + public ?string $description; + + /** + * The domain name of the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Company email address. + */ + #[Optional] + public ?string $email; + + /** + * Industry classification information for the brand. + */ + #[Optional] + public ?Industries $industries; + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + #[Optional('is_nsfw')] + public ?bool $isNsfw; + + /** + * Important website links for the brand. + */ + #[Optional] + public ?Links $links; + + /** + * An array of logos associated with the brand. + * + * @var list|null $logos + */ + #[Optional(list: Logo::class)] + public ?array $logos; + + /** + * Company phone number. + */ + #[Optional] + public ?string $phone; + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @var value-of|null $primaryLanguage + */ + #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] + public ?string $primaryLanguage; + + /** + * The brand's slogan. + */ + #[Optional] + public ?string $slogan; + + /** + * An array of social media links for the brand. + * + * @var list|null $socials + */ + #[Optional(list: Social::class)] + public ?array $socials; + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + */ + #[Optional] + public ?Stock $stock; + + /** + * The title or name of the brand. + */ + #[Optional] + public ?string $title; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Address|AddressShape|null $address + * @param list|null $backdrops + * @param list|null $colors + * @param Industries|IndustriesShape|null $industries + * @param Links|LinksShape|null $links + * @param list|null $logos + * @param PrimaryLanguage|value-of|null $primaryLanguage + * @param list|null $socials + * @param Stock|StockShape|null $stock + */ + public static function with( + Address|array|null $address = null, + ?array $backdrops = null, + ?array $colors = null, + ?string $description = null, + ?string $domain = null, + ?string $email = null, + Industries|array|null $industries = null, + ?bool $isNsfw = null, + Links|array|null $links = null, + ?array $logos = null, + ?string $phone = null, + PrimaryLanguage|string|null $primaryLanguage = null, + ?string $slogan = null, + ?array $socials = null, + Stock|array|null $stock = null, + ?string $title = null, + ): self { + $self = new self; + + null !== $address && $self['address'] = $address; + null !== $backdrops && $self['backdrops'] = $backdrops; + null !== $colors && $self['colors'] = $colors; + null !== $description && $self['description'] = $description; + null !== $domain && $self['domain'] = $domain; + null !== $email && $self['email'] = $email; + null !== $industries && $self['industries'] = $industries; + null !== $isNsfw && $self['isNsfw'] = $isNsfw; + null !== $links && $self['links'] = $links; + null !== $logos && $self['logos'] = $logos; + null !== $phone && $self['phone'] = $phone; + null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; + null !== $slogan && $self['slogan'] = $slogan; + null !== $socials && $self['socials'] = $socials; + null !== $stock && $self['stock'] = $stock; + null !== $title && $self['title'] = $title; + + return $self; + } + + /** + * Physical address of the brand. + * + * @param Address|AddressShape $address + */ + public function withAddress(Address|array $address): self + { + $self = clone $this; + $self['address'] = $address; + + return $self; + } + + /** + * An array of backdrop images for the brand. + * + * @param list $backdrops + */ + public function withBackdrops(array $backdrops): self + { + $self = clone $this; + $self['backdrops'] = $backdrops; + + return $self; + } + + /** + * An array of brand colors. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * A brief description of the brand. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * The domain name of the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Company email address. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Industry classification information for the brand. + * + * @param Industries|IndustriesShape $industries + */ + public function withIndustries(Industries|array $industries): self + { + $self = clone $this; + $self['industries'] = $industries; + + return $self; + } + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + public function withIsNsfw(bool $isNsfw): self + { + $self = clone $this; + $self['isNsfw'] = $isNsfw; + + return $self; + } + + /** + * Important website links for the brand. + * + * @param Links|LinksShape $links + */ + public function withLinks(Links|array $links): self + { + $self = clone $this; + $self['links'] = $links; + + return $self; + } + + /** + * An array of logos associated with the brand. + * + * @param list $logos + */ + public function withLogos(array $logos): self + { + $self = clone $this; + $self['logos'] = $logos; + + return $self; + } + + /** + * Company phone number. + */ + public function withPhone(string $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @param PrimaryLanguage|value-of|null $primaryLanguage + */ + public function withPrimaryLanguage( + PrimaryLanguage|string|null $primaryLanguage + ): self { + $self = clone $this; + $self['primaryLanguage'] = $primaryLanguage; + + return $self; + } + + /** + * The brand's slogan. + */ + public function withSlogan(string $slogan): self + { + $self = clone $this; + $self['slogan'] = $slogan; + + return $self; + } + + /** + * An array of social media links for the brand. + * + * @param list $socials + */ + public function withSocials(array $socials): self + { + $self = clone $this; + $self['socials'] = $socials; + + return $self; + } + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + * + * @param Stock|StockShape $stock + */ + public function withStock(Stock|array $stock): self + { + $self = clone $this; + $self['stock'] = $stock; + + return $self; + } + + /** + * The title or name of the brand. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Address.php b/src/Brand/BrandGetByIsinResponse/Brand/Address.php new file mode 100644 index 00000000..a580c485 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Address.php @@ -0,0 +1,179 @@ + */ + use SdkModel; + + /** + * City name. + */ + #[Optional] + public ?string $city; + + /** + * Country name. + */ + #[Optional] + public ?string $country; + + /** + * Country code. + */ + #[Optional('country_code')] + public ?string $countryCode; + + /** + * Postal or ZIP code. + */ + #[Optional('postal_code')] + public ?string $postalCode; + + /** + * State or province code. + */ + #[Optional('state_code')] + public ?string $stateCode; + + /** + * State or province name. + */ + #[Optional('state_province')] + public ?string $stateProvince; + + /** + * Street address. + */ + #[Optional] + public ?string $street; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $countryCode = null, + ?string $postalCode = null, + ?string $stateCode = null, + ?string $stateProvince = null, + ?string $street = null, + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $postalCode && $self['postalCode'] = $postalCode; + null !== $stateCode && $self['stateCode'] = $stateCode; + null !== $stateProvince && $self['stateProvince'] = $stateProvince; + null !== $street && $self['street'] = $street; + + return $self; + } + + /** + * City name. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * Country name. + */ + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Country code. + */ + public function withCountryCode(string $countryCode): self + { + $self = clone $this; + $self['countryCode'] = $countryCode; + + return $self; + } + + /** + * Postal or ZIP code. + */ + public function withPostalCode(string $postalCode): self + { + $self = clone $this; + $self['postalCode'] = $postalCode; + + return $self; + } + + /** + * State or province code. + */ + public function withStateCode(string $stateCode): self + { + $self = clone $this; + $self['stateCode'] = $stateCode; + + return $self; + } + + /** + * State or province name. + */ + public function withStateProvince(string $stateProvince): self + { + $self = clone $this; + $self['stateProvince'] = $stateProvince; + + return $self; + } + + /** + * Street address. + */ + public function withStreet(string $street): self + { + $self = clone $this; + $self['street'] = $street; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php new file mode 100644 index 00000000..37197346 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php @@ -0,0 +1,113 @@ +|null, + * resolution?: null|Resolution|ResolutionShape, + * url?: string|null, + * } + */ +final class Backdrop implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the backdrop image. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Resolution of the backdrop image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * URL of the backdrop image. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Resolution|ResolutionShape|null $resolution + */ + public static function with( + ?array $colors = null, + Resolution|array|null $resolution = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $resolution && $self['resolution'] = $resolution; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the backdrop image. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Resolution of the backdrop image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * URL of the backdrop image. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php new file mode 100644 index 00000000..26128b40 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php new file mode 100644 index 00000000..02c7875d --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Color.php new file mode 100644 index 00000000..e97ab2ff --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries.php new file mode 100644 index 00000000..27c08ef7 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Industries.php @@ -0,0 +1,65 @@ +|null} + */ +final class Industries implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @var list|null $eic + */ + #[Optional(list: Eic::class)] + public ?array $eic; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $eic + */ + public static function with(?array $eic = null): self + { + $self = new self; + + null !== $eic && $self['eic'] = $eic; + + return $self; + } + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @param list $eic + */ + public function withEic(array $eic): self + { + $self = clone $this; + $self['eic'] = $eic; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php new file mode 100644 index 00000000..76030ba5 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php @@ -0,0 +1,104 @@ +, + * subindustry: Subindustry|value-of, + * } + */ +final class Eic implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Industry classification enum. + * + * @var value-of $industry + */ + #[Required(enum: Industry::class)] + public string $industry; + + /** + * Subindustry classification enum. + * + * @var value-of $subindustry + */ + #[Required(enum: Subindustry::class)] + public string $subindustry; + + /** + * `new Eic()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Eic::with(industry: ..., subindustry: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Eic)->withIndustry(...)->withSubindustry(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Industry|value-of $industry + * @param Subindustry|value-of $subindustry + */ + public static function with( + Industry|string $industry, + Subindustry|string $subindustry + ): self { + $self = new self; + + $self['industry'] = $industry; + $self['subindustry'] = $subindustry; + + return $self; + } + + /** + * Industry classification enum. + * + * @param Industry|value-of $industry + */ + public function withIndustry(Industry|string $industry): self + { + $self = clone $this; + $self['industry'] = $industry; + + return $self; + } + + /** + * Subindustry classification enum. + * + * @param Subindustry|value-of $subindustry + */ + public function withSubindustry(Subindustry|string $subindustry): self + { + $self = clone $this; + $self['subindustry'] = $subindustry; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php new file mode 100644 index 00000000..9b037e75 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php @@ -0,0 +1,59 @@ + */ + use SdkModel; + + /** + * URL to the brand's blog or news page. + */ + #[Optional(nullable: true)] + public ?string $blog; + + /** + * URL to the brand's careers or job opportunities page. + */ + #[Optional(nullable: true)] + public ?string $careers; + + /** + * URL to the brand's contact or contact us page. + */ + #[Optional(nullable: true)] + public ?string $contact; + + /** + * URL to the brand's pricing or plans page. + */ + #[Optional(nullable: true)] + public ?string $pricing; + + /** + * URL to the brand's privacy policy page. + */ + #[Optional(nullable: true)] + public ?string $privacy; + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + #[Optional(nullable: true)] + public ?string $terms; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $blog = null, + ?string $careers = null, + ?string $contact = null, + ?string $pricing = null, + ?string $privacy = null, + ?string $terms = null, + ): self { + $self = new self; + + null !== $blog && $self['blog'] = $blog; + null !== $careers && $self['careers'] = $careers; + null !== $contact && $self['contact'] = $contact; + null !== $pricing && $self['pricing'] = $pricing; + null !== $privacy && $self['privacy'] = $privacy; + null !== $terms && $self['terms'] = $terms; + + return $self; + } + + /** + * URL to the brand's blog or news page. + */ + public function withBlog(?string $blog): self + { + $self = clone $this; + $self['blog'] = $blog; + + return $self; + } + + /** + * URL to the brand's careers or job opportunities page. + */ + public function withCareers(?string $careers): self + { + $self = clone $this; + $self['careers'] = $careers; + + return $self; + } + + /** + * URL to the brand's contact or contact us page. + */ + public function withContact(?string $contact): self + { + $self = clone $this; + $self['contact'] = $contact; + + return $self; + } + + /** + * URL to the brand's pricing or plans page. + */ + public function withPricing(?string $pricing): self + { + $self = clone $this; + $self['pricing'] = $pricing; + + return $self; + } + + /** + * URL to the brand's privacy policy page. + */ + public function withPrivacy(?string $privacy): self + { + $self = clone $this; + $self['privacy'] = $privacy; + + return $self; + } + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + public function withTerms(?string $terms): self + { + $self = clone $this; + $self['terms'] = $terms; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo.php new file mode 100644 index 00000000..fcfd7d51 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Logo.php @@ -0,0 +1,165 @@ +|null, + * mode?: null|Mode|value-of, + * resolution?: null|Resolution|ResolutionShape, + * type?: null|Type|value-of, + * url?: string|null, + * } + */ +final class Logo implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the logo. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Resolution of the logo image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * CDN hosted url of the logo (ready for display). + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Mode|value-of|null $mode + * @param Resolution|ResolutionShape|null $resolution + * @param Type|value-of|null $type + */ + public static function with( + ?array $colors = null, + Mode|string|null $mode = null, + Resolution|array|null $resolution = null, + Type|string|null $type = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $mode && $self['mode'] = $mode; + null !== $resolution && $self['resolution'] = $resolution; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the logo. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Resolution of the logo image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * CDN hosted url of the logo (ready for display). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php new file mode 100644 index 00000000..f8833561 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php new file mode 100644 index 00000000..27ca4f93 --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php new file mode 100644 index 00000000..00fea71f --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php @@ -0,0 +1,15 @@ +, url?: string|null + * } + */ +final class Social implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Type of social media platform. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * URL of the social media page. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + Type|string|null $type = null, + ?string $url = null + ): self { + $self = new self; + + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Type of social media platform. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * URL of the social media page. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php b/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php new file mode 100644 index 00000000..3f648bed --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php @@ -0,0 +1,73 @@ + */ + use SdkModel; + + /** + * Stock exchange name. + */ + #[Optional] + public ?string $exchange; + + /** + * Stock ticker symbol. + */ + #[Optional] + public ?string $ticker; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $exchange = null, + ?string $ticker = null + ): self { + $self = new self; + + null !== $exchange && $self['exchange'] = $exchange; + null !== $ticker && $self['ticker'] = $ticker; + + return $self; + } + + /** + * Stock exchange name. + */ + public function withExchange(string $exchange): self + { + $self = clone $this; + $self['exchange'] = $exchange; + + return $self; + } + + /** + * Stock ticker symbol. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } +} diff --git a/src/Brand/BrandGetByIsinResponse/KeyMetadata.php b/src/Brand/BrandGetByIsinResponse/KeyMetadata.php new file mode 100644 index 00000000..bcb2029b --- /dev/null +++ b/src/Brand/BrandGetByIsinResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse.php b/src/Brand/BrandGetByNameResponse.php new file mode 100644 index 00000000..59671393 --- /dev/null +++ b/src/Brand/BrandGetByNameResponse.php @@ -0,0 +1,129 @@ + */ + use SdkModel; + + /** + * Detailed brand information. + */ + #[Optional] + public ?Brand $brand; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Brand|BrandShape|null $brand + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Brand|array|null $brand = null, + ?int $code = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $brand && $self['brand'] = $brand; + null !== $code && $self['code'] = $code; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * Detailed brand information. + * + * @param Brand|BrandShape $brand + */ + public function withBrand(Brand|array $brand): self + { + $self = clone $this; + $self['brand'] = $brand; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand.php b/src/Brand/BrandGetByNameResponse/Brand.php new file mode 100644 index 00000000..1a6700bf --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand.php @@ -0,0 +1,416 @@ +|null, + * colors?: list|null, + * description?: string|null, + * domain?: string|null, + * email?: string|null, + * industries?: null|Industries|IndustriesShape, + * isNsfw?: bool|null, + * links?: null|Links|LinksShape, + * logos?: list|null, + * phone?: string|null, + * primaryLanguage?: null|PrimaryLanguage|value-of, + * slogan?: string|null, + * socials?: list|null, + * stock?: null|Stock|StockShape, + * title?: string|null, + * } + */ +final class Brand implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Physical address of the brand. + */ + #[Optional] + public ?Address $address; + + /** + * An array of backdrop images for the brand. + * + * @var list|null $backdrops + */ + #[Optional(list: Backdrop::class)] + public ?array $backdrops; + + /** + * An array of brand colors. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * A brief description of the brand. + */ + #[Optional] + public ?string $description; + + /** + * The domain name of the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Company email address. + */ + #[Optional] + public ?string $email; + + /** + * Industry classification information for the brand. + */ + #[Optional] + public ?Industries $industries; + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + #[Optional('is_nsfw')] + public ?bool $isNsfw; + + /** + * Important website links for the brand. + */ + #[Optional] + public ?Links $links; + + /** + * An array of logos associated with the brand. + * + * @var list|null $logos + */ + #[Optional(list: Logo::class)] + public ?array $logos; + + /** + * Company phone number. + */ + #[Optional] + public ?string $phone; + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @var value-of|null $primaryLanguage + */ + #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] + public ?string $primaryLanguage; + + /** + * The brand's slogan. + */ + #[Optional] + public ?string $slogan; + + /** + * An array of social media links for the brand. + * + * @var list|null $socials + */ + #[Optional(list: Social::class)] + public ?array $socials; + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + */ + #[Optional] + public ?Stock $stock; + + /** + * The title or name of the brand. + */ + #[Optional] + public ?string $title; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Address|AddressShape|null $address + * @param list|null $backdrops + * @param list|null $colors + * @param Industries|IndustriesShape|null $industries + * @param Links|LinksShape|null $links + * @param list|null $logos + * @param PrimaryLanguage|value-of|null $primaryLanguage + * @param list|null $socials + * @param Stock|StockShape|null $stock + */ + public static function with( + Address|array|null $address = null, + ?array $backdrops = null, + ?array $colors = null, + ?string $description = null, + ?string $domain = null, + ?string $email = null, + Industries|array|null $industries = null, + ?bool $isNsfw = null, + Links|array|null $links = null, + ?array $logos = null, + ?string $phone = null, + PrimaryLanguage|string|null $primaryLanguage = null, + ?string $slogan = null, + ?array $socials = null, + Stock|array|null $stock = null, + ?string $title = null, + ): self { + $self = new self; + + null !== $address && $self['address'] = $address; + null !== $backdrops && $self['backdrops'] = $backdrops; + null !== $colors && $self['colors'] = $colors; + null !== $description && $self['description'] = $description; + null !== $domain && $self['domain'] = $domain; + null !== $email && $self['email'] = $email; + null !== $industries && $self['industries'] = $industries; + null !== $isNsfw && $self['isNsfw'] = $isNsfw; + null !== $links && $self['links'] = $links; + null !== $logos && $self['logos'] = $logos; + null !== $phone && $self['phone'] = $phone; + null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; + null !== $slogan && $self['slogan'] = $slogan; + null !== $socials && $self['socials'] = $socials; + null !== $stock && $self['stock'] = $stock; + null !== $title && $self['title'] = $title; + + return $self; + } + + /** + * Physical address of the brand. + * + * @param Address|AddressShape $address + */ + public function withAddress(Address|array $address): self + { + $self = clone $this; + $self['address'] = $address; + + return $self; + } + + /** + * An array of backdrop images for the brand. + * + * @param list $backdrops + */ + public function withBackdrops(array $backdrops): self + { + $self = clone $this; + $self['backdrops'] = $backdrops; + + return $self; + } + + /** + * An array of brand colors. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * A brief description of the brand. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * The domain name of the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Company email address. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Industry classification information for the brand. + * + * @param Industries|IndustriesShape $industries + */ + public function withIndustries(Industries|array $industries): self + { + $self = clone $this; + $self['industries'] = $industries; + + return $self; + } + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + public function withIsNsfw(bool $isNsfw): self + { + $self = clone $this; + $self['isNsfw'] = $isNsfw; + + return $self; + } + + /** + * Important website links for the brand. + * + * @param Links|LinksShape $links + */ + public function withLinks(Links|array $links): self + { + $self = clone $this; + $self['links'] = $links; + + return $self; + } + + /** + * An array of logos associated with the brand. + * + * @param list $logos + */ + public function withLogos(array $logos): self + { + $self = clone $this; + $self['logos'] = $logos; + + return $self; + } + + /** + * Company phone number. + */ + public function withPhone(string $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @param PrimaryLanguage|value-of|null $primaryLanguage + */ + public function withPrimaryLanguage( + PrimaryLanguage|string|null $primaryLanguage + ): self { + $self = clone $this; + $self['primaryLanguage'] = $primaryLanguage; + + return $self; + } + + /** + * The brand's slogan. + */ + public function withSlogan(string $slogan): self + { + $self = clone $this; + $self['slogan'] = $slogan; + + return $self; + } + + /** + * An array of social media links for the brand. + * + * @param list $socials + */ + public function withSocials(array $socials): self + { + $self = clone $this; + $self['socials'] = $socials; + + return $self; + } + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + * + * @param Stock|StockShape $stock + */ + public function withStock(Stock|array $stock): self + { + $self = clone $this; + $self['stock'] = $stock; + + return $self; + } + + /** + * The title or name of the brand. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Address.php b/src/Brand/BrandGetByNameResponse/Brand/Address.php new file mode 100644 index 00000000..f8064df9 --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Address.php @@ -0,0 +1,179 @@ + */ + use SdkModel; + + /** + * City name. + */ + #[Optional] + public ?string $city; + + /** + * Country name. + */ + #[Optional] + public ?string $country; + + /** + * Country code. + */ + #[Optional('country_code')] + public ?string $countryCode; + + /** + * Postal or ZIP code. + */ + #[Optional('postal_code')] + public ?string $postalCode; + + /** + * State or province code. + */ + #[Optional('state_code')] + public ?string $stateCode; + + /** + * State or province name. + */ + #[Optional('state_province')] + public ?string $stateProvince; + + /** + * Street address. + */ + #[Optional] + public ?string $street; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $countryCode = null, + ?string $postalCode = null, + ?string $stateCode = null, + ?string $stateProvince = null, + ?string $street = null, + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $postalCode && $self['postalCode'] = $postalCode; + null !== $stateCode && $self['stateCode'] = $stateCode; + null !== $stateProvince && $self['stateProvince'] = $stateProvince; + null !== $street && $self['street'] = $street; + + return $self; + } + + /** + * City name. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * Country name. + */ + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Country code. + */ + public function withCountryCode(string $countryCode): self + { + $self = clone $this; + $self['countryCode'] = $countryCode; + + return $self; + } + + /** + * Postal or ZIP code. + */ + public function withPostalCode(string $postalCode): self + { + $self = clone $this; + $self['postalCode'] = $postalCode; + + return $self; + } + + /** + * State or province code. + */ + public function withStateCode(string $stateCode): self + { + $self = clone $this; + $self['stateCode'] = $stateCode; + + return $self; + } + + /** + * State or province name. + */ + public function withStateProvince(string $stateProvince): self + { + $self = clone $this; + $self['stateProvince'] = $stateProvince; + + return $self; + } + + /** + * Street address. + */ + public function withStreet(string $street): self + { + $self = clone $this; + $self['street'] = $street; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php new file mode 100644 index 00000000..8bedea8b --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php @@ -0,0 +1,113 @@ +|null, + * resolution?: null|Resolution|ResolutionShape, + * url?: string|null, + * } + */ +final class Backdrop implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the backdrop image. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Resolution of the backdrop image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * URL of the backdrop image. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Resolution|ResolutionShape|null $resolution + */ + public static function with( + ?array $colors = null, + Resolution|array|null $resolution = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $resolution && $self['resolution'] = $resolution; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the backdrop image. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Resolution of the backdrop image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * URL of the backdrop image. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php new file mode 100644 index 00000000..1932047f --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php new file mode 100644 index 00000000..95cc16c5 --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Color.php new file mode 100644 index 00000000..56b5adc4 --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries.php b/src/Brand/BrandGetByNameResponse/Brand/Industries.php new file mode 100644 index 00000000..af0cb0be --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Industries.php @@ -0,0 +1,65 @@ +|null} + */ +final class Industries implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @var list|null $eic + */ + #[Optional(list: Eic::class)] + public ?array $eic; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $eic + */ + public static function with(?array $eic = null): self + { + $self = new self; + + null !== $eic && $self['eic'] = $eic; + + return $self; + } + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @param list $eic + */ + public function withEic(array $eic): self + { + $self = clone $this; + $self['eic'] = $eic; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php new file mode 100644 index 00000000..54d6c9d2 --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php @@ -0,0 +1,104 @@ +, + * subindustry: Subindustry|value-of, + * } + */ +final class Eic implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Industry classification enum. + * + * @var value-of $industry + */ + #[Required(enum: Industry::class)] + public string $industry; + + /** + * Subindustry classification enum. + * + * @var value-of $subindustry + */ + #[Required(enum: Subindustry::class)] + public string $subindustry; + + /** + * `new Eic()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Eic::with(industry: ..., subindustry: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Eic)->withIndustry(...)->withSubindustry(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Industry|value-of $industry + * @param Subindustry|value-of $subindustry + */ + public static function with( + Industry|string $industry, + Subindustry|string $subindustry + ): self { + $self = new self; + + $self['industry'] = $industry; + $self['subindustry'] = $subindustry; + + return $self; + } + + /** + * Industry classification enum. + * + * @param Industry|value-of $industry + */ + public function withIndustry(Industry|string $industry): self + { + $self = clone $this; + $self['industry'] = $industry; + + return $self; + } + + /** + * Subindustry classification enum. + * + * @param Subindustry|value-of $subindustry + */ + public function withSubindustry(Subindustry|string $subindustry): self + { + $self = clone $this; + $self['subindustry'] = $subindustry; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php new file mode 100644 index 00000000..df8802ba --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php @@ -0,0 +1,59 @@ + */ + use SdkModel; + + /** + * URL to the brand's blog or news page. + */ + #[Optional(nullable: true)] + public ?string $blog; + + /** + * URL to the brand's careers or job opportunities page. + */ + #[Optional(nullable: true)] + public ?string $careers; + + /** + * URL to the brand's contact or contact us page. + */ + #[Optional(nullable: true)] + public ?string $contact; + + /** + * URL to the brand's pricing or plans page. + */ + #[Optional(nullable: true)] + public ?string $pricing; + + /** + * URL to the brand's privacy policy page. + */ + #[Optional(nullable: true)] + public ?string $privacy; + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + #[Optional(nullable: true)] + public ?string $terms; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $blog = null, + ?string $careers = null, + ?string $contact = null, + ?string $pricing = null, + ?string $privacy = null, + ?string $terms = null, + ): self { + $self = new self; + + null !== $blog && $self['blog'] = $blog; + null !== $careers && $self['careers'] = $careers; + null !== $contact && $self['contact'] = $contact; + null !== $pricing && $self['pricing'] = $pricing; + null !== $privacy && $self['privacy'] = $privacy; + null !== $terms && $self['terms'] = $terms; + + return $self; + } + + /** + * URL to the brand's blog or news page. + */ + public function withBlog(?string $blog): self + { + $self = clone $this; + $self['blog'] = $blog; + + return $self; + } + + /** + * URL to the brand's careers or job opportunities page. + */ + public function withCareers(?string $careers): self + { + $self = clone $this; + $self['careers'] = $careers; + + return $self; + } + + /** + * URL to the brand's contact or contact us page. + */ + public function withContact(?string $contact): self + { + $self = clone $this; + $self['contact'] = $contact; + + return $self; + } + + /** + * URL to the brand's pricing or plans page. + */ + public function withPricing(?string $pricing): self + { + $self = clone $this; + $self['pricing'] = $pricing; + + return $self; + } + + /** + * URL to the brand's privacy policy page. + */ + public function withPrivacy(?string $privacy): self + { + $self = clone $this; + $self['privacy'] = $privacy; + + return $self; + } + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + public function withTerms(?string $terms): self + { + $self = clone $this; + $self['terms'] = $terms; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo.php b/src/Brand/BrandGetByNameResponse/Brand/Logo.php new file mode 100644 index 00000000..56d3855c --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Logo.php @@ -0,0 +1,165 @@ +|null, + * mode?: null|Mode|value-of, + * resolution?: null|Resolution|ResolutionShape, + * type?: null|Type|value-of, + * url?: string|null, + * } + */ +final class Logo implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the logo. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Resolution of the logo image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * CDN hosted url of the logo (ready for display). + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Mode|value-of|null $mode + * @param Resolution|ResolutionShape|null $resolution + * @param Type|value-of|null $type + */ + public static function with( + ?array $colors = null, + Mode|string|null $mode = null, + Resolution|array|null $resolution = null, + Type|string|null $type = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $mode && $self['mode'] = $mode; + null !== $resolution && $self['resolution'] = $resolution; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the logo. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Resolution of the logo image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * CDN hosted url of the logo (ready for display). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php new file mode 100644 index 00000000..e99a36e6 --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php new file mode 100644 index 00000000..5371498e --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php new file mode 100644 index 00000000..8161b3cc --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php @@ -0,0 +1,15 @@ +, url?: string|null + * } + */ +final class Social implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Type of social media platform. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * URL of the social media page. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + Type|string|null $type = null, + ?string $url = null + ): self { + $self = new self; + + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Type of social media platform. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * URL of the social media page. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php b/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php new file mode 100644 index 00000000..f3498814 --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php @@ -0,0 +1,73 @@ + */ + use SdkModel; + + /** + * Stock exchange name. + */ + #[Optional] + public ?string $exchange; + + /** + * Stock ticker symbol. + */ + #[Optional] + public ?string $ticker; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $exchange = null, + ?string $ticker = null + ): self { + $self = new self; + + null !== $exchange && $self['exchange'] = $exchange; + null !== $ticker && $self['ticker'] = $ticker; + + return $self; + } + + /** + * Stock exchange name. + */ + public function withExchange(string $exchange): self + { + $self = clone $this; + $self['exchange'] = $exchange; + + return $self; + } + + /** + * Stock ticker symbol. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } +} diff --git a/src/Brand/BrandGetByNameResponse/KeyMetadata.php b/src/Brand/BrandGetByNameResponse/KeyMetadata.php new file mode 100644 index 00000000..caf12baa --- /dev/null +++ b/src/Brand/BrandGetByNameResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse.php b/src/Brand/BrandGetByTickerResponse.php new file mode 100644 index 00000000..afe72bfa --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse.php @@ -0,0 +1,129 @@ + */ + use SdkModel; + + /** + * Detailed brand information. + */ + #[Optional] + public ?Brand $brand; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Brand|BrandShape|null $brand + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Brand|array|null $brand = null, + ?int $code = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $brand && $self['brand'] = $brand; + null !== $code && $self['code'] = $code; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * Detailed brand information. + * + * @param Brand|BrandShape $brand + */ + public function withBrand(Brand|array $brand): self + { + $self = clone $this; + $self['brand'] = $brand; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand.php b/src/Brand/BrandGetByTickerResponse/Brand.php new file mode 100644 index 00000000..b121f019 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand.php @@ -0,0 +1,416 @@ +|null, + * colors?: list|null, + * description?: string|null, + * domain?: string|null, + * email?: string|null, + * industries?: null|Industries|IndustriesShape, + * isNsfw?: bool|null, + * links?: null|Links|LinksShape, + * logos?: list|null, + * phone?: string|null, + * primaryLanguage?: null|PrimaryLanguage|value-of, + * slogan?: string|null, + * socials?: list|null, + * stock?: null|Stock|StockShape, + * title?: string|null, + * } + */ +final class Brand implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Physical address of the brand. + */ + #[Optional] + public ?Address $address; + + /** + * An array of backdrop images for the brand. + * + * @var list|null $backdrops + */ + #[Optional(list: Backdrop::class)] + public ?array $backdrops; + + /** + * An array of brand colors. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * A brief description of the brand. + */ + #[Optional] + public ?string $description; + + /** + * The domain name of the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Company email address. + */ + #[Optional] + public ?string $email; + + /** + * Industry classification information for the brand. + */ + #[Optional] + public ?Industries $industries; + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + #[Optional('is_nsfw')] + public ?bool $isNsfw; + + /** + * Important website links for the brand. + */ + #[Optional] + public ?Links $links; + + /** + * An array of logos associated with the brand. + * + * @var list|null $logos + */ + #[Optional(list: Logo::class)] + public ?array $logos; + + /** + * Company phone number. + */ + #[Optional] + public ?string $phone; + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @var value-of|null $primaryLanguage + */ + #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] + public ?string $primaryLanguage; + + /** + * The brand's slogan. + */ + #[Optional] + public ?string $slogan; + + /** + * An array of social media links for the brand. + * + * @var list|null $socials + */ + #[Optional(list: Social::class)] + public ?array $socials; + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + */ + #[Optional] + public ?Stock $stock; + + /** + * The title or name of the brand. + */ + #[Optional] + public ?string $title; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Address|AddressShape|null $address + * @param list|null $backdrops + * @param list|null $colors + * @param Industries|IndustriesShape|null $industries + * @param Links|LinksShape|null $links + * @param list|null $logos + * @param PrimaryLanguage|value-of|null $primaryLanguage + * @param list|null $socials + * @param Stock|StockShape|null $stock + */ + public static function with( + Address|array|null $address = null, + ?array $backdrops = null, + ?array $colors = null, + ?string $description = null, + ?string $domain = null, + ?string $email = null, + Industries|array|null $industries = null, + ?bool $isNsfw = null, + Links|array|null $links = null, + ?array $logos = null, + ?string $phone = null, + PrimaryLanguage|string|null $primaryLanguage = null, + ?string $slogan = null, + ?array $socials = null, + Stock|array|null $stock = null, + ?string $title = null, + ): self { + $self = new self; + + null !== $address && $self['address'] = $address; + null !== $backdrops && $self['backdrops'] = $backdrops; + null !== $colors && $self['colors'] = $colors; + null !== $description && $self['description'] = $description; + null !== $domain && $self['domain'] = $domain; + null !== $email && $self['email'] = $email; + null !== $industries && $self['industries'] = $industries; + null !== $isNsfw && $self['isNsfw'] = $isNsfw; + null !== $links && $self['links'] = $links; + null !== $logos && $self['logos'] = $logos; + null !== $phone && $self['phone'] = $phone; + null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; + null !== $slogan && $self['slogan'] = $slogan; + null !== $socials && $self['socials'] = $socials; + null !== $stock && $self['stock'] = $stock; + null !== $title && $self['title'] = $title; + + return $self; + } + + /** + * Physical address of the brand. + * + * @param Address|AddressShape $address + */ + public function withAddress(Address|array $address): self + { + $self = clone $this; + $self['address'] = $address; + + return $self; + } + + /** + * An array of backdrop images for the brand. + * + * @param list $backdrops + */ + public function withBackdrops(array $backdrops): self + { + $self = clone $this; + $self['backdrops'] = $backdrops; + + return $self; + } + + /** + * An array of brand colors. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * A brief description of the brand. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * The domain name of the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Company email address. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Industry classification information for the brand. + * + * @param Industries|IndustriesShape $industries + */ + public function withIndustries(Industries|array $industries): self + { + $self = clone $this; + $self['industries'] = $industries; + + return $self; + } + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + public function withIsNsfw(bool $isNsfw): self + { + $self = clone $this; + $self['isNsfw'] = $isNsfw; + + return $self; + } + + /** + * Important website links for the brand. + * + * @param Links|LinksShape $links + */ + public function withLinks(Links|array $links): self + { + $self = clone $this; + $self['links'] = $links; + + return $self; + } + + /** + * An array of logos associated with the brand. + * + * @param list $logos + */ + public function withLogos(array $logos): self + { + $self = clone $this; + $self['logos'] = $logos; + + return $self; + } + + /** + * Company phone number. + */ + public function withPhone(string $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @param PrimaryLanguage|value-of|null $primaryLanguage + */ + public function withPrimaryLanguage( + PrimaryLanguage|string|null $primaryLanguage + ): self { + $self = clone $this; + $self['primaryLanguage'] = $primaryLanguage; + + return $self; + } + + /** + * The brand's slogan. + */ + public function withSlogan(string $slogan): self + { + $self = clone $this; + $self['slogan'] = $slogan; + + return $self; + } + + /** + * An array of social media links for the brand. + * + * @param list $socials + */ + public function withSocials(array $socials): self + { + $self = clone $this; + $self['socials'] = $socials; + + return $self; + } + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + * + * @param Stock|StockShape $stock + */ + public function withStock(Stock|array $stock): self + { + $self = clone $this; + $self['stock'] = $stock; + + return $self; + } + + /** + * The title or name of the brand. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Address.php b/src/Brand/BrandGetByTickerResponse/Brand/Address.php new file mode 100644 index 00000000..325d1c38 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Address.php @@ -0,0 +1,179 @@ + */ + use SdkModel; + + /** + * City name. + */ + #[Optional] + public ?string $city; + + /** + * Country name. + */ + #[Optional] + public ?string $country; + + /** + * Country code. + */ + #[Optional('country_code')] + public ?string $countryCode; + + /** + * Postal or ZIP code. + */ + #[Optional('postal_code')] + public ?string $postalCode; + + /** + * State or province code. + */ + #[Optional('state_code')] + public ?string $stateCode; + + /** + * State or province name. + */ + #[Optional('state_province')] + public ?string $stateProvince; + + /** + * Street address. + */ + #[Optional] + public ?string $street; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $countryCode = null, + ?string $postalCode = null, + ?string $stateCode = null, + ?string $stateProvince = null, + ?string $street = null, + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $postalCode && $self['postalCode'] = $postalCode; + null !== $stateCode && $self['stateCode'] = $stateCode; + null !== $stateProvince && $self['stateProvince'] = $stateProvince; + null !== $street && $self['street'] = $street; + + return $self; + } + + /** + * City name. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * Country name. + */ + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Country code. + */ + public function withCountryCode(string $countryCode): self + { + $self = clone $this; + $self['countryCode'] = $countryCode; + + return $self; + } + + /** + * Postal or ZIP code. + */ + public function withPostalCode(string $postalCode): self + { + $self = clone $this; + $self['postalCode'] = $postalCode; + + return $self; + } + + /** + * State or province code. + */ + public function withStateCode(string $stateCode): self + { + $self = clone $this; + $self['stateCode'] = $stateCode; + + return $self; + } + + /** + * State or province name. + */ + public function withStateProvince(string $stateProvince): self + { + $self = clone $this; + $self['stateProvince'] = $stateProvince; + + return $self; + } + + /** + * Street address. + */ + public function withStreet(string $street): self + { + $self = clone $this; + $self['street'] = $street; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php new file mode 100644 index 00000000..2be87f33 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php @@ -0,0 +1,113 @@ +|null, + * resolution?: null|Resolution|ResolutionShape, + * url?: string|null, + * } + */ +final class Backdrop implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the backdrop image. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Resolution of the backdrop image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * URL of the backdrop image. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Resolution|ResolutionShape|null $resolution + */ + public static function with( + ?array $colors = null, + Resolution|array|null $resolution = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $resolution && $self['resolution'] = $resolution; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the backdrop image. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Resolution of the backdrop image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * URL of the backdrop image. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php new file mode 100644 index 00000000..efc62277 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php new file mode 100644 index 00000000..faeac3d2 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Color.php new file mode 100644 index 00000000..dcef6d94 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries.php new file mode 100644 index 00000000..3fe79fe3 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Industries.php @@ -0,0 +1,65 @@ +|null} + */ +final class Industries implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @var list|null $eic + */ + #[Optional(list: Eic::class)] + public ?array $eic; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $eic + */ + public static function with(?array $eic = null): self + { + $self = new self; + + null !== $eic && $self['eic'] = $eic; + + return $self; + } + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @param list $eic + */ + public function withEic(array $eic): self + { + $self = clone $this; + $self['eic'] = $eic; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php new file mode 100644 index 00000000..dcc42aa4 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php @@ -0,0 +1,104 @@ +, + * subindustry: Subindustry|value-of, + * } + */ +final class Eic implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Industry classification enum. + * + * @var value-of $industry + */ + #[Required(enum: Industry::class)] + public string $industry; + + /** + * Subindustry classification enum. + * + * @var value-of $subindustry + */ + #[Required(enum: Subindustry::class)] + public string $subindustry; + + /** + * `new Eic()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Eic::with(industry: ..., subindustry: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Eic)->withIndustry(...)->withSubindustry(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Industry|value-of $industry + * @param Subindustry|value-of $subindustry + */ + public static function with( + Industry|string $industry, + Subindustry|string $subindustry + ): self { + $self = new self; + + $self['industry'] = $industry; + $self['subindustry'] = $subindustry; + + return $self; + } + + /** + * Industry classification enum. + * + * @param Industry|value-of $industry + */ + public function withIndustry(Industry|string $industry): self + { + $self = clone $this; + $self['industry'] = $industry; + + return $self; + } + + /** + * Subindustry classification enum. + * + * @param Subindustry|value-of $subindustry + */ + public function withSubindustry(Subindustry|string $subindustry): self + { + $self = clone $this; + $self['subindustry'] = $subindustry; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php new file mode 100644 index 00000000..6a96999a --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php @@ -0,0 +1,59 @@ + */ + use SdkModel; + + /** + * URL to the brand's blog or news page. + */ + #[Optional(nullable: true)] + public ?string $blog; + + /** + * URL to the brand's careers or job opportunities page. + */ + #[Optional(nullable: true)] + public ?string $careers; + + /** + * URL to the brand's contact or contact us page. + */ + #[Optional(nullable: true)] + public ?string $contact; + + /** + * URL to the brand's pricing or plans page. + */ + #[Optional(nullable: true)] + public ?string $pricing; + + /** + * URL to the brand's privacy policy page. + */ + #[Optional(nullable: true)] + public ?string $privacy; + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + #[Optional(nullable: true)] + public ?string $terms; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $blog = null, + ?string $careers = null, + ?string $contact = null, + ?string $pricing = null, + ?string $privacy = null, + ?string $terms = null, + ): self { + $self = new self; + + null !== $blog && $self['blog'] = $blog; + null !== $careers && $self['careers'] = $careers; + null !== $contact && $self['contact'] = $contact; + null !== $pricing && $self['pricing'] = $pricing; + null !== $privacy && $self['privacy'] = $privacy; + null !== $terms && $self['terms'] = $terms; + + return $self; + } + + /** + * URL to the brand's blog or news page. + */ + public function withBlog(?string $blog): self + { + $self = clone $this; + $self['blog'] = $blog; + + return $self; + } + + /** + * URL to the brand's careers or job opportunities page. + */ + public function withCareers(?string $careers): self + { + $self = clone $this; + $self['careers'] = $careers; + + return $self; + } + + /** + * URL to the brand's contact or contact us page. + */ + public function withContact(?string $contact): self + { + $self = clone $this; + $self['contact'] = $contact; + + return $self; + } + + /** + * URL to the brand's pricing or plans page. + */ + public function withPricing(?string $pricing): self + { + $self = clone $this; + $self['pricing'] = $pricing; + + return $self; + } + + /** + * URL to the brand's privacy policy page. + */ + public function withPrivacy(?string $privacy): self + { + $self = clone $this; + $self['privacy'] = $privacy; + + return $self; + } + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + public function withTerms(?string $terms): self + { + $self = clone $this; + $self['terms'] = $terms; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo.php new file mode 100644 index 00000000..d28ac0df --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Logo.php @@ -0,0 +1,165 @@ +|null, + * mode?: null|Mode|value-of, + * resolution?: null|Resolution|ResolutionShape, + * type?: null|Type|value-of, + * url?: string|null, + * } + */ +final class Logo implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the logo. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Resolution of the logo image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * CDN hosted url of the logo (ready for display). + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Mode|value-of|null $mode + * @param Resolution|ResolutionShape|null $resolution + * @param Type|value-of|null $type + */ + public static function with( + ?array $colors = null, + Mode|string|null $mode = null, + Resolution|array|null $resolution = null, + Type|string|null $type = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $mode && $self['mode'] = $mode; + null !== $resolution && $self['resolution'] = $resolution; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the logo. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Resolution of the logo image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * CDN hosted url of the logo (ready for display). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php new file mode 100644 index 00000000..71377134 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php new file mode 100644 index 00000000..a7d34ade --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php new file mode 100644 index 00000000..1a0a4142 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php @@ -0,0 +1,15 @@ +, url?: string|null + * } + */ +final class Social implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Type of social media platform. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * URL of the social media page. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + Type|string|null $type = null, + ?string $url = null + ): self { + $self = new self; + + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Type of social media platform. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * URL of the social media page. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php b/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php new file mode 100644 index 00000000..cb308fd4 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php @@ -0,0 +1,73 @@ + */ + use SdkModel; + + /** + * Stock exchange name. + */ + #[Optional] + public ?string $exchange; + + /** + * Stock ticker symbol. + */ + #[Optional] + public ?string $ticker; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $exchange = null, + ?string $ticker = null + ): self { + $self = new self; + + null !== $exchange && $self['exchange'] = $exchange; + null !== $ticker && $self['ticker'] = $ticker; + + return $self; + } + + /** + * Stock exchange name. + */ + public function withExchange(string $exchange): self + { + $self = clone $this; + $self['exchange'] = $exchange; + + return $self; + } + + /** + * Stock ticker symbol. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } +} diff --git a/src/Brand/BrandGetByTickerResponse/KeyMetadata.php b/src/Brand/BrandGetByTickerResponse/KeyMetadata.php new file mode 100644 index 00000000..f3396e95 --- /dev/null +++ b/src/Brand/BrandGetByTickerResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse.php b/src/Brand/BrandGetResponse.php new file mode 100644 index 00000000..c06a63fb --- /dev/null +++ b/src/Brand/BrandGetResponse.php @@ -0,0 +1,129 @@ + */ + use SdkModel; + + /** + * Detailed brand information. + */ + #[Optional] + public ?Brand $brand; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Brand|BrandShape|null $brand + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Brand|array|null $brand = null, + ?int $code = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $brand && $self['brand'] = $brand; + null !== $code && $self['code'] = $code; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * Detailed brand information. + * + * @param Brand|BrandShape $brand + */ + public function withBrand(Brand|array $brand): self + { + $self = clone $this; + $self['brand'] = $brand; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand.php b/src/Brand/BrandGetResponse/Brand.php new file mode 100644 index 00000000..c4e52beb --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand.php @@ -0,0 +1,416 @@ +|null, + * colors?: list|null, + * description?: string|null, + * domain?: string|null, + * email?: string|null, + * industries?: null|Industries|IndustriesShape, + * isNsfw?: bool|null, + * links?: null|Links|LinksShape, + * logos?: list|null, + * phone?: string|null, + * primaryLanguage?: null|PrimaryLanguage|value-of, + * slogan?: string|null, + * socials?: list|null, + * stock?: null|Stock|StockShape, + * title?: string|null, + * } + */ +final class Brand implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Physical address of the brand. + */ + #[Optional] + public ?Address $address; + + /** + * An array of backdrop images for the brand. + * + * @var list|null $backdrops + */ + #[Optional(list: Backdrop::class)] + public ?array $backdrops; + + /** + * An array of brand colors. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * A brief description of the brand. + */ + #[Optional] + public ?string $description; + + /** + * The domain name of the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Company email address. + */ + #[Optional] + public ?string $email; + + /** + * Industry classification information for the brand. + */ + #[Optional] + public ?Industries $industries; + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + #[Optional('is_nsfw')] + public ?bool $isNsfw; + + /** + * Important website links for the brand. + */ + #[Optional] + public ?Links $links; + + /** + * An array of logos associated with the brand. + * + * @var list|null $logos + */ + #[Optional(list: Logo::class)] + public ?array $logos; + + /** + * Company phone number. + */ + #[Optional] + public ?string $phone; + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @var value-of|null $primaryLanguage + */ + #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] + public ?string $primaryLanguage; + + /** + * The brand's slogan. + */ + #[Optional] + public ?string $slogan; + + /** + * An array of social media links for the brand. + * + * @var list|null $socials + */ + #[Optional(list: Social::class)] + public ?array $socials; + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + */ + #[Optional] + public ?Stock $stock; + + /** + * The title or name of the brand. + */ + #[Optional] + public ?string $title; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Address|AddressShape|null $address + * @param list|null $backdrops + * @param list|null $colors + * @param Industries|IndustriesShape|null $industries + * @param Links|LinksShape|null $links + * @param list|null $logos + * @param PrimaryLanguage|value-of|null $primaryLanguage + * @param list|null $socials + * @param Stock|StockShape|null $stock + */ + public static function with( + Address|array|null $address = null, + ?array $backdrops = null, + ?array $colors = null, + ?string $description = null, + ?string $domain = null, + ?string $email = null, + Industries|array|null $industries = null, + ?bool $isNsfw = null, + Links|array|null $links = null, + ?array $logos = null, + ?string $phone = null, + PrimaryLanguage|string|null $primaryLanguage = null, + ?string $slogan = null, + ?array $socials = null, + Stock|array|null $stock = null, + ?string $title = null, + ): self { + $self = new self; + + null !== $address && $self['address'] = $address; + null !== $backdrops && $self['backdrops'] = $backdrops; + null !== $colors && $self['colors'] = $colors; + null !== $description && $self['description'] = $description; + null !== $domain && $self['domain'] = $domain; + null !== $email && $self['email'] = $email; + null !== $industries && $self['industries'] = $industries; + null !== $isNsfw && $self['isNsfw'] = $isNsfw; + null !== $links && $self['links'] = $links; + null !== $logos && $self['logos'] = $logos; + null !== $phone && $self['phone'] = $phone; + null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; + null !== $slogan && $self['slogan'] = $slogan; + null !== $socials && $self['socials'] = $socials; + null !== $stock && $self['stock'] = $stock; + null !== $title && $self['title'] = $title; + + return $self; + } + + /** + * Physical address of the brand. + * + * @param Address|AddressShape $address + */ + public function withAddress(Address|array $address): self + { + $self = clone $this; + $self['address'] = $address; + + return $self; + } + + /** + * An array of backdrop images for the brand. + * + * @param list $backdrops + */ + public function withBackdrops(array $backdrops): self + { + $self = clone $this; + $self['backdrops'] = $backdrops; + + return $self; + } + + /** + * An array of brand colors. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * A brief description of the brand. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * The domain name of the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Company email address. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Industry classification information for the brand. + * + * @param Industries|IndustriesShape $industries + */ + public function withIndustries(Industries|array $industries): self + { + $self = clone $this; + $self['industries'] = $industries; + + return $self; + } + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + public function withIsNsfw(bool $isNsfw): self + { + $self = clone $this; + $self['isNsfw'] = $isNsfw; + + return $self; + } + + /** + * Important website links for the brand. + * + * @param Links|LinksShape $links + */ + public function withLinks(Links|array $links): self + { + $self = clone $this; + $self['links'] = $links; + + return $self; + } + + /** + * An array of logos associated with the brand. + * + * @param list $logos + */ + public function withLogos(array $logos): self + { + $self = clone $this; + $self['logos'] = $logos; + + return $self; + } + + /** + * Company phone number. + */ + public function withPhone(string $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @param PrimaryLanguage|value-of|null $primaryLanguage + */ + public function withPrimaryLanguage( + PrimaryLanguage|string|null $primaryLanguage + ): self { + $self = clone $this; + $self['primaryLanguage'] = $primaryLanguage; + + return $self; + } + + /** + * The brand's slogan. + */ + public function withSlogan(string $slogan): self + { + $self = clone $this; + $self['slogan'] = $slogan; + + return $self; + } + + /** + * An array of social media links for the brand. + * + * @param list $socials + */ + public function withSocials(array $socials): self + { + $self = clone $this; + $self['socials'] = $socials; + + return $self; + } + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + * + * @param Stock|StockShape $stock + */ + public function withStock(Stock|array $stock): self + { + $self = clone $this; + $self['stock'] = $stock; + + return $self; + } + + /** + * The title or name of the brand. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Address.php b/src/Brand/BrandGetResponse/Brand/Address.php new file mode 100644 index 00000000..a2f6cd0f --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Address.php @@ -0,0 +1,179 @@ + */ + use SdkModel; + + /** + * City name. + */ + #[Optional] + public ?string $city; + + /** + * Country name. + */ + #[Optional] + public ?string $country; + + /** + * Country code. + */ + #[Optional('country_code')] + public ?string $countryCode; + + /** + * Postal or ZIP code. + */ + #[Optional('postal_code')] + public ?string $postalCode; + + /** + * State or province code. + */ + #[Optional('state_code')] + public ?string $stateCode; + + /** + * State or province name. + */ + #[Optional('state_province')] + public ?string $stateProvince; + + /** + * Street address. + */ + #[Optional] + public ?string $street; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $countryCode = null, + ?string $postalCode = null, + ?string $stateCode = null, + ?string $stateProvince = null, + ?string $street = null, + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $postalCode && $self['postalCode'] = $postalCode; + null !== $stateCode && $self['stateCode'] = $stateCode; + null !== $stateProvince && $self['stateProvince'] = $stateProvince; + null !== $street && $self['street'] = $street; + + return $self; + } + + /** + * City name. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * Country name. + */ + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Country code. + */ + public function withCountryCode(string $countryCode): self + { + $self = clone $this; + $self['countryCode'] = $countryCode; + + return $self; + } + + /** + * Postal or ZIP code. + */ + public function withPostalCode(string $postalCode): self + { + $self = clone $this; + $self['postalCode'] = $postalCode; + + return $self; + } + + /** + * State or province code. + */ + public function withStateCode(string $stateCode): self + { + $self = clone $this; + $self['stateCode'] = $stateCode; + + return $self; + } + + /** + * State or province name. + */ + public function withStateProvince(string $stateProvince): self + { + $self = clone $this; + $self['stateProvince'] = $stateProvince; + + return $self; + } + + /** + * Street address. + */ + public function withStreet(string $street): self + { + $self = clone $this; + $self['street'] = $street; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Backdrop.php b/src/Brand/BrandGetResponse/Brand/Backdrop.php new file mode 100644 index 00000000..5bf62ed8 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Backdrop.php @@ -0,0 +1,113 @@ +|null, + * resolution?: null|Resolution|ResolutionShape, + * url?: string|null, + * } + */ +final class Backdrop implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the backdrop image. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Resolution of the backdrop image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * URL of the backdrop image. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Resolution|ResolutionShape|null $resolution + */ + public static function with( + ?array $colors = null, + Resolution|array|null $resolution = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $resolution && $self['resolution'] = $resolution; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the backdrop image. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Resolution of the backdrop image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * URL of the backdrop image. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetResponse/Brand/Backdrop/Color.php new file mode 100644 index 00000000..31022d4f --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Backdrop/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetResponse/Brand/Backdrop/Resolution.php new file mode 100644 index 00000000..67d4f3c8 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Backdrop/Resolution.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Color.php b/src/Brand/BrandGetResponse/Brand/Color.php new file mode 100644 index 00000000..5f07da93 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Industries.php b/src/Brand/BrandGetResponse/Brand/Industries.php new file mode 100644 index 00000000..19306e00 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Industries.php @@ -0,0 +1,65 @@ +|null} + */ +final class Industries implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @var list|null $eic + */ + #[Optional(list: Eic::class)] + public ?array $eic; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $eic + */ + public static function with(?array $eic = null): self + { + $self = new self; + + null !== $eic && $self['eic'] = $eic; + + return $self; + } + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @param list $eic + */ + public function withEic(array $eic): self + { + $self = clone $this; + $self['eic'] = $eic; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetResponse/Brand/Industries/Eic.php new file mode 100644 index 00000000..5399b9fa --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Industries/Eic.php @@ -0,0 +1,104 @@ +, + * subindustry: Subindustry|value-of, + * } + */ +final class Eic implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Industry classification enum. + * + * @var value-of $industry + */ + #[Required(enum: Industry::class)] + public string $industry; + + /** + * Subindustry classification enum. + * + * @var value-of $subindustry + */ + #[Required(enum: Subindustry::class)] + public string $subindustry; + + /** + * `new Eic()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Eic::with(industry: ..., subindustry: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Eic)->withIndustry(...)->withSubindustry(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Industry|value-of $industry + * @param Subindustry|value-of $subindustry + */ + public static function with( + Industry|string $industry, + Subindustry|string $subindustry + ): self { + $self = new self; + + $self['industry'] = $industry; + $self['subindustry'] = $subindustry; + + return $self; + } + + /** + * Industry classification enum. + * + * @param Industry|value-of $industry + */ + public function withIndustry(Industry|string $industry): self + { + $self = clone $this; + $self['industry'] = $industry; + + return $self; + } + + /** + * Subindustry classification enum. + * + * @param Subindustry|value-of $subindustry + */ + public function withSubindustry(Subindustry|string $subindustry): self + { + $self = clone $this; + $self['subindustry'] = $subindustry; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetResponse/Brand/Industries/Eic/Industry.php new file mode 100644 index 00000000..35007796 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Industries/Eic/Industry.php @@ -0,0 +1,59 @@ + */ + use SdkModel; + + /** + * URL to the brand's blog or news page. + */ + #[Optional(nullable: true)] + public ?string $blog; + + /** + * URL to the brand's careers or job opportunities page. + */ + #[Optional(nullable: true)] + public ?string $careers; + + /** + * URL to the brand's contact or contact us page. + */ + #[Optional(nullable: true)] + public ?string $contact; + + /** + * URL to the brand's pricing or plans page. + */ + #[Optional(nullable: true)] + public ?string $pricing; + + /** + * URL to the brand's privacy policy page. + */ + #[Optional(nullable: true)] + public ?string $privacy; + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + #[Optional(nullable: true)] + public ?string $terms; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $blog = null, + ?string $careers = null, + ?string $contact = null, + ?string $pricing = null, + ?string $privacy = null, + ?string $terms = null, + ): self { + $self = new self; + + null !== $blog && $self['blog'] = $blog; + null !== $careers && $self['careers'] = $careers; + null !== $contact && $self['contact'] = $contact; + null !== $pricing && $self['pricing'] = $pricing; + null !== $privacy && $self['privacy'] = $privacy; + null !== $terms && $self['terms'] = $terms; + + return $self; + } + + /** + * URL to the brand's blog or news page. + */ + public function withBlog(?string $blog): self + { + $self = clone $this; + $self['blog'] = $blog; + + return $self; + } + + /** + * URL to the brand's careers or job opportunities page. + */ + public function withCareers(?string $careers): self + { + $self = clone $this; + $self['careers'] = $careers; + + return $self; + } + + /** + * URL to the brand's contact or contact us page. + */ + public function withContact(?string $contact): self + { + $self = clone $this; + $self['contact'] = $contact; + + return $self; + } + + /** + * URL to the brand's pricing or plans page. + */ + public function withPricing(?string $pricing): self + { + $self = clone $this; + $self['pricing'] = $pricing; + + return $self; + } + + /** + * URL to the brand's privacy policy page. + */ + public function withPrivacy(?string $privacy): self + { + $self = clone $this; + $self['privacy'] = $privacy; + + return $self; + } + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + public function withTerms(?string $terms): self + { + $self = clone $this; + $self['terms'] = $terms; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Logo.php b/src/Brand/BrandGetResponse/Brand/Logo.php new file mode 100644 index 00000000..207994c8 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Logo.php @@ -0,0 +1,163 @@ +|null, + * mode?: null|Mode|value-of, + * resolution?: null|Resolution|ResolutionShape, + * type?: null|Type|value-of, + * url?: string|null, + * } + */ +final class Logo implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the logo. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Resolution of the logo image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * CDN hosted url of the logo (ready for display). + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Mode|value-of|null $mode + * @param Resolution|ResolutionShape|null $resolution + * @param Type|value-of|null $type + */ + public static function with( + ?array $colors = null, + Mode|string|null $mode = null, + Resolution|array|null $resolution = null, + Type|string|null $type = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $mode && $self['mode'] = $mode; + null !== $resolution && $self['resolution'] = $resolution; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the logo. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Resolution of the logo image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * CDN hosted url of the logo (ready for display). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Logo/Color.php b/src/Brand/BrandGetResponse/Brand/Logo/Color.php new file mode 100644 index 00000000..e0faf1ab --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Logo/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetResponse/Brand/Logo/Mode.php new file mode 100644 index 00000000..a80ed537 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Logo/Mode.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Logo/Type.php b/src/Brand/BrandGetResponse/Brand/Logo/Type.php new file mode 100644 index 00000000..33757b87 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Logo/Type.php @@ -0,0 +1,15 @@ +, url?: string|null + * } + */ +final class Social implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Type of social media platform. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * URL of the social media page. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + Type|string|null $type = null, + ?string $url = null + ): self { + $self = new self; + + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Type of social media platform. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * URL of the social media page. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Social/Type.php b/src/Brand/BrandGetResponse/Brand/Social/Type.php new file mode 100644 index 00000000..f7a81dd3 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Social/Type.php @@ -0,0 +1,73 @@ + */ + use SdkModel; + + /** + * Stock exchange name. + */ + #[Optional] + public ?string $exchange; + + /** + * Stock ticker symbol. + */ + #[Optional] + public ?string $ticker; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $exchange = null, + ?string $ticker = null + ): self { + $self = new self; + + null !== $exchange && $self['exchange'] = $exchange; + null !== $ticker && $self['ticker'] = $ticker; + + return $self; + } + + /** + * Stock exchange name. + */ + public function withExchange(string $exchange): self + { + $self = clone $this; + $self['exchange'] = $exchange; + + return $self; + } + + /** + * Stock ticker symbol. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/KeyMetadata.php b/src/Brand/BrandGetResponse/KeyMetadata.php new file mode 100644 index 00000000..c2c57d60 --- /dev/null +++ b/src/Brand/BrandGetResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse.php b/src/Brand/BrandGetSimplifiedResponse.php new file mode 100644 index 00000000..b9857d1c --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse.php @@ -0,0 +1,129 @@ + */ + use SdkModel; + + /** + * Simplified brand information. + */ + #[Optional] + public ?Brand $brand; + + /** + * HTTP status code of the response. + */ + #[Optional] + public ?int $code; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Brand|BrandShape|null $brand + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Brand|array|null $brand = null, + ?int $code = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $brand && $self['brand'] = $brand; + null !== $code && $self['code'] = $code; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * Simplified brand information. + * + * @param Brand|BrandShape $brand + */ + public function withBrand(Brand|array $brand): self + { + $self = clone $this; + $self['brand'] = $brand; + + return $self; + } + + /** + * HTTP status code of the response. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand.php b/src/Brand/BrandGetSimplifiedResponse/Brand.php new file mode 100644 index 00000000..c6f53276 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand.php @@ -0,0 +1,162 @@ +|null, + * colors?: list|null, + * domain?: string|null, + * logos?: list|null, + * title?: string|null, + * } + */ +final class Brand implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * An array of backdrop images for the brand. + * + * @var list|null $backdrops + */ + #[Optional(list: Backdrop::class)] + public ?array $backdrops; + + /** + * An array of brand colors. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * The domain name of the brand. + */ + #[Optional] + public ?string $domain; + + /** + * An array of logos associated with the brand. + * + * @var list|null $logos + */ + #[Optional(list: Logo::class)] + public ?array $logos; + + /** + * The title or name of the brand. + */ + #[Optional] + public ?string $title; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $backdrops + * @param list|null $colors + * @param list|null $logos + */ + public static function with( + ?array $backdrops = null, + ?array $colors = null, + ?string $domain = null, + ?array $logos = null, + ?string $title = null, + ): self { + $self = new self; + + null !== $backdrops && $self['backdrops'] = $backdrops; + null !== $colors && $self['colors'] = $colors; + null !== $domain && $self['domain'] = $domain; + null !== $logos && $self['logos'] = $logos; + null !== $title && $self['title'] = $title; + + return $self; + } + + /** + * An array of backdrop images for the brand. + * + * @param list $backdrops + */ + public function withBackdrops(array $backdrops): self + { + $self = clone $this; + $self['backdrops'] = $backdrops; + + return $self; + } + + /** + * An array of brand colors. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * The domain name of the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * An array of logos associated with the brand. + * + * @param list $logos + */ + public function withLogos(array $logos): self + { + $self = clone $this; + $self['logos'] = $logos; + + return $self; + } + + /** + * The title or name of the brand. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop.php new file mode 100644 index 00000000..fdad7de8 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop.php @@ -0,0 +1,113 @@ +|null, + * resolution?: null|Resolution|ResolutionShape, + * url?: string|null, + * } + */ +final class Backdrop implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the backdrop image. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class, + )] + public ?array $colors; + + /** + * Resolution of the backdrop image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * URL of the backdrop image. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Resolution|ResolutionShape|null $resolution + */ + public static function with( + ?array $colors = null, + Resolution|array|null $resolution = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $resolution && $self['resolution'] = $resolution; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the backdrop image. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Resolution of the backdrop image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * URL of the backdrop image. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Color.php new file mode 100644 index 00000000..90cdc537 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Resolution.php new file mode 100644 index 00000000..2a5a8307 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Backdrop/Resolution.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Color.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Color.php new file mode 100644 index 00000000..d0ef9675 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Logo.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo.php new file mode 100644 index 00000000..8a20eb90 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo.php @@ -0,0 +1,165 @@ +|null, + * mode?: null|Mode|value-of, + * resolution?: null|Resolution|ResolutionShape, + * type?: null|Type|value-of, + * url?: string|null, + * } + */ +final class Logo implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the logo. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class + )] + public ?array $colors; + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Resolution of the logo image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * CDN hosted url of the logo (ready for display). + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Mode|value-of|null $mode + * @param Resolution|ResolutionShape|null $resolution + * @param Type|value-of|null $type + */ + public static function with( + ?array $colors = null, + Mode|string|null $mode = null, + Resolution|array|null $resolution = null, + Type|string|null $type = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $mode && $self['mode'] = $mode; + null !== $resolution && $self['resolution'] = $resolution; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the logo. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Resolution of the logo image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * CDN hosted url of the logo (ready for display). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Color.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Color.php new file mode 100644 index 00000000..3bb1e265 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Mode.php new file mode 100644 index 00000000..0a603c5e --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Mode.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Type.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Type.php new file mode 100644 index 00000000..07c9887b --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Logo/Type.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionParams.php b/src/Brand/BrandIdentifyFromTransactionParams.php new file mode 100644 index 00000000..5de9c697 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionParams.php @@ -0,0 +1,252 @@ +, + * forceLanguage?: null|ForceLanguage|value-of, + * highConfidenceOnly?: bool|null, + * maxSpeed?: bool|null, + * mcc?: string|null, + * phone?: float|null, + * timeoutMs?: int|null, + * } + */ +final class BrandIdentifyFromTransactionParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Transaction information to identify the brand. + */ + #[Required] + public string $transactionInfo; + + /** + * Optional city name to prioritize when searching for the brand. + */ + #[Optional] + public ?string $city; + + /** + * Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. + * + * @var value-of|null $countryGl + */ + #[Optional(enum: CountryGl::class)] + public ?string $countryGl; + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @var value-of|null $forceLanguage + */ + #[Optional(enum: ForceLanguage::class)] + public ?string $forceLanguage; + + /** + * When set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence. + */ + #[Optional] + public ?bool $highConfidenceOnly; + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + #[Optional] + public ?bool $maxSpeed; + + /** + * Optional Merchant Category Code (MCC) to help identify the business category/industry. + */ + #[Optional] + public ?string $mcc; + + /** + * Optional phone number from the transaction to help verify brand match. + */ + #[Optional] + public ?float $phone; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new BrandIdentifyFromTransactionParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandIdentifyFromTransactionParams::with(transactionInfo: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandIdentifyFromTransactionParams)->withTransactionInfo(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param CountryGl|value-of|null $countryGl + * @param ForceLanguage|value-of|null $forceLanguage + */ + public static function with( + string $transactionInfo, + ?string $city = null, + CountryGl|string|null $countryGl = null, + ForceLanguage|string|null $forceLanguage = null, + ?bool $highConfidenceOnly = null, + ?bool $maxSpeed = null, + ?string $mcc = null, + ?float $phone = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['transactionInfo'] = $transactionInfo; + + null !== $city && $self['city'] = $city; + null !== $countryGl && $self['countryGl'] = $countryGl; + null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; + null !== $highConfidenceOnly && $self['highConfidenceOnly'] = $highConfidenceOnly; + null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; + null !== $mcc && $self['mcc'] = $mcc; + null !== $phone && $self['phone'] = $phone; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Transaction information to identify the brand. + */ + public function withTransactionInfo(string $transactionInfo): self + { + $self = clone $this; + $self['transactionInfo'] = $transactionInfo; + + return $self; + } + + /** + * Optional city name to prioritize when searching for the brand. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. + * + * @param CountryGl|value-of $countryGl + */ + public function withCountryGl(CountryGl|string $countryGl): self + { + $self = clone $this; + $self['countryGl'] = $countryGl; + + return $self; + } + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @param ForceLanguage|value-of $forceLanguage + */ + public function withForceLanguage(ForceLanguage|string $forceLanguage): self + { + $self = clone $this; + $self['forceLanguage'] = $forceLanguage; + + return $self; + } + + /** + * When set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence. + */ + public function withHighConfidenceOnly(bool $highConfidenceOnly): self + { + $self = clone $this; + $self['highConfidenceOnly'] = $highConfidenceOnly; + + return $self; + } + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + public function withMaxSpeed(bool $maxSpeed): self + { + $self = clone $this; + $self['maxSpeed'] = $maxSpeed; + + return $self; + } + + /** + * Optional Merchant Category Code (MCC) to help identify the business category/industry. + */ + public function withMcc(string $mcc): self + { + $self = clone $this; + $self['mcc'] = $mcc; + + return $self; + } + + /** + * Optional phone number from the transaction to help verify brand match. + */ + public function withPhone(float $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php b/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php new file mode 100644 index 00000000..9fdec22b --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php @@ -0,0 +1,489 @@ + */ + use SdkModel; + + /** + * Detailed brand information. + */ + #[Optional] + public ?Brand $brand; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Brand|BrandShape|null $brand + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Brand|array|null $brand = null, + ?int $code = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $brand && $self['brand'] = $brand; + null !== $code && $self['code'] = $code; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * Detailed brand information. + * + * @param Brand|BrandShape $brand + */ + public function withBrand(Brand|array $brand): self + { + $self = clone $this; + $self['brand'] = $brand; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php new file mode 100644 index 00000000..6110e28b --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php @@ -0,0 +1,416 @@ +|null, + * colors?: list|null, + * description?: string|null, + * domain?: string|null, + * email?: string|null, + * industries?: null|Industries|IndustriesShape, + * isNsfw?: bool|null, + * links?: null|Links|LinksShape, + * logos?: list|null, + * phone?: string|null, + * primaryLanguage?: null|PrimaryLanguage|value-of, + * slogan?: string|null, + * socials?: list|null, + * stock?: null|Stock|StockShape, + * title?: string|null, + * } + */ +final class Brand implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Physical address of the brand. + */ + #[Optional] + public ?Address $address; + + /** + * An array of backdrop images for the brand. + * + * @var list|null $backdrops + */ + #[Optional(list: Backdrop::class)] + public ?array $backdrops; + + /** + * An array of brand colors. + * + * @var list|null $colors + */ + #[Optional(list: Color::class)] + public ?array $colors; + + /** + * A brief description of the brand. + */ + #[Optional] + public ?string $description; + + /** + * The domain name of the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Company email address. + */ + #[Optional] + public ?string $email; + + /** + * Industry classification information for the brand. + */ + #[Optional] + public ?Industries $industries; + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + #[Optional('is_nsfw')] + public ?bool $isNsfw; + + /** + * Important website links for the brand. + */ + #[Optional] + public ?Links $links; + + /** + * An array of logos associated with the brand. + * + * @var list|null $logos + */ + #[Optional(list: Logo::class)] + public ?array $logos; + + /** + * Company phone number. + */ + #[Optional] + public ?string $phone; + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @var value-of|null $primaryLanguage + */ + #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] + public ?string $primaryLanguage; + + /** + * The brand's slogan. + */ + #[Optional] + public ?string $slogan; + + /** + * An array of social media links for the brand. + * + * @var list|null $socials + */ + #[Optional(list: Social::class)] + public ?array $socials; + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + */ + #[Optional] + public ?Stock $stock; + + /** + * The title or name of the brand. + */ + #[Optional] + public ?string $title; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Address|AddressShape|null $address + * @param list|null $backdrops + * @param list|null $colors + * @param Industries|IndustriesShape|null $industries + * @param Links|LinksShape|null $links + * @param list|null $logos + * @param PrimaryLanguage|value-of|null $primaryLanguage + * @param list|null $socials + * @param Stock|StockShape|null $stock + */ + public static function with( + Address|array|null $address = null, + ?array $backdrops = null, + ?array $colors = null, + ?string $description = null, + ?string $domain = null, + ?string $email = null, + Industries|array|null $industries = null, + ?bool $isNsfw = null, + Links|array|null $links = null, + ?array $logos = null, + ?string $phone = null, + PrimaryLanguage|string|null $primaryLanguage = null, + ?string $slogan = null, + ?array $socials = null, + Stock|array|null $stock = null, + ?string $title = null, + ): self { + $self = new self; + + null !== $address && $self['address'] = $address; + null !== $backdrops && $self['backdrops'] = $backdrops; + null !== $colors && $self['colors'] = $colors; + null !== $description && $self['description'] = $description; + null !== $domain && $self['domain'] = $domain; + null !== $email && $self['email'] = $email; + null !== $industries && $self['industries'] = $industries; + null !== $isNsfw && $self['isNsfw'] = $isNsfw; + null !== $links && $self['links'] = $links; + null !== $logos && $self['logos'] = $logos; + null !== $phone && $self['phone'] = $phone; + null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; + null !== $slogan && $self['slogan'] = $slogan; + null !== $socials && $self['socials'] = $socials; + null !== $stock && $self['stock'] = $stock; + null !== $title && $self['title'] = $title; + + return $self; + } + + /** + * Physical address of the brand. + * + * @param Address|AddressShape $address + */ + public function withAddress(Address|array $address): self + { + $self = clone $this; + $self['address'] = $address; + + return $self; + } + + /** + * An array of backdrop images for the brand. + * + * @param list $backdrops + */ + public function withBackdrops(array $backdrops): self + { + $self = clone $this; + $self['backdrops'] = $backdrops; + + return $self; + } + + /** + * An array of brand colors. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * A brief description of the brand. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * The domain name of the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Company email address. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Industry classification information for the brand. + * + * @param Industries|IndustriesShape $industries + */ + public function withIndustries(Industries|array $industries): self + { + $self = clone $this; + $self['industries'] = $industries; + + return $self; + } + + /** + * Indicates whether the brand content is not safe for work (NSFW). + */ + public function withIsNsfw(bool $isNsfw): self + { + $self = clone $this; + $self['isNsfw'] = $isNsfw; + + return $self; + } + + /** + * Important website links for the brand. + * + * @param Links|LinksShape $links + */ + public function withLinks(Links|array $links): self + { + $self = clone $this; + $self['links'] = $links; + + return $self; + } + + /** + * An array of logos associated with the brand. + * + * @param list $logos + */ + public function withLogos(array $logos): self + { + $self = clone $this; + $self['logos'] = $logos; + + return $self; + } + + /** + * Company phone number. + */ + public function withPhone(string $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } + + /** + * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * + * @param PrimaryLanguage|value-of|null $primaryLanguage + */ + public function withPrimaryLanguage( + PrimaryLanguage|string|null $primaryLanguage + ): self { + $self = clone $this; + $self['primaryLanguage'] = $primaryLanguage; + + return $self; + } + + /** + * The brand's slogan. + */ + public function withSlogan(string $slogan): self + { + $self = clone $this; + $self['slogan'] = $slogan; + + return $self; + } + + /** + * An array of social media links for the brand. + * + * @param list $socials + */ + public function withSocials(array $socials): self + { + $self = clone $this; + $self['socials'] = $socials; + + return $self; + } + + /** + * Stock market information for this brand (will be null if not a publicly traded company). + * + * @param Stock|StockShape $stock + */ + public function withStock(Stock|array $stock): self + { + $self = clone $this; + $self['stock'] = $stock; + + return $self; + } + + /** + * The title or name of the brand. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php new file mode 100644 index 00000000..bc937d0c --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php @@ -0,0 +1,179 @@ + */ + use SdkModel; + + /** + * City name. + */ + #[Optional] + public ?string $city; + + /** + * Country name. + */ + #[Optional] + public ?string $country; + + /** + * Country code. + */ + #[Optional('country_code')] + public ?string $countryCode; + + /** + * Postal or ZIP code. + */ + #[Optional('postal_code')] + public ?string $postalCode; + + /** + * State or province code. + */ + #[Optional('state_code')] + public ?string $stateCode; + + /** + * State or province name. + */ + #[Optional('state_province')] + public ?string $stateProvince; + + /** + * Street address. + */ + #[Optional] + public ?string $street; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $countryCode = null, + ?string $postalCode = null, + ?string $stateCode = null, + ?string $stateProvince = null, + ?string $street = null, + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $postalCode && $self['postalCode'] = $postalCode; + null !== $stateCode && $self['stateCode'] = $stateCode; + null !== $stateProvince && $self['stateProvince'] = $stateProvince; + null !== $street && $self['street'] = $street; + + return $self; + } + + /** + * City name. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * Country name. + */ + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Country code. + */ + public function withCountryCode(string $countryCode): self + { + $self = clone $this; + $self['countryCode'] = $countryCode; + + return $self; + } + + /** + * Postal or ZIP code. + */ + public function withPostalCode(string $postalCode): self + { + $self = clone $this; + $self['postalCode'] = $postalCode; + + return $self; + } + + /** + * State or province code. + */ + public function withStateCode(string $stateCode): self + { + $self = clone $this; + $self['stateCode'] = $stateCode; + + return $self; + } + + /** + * State or province name. + */ + public function withStateProvince(string $stateProvince): self + { + $self = clone $this; + $self['stateProvince'] = $stateProvince; + + return $self; + } + + /** + * Street address. + */ + public function withStreet(string $street): self + { + $self = clone $this; + $self['street'] = $street; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php new file mode 100644 index 00000000..46c8abb2 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php @@ -0,0 +1,113 @@ +|null, + * resolution?: null|Resolution|ResolutionShape, + * url?: string|null, + * } + */ +final class Backdrop implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the backdrop image. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class, + )] + public ?array $colors; + + /** + * Resolution of the backdrop image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * URL of the backdrop image. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Resolution|ResolutionShape|null $resolution + */ + public static function with( + ?array $colors = null, + Resolution|array|null $resolution = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $resolution && $self['resolution'] = $resolution; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the backdrop image. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Resolution of the backdrop image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * URL of the backdrop image. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php new file mode 100644 index 00000000..c0c8f828 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php new file mode 100644 index 00000000..311b6d39 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php new file mode 100644 index 00000000..249a4148 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php new file mode 100644 index 00000000..b0519ada --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php @@ -0,0 +1,65 @@ +|null} + */ +final class Industries implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @var list|null $eic + */ + #[Optional(list: Eic::class)] + public ?array $eic; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $eic + */ + public static function with(?array $eic = null): self + { + $self = new self; + + null !== $eic && $self['eic'] = $eic; + + return $self; + } + + /** + * Easy Industry Classification - array of industry and subindustry pairs. + * + * @param list $eic + */ + public function withEic(array $eic): self + { + $self = clone $this; + $self['eic'] = $eic; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php new file mode 100644 index 00000000..cb9dd0db --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php @@ -0,0 +1,104 @@ +, + * subindustry: Subindustry|value-of, + * } + */ +final class Eic implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Industry classification enum. + * + * @var value-of $industry + */ + #[Required(enum: Industry::class)] + public string $industry; + + /** + * Subindustry classification enum. + * + * @var value-of $subindustry + */ + #[Required(enum: Subindustry::class)] + public string $subindustry; + + /** + * `new Eic()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Eic::with(industry: ..., subindustry: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Eic)->withIndustry(...)->withSubindustry(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Industry|value-of $industry + * @param Subindustry|value-of $subindustry + */ + public static function with( + Industry|string $industry, + Subindustry|string $subindustry + ): self { + $self = new self; + + $self['industry'] = $industry; + $self['subindustry'] = $subindustry; + + return $self; + } + + /** + * Industry classification enum. + * + * @param Industry|value-of $industry + */ + public function withIndustry(Industry|string $industry): self + { + $self = clone $this; + $self['industry'] = $industry; + + return $self; + } + + /** + * Subindustry classification enum. + * + * @param Subindustry|value-of $subindustry + */ + public function withSubindustry(Subindustry|string $subindustry): self + { + $self = clone $this; + $self['subindustry'] = $subindustry; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php new file mode 100644 index 00000000..fd1a8391 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php @@ -0,0 +1,59 @@ + */ + use SdkModel; + + /** + * URL to the brand's blog or news page. + */ + #[Optional(nullable: true)] + public ?string $blog; + + /** + * URL to the brand's careers or job opportunities page. + */ + #[Optional(nullable: true)] + public ?string $careers; + + /** + * URL to the brand's contact or contact us page. + */ + #[Optional(nullable: true)] + public ?string $contact; + + /** + * URL to the brand's pricing or plans page. + */ + #[Optional(nullable: true)] + public ?string $pricing; + + /** + * URL to the brand's privacy policy page. + */ + #[Optional(nullable: true)] + public ?string $privacy; + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + #[Optional(nullable: true)] + public ?string $terms; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $blog = null, + ?string $careers = null, + ?string $contact = null, + ?string $pricing = null, + ?string $privacy = null, + ?string $terms = null, + ): self { + $self = new self; + + null !== $blog && $self['blog'] = $blog; + null !== $careers && $self['careers'] = $careers; + null !== $contact && $self['contact'] = $contact; + null !== $pricing && $self['pricing'] = $pricing; + null !== $privacy && $self['privacy'] = $privacy; + null !== $terms && $self['terms'] = $terms; + + return $self; + } + + /** + * URL to the brand's blog or news page. + */ + public function withBlog(?string $blog): self + { + $self = clone $this; + $self['blog'] = $blog; + + return $self; + } + + /** + * URL to the brand's careers or job opportunities page. + */ + public function withCareers(?string $careers): self + { + $self = clone $this; + $self['careers'] = $careers; + + return $self; + } + + /** + * URL to the brand's contact or contact us page. + */ + public function withContact(?string $contact): self + { + $self = clone $this; + $self['contact'] = $contact; + + return $self; + } + + /** + * URL to the brand's pricing or plans page. + */ + public function withPricing(?string $pricing): self + { + $self = clone $this; + $self['pricing'] = $pricing; + + return $self; + } + + /** + * URL to the brand's privacy policy page. + */ + public function withPrivacy(?string $privacy): self + { + $self = clone $this; + $self['privacy'] = $privacy; + + return $self; + } + + /** + * URL to the brand's terms of service or terms and conditions page. + */ + public function withTerms(?string $terms): self + { + $self = clone $this; + $self['terms'] = $terms; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php new file mode 100644 index 00000000..3ad972b7 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php @@ -0,0 +1,165 @@ +|null, + * mode?: null|Mode|value-of, + * resolution?: null|Resolution|ResolutionShape, + * type?: null|Type|value-of, + * url?: string|null, + * } + */ +final class Logo implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of colors in the logo. + * + * @var list|null $colors + */ + #[Optional( + list: Color::class, + )] + public ?array $colors; + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; + + /** + * Resolution of the logo image. + */ + #[Optional] + public ?Resolution $resolution; + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * CDN hosted url of the logo (ready for display). + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $colors + * @param Mode|value-of|null $mode + * @param Resolution|ResolutionShape|null $resolution + * @param Type|value-of|null $type + */ + public static function with( + ?array $colors = null, + Mode|string|null $mode = null, + Resolution|array|null $resolution = null, + Type|string|null $type = null, + ?string $url = null, + ): self { + $self = new self; + + null !== $colors && $self['colors'] = $colors; + null !== $mode && $self['mode'] = $mode; + null !== $resolution && $self['resolution'] = $resolution; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Array of colors in the logo. + * + * @param list $colors + */ + public function withColors(array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Resolution of the logo image. + * + * @param Resolution|ResolutionShape $resolution + */ + public function withResolution(Resolution|array $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } + + /** + * Type of the logo based on resolution (e.g., 'icon', 'logo'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * CDN hosted url of the logo (ready for display). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php new file mode 100644 index 00000000..d998e680 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php @@ -0,0 +1,72 @@ + */ + use SdkModel; + + /** + * Color in hexadecimal format. + */ + #[Optional] + public ?string $hex; + + /** + * Name of the color. + */ + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $hex = null, ?string $name = null): self + { + $self = new self; + + null !== $hex && $self['hex'] = $hex; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * Color in hexadecimal format. + */ + public function withHex(string $hex): self + { + $self = clone $this; + $self['hex'] = $hex; + + return $self; + } + + /** + * Name of the color. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php new file mode 100644 index 00000000..27574670 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * Aspect ratio of the image (width/height). + */ + #[Optional('aspect_ratio')] + public ?float $aspectRatio; + + /** + * Height of the image in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Width of the image in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?float $aspectRatio = null, + ?int $height = null, + ?int $width = null + ): self { + $self = new self; + + null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Aspect ratio of the image (width/height). + */ + public function withAspectRatio(float $aspectRatio): self + { + $self = clone $this; + $self['aspectRatio'] = $aspectRatio; + + return $self; + } + + /** + * Height of the image in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Width of the image in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php new file mode 100644 index 00000000..8aa9e3c6 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php @@ -0,0 +1,15 @@ +, url?: string|null + * } + */ +final class Social implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Type of social media platform. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * URL of the social media page. + */ + #[Optional] + public ?string $url; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + Type|string|null $type = null, + ?string $url = null + ): self { + $self = new self; + + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Type of social media platform. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * URL of the social media page. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php new file mode 100644 index 00000000..9ca63322 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php @@ -0,0 +1,73 @@ + */ + use SdkModel; + + /** + * Stock exchange name. + */ + #[Optional] + public ?string $exchange; + + /** + * Stock ticker symbol. + */ + #[Optional] + public ?string $ticker; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $exchange = null, + ?string $ticker = null + ): self { + $self = new self; + + null !== $exchange && $self['exchange'] = $exchange; + null !== $ticker && $self['ticker'] = $ticker; + + return $self; + } + + /** + * Stock exchange name. + */ + public function withExchange(string $exchange): self + { + $self = clone $this; + $self['exchange'] = $exchange; + + return $self; + } + + /** + * Stock ticker symbol. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } +} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php b/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php new file mode 100644 index 00000000..f1edefc6 --- /dev/null +++ b/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandRetrieveByEmailParams.php b/src/Brand/BrandRetrieveByEmailParams.php new file mode 100644 index 00000000..23e596fa --- /dev/null +++ b/src/Brand/BrandRetrieveByEmailParams.php @@ -0,0 +1,166 @@ +, + * maxAgeMs?: int|null, + * maxSpeed?: bool|null, + * timeoutMs?: int|null, + * } + */ +final class BrandRetrieveByEmailParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + #[Required] + public string $email; + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @var value-of|null $forceLanguage + */ + #[Optional(enum: ForceLanguage::class)] + public ?string $forceLanguage; + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + #[Optional] + public ?bool $maxSpeed; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new BrandRetrieveByEmailParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandRetrieveByEmailParams::with(email: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandRetrieveByEmailParams)->withEmail(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ForceLanguage|value-of|null $forceLanguage + */ + public static function with( + string $email, + ForceLanguage|string|null $forceLanguage = null, + ?int $maxAgeMs = null, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['email'] = $email; + + null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @param ForceLanguage|value-of $forceLanguage + */ + public function withForceLanguage(ForceLanguage|string $forceLanguage): self + { + $self = clone $this; + $self['forceLanguage'] = $forceLanguage; + + return $self; + } + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + public function withMaxSpeed(bool $maxSpeed): self + { + $self = clone $this; + $self['maxSpeed'] = $maxSpeed; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php b/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php new file mode 100644 index 00000000..6ebc1511 --- /dev/null +++ b/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php @@ -0,0 +1,251 @@ +, + * maxAgeMs?: int|null, + * maxSpeed?: bool|null, + * timeoutMs?: int|null, + * } + */ +final class BrandRetrieveByIsinParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. + */ + #[Required] + public string $isin; + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @var value-of|null $forceLanguage + */ + #[Optional(enum: ForceLanguage::class)] + public ?string $forceLanguage; + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + #[Optional] + public ?bool $maxSpeed; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new BrandRetrieveByIsinParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandRetrieveByIsinParams::with(isin: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandRetrieveByIsinParams)->withIsin(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ForceLanguage|value-of|null $forceLanguage + */ + public static function with( + string $isin, + ForceLanguage|string|null $forceLanguage = null, + ?int $maxAgeMs = null, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['isin'] = $isin; + + null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. + */ + public function withIsin(string $isin): self + { + $self = clone $this; + $self['isin'] = $isin; + + return $self; + } + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @param ForceLanguage|value-of $forceLanguage + */ + public function withForceLanguage(ForceLanguage|string $forceLanguage): self + { + $self = clone $this; + $self['forceLanguage'] = $forceLanguage; + + return $self; + } + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + public function withMaxSpeed(bool $maxSpeed): self + { + $self = clone $this; + $self['maxSpeed'] = $maxSpeed; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php b/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php new file mode 100644 index 00000000..59bbdf53 --- /dev/null +++ b/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php @@ -0,0 +1,251 @@ +, + * forceLanguage?: null|ForceLanguage|value-of, + * maxAgeMs?: int|null, + * maxSpeed?: bool|null, + * timeoutMs?: int|null, + * } + */ +final class BrandRetrieveByNameParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. + */ + #[Required] + public string $name; + + /** + * Optional country code hint (GL parameter) to specify the country for the company name. + * + * @var value-of|null $countryGl + */ + #[Optional(enum: CountryGl::class)] + public ?string $countryGl; + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @var value-of|null $forceLanguage + */ + #[Optional(enum: ForceLanguage::class)] + public ?string $forceLanguage; + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + #[Optional] + public ?bool $maxSpeed; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new BrandRetrieveByNameParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandRetrieveByNameParams::with(name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandRetrieveByNameParams)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param CountryGl|value-of|null $countryGl + * @param ForceLanguage|value-of|null $forceLanguage + */ + public static function with( + string $name, + CountryGl|string|null $countryGl = null, + ForceLanguage|string|null $forceLanguage = null, + ?int $maxAgeMs = null, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['name'] = $name; + + null !== $countryGl && $self['countryGl'] = $countryGl; + null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Optional country code hint (GL parameter) to specify the country for the company name. + * + * @param CountryGl|value-of $countryGl + */ + public function withCountryGl(CountryGl|string $countryGl): self + { + $self = clone $this; + $self['countryGl'] = $countryGl; + + return $self; + } + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @param ForceLanguage|value-of $forceLanguage + */ + public function withForceLanguage(ForceLanguage|string $forceLanguage): self + { + $self = clone $this; + $self['forceLanguage'] = $forceLanguage; + + return $self; + } + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + public function withMaxSpeed(bool $maxSpeed): self + { + $self = clone $this; + $self['maxSpeed'] = $maxSpeed; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Brand/BrandRetrieveByNameParams/CountryGl.php b/src/Brand/BrandRetrieveByNameParams/CountryGl.php new file mode 100644 index 00000000..290fad48 --- /dev/null +++ b/src/Brand/BrandRetrieveByNameParams/CountryGl.php @@ -0,0 +1,489 @@ +, + * maxAgeMs?: int|null, + * maxSpeed?: bool|null, + * tickerExchange?: null|TickerExchange|value-of, + * timeoutMs?: int|null, + * } + */ +final class BrandRetrieveByTickerParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. + */ + #[Required] + public string $ticker; + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @var value-of|null $forceLanguage + */ + #[Optional(enum: ForceLanguage::class)] + public ?string $forceLanguage; + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + #[Optional] + public ?bool $maxSpeed; + + /** + * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * + * @var value-of|null $tickerExchange + */ + #[Optional(enum: TickerExchange::class)] + public ?string $tickerExchange; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new BrandRetrieveByTickerParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandRetrieveByTickerParams::with(ticker: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandRetrieveByTickerParams)->withTicker(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ForceLanguage|value-of|null $forceLanguage + * @param TickerExchange|value-of|null $tickerExchange + */ + public static function with( + string $ticker, + ForceLanguage|string|null $forceLanguage = null, + ?int $maxAgeMs = null, + ?bool $maxSpeed = null, + TickerExchange|string|null $tickerExchange = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['ticker'] = $ticker; + + null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; + null !== $tickerExchange && $self['tickerExchange'] = $tickerExchange; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @param ForceLanguage|value-of $forceLanguage + */ + public function withForceLanguage(ForceLanguage|string $forceLanguage): self + { + $self = clone $this; + $self['forceLanguage'] = $forceLanguage; + + return $self; + } + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + */ + public function withMaxSpeed(bool $maxSpeed): self + { + $self = clone $this; + $self['maxSpeed'] = $maxSpeed; + + return $self; + } + + /** + * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * + * @param TickerExchange|value-of $tickerExchange + */ + public function withTickerExchange( + TickerExchange|string $tickerExchange + ): self { + $self = clone $this; + $self['tickerExchange'] = $tickerExchange; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php b/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php new file mode 100644 index 00000000..7449533c --- /dev/null +++ b/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php @@ -0,0 +1,251 @@ +, + * maxAgeMs?: int|null, + * maxSpeed?: bool|null, + * timeoutMs?: int|null, + * } + */ +final class BrandRetrieveParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. + */ + #[Required] + public string $domain; + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @var value-of|null $forceLanguage + */ + #[Optional(enum: ForceLanguage::class)] + public ?string $forceLanguage; + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + */ + #[Optional] + public ?bool $maxSpeed; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new BrandRetrieveParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandRetrieveParams::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandRetrieveParams)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ForceLanguage|value-of|null $forceLanguage + */ + public static function with( + string $domain, + ForceLanguage|string|null $forceLanguage = null, + ?int $maxAgeMs = null, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['domain'] = $domain; + + null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Optional parameter to force the language of the retrieved brand data. + * + * @param ForceLanguage|value-of $forceLanguage + */ + public function withForceLanguage(ForceLanguage|string $forceLanguage): self + { + $self = clone $this; + $self['forceLanguage'] = $forceLanguage; + + return $self; + } + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + */ + public function withMaxSpeed(bool $maxSpeed): self + { + $self = clone $this; + $self['maxSpeed'] = $maxSpeed; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Brand/BrandRetrieveParams/ForceLanguage.php b/src/Brand/BrandRetrieveParams/ForceLanguage.php new file mode 100644 index 00000000..41a3aee3 --- /dev/null +++ b/src/Brand/BrandRetrieveParams/ForceLanguage.php @@ -0,0 +1,251 @@ + */ + use SdkModel; + use SdkParams; + + /** + * Domain name to retrieve simplified brand data for. + */ + #[Required] + public string $domain; + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new BrandRetrieveSimplifiedParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandRetrieveSimplifiedParams::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandRetrieveSimplifiedParams)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $domain, + ?int $maxAgeMs = null, + ?int $timeoutMs = null + ): self { + $self = new self; + + $self['domain'] = $domain; + + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Domain name to retrieve simplified brand data for. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Client.php b/src/Client.php new file mode 100644 index 00000000..88d79bf3 --- /dev/null +++ b/src/Client.php @@ -0,0 +1,149 @@ +apiKey = (string) ($apiKey ?? Util::getenv('CONTEXT_DEV_API_KEY')); + + $baseUrl ??= Util::getenv( + 'CONTEXT_DEV_BASE_URL' + ) ?: 'https://api.context.dev/v1'; + + $options = RequestOptions::parse( + RequestOptions::with( + uriFactory: Psr17FactoryDiscovery::findUriFactory(), + streamFactory: Psr17FactoryDiscovery::findStreamFactory(), + requestFactory: Psr17FactoryDiscovery::findRequestFactory(), + transporter: Psr18ClientDiscovery::find(), + ), + $requestOptions, + ); + + if (is_null($options->streamingTransporter)) { + assert(!is_null($options->transporter)); + $options->streamingTransporter = new StreamingHttpClient($options->transporter); + } + + /** @var array $headers */ + $headers = [ + 'Content-Type' => 'application/json', + 'Accept' => 'application/json', + 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), + 'X-Stainless-Lang' => 'php', + 'X-Stainless-Package-Version' => '0.0.1', + 'X-Stainless-Arch' => Util::machtype(), + 'X-Stainless-OS' => Util::ostype(), + 'X-Stainless-Runtime' => php_sapi_name(), + 'X-Stainless-Runtime-Version' => phpversion(), + ]; + + $customHeadersEnv = Util::getenv('CONTEXT_DEV_CUSTOM_HEADERS'); + if (null !== $customHeadersEnv) { + foreach (explode("\n", $customHeadersEnv) as $line) { + $colon = strpos($line, ':'); + if (false !== $colon) { + $headers[trim(substr($line, 0, $colon))] = trim(substr($line, $colon + 1)); + } + } + } + + parent::__construct( + headers: $headers, + baseUrl: $baseUrl, + options: $options + ); + + $this->web = new WebService($this); + $this->ai = new AIService($this); + $this->brand = new BrandService($this); + $this->industry = new IndustryService($this); + $this->utility = new UtilityService($this); + } + + /** @return array */ + protected function authHeaders(): array + { + return $this->apiKey ? ['Authorization' => "Bearer {$this->apiKey}"] : []; + } + + /** + * @internal + * + * @param string|list $path + * @param array $query + * @param array|null> $headers + * @param RequestOpts|null $opts + * + * @return array{NormalizedRequest, RequestOptions} + */ + protected function buildRequest( + string $method, + string|array $path, + array $query, + array $headers, + mixed $body, + RequestOptions|array|null $opts, + ): array { + return parent::buildRequest( + method: $method, + path: $path, + query: $query, + headers: [...$this->authHeaders(), ...$headers], + body: $body, + opts: $opts, + ); + } +} diff --git a/src/Core.php b/src/Core.php new file mode 100644 index 00000000..b8b38398 --- /dev/null +++ b/src/Core.php @@ -0,0 +1,5 @@ +|Converter|string|null $type + * @param class-string<\BackedEnum>|Converter|null $enum + * @param class-string|Converter|null $union + * @param class-string|Converter|string|null $list + * @param class-string|Converter|string|null $map + */ + public function __construct( + ?string $apiName = null, + Converter|string|null $type = null, + Converter|string|null $enum = null, + Converter|string|null $union = null, + Converter|string|null $list = null, + Converter|string|null $map = null, + bool $nullable = false, + ) { + parent::__construct(apiName: $apiName, type: $type, enum: $enum, union: $union, list: $list, map: $map, nullable: $nullable); + $this->optional = true; + } +} diff --git a/src/Core/Attributes/Required.php b/src/Core/Attributes/Required.php new file mode 100644 index 00000000..40033e11 --- /dev/null +++ b/src/Core/Attributes/Required.php @@ -0,0 +1,60 @@ +|Converter|string|null */ + public readonly Converter|string|null $type; + + public readonly ?string $apiName; + + public bool $optional; + + public readonly bool $nullable; + + /** + * @param class-string|Converter|string|null $type + * @param class-string<\BackedEnum>|Converter|null $enum + * @param class-string|Converter|null $union + * @param class-string|Converter|string|null $list + * @param class-string|Converter|string|null $map + */ + public function __construct( + ?string $apiName = null, + Converter|string|null $type = null, + Converter|string|null $enum = null, + Converter|string|null $union = null, + Converter|string|null $list = null, + Converter|string|null $map = null, + bool $nullable = false, + ) { + $type ??= $union; + if (null !== $list) { + $type ??= new ListOf($list); + } + if (null !== $map) { + $type ??= new MapOf($map); + } + if (null !== $enum) { + $type ??= $enum instanceof Converter ? $enum : EnumOf::fromBackedEnum($enum); + } + + $this->apiName = $apiName; + $this->type = $type; + $this->optional = false; + $this->nullable = $nullable; + } +} diff --git a/src/Core/BaseClient.php b/src/Core/BaseClient.php new file mode 100644 index 00000000..b74a2cdc --- /dev/null +++ b/src/Core/BaseClient.php @@ -0,0 +1,287 @@ +, + * headers: array>, + * body: mixed, + * } + */ +abstract class BaseClient +{ + protected UriInterface $baseUrl; + + /** + * @internal + * + * @param array|null> $headers + */ + public function __construct( + protected array $headers, + string $baseUrl, + protected ?string $idempotencyHeader = null, + protected RequestOptions $options = new RequestOptions, + ) { + assert(!is_null($this->options->uriFactory)); + $this->baseUrl = $this->options->uriFactory->createUri($baseUrl); + } + + /** + * @param string|list $path + * @param array $query + * @param array $headers + * @param string|int|list|null $unwrap + * @param class-string>|null $page + * @param class-string>|null $stream + * @param RequestOptions|array|null $options + * + * @return BaseResponse + */ + public function request( + string $method, + string|array $path, + array $query = [], + array $headers = [], + mixed $body = null, + string|int|array|null $unwrap = null, + string|Converter|ConverterSource|null $convert = null, + ?string $page = null, + ?string $stream = null, + RequestOptions|array|null $options = [], + ): BaseResponse { + [$req, $opts] = $this->buildRequest( + method: $method, + // @phpstan-ignore argument.type + path: $path, + query: $query, + // @phpstan-ignore argument.type + headers: $headers, + body: $body, + // @phpstan-ignore argument.type + opts: $options, + ); + ['method' => $method, 'path' => $uri, 'headers' => $headers, 'body' => $data] = $req; + assert(!is_null($opts->requestFactory)); + + $request = $opts->requestFactory->createRequest($method, uri: $uri); + $request = Util::withSetHeaders($request, headers: $headers); + $request = $this->transformRequest($request); + + // @phpstan-ignore-next-line argument.type + $rsp = $this->sendRequest($opts, req: $request, data: $data, redirectCount: 0, retryCount: 0); + + // @phpstan-ignore-next-line argument.type + return new RawResponse(client: $this, request: $request, response: $rsp, options: $opts, requestInfo: $req, unwrap: $unwrap, stream: $stream, page: $page, convert: $convert ?? 'null'); + } + + /** + * @internal + */ + protected function generateIdempotencyKey(): string + { + $hex = bin2hex(random_bytes(32)); + + return "stainless-php-retry-{$hex}"; + } + + /** + * @internal + * + * @param string|list $path + * @param array $query + * @param array|null> $headers + * @param RequestOpts|null $opts + * + * @return array{NormalizedRequest, RequestOptions} + */ + protected function buildRequest( + string $method, + string|array $path, + array $query, + array $headers, + mixed $body, + RequestOptions|array|null $opts, + ): array { + $options = RequestOptions::parse($this->options, $opts); + + $parsedPath = Util::parsePath($path); + + /** @var array $mergedQuery */ + $mergedQuery = array_merge_recursive( + $query, + $options->extraQueryParams ?? [] + ); + $uri = Util::joinUri($this->baseUrl, path: $parsedPath, query: $mergedQuery)->__toString(); + $idempotencyHeaders = $this->idempotencyHeader && !array_key_exists($this->idempotencyHeader, array: $headers) + ? [$this->idempotencyHeader => $this->generateIdempotencyKey()] + : []; + + /** @var array|null> $mergedHeaders */ + $mergedHeaders = [ + ...$this->headers, + ...$headers, + ...($options->extraHeaders ?? []), + ...$idempotencyHeaders, + ]; + + $req = ['method' => strtoupper($method), 'path' => $uri, 'query' => $mergedQuery, 'headers' => $mergedHeaders, 'body' => $body]; + + return [$req, $options]; + } + + protected function transformRequest( + RequestInterface $request + ): RequestInterface { + return $request; + } + + /** + * @internal + */ + protected function followRedirect( + ResponseInterface $rsp, + RequestInterface $req + ): RequestInterface { + $location = $rsp->getHeaderLine('Location'); + if (!$location) { + throw new APIConnectionException($req, message: 'Redirection without Location header'); + } + + $uri = Util::joinUri($req->getUri(), path: $location); + + return $req->withUri($uri); + } + + /** + * @internal + */ + protected function shouldRetry( + RequestOptions $opts, + int $retryCount, + ?ResponseInterface $rsp + ): bool { + if ($retryCount >= $opts->maxRetries) { + return false; + } + + $code = $rsp?->getStatusCode(); + if (408 == $code || 409 == $code || 429 == $code || $code >= 500) { + return true; + } + + return false; + } + + /** + * @internal + */ + protected function retryDelay( + RequestOptions $opts, + int $retryCount, + ?ResponseInterface $rsp + ): float { + if (!empty($header = $rsp?->getHeaderLine('retry-after'))) { + if (is_numeric($header)) { + return floatval($header); + } + + try { + $date = new \DateTimeImmutable($header); + $span = time() - $date->getTimestamp(); + + return max(0.0, $span); + } catch (\DateMalformedStringException) { + } + } + + $scale = $retryCount ** 2; + $jitter = 1 - (0.25 * mt_rand() / mt_getrandmax()); + $naive = $opts->initialRetryDelay * $scale * $jitter; + + return max(0.0, min($naive, $opts->maxRetryDelay)); + } + + /** + * @internal + * + * @param bool|int|float|string|resource|\Traversable|array|null $data + */ + protected function sendRequest( + RequestOptions $opts, + RequestInterface $req, + mixed $data, + int $retryCount, + int $redirectCount, + ): ResponseInterface { + assert(null !== $opts->streamFactory && null !== $opts->transporter); + + /** @var RequestInterface */ + $req = $req->withHeader('X-Stainless-Retry-Count', strval($retryCount)); + $req = Util::withSetBody($opts->streamFactory, req: $req, body: $data); + + $transporter = Util::isStreamingRequest($req) + ? ($opts->streamingTransporter ?? $opts->transporter) + : $opts->transporter; + + $rsp = null; + $err = null; + + try { + $rsp = $transporter->sendRequest($req); + } catch (ClientExceptionInterface $e) { + $err = $e; + } + + $code = $rsp?->getStatusCode(); + + if ($code >= 300 && $code < 400) { + assert(!is_null($rsp)); + + if ($redirectCount >= 20) { + throw new APIConnectionException($req, message: 'Maximum redirects exceeded'); + } + + $req = $this->followRedirect($rsp, req: $req); + + return $this->sendRequest($opts, req: $req, data: $data, retryCount: $retryCount, redirectCount: ++$redirectCount); + } + + if ($code >= 400 || is_null($rsp)) { + if (!$this->shouldRetry($opts, retryCount: $retryCount, rsp: $rsp)) { + $exn = is_null($rsp) ? new APIConnectionException($req, previous: $err) : APIStatusException::from(request: $req, response: $rsp); + + throw $exn; + } + + $seconds = $this->retryDelay($opts, retryCount: $retryCount, rsp: $rsp); + $floor = floor($seconds); + time_nanosleep((int) $floor, nanoseconds: (int) ($seconds - $floor) * 10 ** 9); + + return $this->sendRequest($opts, req: $req, data: $data, retryCount: ++$retryCount, redirectCount: $redirectCount); + } + + return $rsp; + } +} diff --git a/src/Core/Concerns/ResponseProxy.php b/src/Core/Concerns/ResponseProxy.php new file mode 100644 index 00000000..bdf90455 --- /dev/null +++ b/src/Core/Concerns/ResponseProxy.php @@ -0,0 +1,101 @@ +response->getProtocolVersion(); + } + + public function withProtocolVersion(string $version): static + { + $self = clone $this; + $self->response = $this->response->withProtocolVersion($version); + + return $self; + } + + public function getHeaders(): array + { + return $this->response->getHeaders(); + } + + public function hasHeader(string $name): bool + { + return $this->response->hasHeader($name); + } + + public function getHeader(string $name): array + { + return $this->response->getHeader($name); + } + + public function getHeaderLine(string $name): string + { + return $this->response->getHeaderLine($name); + } + + public function withHeader(string $name, $value): static + { + $self = clone $this; + $self->response = $this->response->withHeader($name, value: $value); + + return $self; + } + + public function withAddedHeader(string $name, $value): static + { + $self = clone $this; + $self->response = $this->response->withAddedHeader($name, value: $value); + + return $self; + } + + public function withoutHeader(string $name): static + { + $self = clone $this; + $self->response = $this->response->withoutHeader($name); + + return $self; + } + + public function getBody(): StreamInterface + { + return $this->response->getBody(); + } + + public function withBody(StreamInterface $body): static + { + $self = clone $this; + $self->response = $this->response->withBody($body); + + return $self; + } + + public function getStatusCode(): int + { + return $this->response->getStatusCode(); + } + + public function withStatus(int $code, string $reasonPhrase = ''): static + { + $self = clone $this; + $self->response = $this->response->withstatus($code, reasonPhrase: $reasonPhrase); + + return $self; + } + + public function getReasonPhrase(): string + { + return $this->response->getReasonPhrase(); + } +} diff --git a/src/Core/Concerns/SdkEnum.php b/src/Core/Concerns/SdkEnum.php new file mode 100644 index 00000000..a8b31052 --- /dev/null +++ b/src/Core/Concerns/SdkEnum.php @@ -0,0 +1,34 @@ +getReflectionConstants() as $constant) { + if ($constant->isPublic()) { + array_push($acc, $constant->getValue()); + } + } + + // @phpstan-ignore-next-line return.type + return static::$converter = new EnumOf($acc); + } +} diff --git a/src/Core/Concerns/SdkModel.php b/src/Core/Concerns/SdkModel.php new file mode 100644 index 00000000..c5c096e1 --- /dev/null +++ b/src/Core/Concerns/SdkModel.php @@ -0,0 +1,285 @@ + + */ +trait SdkModel +{ + private static ModelOf $converter; + + /** + * @var array keeps track of undocumented data + */ + private array $_data = []; + + /** + * @internal + * + * @return array + */ + public function __serialize(): array + { + $properties = $this->toProperties(); + + return array_map(static fn ($v) => self::serialize($v), array: $properties); + } + + /** + * @internal + * + * @param array $data + */ + public function __unserialize(array $data): void + { + foreach ($data as $key => $value) { + // @phpstan-ignore-next-line argument.type + $this->offsetSet($key, value: $value); + } + } + + /** + * @internal + * + * @return array + */ + public function __debugInfo(): array + { + return $this->__serialize(); + } + + /** + * @internal + */ + public function __toString(): string + { + return Util::prettyEncodeJson($this->__debugInfo()); + } + + /** + * @internal + * + * Magic get is intended to occur when we have manually unset + * a native class property, indicating an omitted value, + * or a property overridden with an incongruent type + * + * @throws \Exception + */ + public function __get(string $key): mixed + { + if (!array_key_exists($key, array: self::$converter->properties)) { + throw new \RuntimeException("Property '{$key}' does not exist in {$this}::class"); + } + + // The unset property was overridden by a value with an incongruent type. + // It's forbidden for an optional value to be `null` in the payload. + if (array_key_exists($key, array: $this->_data)) { + throw new \Exception( + "The {$key} property is overridden, use the array access ['{$key}'] syntax to the raw payload property.", + ); + } + + // An optional property which was unset to be omitted from serialized is being accessed. + // Return null to match user's expectations. + // @phpstan-ignore-next-line return.type + return null; + } + + /** + * @internal + * + * @return Shape + */ + public function toProperties(): array + { + // @phpstan-ignore-next-line return.type + return [...Util::get_object_vars($this), ...$this->_data]; + } + + /** + * @internal + * + * @param key-of $offset + */ + public function offsetExists(mixed $offset): bool + { + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (!is_string($offset)) { + throw new \InvalidArgumentException; + } + + if (array_key_exists($offset, array: $this->_data)) { + return true; + } + + if (array_key_exists($offset, array: self::$converter->properties)) { + if (isset($this->{$offset})) { + return true; + } + + $property = self::$converter->properties[$offset]->property; + + return $property->isInitialized($this); + } + + return false; + } + + /** + * @internal + * + * @param key-of $offset + */ + public function &offsetGet(mixed $offset): mixed + { + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (!is_string($offset)) { + throw new \InvalidArgumentException; + } + + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (!$this->offsetExists($offset)) { + // @phpstan-ignore-next-line return.type + return null; + } + + if (array_key_exists($offset, array: $this->_data)) { + // @phpstan-ignore-next-line return.type + return $this->_data[$offset]; + } + + // @phpstan-ignore-next-line return.type + return $this->{$offset}; + } + + /** + * @internal + * + * @param key-of $offset + */ + public function offsetSet(mixed $offset, mixed $value): void + { + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (!is_string($offset)) { + throw new \InvalidArgumentException; + } + + $type = array_key_exists($offset, array: self::$converter->properties) + ? self::$converter->properties[$offset]->type + : 'mixed'; + + $coerced = Conversion::coerce($type, value: $value, state: new CoerceState(translateNames: false)); + + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (property_exists($this, property: $offset)) { + try { + // @phpstan-ignore-next-line assign.propertyType + $this->{$offset} = $coerced; + unset($this->_data[$offset]); + + return; + // @phpstan-ignore-next-line catch.neverThrown + } catch (\TypeError) { + unset($this->{$offset}); + } + } + + $this->_data[$offset] = $coerced; + } + + /** + * @internal + * + * @param key-of $offset + */ + public function offsetUnset(mixed $offset): void + { + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (!is_string($offset)) { + throw new \InvalidArgumentException; + } + + // @phpstan-ignore-next-line function.alreadyNarrowedType + if (property_exists($this, property: $offset)) { + unset($this->{$offset}); + } + + unset($this->_data[$offset]); + } + + /** + * @internal + * + * @return array + */ + public function jsonSerialize(): array + { + // @phpstan-ignore-next-line argument.type + return Conversion::dump(self::converter(), value: $this->__serialize()); + } + + /** + * @param array $data + */ + public static function fromArray(array $data): static + { + // @phpstan-ignore-next-line argument.type + return self::converter()->from($data); + } + + /** + * @internal + */ + public static function converter(): Converter + { + if (isset(self::$converter)) { + return self::$converter; + } + + $class = new \ReflectionClass(static::class); + + return self::$converter = new ModelOf($class); + } + + /** + * @internal + */ + private function initialize(): void + { + static::converter(); + + foreach (self::$converter->properties as $name => $info) { + if ($info->optional) { + unset($this->{$name}); + } + } + } + + /** + * @internal + */ + private static function serialize(mixed $value): mixed + { + if ($value instanceof BaseModel) { + return $value->toProperties(); + } + + if (is_array($value)) { + return array_map(static fn ($v) => self::serialize($v), array: $value); + } + + return $value; + } +} diff --git a/src/Core/Concerns/SdkPage.php b/src/Core/Concerns/SdkPage.php new file mode 100644 index 00000000..7169407d --- /dev/null +++ b/src/Core/Concerns/SdkPage.php @@ -0,0 +1,102 @@ + + */ + abstract public function getItems(): array; + + public function hasNextPage(): bool + { + return !is_null($this->nextRequest()); + } + + /** + * Get the next page of results. + * Before calling this method, you must check if there is a next page + * using {@link hasNextPage()}. + * + * @return static of static + * + * @throws APIStatusException + */ + public function getNextPage(): static + { + $next = $this->nextRequest(); + if (!$next) { + throw new \RuntimeException( + 'No next page expected; please check `.hasNextPage()` before calling `.getNextPage()`.' + ); + } + + [$req, $opts] = $next; + + // @phpstan-ignore-next-line argument.type + /** @var BaseResponse */ + $response = $this->client->request(...$req, convert: $this->convert, page: $this::class, options: $opts); + + // @phpstan-ignore-next-line return.type + return $response->parse(); + } + + /** + * Iterator yielding each page (instance of static). + * + * @return \Generator + */ + public function getIterator(): \Generator + { + $page = $this; + + yield $page; + while ($page->hasNextPage()) { + $page = $page->getNextPage(); + + yield $page; + } + } + + /** + * Iterator yielding each item across all pages. + * + * @return \Generator + */ + public function pagingEachItem(): \Generator + { + foreach ($this as $page) { + foreach ($page->getItems() as $item) { + yield $item; + } + } + } + + /** + * @internal + * + * @return array{NormalizedRequest, RequestOptions} + */ + abstract protected function nextRequest(): ?array; +} diff --git a/src/Core/Concerns/SdkParams.php b/src/Core/Concerns/SdkParams.php new file mode 100644 index 00000000..09b88290 --- /dev/null +++ b/src/Core/Concerns/SdkParams.php @@ -0,0 +1,36 @@ +|RequestOptions|null $options + * + * @return array{array, RequestOptions} + */ + public static function parseRequest(mixed $params, array|RequestOptions|null $options): array + { + $converter = self::converter(); + $state = new DumpState; + $dumped = (array) Conversion::dump($converter, value: $params, state: $state); + // @phpstan-ignore-next-line argument.type + $opts = RequestOptions::parse($options); + + if (!$state->canRetry) { + $opts->maxRetries = 0; + } + + // @phpstan-ignore-next-line return.type + return [$dumped, $opts]; + } +} diff --git a/src/Core/Concerns/SdkUnion.php b/src/Core/Concerns/SdkUnion.php new file mode 100644 index 00000000..68f39b02 --- /dev/null +++ b/src/Core/Concerns/SdkUnion.php @@ -0,0 +1,39 @@ +|list + */ + public static function variants(): array + { + return []; + } + + public static function converter(): Converter + { + if (isset(static::$converter)) { + return static::$converter; + } + + return static::$converter = new UnionOf(discriminator: static::discriminator(), variants: static::variants()); + } +} diff --git a/src/Core/Contracts/BaseModel.php b/src/Core/Contracts/BaseModel.php new file mode 100644 index 00000000..f2b4712b --- /dev/null +++ b/src/Core/Contracts/BaseModel.php @@ -0,0 +1,18 @@ + + */ +interface BaseModel extends \ArrayAccess, \JsonSerializable, \Stringable, ConverterSource +{ + /** @return array */ + public function toProperties(): array; +} diff --git a/src/Core/Contracts/BasePage.php b/src/Core/Contracts/BasePage.php new file mode 100644 index 00000000..f39abd8b --- /dev/null +++ b/src/Core/Contracts/BasePage.php @@ -0,0 +1,34 @@ + + */ +interface BasePage extends \IteratorAggregate +{ + public function hasNextPage(): bool; + + /** + * @return list + */ + public function getItems(): array; + + /** + * @return static + */ + public function getNextPage(): static; + + /** + * @return \Generator + */ + public function pagingEachItem(): \Generator; +} diff --git a/src/Core/Contracts/BaseResponse.php b/src/Core/Contracts/BaseResponse.php new file mode 100644 index 00000000..387b37e9 --- /dev/null +++ b/src/Core/Contracts/BaseResponse.php @@ -0,0 +1,21 @@ + + */ +interface BaseStream extends \IteratorAggregate +{ + public function __construct( + Converter|ConverterSource|string $convert, + RequestInterface $request, + ResponseInterface $response, + mixed $parsedBody, + ); + + /** + * Manually force the stream to close early. + * Iterating through will automatically close as well. + */ + public function close(): void; +} diff --git a/src/Core/Conversion.php b/src/Core/Conversion.php new file mode 100644 index 00000000..342a6259 --- /dev/null +++ b/src/Core/Conversion.php @@ -0,0 +1,229 @@ + self::dump_unknown($v, state: $state), array: $value); + } + + if (is_object($value)) { + if ($value instanceof FileParam) { + return $value; + } + + if (is_a($value, class: ConverterSource::class)) { + return $value::converter()->dump($value, state: $state); + } + + if (is_a($value, class: \BackedEnum::class)) { + return $value->value; + } + + if (is_a($value, class: \DateTimeInterface::class)) { + return date_format($value, format: \DateTimeInterface::RFC3339); + } + + if (is_a($value, class: \JsonSerializable::class)) { + return $value->jsonSerialize(); + } + + $acc = get_object_vars($value); + + return empty($acc) ? (object) $acc : self::dump_unknown($acc, state: $state); + } + + return $value; + } + + public static function coerce(Converter|ConverterSource|string $target, mixed $value, CoerceState $state = new CoerceState): mixed + { + if ($value instanceof $target) { + ++$state->yes; + + return $value; + } + + if (is_a($target, class: ConverterSource::class, allow_string: true)) { + $target = $target::converter(); + } + + if ($target instanceof Converter) { + return $target->coerce($value, state: $state); + } + + // BackedEnum class-name targets: wrap in EnumOf so enum values are scored + // against the enum's cases. Without this, tryConvert's default case scores + // any class-name target as `no`, even when the value is a valid enum member. + if (is_a($target, class: \BackedEnum::class, allow_string: true)) { + return EnumOf::fromBackedEnum($target)->coerce($value, state: $state); + } + + return self::tryConvert($target, value: $value, state: $state); + } + + public static function dump(Converter|ConverterSource|string $target, mixed $value, DumpState $state = new DumpState): mixed + { + if ($target instanceof Converter) { + return $target->dump($value, state: $state); + } + + if (is_a($target, class: ConverterSource::class, allow_string: true)) { + return $target::converter()->dump($value, state: $state); + } + + // BackedEnum class-name targets: wrap in EnumOf so enum values are scored + // against the enum's cases. Without this, tryConvert's default case scores + // any class-name target as `no`, even when the value is a valid enum member. + if (is_a($target, class: \BackedEnum::class, allow_string: true)) { + return EnumOf::fromBackedEnum($target)->dump($value, state: $state); + } + + self::tryConvert($target, value: $value, state: $state); + + return self::dump_unknown($value, state: $state); + } + + private static function tryConvert(Converter|ConverterSource|string $target, mixed $value, CoerceState|DumpState $state): mixed + { + switch ($target) { + case 'mixed': + ++$state->yes; + + return $value; + + case 'null': + if (is_null($value)) { + ++$state->yes; + + return null; + } + + ++$state->maybe; + + return null; + + case 'bool': + if (is_bool($value)) { + ++$state->yes; + + return $value; + } + + ++$state->no; + + return $value; + + case 'int': + if (is_int($value)) { + ++$state->yes; + + return $value; + } + + if (is_float($value)) { + ++$state->maybe; + + return (int) $value; + } + + if (is_string($value) && ctype_digit($value)) { + ++$state->maybe; + + return (int) $value; + } + + ++$state->no; + + return $value; + + case 'float': + if (is_numeric($value)) { + ++$state->yes; + + return (float) $value; + } + + if (is_string($value) && is_numeric($value)) { + ++$state->maybe; + + return (float) $value; + } + + ++$state->no; + + return $value; + + case 'string': + if (is_string($value)) { + ++$state->yes; + + return $value; + } + + if (is_numeric($value)) { + ++$state->maybe; + + return (string) $value; + } + + if ($value instanceof \Generator) { + return implode('', iterator_to_array($value)); + } + + ++$state->no; + + return $value; + + case 'DateTimeInterface': + case 'DateTimeImmutable': + if (is_string($value)) { + try { + ++$state->maybe; + + return new \DateTimeImmutable($value); + } catch (\Exception) { + --$state->maybe; + } + } + + ++$state->no; + + return $value; + + case 'DateTime': + if (is_string($value)) { + try { + ++$state->maybe; + + return new \DateTime($value); + } catch (\Exception) { + --$state->maybe; + } + } + + ++$state->no; + + return $value; + + default: + ++$state->no; + + return $value; + } + } +} diff --git a/src/Core/Conversion/CoerceState.php b/src/Core/Conversion/CoerceState.php new file mode 100644 index 00000000..ac106ef5 --- /dev/null +++ b/src/Core/Conversion/CoerceState.php @@ -0,0 +1,19 @@ +type = $type ?? $enum ?? $union; + assert(!is_null($this->type)); + } + + public function coerce(mixed $value, CoerceState $state): mixed + { + if (!is_array($value)) { + return $value; + } + ++$state->yes; + + $acc = []; + foreach ($value as $k => $v) { + if ($this->nullable && is_null($v)) { + ++$state->yes; + $acc[$k] = null; + } else { + $acc[$k] = Conversion::coerce($this->type, value: $v, state: $state); + } + } + + return $acc; + } + + public function dump(mixed $value, DumpState $state): mixed + { + if (!is_array($value)) { + return Conversion::dump_unknown($value, state: $state); + } + ++$state->yes; + + if (empty($value)) { + return $this->empty(); + } + + $acc = []; + foreach ($value as $k => $v) { + if ($this->nullable && is_null($v)) { + ++$state->yes; + $acc[$k] = null; + } else { + $acc[$k] = Conversion::dump($this->type, value: $v, state: $state); + } + } + + return $acc; + } + + // @phpstan-ignore-next-line missingType.iterableValue + private function empty(): array|object + { + return (object) []; + } +} diff --git a/src/Core/Conversion/Contracts/Converter.php b/src/Core/Conversion/Contracts/Converter.php new file mode 100644 index 00000000..4670f6e6 --- /dev/null +++ b/src/Core/Conversion/Contracts/Converter.php @@ -0,0 +1,24 @@ +, self> */ + private static array $cache = []; + + /** + * @param list $members + */ + public function __construct(private readonly array $members) + { + $type = 'NULL'; + foreach ($this->members as $member) { + $type = gettype($member); + } + $this->type = $type; + } + + /** @param class-string<\BackedEnum> $enum */ + public static function fromBackedEnum(string $enum): self + { + // @phpstan-ignore-next-line argument.type + return self::$cache[$enum] ??= new self(array_column($enum::cases(), column_key: 'value')); + } + + public function coerce(mixed $value, CoerceState $state): mixed + { + $this->tally($value, state: $state); + + return $value; + } + + public function dump(mixed $value, DumpState $state): mixed + { + $this->tally($value, state: $state); + + return Conversion::dump_unknown($value, state: $state); + } + + private function tally(mixed $value, CoerceState|DumpState $state): void + { + $needle = $value instanceof \BackedEnum ? $value->value : $value; + if (in_array($needle, haystack: $this->members, strict: true)) { + ++$state->yes; + } elseif ($this->type === gettype($needle)) { + ++$state->maybe; + } else { + ++$state->no; + } + } +} diff --git a/src/Core/Conversion/ListOf.php b/src/Core/Conversion/ListOf.php new file mode 100644 index 00000000..09ff0403 --- /dev/null +++ b/src/Core/Conversion/ListOf.php @@ -0,0 +1,22 @@ + + */ + public readonly array $properties; + + /** + * @param \ReflectionClass $class + */ + public function __construct(public readonly \ReflectionClass $class) + { + $properties = []; + + foreach ($this->class->getProperties() as $property) { + $attributes = [...$property->getAttributes(Required::class), ...$property->getAttributes(Optional::class)]; + + if (!empty($attributes)) { + $name = $property->getName(); + $properties[$name] = new PropertyInfo($property); + } + } + $this->properties = $properties; + } + + public function coerce(mixed $value, CoerceState $state): mixed + { + if ($value instanceof $this->class->name) { + ++$state->yes; + + return $value; + } + + if (!is_array($value) || (!empty($value) && array_is_list($value))) { + ++$state->no; + + return $value; + } + + ++$state->yes; + + $val = [...$value]; + $acc = []; + + foreach ($this->properties as $name => $info) { + $srcName = $state->translateNames ? $info->apiName : $name; + if (!array_key_exists($srcName, array: $val)) { + if ($info->optional) { + ++$state->yes; + } elseif ($info->nullable) { + ++$state->maybe; + } else { + ++$state->no; + } + + continue; + } + + $item = $val[$srcName]; + unset($val[$srcName]); + + if (is_null($item) && ($info->nullable || $info->optional)) { + if ($info->nullable) { + ++$state->yes; + } elseif ($info->optional) { + ++$state->maybe; + } + $acc[$name] = null; + } else { + $coerced = Conversion::coerce($info->type, value: $item, state: $state); + $acc[$name] = $coerced; + } + } + + foreach ($val as $name => $item) { + $acc[$name] = $item; + } + + // @phpstan-ignore-next-line return.type + return $this->from($acc); + } + + public function dump(mixed $value, DumpState $state): mixed + { + if ($value instanceof BaseModel) { + $value = $value->toProperties(); + } + + if (is_array($value)) { + ++$state->yes; + $acc = []; + + foreach ($value as $name => $item) { + if (array_key_exists($name, array: $this->properties)) { + ++$state->yes; + $info = $this->properties[$name]; + $acc[$info->apiName] = Conversion::dump($info->type, value: $item, state: $state); + } else { + $acc[$name] = Conversion::dump_unknown($item, state: $state); + } + } + + return empty($acc) ? ((object) $acc) : $acc; + } + + ++$state->no; + + return Conversion::dump_unknown($value, state: $state); + } + + /** + * @param array $data + */ + public function from(array $data): BaseModel + { + $instance = $this->class->newInstanceWithoutConstructor(); + // @phpstan-ignore-next-line + $instance->__unserialize($data); + + return $instance; + } +} diff --git a/src/Core/Conversion/PropertyInfo.php b/src/Core/Conversion/PropertyInfo.php new file mode 100644 index 00000000..4ee7c6bf --- /dev/null +++ b/src/Core/Conversion/PropertyInfo.php @@ -0,0 +1,79 @@ +getType()?->allowsNull() ?? false; + + $apiName = $property->getName(); + $type = $property->getType(); + $optional = false; + $attributes = [...$property->getAttributes(Required::class), ...$property->getAttributes(Optional::class)]; + + foreach ($attributes as $attr) { + /** @var Required $attribute */ + $attribute = $attr->newInstance(); + + $apiName = $attribute->apiName ?? $apiName; + $optional = $attribute->optional; + $nullable |= $attribute->nullable; + $type = $attribute->type ?? $type; + } + + $this->apiName = $apiName; + $this->type = self::parse($type); + $this->nullable = (bool) $nullable; + $this->optional = $optional; + } + + /** + * @param array|Converter|ConverterSource|\ReflectionType|string|null $type + */ + private static function parse(array|Converter|ConverterSource|\ReflectionType|string|null $type): Converter|ConverterSource|string + { + if (is_string($type) || $type instanceof Converter) { + return $type; + } + + if (is_array($type)) { + // @phpstan-ignore-next-line return.type + return new UnionOf($type); + } + + if ($type instanceof \ReflectionUnionType) { + // @phpstan-ignore-next-line argument.type + return new UnionOf(array_map(static fn ($t) => self::parse($t), array: $type->getTypes())); + } + + if ($type instanceof \ReflectionNamedType) { + return $type->getName(); + } + + if ($type instanceof \ReflectionIntersectionType) { + throw new \ValueError; + } + + return 'mixed'; + } +} diff --git a/src/Core/Conversion/UnionOf.php b/src/Core/Conversion/UnionOf.php new file mode 100644 index 00000000..b641794f --- /dev/null +++ b/src/Core/Conversion/UnionOf.php @@ -0,0 +1,132 @@ +|list $variants + */ + public function __construct( + private readonly array $variants, + private readonly ?string $discriminator = null, + ) {} + + public function coerce(mixed $value, CoerceState $state): mixed + { + if (!is_null($target = $this->resolveVariant(value: $value))) { + return Conversion::coerce($target, value: $value, state: $state); + } + + $alternatives = []; + foreach ($this->variants as $_ => $variant) { + ++$state->branched; + $newState = new CoerceState; + + $coerced = Conversion::coerce($variant, value: $value, state: $newState); + if (($newState->no + $newState->maybe) === 0) { + $state->yes += $newState->yes; + + return $coerced; + } + if ($newState->maybe > 0) { + $alternatives[] = [[-$newState->yes, -$newState->maybe, $newState->no], $newState, $coerced]; + } + } + + usort( + $alternatives, + static fn (array $a, array $b): int => $a[0][0] <=> $b[0][0] ?: $a[0][1] <=> $b[0][1] ?: $a[0][2] <=> $b[0][2] + ); + + if (empty($alternatives)) { + ++$state->no; + + return $value; + } + + [[,$newState, $best]] = $alternatives; + $state->yes += $newState->yes; + $state->maybe += $newState->maybe; + $state->no += $newState->no; + + return $best; + } + + public function dump(mixed $value, DumpState $state): mixed + { + if (!is_null($target = $this->resolveVariant(value: $value))) { + return Conversion::dump($target, value: $value, state: $state); + } + + $alternatives = []; + foreach ($this->variants as $_ => $variant) { + ++$state->branched; + if ($value instanceof $variant) { + return Conversion::dump($variant, value: $value, state: $state); + } + + $newState = new DumpState; + $dumped = Conversion::dump($variant, value: $value, state: $newState); + if (($newState->no + $newState->maybe) === 0) { + $state->yes += $newState->yes; + + return $dumped; + } + if ($newState->maybe > 0) { + $alternatives[] = [[-$newState->yes, -$newState->maybe, $newState->no], $newState, $dumped]; + } + } + + usort( + $alternatives, + static fn (array $a, array $b): int => $a[0][0] <=> $b[0][0] ?: $a[0][1] <=> $b[0][1] ?: $a[0][2] <=> $b[0][2] + ); + + if (empty($alternatives)) { + ++$state->no; + + return Conversion::dump_unknown($value, state: $state); + } + + [[,$newState, $best]] = $alternatives; + $state->yes += $newState->yes; + $state->maybe += $newState->maybe; + $state->no += $newState->no; + + return $best; + } + + private function resolveVariant( + mixed $value, + ): Converter|ConverterSource|string|null { + if ($value instanceof BaseModel) { + return $value::class; + } + + if ( + null !== $this->discriminator + && is_array($value) + && array_key_exists($this->discriminator, array: $value) + ) { + $discriminator = $value[$this->discriminator]; + if (!is_string($discriminator)) { + return null; + } + + return $this->variants[$discriminator] ?? null; + } + + return null; + } +} diff --git a/src/Core/Exceptions/APIConnectionException.php b/src/Core/Exceptions/APIConnectionException.php new file mode 100644 index 00000000..23df7758 --- /dev/null +++ b/src/Core/Exceptions/APIConnectionException.php @@ -0,0 +1,9 @@ +response = $response; + $this->status = $response->getStatusCode(); + + $summary = Util::prettyEncodeJson(['status' => $this->status, 'body' => Util::decodeJson($response->getBody())]); + + if ('' != $message) { + $summary .= $message.PHP_EOL.$summary; + } + + parent::__construct(request: $request, message: $summary, previous: $previous); + } + + public static function from( + RequestInterface $request, + ResponseInterface $response, + string $message = '' + ): self { + $status = $response->getStatusCode(); + + $cls = match (true) { + 400 === $status => BadRequestException::class, + 401 === $status => AuthenticationException::class, + 403 === $status => PermissionDeniedException::class, + 404 === $status => NotFoundException::class, + 409 === $status => ConflictException::class, + 422 === $status => UnprocessableEntityException::class, + 429 === $status => RateLimitException::class, + $status >= 500 => InternalServerException::class, + default => APIStatusException::class + }; + + return new $cls(request: $request, response: $response, message: $message); + } +} diff --git a/src/Core/Exceptions/APITimeoutException.php b/src/Core/Exceptions/APITimeoutException.php new file mode 100644 index 00000000..a4a5dcec --- /dev/null +++ b/src/Core/Exceptions/APITimeoutException.php @@ -0,0 +1,19 @@ +files->upload(file: FileParam::fromResource(fopen('data.csv', 'r'))); + * + * // From a string: + * $client->files->upload(file: FileParam::fromString('csv data...', 'data.csv')); + * ``` + */ +final class FileParam +{ + public const DEFAULT_CONTENT_TYPE = 'application/octet-stream'; + + /** + * @param resource|string $data the file content as a resource or string + */ + private function __construct( + public readonly mixed $data, + public readonly string $filename, + public readonly string $contentType = self::DEFAULT_CONTENT_TYPE, + ) {} + + /** + * Create a FileParam from an open resource (e.g. from fopen()). + * + * @param resource $resource an open file resource + * @param string|null $filename Override the filename. Defaults to the resource URI basename. + * @param string $contentType override the content type + */ + public static function fromResource(mixed $resource, ?string $filename = null, string $contentType = self::DEFAULT_CONTENT_TYPE): self + { + if (!is_resource($resource)) { + throw new \InvalidArgumentException('Expected a resource, got '.get_debug_type($resource)); + } + + if (is_null($filename)) { + $meta = stream_get_meta_data($resource); + $filename = basename($meta['uri'] ?? 'upload'); + } + + return new self($resource, filename: $filename, contentType: $contentType); + } + + /** + * Create a FileParam from a string. + * + * @param string $content the file content + * @param string $filename the filename for the Content-Disposition header + * @param string $contentType override the content type + */ + public static function fromString(string $content, string $filename, string $contentType = self::DEFAULT_CONTENT_TYPE): self + { + return new self($content, filename: $filename, contentType: $contentType); + } +} diff --git a/src/Core/Implementation/RawResponse.php b/src/Core/Implementation/RawResponse.php new file mode 100644 index 00000000..9a617c2e --- /dev/null +++ b/src/Core/Implementation/RawResponse.php @@ -0,0 +1,106 @@ + + */ +class RawResponse implements BaseResponse +{ + use ResponseProxy; + + private mixed $decodedBody; + + /** @var R */ + private mixed $coercedResponse; + + private bool $decoded = false; + private bool $coerced = false; + + /** + * @param NormalizedRequest $requestInfo + * @param list|string|int|null $unwrap + */ + public function __construct( + private BaseClient $client, + private RequestOptions $options, + private RequestInterface $request, + private ResponseInterface $response, + private array $requestInfo, + private array|string|int|null $unwrap, + private Converter|ConverterSource|string $convert, + private ?string $page, + private ?string $stream, + ) {} + + public function getRequest(): RequestInterface + { + return $this->request; + } + + public function parse(): mixed + { + if (!$this->coerced) { + if (!is_null($this->stream)) { + // @phpstan-ignore-next-line assign.propertyType + $this->coercedResponse = new $this->stream( + convert: $this->convert, + request: $this->request, + response: $this->response, + parsedBody: $this->getDecoded(), + ); + } elseif (!is_null($this->page)) { + // @phpstan-ignore-next-line assign.propertyType + $this->coercedResponse = new $this->page( + convert: $this->convert, + client: $this->client, + requestInfo: $this->requestInfo, + options: $this->options, + response: $this->response, + parsedBody: $this->getDecoded(), + ); + } else { + // @phpstan-ignore-next-line assign.propertyType + $this->coercedResponse = Conversion::coerce( + $this->convert, + value: $this->getDecoded(), + ); + } + + $this->coerced = true; + } + + return $this->coercedResponse; + } + + private function getDecoded(): mixed + { + if (!$this->decoded) { + $decoded = Util::decodeContent($this->response); + if (!is_null($this->unwrap)) { + $decoded = Util::dig($decoded, key: $this->unwrap); + } + $this->decodedBody = $decoded; + $this->decoded = true; + } + + return $this->decodedBody; + } +} diff --git a/src/Core/Implementation/StreamingHttpClient.php b/src/Core/Implementation/StreamingHttpClient.php new file mode 100644 index 00000000..27807d25 --- /dev/null +++ b/src/Core/Implementation/StreamingHttpClient.php @@ -0,0 +1,29 @@ +inner, '\GuzzleHttp\Client')) { + return $this->inner->send($request, ['stream' => true]); + } + + return $this->inner->sendRequest($request); + } +} diff --git a/src/Core/Util.php b/src/Core/Util.php new file mode 100644 index 00000000..c1634798 --- /dev/null +++ b/src/Core/Util.php @@ -0,0 +1,577 @@ + + */ + public static function get_object_vars(object $object): array + { + return get_object_vars($object); + } + + public static function machtype(): string + { + $arch = php_uname('m'); + + return match (true) { + str_contains($arch, 'aarch64'), str_contains($arch, 'arm64') => 'arm64', + str_contains($arch, 'x86_64'), str_contains($arch, 'amd64') => 'x64', + str_contains($arch, 'i386'), str_contains($arch, 'i686') => 'x32', + str_contains($arch, 'arm') => 'arm', + default => 'unknown', + }; + } + + public static function ostype(): string + { + return match ($os = strtolower(PHP_OS_FAMILY)) { + 'linux' => 'Linux', + 'darwin' => 'MacOS', + 'windows' => 'Windows', + 'solaris' => 'Solaris', + // @phpstan-ignore-next-line match.alwaysFalse + 'bsd', 'freebsd', 'openbsd' => 'BSD', + default => "Other:{$os}", + }; + } + + /** + * @template T + * + * @param array $array + * @param array $map + * + * @return array + */ + public static function array_transform_keys(array $array, array $map): array + { + $acc = []; + foreach ($array as $key => $value) { + $acc[$map[$key] ?? $key] = $value; + } + + return $acc; + } + + public static function strVal(mixed $value): string + { + if (is_bool($value)) { + return $value ? 'true' : 'false'; + } + + if (is_object($value) && is_a($value, class: \DateTimeInterface::class)) { + return date_format($value, format: \DateTimeInterface::RFC3339); + } + + // @phpstan-ignore-next-line argument.type + return strval($value); + } + + /** + * @param callable $callback + */ + public static function mapRecursive(mixed $callback, mixed $value): mixed + { + $mapped = match (true) { + is_array($value) => array_map(static fn ($v) => self::mapRecursive($callback, value: $v), $value), + default => $value, + }; + + return $callback($mapped); + } + + public static function removeNulls(mixed $value): mixed + { + $mapped = self::mapRecursive( + static fn ($vs) => is_array($vs) && !array_is_list($vs) ? array_filter($vs, callback: static fn ($v) => !is_null($v)) : $vs, + value: $value + ); + + return $mapped; + } + + /** + * @param string|int|list|callable $key + */ + public static function dig( + mixed $array, + string|int|array|callable $key + ): mixed { + if (is_callable($key)) { + return $key($array); + } + + if (is_array($array)) { + if ((is_string($key) || is_int($key)) && array_key_exists($key, array: $array)) { + return $array[$key]; + } + + if (is_array($key) && !empty($key)) { + if (array_key_exists($fst = $key[0], array: $array)) { + return self::dig($array[$fst], key: array_slice($key, 1)); + } + } + } + + return null; + } + + /** + * @param string|list $path + */ + public static function parsePath(string|array $path): string + { + if (is_string($path)) { + return $path; + } + + if (empty($path)) { + return ''; + } + + [$template] = $path; + $mapped = array_map(static fn ($s) => rawurlencode(self::strVal($s)), array: array_slice($path, 1)); + + return sprintf($template, ...$mapped); + } + + /** + * @param array $query + */ + public static function joinUri( + UriInterface $base, + string $path, + array $query = [] + ): UriInterface { + $parsed = parse_url($path); + if ($scheme = $parsed['scheme'] ?? null) { + $base = $base->withScheme($scheme); + } + if ($host = $parsed['host'] ?? null) { + $base = $base->withHost($host); + } + if ($port = $parsed['port'] ?? null) { + $base = $base->withPort($port); + } + if (($user = $parsed['user'] ?? null) || ($pass = $parsed['pass'] ?? null)) { + $base = $base->withUserInfo($user ?? '', $pass ?? null); + } + if ($path = $parsed['path'] ?? null) { + $base = str_starts_with($path, '/') ? $base->withPath($path) : $base->withPath($base->getPath().'/'.$path); + } + + [$q1, $q2] = [[], []]; + parse_str($base->getQuery(), $q1); + parse_str($parsed['query'] ?? '', $q2); + + $mergedQuery = array_merge_recursive($q1, $q2, $query); + + /** @var array */ + $normalizedQuery = self::mapRecursive( + static fn ($v) => is_bool($v) || is_numeric($v) ? self::strVal($v) : $v, + value: $mergedQuery + ); + $qs = http_build_query($normalizedQuery, encoding_type: PHP_QUERY_RFC3986); + + return $base->withQuery($qs); + } + + public static function isStreamingRequest(RequestInterface $request): bool + { + $accept = $request->getHeaderLine('Accept'); + + return !empty(array_filter( + self::STREAMING_CONTENT_TYPE, + static fn (string $pattern) => (bool) preg_match($pattern, subject: $accept), + )); + } + + /** + * @param array|null> $headers + */ + public static function withSetHeaders( + RequestInterface $req, + array $headers + ): RequestInterface { + foreach ($headers as $name => $value) { + if (is_null($value)) { + /** @var RequestInterface */ + $req = $req->withoutHeader($name); + } else { + $value = is_array($value) ? array_map(static fn ($v) => self::strVal($v), array: $value) : self::strVal($value); + + /** @var RequestInterface */ + $req = $req->withHeader($name, $value); + } + } + + return $req; + } + + /** + * @return \Iterator + */ + public static function streamIterator(StreamInterface $stream): \Iterator + { + if (!$stream->isReadable()) { + return; + } + + try { + while (!$stream->eof()) { + yield $stream->read(self::BUF_SIZE); + } + } finally { + $stream->close(); + } + } + + /** + * @param bool|int|float|string|resource|\Traversable|array|null $body + */ + public static function withSetBody( + StreamFactoryInterface $factory, + RequestInterface $req, + mixed $body + ): RequestInterface { + if ($body instanceof StreamInterface) { + /** @var RequestInterface */ + return $req->withBody($body); + } + + $contentType = $req->getHeaderLine('Content-Type'); + if (preg_match(self::JSON_CONTENT_TYPE, $contentType)) { + if (is_array($body) || is_object($body)) { + $encoded = json_encode($body, flags: self::JSON_ENCODE_FLAGS); + $stream = $factory->createStream($encoded); + + /** @var RequestInterface */ + return $req->withBody($stream); + } + } + + if (preg_match('/^multipart\/form-data/', $contentType)) { + [$boundary, $gen] = self::encodeMultipartStreaming($body); + $encoded = implode('', iterator_to_array($gen, preserve_keys: false)); + $stream = $factory->createStream($encoded); + + /** @var RequestInterface */ + return $req->withHeader('Content-Type', "{$contentType}; boundary={$boundary}")->withBody($stream); + } + + if (is_resource($body)) { + $stream = $factory->createStreamFromResource($body); + + /** @var RequestInterface */ + return $req->withBody($stream); + } + + if (is_string($body)) { + $stream = $factory->createStream($body); + + // @var RequestInterface + return $req->withBody($stream); + } + + return $req; + } + + /** + * @param \Iterator $stream + * + * @return \Iterator + */ + public static function decodeLines(\Iterator $stream): \Iterator + { + $buf = ''; + foreach ($stream as $chunk) { + $buf .= $chunk; + while (($pos = strpos($buf, "\n")) !== false) { + yield substr($buf, 0, $pos); + $buf = substr($buf, $pos + 1); + } + } + if ('' !== $buf) { + yield $buf; + } + } + + /** + * @param \Iterator $lines + * + * @return \Generator + */ + public static function decodeSSE(\Iterator $lines): \Generator + { + $blank = ['event' => null, 'data' => null, 'id' => null, 'retry' => null]; + $acc = []; + + foreach ($lines as $line) { + $line = rtrim($line); + if ('' === $line) { + if (empty($acc)) { + continue; + } + + yield [...$blank, ...$acc]; + $acc = []; + } + + if (str_starts_with($line, ':')) { + continue; + } + + $matches = []; + if (preg_match('/^([^:]+):\s?(.*)$/', $line, $matches)) { + [, $field, $value] = $matches; + + switch ($field) { + case 'event': + $acc['event'] = $value; + + break; + + case 'data': + if (isset($acc['data'])) { + $acc['data'] .= "\n".$value; + } else { + $acc['data'] = $value; + } + + break; + + case 'id': + $acc['id'] = $value; + + break; + + case 'retry': + $acc['retry'] = (int) $value; + + break; + } + } + } + + if (!empty($acc)) { + yield [...$blank, ...$acc]; + } + } + + public static function decodeJson(string $json): mixed + { + return json_decode($json, associative: true, flags: JSON_THROW_ON_ERROR); + } + + public static function decodeContent(ResponseInterface $rsp): mixed + { + if (204 == $rsp->getStatusCode()) { + return null; + } + + $content_type = $rsp->getHeaderLine('Content-Type'); + $body = $rsp->getBody(); + + if (preg_match(self::JSON_CONTENT_TYPE, subject: $content_type)) { + $json = $body->getContents(); + + return self::decodeJson($json); + } + + if (preg_match(self::JSONL_CONTENT_TYPE, subject: $content_type)) { + $it = self::streamIterator($body); + $lines = self::decodeLines($it); + + return (function () use ($lines) { + foreach ($lines as $line) { + yield static::decodeJson($line); + } + })(); + } + + if (str_contains($content_type, needle: 'text/event-stream')) { + $it = self::streamIterator($body); + $lines = self::decodeLines($it); + + return self::decodeSSE($lines); + } + + return self::streamIterator($body); + } + + public static function prettyEncodeJson(mixed $obj): string + { + return json_encode($obj, flags: JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT) ?: ''; + } + + /** + * @param list $closing + * + * @return \Generator + */ + private static function writeMultipartContent( + mixed $val, + array &$closing, + ?string $contentType = null + ): \Generator { + $contentLine = "Content-Type: %s\r\n\r\n"; + + if ($val instanceof FileParam) { + $ct = $val->contentType ?? $contentType; + + yield sprintf($contentLine, $ct); + $data = $val->data; + if (is_string($data)) { + yield $data; + } else { // resource + while (!feof($data)) { + if ($read = fread($data, length: self::BUF_SIZE)) { + yield $read; + } + } + } + } elseif (is_string($val) || is_numeric($val) || is_bool($val)) { + yield sprintf($contentLine, $contentType ?? 'text/plain'); + + yield self::strVal($val); + } else { + yield sprintf($contentLine, $contentType ?? 'application/json'); + + yield json_encode($val, flags: self::JSON_ENCODE_FLAGS); + } + + yield "\r\n"; + } + + /** + * @param list $closing + * + * @return \Generator + */ + private static function writeMultipartChunk( + string $boundary, + ?string $key, + mixed $val, + array &$closing + ): \Generator { + yield "--{$boundary}\r\n"; + + yield 'Content-Disposition: form-data'; + + if (!is_null($key)) { + $name = str_replace(['"', "\r", "\n"], replace: '', subject: $key); + + yield "; name=\"{$name}\""; + } + + // File uploads require a filename in the Content-Disposition header, + // e.g. `Content-Disposition: form-data; name="file"; filename="data.csv"` + // Without this, many servers will reject the upload with a 400. + if ($val instanceof FileParam) { + $filename = str_replace(['"', "\r", "\n"], replace: '', subject: $val->filename); + + yield "; filename=\"{$filename}\""; + } + + yield "\r\n"; + foreach (self::writeMultipartContent($val, closing: $closing) as $chunk) { + yield $chunk; + } + } + + /** + * Expands list arrays into separate multipart parts, applying the configured array key format. + * + * @param list $closing + * + * @return \Generator + */ + private static function writeMultipartField( + string $boundary, + ?string $key, + mixed $val, + array &$closing + ): \Generator { + if (is_array($val) && array_is_list($val)) { + foreach ($val as $item) { + yield from self::writeMultipartField(boundary: $boundary, key: $key, val: $item, closing: $closing); + } + } else { + yield from self::writeMultipartChunk(boundary: $boundary, key: $key, val: $val, closing: $closing); + } + } + + /** + * @param bool|int|float|string|resource|\Traversable|array|null $body + * + * @return array{string, \Generator} + */ + private static function encodeMultipartStreaming(mixed $body): array + { + $boundary = rtrim(strtr(base64_encode(random_bytes(60)), '+/', '-_'), '='); + $gen = (function () use ($boundary, $body) { + $closing = []; + + try { + if (is_array($body) || is_object($body)) { + foreach ((array) $body as $key => $val) { + yield from static::writeMultipartField(boundary: $boundary, key: $key, val: $val, closing: $closing); + } + } else { + yield from static::writeMultipartField(boundary: $boundary, key: null, val: $body, closing: $closing); + } + + yield "--{$boundary}--\r\n"; + } finally { + foreach ($closing as $c) { + $c(); + } + } + })(); + + return [$boundary, $gen]; + } +} diff --git a/src/Industry/IndustryGetNaicsResponse.php b/src/Industry/IndustryGetNaicsResponse.php new file mode 100644 index 00000000..4f2b2394 --- /dev/null +++ b/src/Industry/IndustryGetNaicsResponse.php @@ -0,0 +1,151 @@ +|null, + * domain?: string|null, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * status?: string|null, + * type?: string|null, + * } + */ +final class IndustryGetNaicsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of NAICS codes and titles. + * + * @var list|null $codes + */ + #[Optional(list: Code::class)] + public ?array $codes; + + /** + * Domain found for the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + /** + * Industry classification type, for naics api it will be `naics`. + */ + #[Optional] + public ?string $type; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $codes + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + ?array $codes = null, + ?string $domain = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ?string $type = null, + ): self { + $self = new self; + + null !== $codes && $self['codes'] = $codes; + null !== $domain && $self['domain'] = $domain; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + null !== $type && $self['type'] = $type; + + return $self; + } + + /** + * Array of NAICS codes and titles. + * + * @param list $codes + */ + public function withCodes(array $codes): self + { + $self = clone $this; + $self['codes'] = $codes; + + return $self; + } + + /** + * Domain found for the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Industry classification type, for naics api it will be `naics`. + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Industry/IndustryGetNaicsResponse/Code.php b/src/Industry/IndustryGetNaicsResponse/Code.php new file mode 100644 index 00000000..4ae65d56 --- /dev/null +++ b/src/Industry/IndustryGetNaicsResponse/Code.php @@ -0,0 +1,116 @@ +, name: string + * } + */ +final class Code implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * NAICS code. + */ + #[Required] + public string $code; + + /** + * Confidence level for how well this NAICS code matches the company description. + * + * @var value-of $confidence + */ + #[Required(enum: Confidence::class)] + public string $confidence; + + /** + * NAICS title. + */ + #[Required] + public string $name; + + /** + * `new Code()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Code::with(code: ..., confidence: ..., name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Code)->withCode(...)->withConfidence(...)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Confidence|value-of $confidence + */ + public static function with( + string $code, + Confidence|string $confidence, + string $name + ): self { + $self = new self; + + $self['code'] = $code; + $self['confidence'] = $confidence; + $self['name'] = $name; + + return $self; + } + + /** + * NAICS code. + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Confidence level for how well this NAICS code matches the company description. + * + * @param Confidence|value-of $confidence + */ + public function withConfidence(Confidence|string $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * NAICS title. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/Industry/IndustryGetNaicsResponse/Code/Confidence.php b/src/Industry/IndustryGetNaicsResponse/Code/Confidence.php new file mode 100644 index 00000000..f1805f94 --- /dev/null +++ b/src/Industry/IndustryGetNaicsResponse/Code/Confidence.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Industry/IndustryGetSicResponse.php b/src/Industry/IndustryGetSicResponse.php new file mode 100644 index 00000000..8ed1f7f5 --- /dev/null +++ b/src/Industry/IndustryGetSicResponse.php @@ -0,0 +1,178 @@ +, + * codes?: list|null, + * domain?: string|null, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * status?: string|null, + * type?: string|null, + * } + */ +final class IndustryGetSicResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Echoes back which SIC dataset was used to classify the brand. + * + * @var value-of|null $classification + */ + #[Optional(enum: Classification::class)] + public ?string $classification; + + /** + * Array of SIC codes with confidence scores. Extra fields depend on the requested classification: `original_sic` results include `majorGroup` and `majorGroupName`; `latest_sec` results include `office`. + * + * @var list|null $codes + */ + #[Optional(list: Code::class)] + public ?array $codes; + + /** + * Domain found for the brand. + */ + #[Optional] + public ?string $domain; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + /** + * Industry classification type, for sic api it will be `sic`. + */ + #[Optional] + public ?string $type; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Classification|value-of|null $classification + * @param list|null $codes + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Classification|string|null $classification = null, + ?array $codes = null, + ?string $domain = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + ?string $type = null, + ): self { + $self = new self; + + null !== $classification && $self['classification'] = $classification; + null !== $codes && $self['codes'] = $codes; + null !== $domain && $self['domain'] = $domain; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + null !== $type && $self['type'] = $type; + + return $self; + } + + /** + * Echoes back which SIC dataset was used to classify the brand. + * + * @param Classification|value-of $classification + */ + public function withClassification( + Classification|string $classification + ): self { + $self = clone $this; + $self['classification'] = $classification; + + return $self; + } + + /** + * Array of SIC codes with confidence scores. Extra fields depend on the requested classification: `original_sic` results include `majorGroup` and `majorGroupName`; `latest_sec` results include `office`. + * + * @param list $codes + */ + public function withCodes(array $codes): self + { + $self = clone $this; + $self['codes'] = $codes; + + return $self; + } + + /** + * Domain found for the brand. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Industry classification type, for sic api it will be `sic`. + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Industry/IndustryGetSicResponse/Classification.php b/src/Industry/IndustryGetSicResponse/Classification.php new file mode 100644 index 00000000..afa37cdb --- /dev/null +++ b/src/Industry/IndustryGetSicResponse/Classification.php @@ -0,0 +1,15 @@ +, + * name: string, + * majorGroup?: string|null, + * majorGroupName?: string|null, + * office?: string|null, + * } + */ +final class Code implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * SIC code (4-digit). + */ + #[Required] + public string $code; + + /** + * Confidence level for how well this SIC code matches the company description. + * + * @var value-of $confidence + */ + #[Required(enum: Confidence::class)] + public string $confidence; + + /** + * SIC industry title. + */ + #[Required] + public string $name; + + /** + * 2-digit major group identifier (the leading two digits of the code). Only present when `classification` is `original_sic`. + */ + #[Optional] + public ?string $majorGroup; + + /** + * Description of the 2-digit major group. Only present when `classification` is `original_sic`. + */ + #[Optional] + public ?string $majorGroupName; + + /** + * SEC review office responsible for filings under this code. Only present when `classification` is `latest_sec`. + */ + #[Optional] + public ?string $office; + + /** + * `new Code()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Code::with(code: ..., confidence: ..., name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Code)->withCode(...)->withConfidence(...)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Confidence|value-of $confidence + */ + public static function with( + string $code, + Confidence|string $confidence, + string $name, + ?string $majorGroup = null, + ?string $majorGroupName = null, + ?string $office = null, + ): self { + $self = new self; + + $self['code'] = $code; + $self['confidence'] = $confidence; + $self['name'] = $name; + + null !== $majorGroup && $self['majorGroup'] = $majorGroup; + null !== $majorGroupName && $self['majorGroupName'] = $majorGroupName; + null !== $office && $self['office'] = $office; + + return $self; + } + + /** + * SIC code (4-digit). + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Confidence level for how well this SIC code matches the company description. + * + * @param Confidence|value-of $confidence + */ + public function withConfidence(Confidence|string $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * SIC industry title. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * 2-digit major group identifier (the leading two digits of the code). Only present when `classification` is `original_sic`. + */ + public function withMajorGroup(string $majorGroup): self + { + $self = clone $this; + $self['majorGroup'] = $majorGroup; + + return $self; + } + + /** + * Description of the 2-digit major group. Only present when `classification` is `original_sic`. + */ + public function withMajorGroupName(string $majorGroupName): self + { + $self = clone $this; + $self['majorGroupName'] = $majorGroupName; + + return $self; + } + + /** + * SEC review office responsible for filings under this code. Only present when `classification` is `latest_sec`. + */ + public function withOffice(string $office): self + { + $self = clone $this; + $self['office'] = $office; + + return $self; + } +} diff --git a/src/Industry/IndustryGetSicResponse/Code/Confidence.php b/src/Industry/IndustryGetSicResponse/Code/Confidence.php new file mode 100644 index 00000000..0f514cec --- /dev/null +++ b/src/Industry/IndustryGetSicResponse/Code/Confidence.php @@ -0,0 +1,17 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Industry/IndustryRetrieveNaicsParams.php b/src/Industry/IndustryRetrieveNaicsParams.php new file mode 100644 index 00000000..cdc69a68 --- /dev/null +++ b/src/Industry/IndustryRetrieveNaicsParams.php @@ -0,0 +1,139 @@ + */ + use SdkModel; + use SdkParams; + + /** + * Brand domain or title to retrieve NAICS code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. + */ + #[Required] + public string $input; + + /** + * Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults to 5. + */ + #[Optional] + public ?int $maxResults; + + /** + * Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1. + */ + #[Optional] + public ?int $minResults; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new IndustryRetrieveNaicsParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * IndustryRetrieveNaicsParams::with(input: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new IndustryRetrieveNaicsParams)->withInput(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $input, + ?int $maxResults = null, + ?int $minResults = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['input'] = $input; + + null !== $maxResults && $self['maxResults'] = $maxResults; + null !== $minResults && $self['minResults'] = $minResults; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Brand domain or title to retrieve NAICS code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. + */ + public function withInput(string $input): self + { + $self = clone $this; + $self['input'] = $input; + + return $self; + } + + /** + * Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults to 5. + */ + public function withMaxResults(int $maxResults): self + { + $self = clone $this; + $self['maxResults'] = $maxResults; + + return $self; + } + + /** + * Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1. + */ + public function withMinResults(int $minResults): self + { + $self = clone $this; + $self['minResults'] = $minResults; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Industry/IndustryRetrieveSicParams.php b/src/Industry/IndustryRetrieveSicParams.php new file mode 100644 index 00000000..97aece5f --- /dev/null +++ b/src/Industry/IndustryRetrieveSicParams.php @@ -0,0 +1,166 @@ +, + * } + */ +final class IndustryRetrieveSicParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Brand domain or title to retrieve SIC code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. + */ + #[Required] + public string $input; + + /** + * Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + */ + #[Optional] + public ?int $maxResults; + + /** + * Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + */ + #[Optional] + public ?int $minResults; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`. + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + + /** + * `new IndustryRetrieveSicParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * IndustryRetrieveSicParams::with(input: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new IndustryRetrieveSicParams)->withInput(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + string $input, + ?int $maxResults = null, + ?int $minResults = null, + ?int $timeoutMs = null, + Type|string|null $type = null, + ): self { + $self = new self; + + $self['input'] = $input; + + null !== $maxResults && $self['maxResults'] = $maxResults; + null !== $minResults && $self['minResults'] = $minResults; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $type && $self['type'] = $type; + + return $self; + } + + /** + * Brand domain or title to retrieve SIC code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. + */ + public function withInput(string $input): self + { + $self = clone $this; + $self['input'] = $input; + + return $self; + } + + /** + * Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + */ + public function withMaxResults(int $maxResults): self + { + $self = clone $this; + $self['maxResults'] = $maxResults; + + return $self; + } + + /** + * Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + */ + public function withMinResults(int $minResults): self + { + $self = clone $this; + $self['minResults'] = $minResults; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Industry/IndustryRetrieveSicParams/Type.php b/src/Industry/IndustryRetrieveSicParams/Type.php new file mode 100644 index 00000000..9726506e --- /dev/null +++ b/src/Industry/IndustryRetrieveSicParams/Type.php @@ -0,0 +1,15 @@ +>|null, + * extraQueryParams?: array|null, + * extraBodyParams?: mixed, + * transporter?: ClientInterface|null, + * streamingTransporter?: ClientInterface|null, + * uriFactory?: UriFactoryInterface|null, + * streamFactory?: StreamFactoryInterface|null, + * requestFactory?: RequestFactoryInterface|null, + * } + * @phpstan-type RequestOpts = null|RequestOptions|RequestOptionShape + */ +final class RequestOptions implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Property] + public float $timeout = 60; + + #[Property] + public int $maxRetries = 2; + + #[Property] + public float $initialRetryDelay = 0.5; + + #[Property] + public float $maxRetryDelay = 8.0; + + /** @var array|null>|null $extraHeaders */ + #[Optional] + public ?array $extraHeaders; + + /** @var array|null $extraQueryParams */ + #[Optional] + public ?array $extraQueryParams; + + #[Optional] + public mixed $extraBodyParams; + + #[Optional] + public ?ClientInterface $transporter; + + #[Optional] + public ?ClientInterface $streamingTransporter; + + #[Optional] + public ?UriFactoryInterface $uriFactory; + + #[Optional] + public ?StreamFactoryInterface $streamFactory; + + #[Optional] + public ?RequestFactoryInterface $requestFactory; + + public function __construct() + { + $this->initialize(); + } + + /** + * @param RequestOpts|null $options + */ + public static function parse(RequestOptions|array|null ...$options): self + { + $parsed = array_map(static fn ($o) => $o instanceof self ? $o->toProperties() : $o ?? [], array: $options); + + // @phpstan-ignore-next-line argument.type + return self::with(...array_merge(...$parsed)); + } + + /** + * @param array|null>|null $extraHeaders + * @param array|null $extraQueryParams + */ + public static function with( + ?float $timeout = null, + ?int $maxRetries = null, + ?float $initialRetryDelay = null, + ?float $maxRetryDelay = null, + ?array $extraHeaders = null, + ?array $extraQueryParams = null, + mixed $extraBodyParams = null, + ?ClientInterface $transporter = null, + ?ClientInterface $streamingTransporter = null, + ?UriFactoryInterface $uriFactory = null, + ?StreamFactoryInterface $streamFactory = null, + ?RequestFactoryInterface $requestFactory = null, + ): self { + $self = new self; + + null !== $timeout && $self->timeout = $timeout; + null !== $maxRetries && $self->maxRetries = $maxRetries; + null !== $initialRetryDelay && $self + ->initialRetryDelay = $initialRetryDelay + ; + null !== $maxRetryDelay && $self->maxRetryDelay = $maxRetryDelay; + null !== $extraHeaders && $self->extraHeaders = $extraHeaders; + null !== $extraQueryParams && $self->extraQueryParams = $extraQueryParams; + null !== $extraBodyParams && $self->extraBodyParams = $extraBodyParams; + null !== $transporter && $self->transporter = $transporter; + null !== $streamingTransporter && $self + ->streamingTransporter = $streamingTransporter + ; + null !== $uriFactory && $self->uriFactory = $uriFactory; + null !== $streamFactory && $self->streamFactory = $streamFactory; + null !== $requestFactory && $self->requestFactory = $requestFactory; + + return $self; + } + + public function withTimeout(float $timeout): self + { + $self = clone $this; + $self->timeout = $timeout; + + return $self; + } + + public function withMaxRetries(int $maxRetries): self + { + $self = clone $this; + $self->maxRetries = $maxRetries; + + return $self; + } + + public function withInitialRetryDelay(float $initialRetryDelay): self + { + $self = clone $this; + $self->initialRetryDelay = $initialRetryDelay; + + return $self; + } + + public function withMaxRetryDelay(float $maxRetryDelay): self + { + $self = clone $this; + $self->maxRetryDelay = $maxRetryDelay; + + return $self; + } + + /** + * @param array|null> $extraHeaders + */ + public function withExtraHeaders(array $extraHeaders): self + { + $self = clone $this; + $self->extraHeaders = $extraHeaders; + + return $self; + } + + /** + * @param array $extraQueryParams + */ + public function withExtraQueryParams(array $extraQueryParams): self + { + $self = clone $this; + $self->extraQueryParams = $extraQueryParams; + + return $self; + } + + public function withExtraBodyParams(mixed $extraBodyParams): self + { + $self = clone $this; + $self->extraBodyParams = $extraBodyParams; + + return $self; + } + + public function withTransporter(ClientInterface $transporter): self + { + $self = clone $this; + $self->transporter = $transporter; + + return $self; + } + + public function withStreamingTransporter( + ClientInterface $streamingTransporter + ): self { + $self = clone $this; + $self->streamingTransporter = $streamingTransporter; + + return $self; + } + + public function withUriFactory(UriFactoryInterface $uriFactory): self + { + $self = clone $this; + $self->uriFactory = $uriFactory; + + return $self; + } + + public function withStreamFactory( + StreamFactoryInterface $streamFactory + ): self { + $self = clone $this; + $self->streamFactory = $streamFactory; + + return $self; + } + + public function withRequestFactory( + RequestFactoryInterface $requestFactory + ): self { + $self = clone $this; + $self->requestFactory = $requestFactory; + + return $self; + } +} diff --git a/src/ServiceContracts/AIContract.php b/src/ServiceContracts/AIContract.php new file mode 100644 index 00000000..ecd7de9b --- /dev/null +++ b/src/ServiceContracts/AIContract.php @@ -0,0 +1,78 @@ + $dataToExtract Array of data points to extract from the website + * @param string $domain The domain name to analyze + * @param SpecificPages|SpecificPagesShape $specificPages Optional object specifying which pages to analyze + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function aiQuery( + array $dataToExtract, + string $domain, + SpecificPages|array|null $specificPages = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): AIAIQueryResponse; + + /** + * @api + * + * @param string $url the product page URL to extract product data from + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractProduct( + string $url, + int $maxAgeMs = 604800000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): AIExtractProductResponse; + + /** + * @api + * + * @param string $domain the domain name to analyze + * @param string $directURL a specific URL to use directly as the starting point for extraction without domain resolution + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param int $maxProducts maximum number of products to extract + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractProducts( + string $domain, + string $directURL, + int $maxAgeMs = 604800000, + ?int $maxProducts = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): AIExtractProductsResponse; +} diff --git a/src/ServiceContracts/AIRawContract.php b/src/ServiceContracts/AIRawContract.php new file mode 100644 index 00000000..dc6e6011 --- /dev/null +++ b/src/ServiceContracts/AIRawContract.php @@ -0,0 +1,66 @@ +|AIAIQueryParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function aiQuery( + array|AIAIQueryParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|AIExtractProductParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractProduct( + array|AIExtractProductParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|AIExtractProductsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractProducts( + array|AIExtractProductsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/BrandContract.php b/src/ServiceContracts/BrandContract.php new file mode 100644 index 00000000..342ac582 --- /dev/null +++ b/src/ServiceContracts/BrandContract.php @@ -0,0 +1,179 @@ + $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $domain, + ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetResponse; + + /** + * @api + * + * @param string $transactionInfo Transaction information to identify the brand + * @param string $city optional city name to prioritize when searching for the brand + * @param CountryGl|value-of $countryGl Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. + * @param \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|value-of<\ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param bool $highConfidenceOnly when set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param string $mcc optional Merchant Category Code (MCC) to help identify the business category/industry + * @param float $phone optional phone number from the transaction to help verify brand match + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function identifyFromTransaction( + string $transactionInfo, + ?string $city = null, + CountryGl|string|null $countryGl = null, + \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|string|null $forceLanguage = null, + bool $highConfidenceOnly = false, + ?bool $maxSpeed = null, + ?string $mcc = null, + ?float $phone = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandIdentifyFromTransactionResponse; + + /** + * @api + * + * @param string $email Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + * @param \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByEmail( + string $email, + \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByEmailResponse; + + /** + * @api + * + * @param string $isin ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. + * @param \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByIsin( + string $isin, + \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByIsinResponse; + + /** + * @api + * + * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. + * @param \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\CountryGl> $countryGl optional country code hint (GL parameter) to specify the country for the company name + * @param \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByName( + string $name, + \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|string|null $countryGl = null, + \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByNameResponse; + + /** + * @api + * + * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. + * @param \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param TickerExchange|value-of $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByTicker( + string $ticker, + \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + TickerExchange|string|null $tickerExchange = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByTickerResponse; + + /** + * @api + * + * @param string $domain Domain name to retrieve simplified brand data for + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveSimplified( + string $domain, + int $maxAgeMs = 7776000000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetSimplifiedResponse; +} diff --git a/src/ServiceContracts/BrandRawContract.php b/src/ServiceContracts/BrandRawContract.php new file mode 100644 index 00000000..42adeb47 --- /dev/null +++ b/src/ServiceContracts/BrandRawContract.php @@ -0,0 +1,134 @@ +|BrandRetrieveParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + array|BrandRetrieveParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BrandIdentifyFromTransactionParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function identifyFromTransaction( + array|BrandIdentifyFromTransactionParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BrandRetrieveByEmailParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByEmail( + array|BrandRetrieveByEmailParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BrandRetrieveByIsinParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByIsin( + array|BrandRetrieveByIsinParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BrandRetrieveByNameParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByName( + array|BrandRetrieveByNameParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BrandRetrieveByTickerParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByTicker( + array|BrandRetrieveByTickerParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BrandRetrieveSimplifiedParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveSimplified( + array|BrandRetrieveSimplifiedParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/IndustryContract.php b/src/ServiceContracts/IndustryContract.php new file mode 100644 index 00000000..ebfb48c1 --- /dev/null +++ b/src/ServiceContracts/IndustryContract.php @@ -0,0 +1,57 @@ + $type Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveSic( + string $input, + int $maxResults = 5, + int $minResults = 1, + ?int $timeoutMs = null, + Type|string $type = 'original_sic', + RequestOptions|array|null $requestOptions = null, + ): IndustryGetSicResponse; +} diff --git a/src/ServiceContracts/IndustryRawContract.php b/src/ServiceContracts/IndustryRawContract.php new file mode 100644 index 00000000..d29feec0 --- /dev/null +++ b/src/ServiceContracts/IndustryRawContract.php @@ -0,0 +1,49 @@ +|IndustryRetrieveNaicsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveNaics( + array|IndustryRetrieveNaicsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|IndustryRetrieveSicParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveSic( + array|IndustryRetrieveSicParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/UtilityContract.php b/src/ServiceContracts/UtilityContract.php new file mode 100644 index 00000000..7ffb24df --- /dev/null +++ b/src/ServiceContracts/UtilityContract.php @@ -0,0 +1,46 @@ +|UtilityPrefetchParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function prefetch( + array|UtilityPrefetchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|UtilityPrefetchByEmailParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function prefetchByEmail( + array|UtilityPrefetchByEmailParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php new file mode 100644 index 00000000..0fa57c1f --- /dev/null +++ b/src/ServiceContracts/WebContract.php @@ -0,0 +1,349 @@ + $schema JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * @param string $url The starting website URL to crawl and extract from. Must include http:// or https://. + * @param bool $factCheck When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. + * @param bool $followSubdomains when true, follow links on subdomains of the starting URL's domain + * @param bool $includeFrames when true, iframe contents are included in Markdown before extraction + * @param string $instructions optional extraction guidance, such as which facts to prioritize or how to interpret fields in the schema + * @param int $maxAgeMs Return cached scrape results if a prior scrape for the same parameters is younger than this many milliseconds. Defaults to 7 days (604800000 ms). + * @param int $maxDepth Optional maximum link depth from the starting URL (0 = only the starting page). If omitted, there is no crawl depth limit. + * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. + * @param Pdf|PdfShape $pdf + * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extract( + array $schema, + string $url, + bool $factCheck = false, + bool $followSubdomains = false, + bool $includeFrames = false, + ?string $instructions = null, + int $maxAgeMs = 604800000, + ?int $maxDepth = null, + int $maxPages = 5, + Pdf|array $pdf = ['shouldParse' => true], + int $stopAfterMs = 80000, + ?int $timeoutMs = null, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractResponse; + + /** + * @api + * + * @param string $domain Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted and normalized to their domain. + * @param int $numCompetitors Exact number of direct competitors to return. Defaults to 5. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractCompetitors( + string $domain, + int $numCompetitors = 5, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractCompetitorsResponse; + + /** + * @api + * + * @param string $directURL A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + * @param string $domain Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractFonts( + ?string $directURL = null, + ?string $domain = null, + int $maxAgeMs = 7776000000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractFontsResponse; + + /** + * @api + * + * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractStyleguide( + ?string $directURL = null, + ?string $domain = null, + int $maxAgeMs = 7776000000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractStyleguideResponse; + + /** + * @api + * + * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. + * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). + * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. + * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function screenshot( + ?string $directURL = null, + ?string $domain = null, + FullScreenshot|string|null $fullScreenshot = null, + HandleCookiePopup|string $handleCookiePopup = 'false', + int $maxAgeMs = 86400000, + Page|string|null $page = null, + ?int $timeoutMs = null, + Viewport|array $viewport = ['width' => 1920, 'height' => 1080], + int $waitForMs = 3000, + RequestOptions|array|null $requestOptions = null, + ): WebScreenshotResponse; + + /** + * @api + * + * @param string $query natural-language search query + * @param list $excludeDomains Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. + * @param Freshness|value-of $freshness restrict results to content published within this window + * @param list $includeDomains Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"]. + * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. + * @param bool $queryFanout expand the query into multiple parallel variants for broader recall + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function search( + string $query, + ?array $excludeDomains = null, + Freshness|string|null $freshness = null, + ?array $includeDomains = null, + MarkdownOptions|array|null $markdownOptions = null, + ?bool $queryFanout = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebSearchResponse; + + /** + * @api + * + * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) + * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. + * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page + * @param bool $includeImages Include image references in the Markdown output + * @param bool $includeLinks Preserve hyperlinks in the Markdown output + * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before each crawled page is converted to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) + * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. + * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output + * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. + * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webCrawlMd( + string $url, + ?array $excludeSelectors = null, + bool $followSubdomains = false, + bool $includeFrames = false, + bool $includeImages = false, + bool $includeLinks = true, + ?array $includeSelectors = null, + int $maxAgeMs = 86400000, + ?int $maxDepth = null, + int $maxPages = 100, + \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ + 'shouldParse' => true, + ], + bool $shortenBase64Images = true, + int $stopAfterMs = 80000, + ?int $timeoutMs = null, + ?string $urlRegex = null, + bool $useMainContentOnly = false, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebCrawlMdResponse; + + /** + * @api + * + * @param string $url Full URL to scrape (must include http:// or https:// protocol) + * @param list $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML + * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeHTML( + string $url, + ?array $excludeSelectors = null, + ?array $headers = null, + bool $includeFrames = false, + ?array $includeSelectors = null, + int $maxAgeMs = 86400000, + \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ + 'shouldParse' => true, + ], + ?int $timeoutMs = null, + bool $useMainContentOnly = false, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeHTMLResponse; + + /** + * @api + * + * @param string $url Page URL to inspect. Must include http:// or https://. + * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeImages( + string $url, + Enrichment|array|null $enrichment = null, + ?array $headers = null, + int $maxAgeMs = 86400000, + ?int $timeoutMs = null, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeImagesResponse; + + /** + * @api + * + * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + * @param list $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown + * @param bool $includeImages Include image references in Markdown output + * @param bool $includeLinks Preserve hyperlinks in Markdown output + * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeMd( + string $url, + ?array $excludeSelectors = null, + ?array $headers = null, + bool $includeFrames = false, + bool $includeImages = false, + bool $includeLinks = true, + ?array $includeSelectors = null, + int $maxAgeMs = 86400000, + \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ + 'shouldParse' => true, + ], + bool $shortenBase64Images = true, + ?int $timeoutMs = null, + bool $useMainContentOnly = false, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeMdResponse; + + /** + * @api + * + * @param string $domain Domain to build a sitemap for + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeSitemap( + string $domain, + ?array $headers = null, + int $maxLinks = 10000, + ?int $timeoutMs = null, + ?string $urlRegex = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeSitemapResponse; +} diff --git a/src/ServiceContracts/WebRawContract.php b/src/ServiceContracts/WebRawContract.php new file mode 100644 index 00000000..27632bf8 --- /dev/null +++ b/src/ServiceContracts/WebRawContract.php @@ -0,0 +1,202 @@ +|WebExtractParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extract( + array|WebExtractParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebExtractCompetitorsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractCompetitors( + array|WebExtractCompetitorsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebExtractFontsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractFonts( + array|WebExtractFontsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebExtractStyleguideParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractStyleguide( + array|WebExtractStyleguideParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebScreenshotParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function screenshot( + array|WebScreenshotParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebSearchParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function search( + array|WebSearchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebWebCrawlMdParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webCrawlMd( + array|WebWebCrawlMdParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebWebScrapeHTMLParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeHTML( + array|WebWebScrapeHTMLParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebWebScrapeImagesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeImages( + array|WebWebScrapeImagesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebWebScrapeMdParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeMd( + array|WebWebScrapeMdParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|WebWebScrapeSitemapParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeSitemap( + array|WebWebScrapeSitemapParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/Services/AIRawService.php b/src/Services/AIRawService.php new file mode 100644 index 00000000..0b6e140f --- /dev/null +++ b/src/Services/AIRawService.php @@ -0,0 +1,139 @@ +, + * domain: string, + * specificPages?: SpecificPages|SpecificPagesShape, + * timeoutMs?: int, + * }|AIAIQueryParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function aiQuery( + array|AIAIQueryParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = AIAIQueryParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'brand/ai/query', + body: (object) $parsed, + options: $options, + convert: AIAIQueryResponse::class, + ); + } + + /** + * @api + * + * Given a single URL, determines if it is a product page and extracts the product information. + * + * @param array{ + * url: string, maxAgeMs?: int, timeoutMs?: int + * }|AIExtractProductParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractProduct( + array|AIExtractProductParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = AIExtractProductParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'brand/ai/product', + body: (object) $parsed, + options: $options, + convert: AIExtractProductResponse::class, + ); + } + + /** + * @api + * + * Extract product information from a brand's website. We will analyze the website and return a list of products with details such as name, description, image, pricing, features, and more. + * + * @param array{ + * domain: string, + * maxAgeMs?: int, + * maxProducts?: int, + * timeoutMs?: int, + * directURL: string, + * }|AIExtractProductsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractProducts( + array|AIExtractProductsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = AIExtractProductsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'brand/ai/products', + body: (object) $parsed, + options: $options, + convert: AIExtractProductsResponse::class, + ); + } +} diff --git a/src/Services/AIService.php b/src/Services/AIService.php new file mode 100644 index 00000000..187e24a7 --- /dev/null +++ b/src/Services/AIService.php @@ -0,0 +1,138 @@ +raw = new AIRawService($client); + } + + /** + * @api + * + * Use AI to extract specific data points from a brand's website. The AI will crawl the website and extract the requested information based on the provided data points. + * + * @param list $dataToExtract Array of data points to extract from the website + * @param string $domain The domain name to analyze + * @param SpecificPages|SpecificPagesShape $specificPages Optional object specifying which pages to analyze + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function aiQuery( + array $dataToExtract, + string $domain, + SpecificPages|array|null $specificPages = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): AIAIQueryResponse { + $params = Util::removeNulls( + [ + 'dataToExtract' => $dataToExtract, + 'domain' => $domain, + 'specificPages' => $specificPages, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->aiQuery(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Given a single URL, determines if it is a product page and extracts the product information. + * + * @param string $url the product page URL to extract product data from + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractProduct( + string $url, + int $maxAgeMs = 604800000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): AIExtractProductResponse { + $params = Util::removeNulls( + ['url' => $url, 'maxAgeMs' => $maxAgeMs, 'timeoutMs' => $timeoutMs] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->extractProduct(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Extract product information from a brand's website. We will analyze the website and return a list of products with details such as name, description, image, pricing, features, and more. + * + * @param string $domain the domain name to analyze + * @param string $directURL a specific URL to use directly as the starting point for extraction without domain resolution + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param int $maxProducts maximum number of products to extract + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractProducts( + string $domain, + string $directURL, + int $maxAgeMs = 604800000, + ?int $maxProducts = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): AIExtractProductsResponse { + $params = Util::removeNulls( + [ + 'domain' => $domain, + 'maxAgeMs' => $maxAgeMs, + 'maxProducts' => $maxProducts, + 'timeoutMs' => $timeoutMs, + 'directURL' => $directURL, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->extractProducts(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php new file mode 100644 index 00000000..a2aabbb7 --- /dev/null +++ b/src/Services/BrandRawService.php @@ -0,0 +1,334 @@ +, + * maxAgeMs?: int, + * maxSpeed?: bool, + * timeoutMs?: int, + * }|BrandRetrieveParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + array|BrandRetrieveParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandRetrieveParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/retrieve', + query: Util::array_transform_keys( + $parsed, + ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], + ), + options: $options, + convert: BrandGetResponse::class, + ); + } + + /** + * @api + * + * Endpoint specially designed for platforms that want to identify transaction data by the transaction title. + * + * @param array{ + * transactionInfo: string, + * city?: string, + * countryGl?: value-of, + * forceLanguage?: value-of, + * highConfidenceOnly?: bool, + * maxSpeed?: bool, + * mcc?: string, + * phone?: float, + * timeoutMs?: int, + * }|BrandIdentifyFromTransactionParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function identifyFromTransaction( + array|BrandIdentifyFromTransactionParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandIdentifyFromTransactionParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/transaction_identifier', + query: Util::array_transform_keys( + $parsed, + [ + 'transactionInfo' => 'transaction_info', + 'countryGl' => 'country_gl', + 'forceLanguage' => 'force_language', + 'highConfidenceOnly' => 'high_confidence_only', + 'timeoutMs' => 'timeoutMS', + ], + ), + options: $options, + convert: BrandIdentifyFromTransactionResponse::class, + ); + } + + /** + * @api + * + * Retrieve brand information using an email address while detecting disposable and free email addresses. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. + * + * @param array{ + * email: string, + * forceLanguage?: value-of, + * maxAgeMs?: int, + * maxSpeed?: bool, + * timeoutMs?: int, + * }|BrandRetrieveByEmailParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByEmail( + array|BrandRetrieveByEmailParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandRetrieveByEmailParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/retrieve-by-email', + query: Util::array_transform_keys( + $parsed, + ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], + ), + options: $options, + convert: BrandGetByEmailResponse::class, + ); + } + + /** + * @api + * + * Retrieve brand information using an ISIN (International Securities Identification Number). + * + * @param array{ + * isin: string, + * forceLanguage?: value-of, + * maxAgeMs?: int, + * maxSpeed?: bool, + * timeoutMs?: int, + * }|BrandRetrieveByIsinParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByIsin( + array|BrandRetrieveByIsinParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandRetrieveByIsinParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/retrieve-by-isin', + query: Util::array_transform_keys( + $parsed, + ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], + ), + options: $options, + convert: BrandGetByIsinResponse::class, + ); + } + + /** + * @api + * + * Retrieve brand information using a company name. + * + * @param array{ + * name: string, + * countryGl?: value-of, + * forceLanguage?: value-of, + * maxAgeMs?: int, + * maxSpeed?: bool, + * timeoutMs?: int, + * }|BrandRetrieveByNameParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByName( + array|BrandRetrieveByNameParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandRetrieveByNameParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/retrieve-by-name', + query: Util::array_transform_keys( + $parsed, + [ + 'countryGl' => 'country_gl', + 'forceLanguage' => 'force_language', + 'timeoutMs' => 'timeoutMS', + ], + ), + options: $options, + convert: BrandGetByNameResponse::class, + ); + } + + /** + * @api + * + * Retrieve brand information using a stock ticker symbol. + * + * @param array{ + * ticker: string, + * forceLanguage?: value-of, + * maxAgeMs?: int, + * maxSpeed?: bool, + * tickerExchange?: value-of, + * timeoutMs?: int, + * }|BrandRetrieveByTickerParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveByTicker( + array|BrandRetrieveByTickerParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandRetrieveByTickerParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/retrieve-by-ticker', + query: Util::array_transform_keys( + $parsed, + [ + 'forceLanguage' => 'force_language', + 'tickerExchange' => 'ticker_exchange', + 'timeoutMs' => 'timeoutMS', + ], + ), + options: $options, + convert: BrandGetByTickerResponse::class, + ); + } + + /** + * @api + * + * Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. Optimized for faster responses and reduced data transfer. + * + * @param array{ + * domain: string, maxAgeMs?: int, timeoutMs?: int + * }|BrandRetrieveSimplifiedParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveSimplified( + array|BrandRetrieveSimplifiedParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandRetrieveSimplifiedParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/retrieve-simplified', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: BrandGetSimplifiedResponse::class, + ); + } +} diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php new file mode 100644 index 00000000..f5f2944a --- /dev/null +++ b/src/Services/BrandService.php @@ -0,0 +1,314 @@ +raw = new BrandRawService($client); + } + + /** + * @api + * + * Retrieve logos, backdrops, colors, industry, description, and more from any domain + * + * @param string $domain Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. + * @param ForceLanguage|value-of $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $domain, + ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetResponse { + $params = Util::removeNulls( + [ + 'domain' => $domain, + 'forceLanguage' => $forceLanguage, + 'maxAgeMs' => $maxAgeMs, + 'maxSpeed' => $maxSpeed, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Endpoint specially designed for platforms that want to identify transaction data by the transaction title. + * + * @param string $transactionInfo Transaction information to identify the brand + * @param string $city optional city name to prioritize when searching for the brand + * @param CountryGl|value-of $countryGl Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. + * @param \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|value-of<\ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param bool $highConfidenceOnly when set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param string $mcc optional Merchant Category Code (MCC) to help identify the business category/industry + * @param float $phone optional phone number from the transaction to help verify brand match + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function identifyFromTransaction( + string $transactionInfo, + ?string $city = null, + CountryGl|string|null $countryGl = null, + \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|string|null $forceLanguage = null, + bool $highConfidenceOnly = false, + ?bool $maxSpeed = null, + ?string $mcc = null, + ?float $phone = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandIdentifyFromTransactionResponse { + $params = Util::removeNulls( + [ + 'transactionInfo' => $transactionInfo, + 'city' => $city, + 'countryGl' => $countryGl, + 'forceLanguage' => $forceLanguage, + 'highConfidenceOnly' => $highConfidenceOnly, + 'maxSpeed' => $maxSpeed, + 'mcc' => $mcc, + 'phone' => $phone, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->identifyFromTransaction(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Retrieve brand information using an email address while detecting disposable and free email addresses. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. + * + * @param string $email Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + * @param \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByEmail( + string $email, + \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByEmailResponse { + $params = Util::removeNulls( + [ + 'email' => $email, + 'forceLanguage' => $forceLanguage, + 'maxAgeMs' => $maxAgeMs, + 'maxSpeed' => $maxSpeed, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveByEmail(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Retrieve brand information using an ISIN (International Securities Identification Number). + * + * @param string $isin ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. + * @param \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByIsin( + string $isin, + \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByIsinResponse { + $params = Util::removeNulls( + [ + 'isin' => $isin, + 'forceLanguage' => $forceLanguage, + 'maxAgeMs' => $maxAgeMs, + 'maxSpeed' => $maxSpeed, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveByIsin(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Retrieve brand information using a company name. + * + * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. + * @param \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\CountryGl> $countryGl optional country code hint (GL parameter) to specify the country for the company name + * @param \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByName( + string $name, + \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|string|null $countryGl = null, + \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByNameResponse { + $params = Util::removeNulls( + [ + 'name' => $name, + 'countryGl' => $countryGl, + 'forceLanguage' => $forceLanguage, + 'maxAgeMs' => $maxAgeMs, + 'maxSpeed' => $maxSpeed, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveByName(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Retrieve brand information using a stock ticker symbol. + * + * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. + * @param \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param TickerExchange|value-of $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveByTicker( + string $ticker, + \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|string|null $forceLanguage = null, + int $maxAgeMs = 7776000000, + ?bool $maxSpeed = null, + TickerExchange|string|null $tickerExchange = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetByTickerResponse { + $params = Util::removeNulls( + [ + 'ticker' => $ticker, + 'forceLanguage' => $forceLanguage, + 'maxAgeMs' => $maxAgeMs, + 'maxSpeed' => $maxSpeed, + 'tickerExchange' => $tickerExchange, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveByTicker(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. Optimized for faster responses and reduced data transfer. + * + * @param string $domain Domain name to retrieve simplified brand data for + * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveSimplified( + string $domain, + int $maxAgeMs = 7776000000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BrandGetSimplifiedResponse { + $params = Util::removeNulls( + ['domain' => $domain, 'maxAgeMs' => $maxAgeMs, 'timeoutMs' => $timeoutMs] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveSimplified(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/src/Services/IndustryRawService.php b/src/Services/IndustryRawService.php new file mode 100644 index 00000000..9613d743 --- /dev/null +++ b/src/Services/IndustryRawService.php @@ -0,0 +1,99 @@ + + * + * @throws APIException + */ + public function retrieveNaics( + array|IndustryRetrieveNaicsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = IndustryRetrieveNaicsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/naics', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: IndustryGetNaicsResponse::class, + ); + } + + /** + * @api + * + * Classify any brand into Standard Industrial Classification (SIC) codes from its domain or name. Choose between the original SIC system (`original_sic`) or the latest SIC list maintained by the SEC (`latest_sec`). + * + * @param array{ + * input: string, + * maxResults?: int, + * minResults?: int, + * timeoutMs?: int, + * type?: Type|value-of, + * }|IndustryRetrieveSicParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveSic( + array|IndustryRetrieveSicParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = IndustryRetrieveSicParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/sic', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: IndustryGetSicResponse::class, + ); + } +} diff --git a/src/Services/IndustryService.php b/src/Services/IndustryService.php new file mode 100644 index 00000000..47d6a851 --- /dev/null +++ b/src/Services/IndustryService.php @@ -0,0 +1,106 @@ +raw = new IndustryRawService($client); + } + + /** + * @api + * + * Classify any brand into 2022 NAICS industry codes from its domain or name. + * + * @param string $input Brand domain or title to retrieve NAICS code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. + * @param int $maxResults Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults to 5. + * @param int $minResults Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveNaics( + string $input, + int $maxResults = 5, + int $minResults = 1, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): IndustryGetNaicsResponse { + $params = Util::removeNulls( + [ + 'input' => $input, + 'maxResults' => $maxResults, + 'minResults' => $minResults, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveNaics(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Classify any brand into Standard Industrial Classification (SIC) codes from its domain or name. Choose between the original SIC system (`original_sic`) or the latest SIC list maintained by the SEC (`latest_sec`). + * + * @param string $input Brand domain or title to retrieve SIC code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. + * @param int $maxResults Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. + * @param int $minResults Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param Type|value-of $type Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveSic( + string $input, + int $maxResults = 5, + int $minResults = 1, + ?int $timeoutMs = null, + Type|string $type = 'original_sic', + RequestOptions|array|null $requestOptions = null, + ): IndustryGetSicResponse { + $params = Util::removeNulls( + [ + 'input' => $input, + 'maxResults' => $maxResults, + 'minResults' => $minResults, + 'timeoutMs' => $timeoutMs, + 'type' => $type, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveSic(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/src/Services/UtilityRawService.php b/src/Services/UtilityRawService.php new file mode 100644 index 00000000..fb7fc71f --- /dev/null +++ b/src/Services/UtilityRawService.php @@ -0,0 +1,91 @@ + + * + * @throws APIException + */ + public function prefetch( + array|UtilityPrefetchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = UtilityPrefetchParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'brand/prefetch', + body: (object) $parsed, + options: $options, + convert: UtilityPrefetchResponse::class, + ); + } + + /** + * @api + * + * Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint accepts an email address, extracts the domain from it, validates that it's not a disposable or free email provider, and queues the domain for prefetching. + * + * @param array{ + * email: string, timeoutMs?: int + * }|UtilityPrefetchByEmailParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function prefetchByEmail( + array|UtilityPrefetchByEmailParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = UtilityPrefetchByEmailParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'brand/prefetch-by-email', + body: (object) $parsed, + options: $options, + convert: UtilityPrefetchByEmailResponse::class, + ); + } +} diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php new file mode 100644 index 00000000..ff11a921 --- /dev/null +++ b/src/Services/UtilityService.php @@ -0,0 +1,82 @@ +raw = new UtilityRawService($client); + } + + /** + * @api + * + * Signal that you may fetch brand data for a particular domain soon to improve latency. + * + * @param string $domain Domain name to prefetch brand data for + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function prefetch( + string $domain, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): UtilityPrefetchResponse { + $params = Util::removeNulls( + ['domain' => $domain, 'timeoutMs' => $timeoutMs] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->prefetch(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint accepts an email address, extracts the domain from it, validates that it's not a disposable or free email provider, and queues the domain for prefetching. + * + * @param string $email Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function prefetchByEmail( + string $email, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): UtilityPrefetchByEmailResponse { + $params = Util::removeNulls(['email' => $email, 'timeoutMs' => $timeoutMs]); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->prefetchByEmail(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php new file mode 100644 index 00000000..8e98d664 --- /dev/null +++ b/src/Services/WebRawService.php @@ -0,0 +1,505 @@ +, + * url: string, + * factCheck?: bool, + * followSubdomains?: bool, + * includeFrames?: bool, + * instructions?: string, + * maxAgeMs?: int, + * maxDepth?: int, + * maxPages?: int, + * pdf?: Pdf|PdfShape, + * stopAfterMs?: int, + * timeoutMs?: int, + * waitForMs?: int, + * }|WebExtractParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extract( + array|WebExtractParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebExtractParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'web/extract', + body: (object) $parsed, + options: $options, + convert: WebExtractResponse::class, + ); + } + + /** + * @api + * + * Analyze a company's landing page and web search evidence to return direct competitors for the same product or market. + * + * @param array{ + * domain: string, numCompetitors?: int, timeoutMs?: int + * }|WebExtractCompetitorsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractCompetitors( + array|WebExtractCompetitorsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebExtractCompetitorsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/competitors', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: WebExtractCompetitorsResponse::class, + ); + } + + /** + * @api + * + * Scrape font information from a website including font families, usage statistics, fallbacks, and element/word counts. + * + * @param array{ + * directURL?: string, domain?: string, maxAgeMs?: int, timeoutMs?: int + * }|WebExtractFontsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractFonts( + array|WebExtractFontsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebExtractFontsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/fonts', + query: Util::array_transform_keys( + $parsed, + ['directURL' => 'directUrl', 'timeoutMs' => 'timeoutMS'] + ), + options: $options, + convert: WebExtractFontsResponse::class, + ); + } + + /** + * @api + * + * Extract a comprehensive design system from a website including colors, typography, spacing, shadows, and UI components. + * + * @param array{ + * directURL?: string, domain?: string, maxAgeMs?: int, timeoutMs?: int + * }|WebExtractStyleguideParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function extractStyleguide( + array|WebExtractStyleguideParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebExtractStyleguideParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/styleguide', + query: Util::array_transform_keys( + $parsed, + ['directURL' => 'directUrl', 'timeoutMs' => 'timeoutMS'] + ), + options: $options, + convert: WebExtractStyleguideResponse::class, + ); + } + + /** + * @api + * + * Capture a screenshot of a website. + * + * @param array{ + * directURL?: string, + * domain?: string, + * fullScreenshot?: FullScreenshot|value-of, + * handleCookiePopup?: HandleCookiePopup|value-of, + * maxAgeMs?: int, + * page?: Page|value-of, + * timeoutMs?: int, + * viewport?: Viewport|ViewportShape, + * waitForMs?: int, + * }|WebScreenshotParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function screenshot( + array|WebScreenshotParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebScreenshotParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/screenshot', + query: Util::array_transform_keys( + $parsed, + ['directURL' => 'directUrl', 'timeoutMs' => 'timeoutMS'] + ), + options: $options, + convert: WebScreenshotResponse::class, + ); + } + + /** + * @api + * + * Search the web and optionally scrape each result to Markdown in one round-trip. + * + * @param array{ + * query: string, + * excludeDomains?: list, + * freshness?: Freshness|value-of, + * includeDomains?: list, + * markdownOptions?: MarkdownOptions|MarkdownOptionsShape, + * queryFanout?: bool, + * timeoutMs?: int, + * }|WebSearchParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function search( + array|WebSearchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebSearchParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'web/search', + body: (object) $parsed, + options: $options, + convert: WebSearchResponse::class, + ); + } + + /** + * @api + * + * Performs a crawl starting from a given URL, extracts page content as Markdown, and returns results for all crawled pages. + * + * @param array{ + * url: string, + * excludeSelectors?: list, + * followSubdomains?: bool, + * includeFrames?: bool, + * includeImages?: bool, + * includeLinks?: bool, + * includeSelectors?: list, + * maxAgeMs?: int, + * maxDepth?: int, + * maxPages?: int, + * pdf?: WebWebCrawlMdParams\Pdf|PdfShape1, + * shortenBase64Images?: bool, + * stopAfterMs?: int, + * timeoutMs?: int, + * urlRegex?: string, + * useMainContentOnly?: bool, + * waitForMs?: int, + * }|WebWebCrawlMdParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webCrawlMd( + array|WebWebCrawlMdParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebWebCrawlMdParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'web/crawl', + body: (object) $parsed, + options: $options, + convert: WebWebCrawlMdResponse::class, + ); + } + + /** + * @api + * + * Scrapes the given URL and returns the raw HTML content of the page. + * + * @param array{ + * url: string, + * excludeSelectors?: list, + * headers?: array, + * includeFrames?: bool, + * includeSelectors?: list, + * maxAgeMs?: int, + * pdf?: WebWebScrapeHTMLParams\Pdf|PdfShape2, + * timeoutMs?: int, + * useMainContentOnly?: bool, + * waitForMs?: int, + * }|WebWebScrapeHTMLParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeHTML( + array|WebWebScrapeHTMLParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebWebScrapeHTMLParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/scrape/html', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: WebWebScrapeHTMLResponse::class, + ); + } + + /** + * @api + * + * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. + * + * @param array{ + * url: string, + * enrichment?: Enrichment|EnrichmentShape, + * headers?: array, + * maxAgeMs?: int, + * timeoutMs?: int, + * waitForMs?: int, + * }|WebWebScrapeImagesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeImages( + array|WebWebScrapeImagesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebWebScrapeImagesParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/scrape/images', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: WebWebScrapeImagesResponse::class, + ); + } + + /** + * @api + * + * Scrapes the given URL into LLM usable Markdown. + * + * @param array{ + * url: string, + * excludeSelectors?: list, + * headers?: array, + * includeFrames?: bool, + * includeImages?: bool, + * includeLinks?: bool, + * includeSelectors?: list, + * maxAgeMs?: int, + * pdf?: WebWebScrapeMdParams\Pdf|PdfShape3, + * shortenBase64Images?: bool, + * timeoutMs?: int, + * useMainContentOnly?: bool, + * waitForMs?: int, + * }|WebWebScrapeMdParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeMd( + array|WebWebScrapeMdParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebWebScrapeMdParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/scrape/markdown', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: WebWebScrapeMdResponse::class, + ); + } + + /** + * @api + * + * Crawl an entire website's sitemap and return all discovered page URLs. + * + * @param array{ + * domain: string, + * headers?: array, + * maxLinks?: int, + * timeoutMs?: int, + * urlRegex?: string, + * }|WebWebScrapeSitemapParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function webScrapeSitemap( + array|WebWebScrapeSitemapParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = WebWebScrapeSitemapParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'web/scrape/sitemap', + query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + options: $options, + convert: WebWebScrapeSitemapResponse::class, + ); + } +} diff --git a/src/Services/WebService.php b/src/Services/WebService.php new file mode 100644 index 00000000..cdf405e6 --- /dev/null +++ b/src/Services/WebService.php @@ -0,0 +1,588 @@ +raw = new WebRawService($client); + } + + /** + * @api + * + * Crawl a website, use the provided JSON Schema and instructions to prioritize relevant internal links, and extract structured data from the selected pages. + * + * @param array $schema JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * @param string $url The starting website URL to crawl and extract from. Must include http:// or https://. + * @param bool $factCheck When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. + * @param bool $followSubdomains when true, follow links on subdomains of the starting URL's domain + * @param bool $includeFrames when true, iframe contents are included in Markdown before extraction + * @param string $instructions optional extraction guidance, such as which facts to prioritize or how to interpret fields in the schema + * @param int $maxAgeMs Return cached scrape results if a prior scrape for the same parameters is younger than this many milliseconds. Defaults to 7 days (604800000 ms). + * @param int $maxDepth Optional maximum link depth from the starting URL (0 = only the starting page). If omitted, there is no crawl depth limit. + * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. + * @param Pdf|PdfShape $pdf + * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extract( + array $schema, + string $url, + bool $factCheck = false, + bool $followSubdomains = false, + bool $includeFrames = false, + ?string $instructions = null, + int $maxAgeMs = 604800000, + ?int $maxDepth = null, + int $maxPages = 5, + Pdf|array $pdf = ['shouldParse' => true], + int $stopAfterMs = 80000, + ?int $timeoutMs = null, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractResponse { + $params = Util::removeNulls( + [ + 'schema' => $schema, + 'url' => $url, + 'factCheck' => $factCheck, + 'followSubdomains' => $followSubdomains, + 'includeFrames' => $includeFrames, + 'instructions' => $instructions, + 'maxAgeMs' => $maxAgeMs, + 'maxDepth' => $maxDepth, + 'maxPages' => $maxPages, + 'pdf' => $pdf, + 'stopAfterMs' => $stopAfterMs, + 'timeoutMs' => $timeoutMs, + 'waitForMs' => $waitForMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->extract(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Analyze a company's landing page and web search evidence to return direct competitors for the same product or market. + * + * @param string $domain Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted and normalized to their domain. + * @param int $numCompetitors Exact number of direct competitors to return. Defaults to 5. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractCompetitors( + string $domain, + int $numCompetitors = 5, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractCompetitorsResponse { + $params = Util::removeNulls( + [ + 'domain' => $domain, + 'numCompetitors' => $numCompetitors, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->extractCompetitors(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Scrape font information from a website including font families, usage statistics, fallbacks, and element/word counts. + * + * @param string $directURL A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + * @param string $domain Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractFonts( + ?string $directURL = null, + ?string $domain = null, + int $maxAgeMs = 7776000000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractFontsResponse { + $params = Util::removeNulls( + [ + 'directURL' => $directURL, + 'domain' => $domain, + 'maxAgeMs' => $maxAgeMs, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->extractFonts(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Extract a comprehensive design system from a website including colors, typography, spacing, shadows, and UI components. + * + * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function extractStyleguide( + ?string $directURL = null, + ?string $domain = null, + int $maxAgeMs = 7776000000, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebExtractStyleguideResponse { + $params = Util::removeNulls( + [ + 'directURL' => $directURL, + 'domain' => $domain, + 'maxAgeMs' => $maxAgeMs, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->extractStyleguide(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Capture a screenshot of a website. + * + * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. + * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). + * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. + * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function screenshot( + ?string $directURL = null, + ?string $domain = null, + FullScreenshot|string|null $fullScreenshot = null, + HandleCookiePopup|string $handleCookiePopup = 'false', + int $maxAgeMs = 86400000, + Page|string|null $page = null, + ?int $timeoutMs = null, + Viewport|array $viewport = ['width' => 1920, 'height' => 1080], + int $waitForMs = 3000, + RequestOptions|array|null $requestOptions = null, + ): WebScreenshotResponse { + $params = Util::removeNulls( + [ + 'directURL' => $directURL, + 'domain' => $domain, + 'fullScreenshot' => $fullScreenshot, + 'handleCookiePopup' => $handleCookiePopup, + 'maxAgeMs' => $maxAgeMs, + 'page' => $page, + 'timeoutMs' => $timeoutMs, + 'viewport' => $viewport, + 'waitForMs' => $waitForMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->screenshot(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Search the web and optionally scrape each result to Markdown in one round-trip. + * + * @param string $query natural-language search query + * @param list $excludeDomains Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. + * @param Freshness|value-of $freshness restrict results to content published within this window + * @param list $includeDomains Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"]. + * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. + * @param bool $queryFanout expand the query into multiple parallel variants for broader recall + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function search( + string $query, + ?array $excludeDomains = null, + Freshness|string|null $freshness = null, + ?array $includeDomains = null, + MarkdownOptions|array|null $markdownOptions = null, + ?bool $queryFanout = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebSearchResponse { + $params = Util::removeNulls( + [ + 'query' => $query, + 'excludeDomains' => $excludeDomains, + 'freshness' => $freshness, + 'includeDomains' => $includeDomains, + 'markdownOptions' => $markdownOptions, + 'queryFanout' => $queryFanout, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->search(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Performs a crawl starting from a given URL, extracts page content as Markdown, and returns results for all crawled pages. + * + * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) + * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. + * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page + * @param bool $includeImages Include image references in the Markdown output + * @param bool $includeLinks Preserve hyperlinks in the Markdown output + * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before each crawled page is converted to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) + * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. + * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output + * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. + * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webCrawlMd( + string $url, + ?array $excludeSelectors = null, + bool $followSubdomains = false, + bool $includeFrames = false, + bool $includeImages = false, + bool $includeLinks = true, + ?array $includeSelectors = null, + int $maxAgeMs = 86400000, + ?int $maxDepth = null, + int $maxPages = 100, + \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ + 'shouldParse' => true, + ], + bool $shortenBase64Images = true, + int $stopAfterMs = 80000, + ?int $timeoutMs = null, + ?string $urlRegex = null, + bool $useMainContentOnly = false, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebCrawlMdResponse { + $params = Util::removeNulls( + [ + 'url' => $url, + 'excludeSelectors' => $excludeSelectors, + 'followSubdomains' => $followSubdomains, + 'includeFrames' => $includeFrames, + 'includeImages' => $includeImages, + 'includeLinks' => $includeLinks, + 'includeSelectors' => $includeSelectors, + 'maxAgeMs' => $maxAgeMs, + 'maxDepth' => $maxDepth, + 'maxPages' => $maxPages, + 'pdf' => $pdf, + 'shortenBase64Images' => $shortenBase64Images, + 'stopAfterMs' => $stopAfterMs, + 'timeoutMs' => $timeoutMs, + 'urlRegex' => $urlRegex, + 'useMainContentOnly' => $useMainContentOnly, + 'waitForMs' => $waitForMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->webCrawlMd(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Scrapes the given URL and returns the raw HTML content of the page. + * + * @param string $url Full URL to scrape (must include http:// or https:// protocol) + * @param list $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML + * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeHTML( + string $url, + ?array $excludeSelectors = null, + ?array $headers = null, + bool $includeFrames = false, + ?array $includeSelectors = null, + int $maxAgeMs = 86400000, + \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ + 'shouldParse' => true, + ], + ?int $timeoutMs = null, + bool $useMainContentOnly = false, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeHTMLResponse { + $params = Util::removeNulls( + [ + 'url' => $url, + 'excludeSelectors' => $excludeSelectors, + 'headers' => $headers, + 'includeFrames' => $includeFrames, + 'includeSelectors' => $includeSelectors, + 'maxAgeMs' => $maxAgeMs, + 'pdf' => $pdf, + 'timeoutMs' => $timeoutMs, + 'useMainContentOnly' => $useMainContentOnly, + 'waitForMs' => $waitForMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->webScrapeHTML(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. + * + * @param string $url Page URL to inspect. Must include http:// or https://. + * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeImages( + string $url, + Enrichment|array|null $enrichment = null, + ?array $headers = null, + int $maxAgeMs = 86400000, + ?int $timeoutMs = null, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeImagesResponse { + $params = Util::removeNulls( + [ + 'url' => $url, + 'enrichment' => $enrichment, + 'headers' => $headers, + 'maxAgeMs' => $maxAgeMs, + 'timeoutMs' => $timeoutMs, + 'waitForMs' => $waitForMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->webScrapeImages(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Scrapes the given URL into LLM usable Markdown. + * + * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + * @param list $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown + * @param bool $includeImages Include image references in Markdown output + * @param bool $includeLinks Preserve hyperlinks in Markdown output + * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation + * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeMd( + string $url, + ?array $excludeSelectors = null, + ?array $headers = null, + bool $includeFrames = false, + bool $includeImages = false, + bool $includeLinks = true, + ?array $includeSelectors = null, + int $maxAgeMs = 86400000, + \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ + 'shouldParse' => true, + ], + bool $shortenBase64Images = true, + ?int $timeoutMs = null, + bool $useMainContentOnly = false, + ?int $waitForMs = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeMdResponse { + $params = Util::removeNulls( + [ + 'url' => $url, + 'excludeSelectors' => $excludeSelectors, + 'headers' => $headers, + 'includeFrames' => $includeFrames, + 'includeImages' => $includeImages, + 'includeLinks' => $includeLinks, + 'includeSelectors' => $includeSelectors, + 'maxAgeMs' => $maxAgeMs, + 'pdf' => $pdf, + 'shortenBase64Images' => $shortenBase64Images, + 'timeoutMs' => $timeoutMs, + 'useMainContentOnly' => $useMainContentOnly, + 'waitForMs' => $waitForMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->webScrapeMd(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Crawl an entire website's sitemap and return all discovered page URLs. + * + * @param string $domain Domain to build a sitemap for + * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function webScrapeSitemap( + string $domain, + ?array $headers = null, + int $maxLinks = 10000, + ?int $timeoutMs = null, + ?string $urlRegex = null, + RequestOptions|array|null $requestOptions = null, + ): WebWebScrapeSitemapResponse { + $params = Util::removeNulls( + [ + 'domain' => $domain, + 'headers' => $headers, + 'maxLinks' => $maxLinks, + 'timeoutMs' => $timeoutMs, + 'urlRegex' => $urlRegex, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->webScrapeSitemap(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/src/Utility/UtilityPrefetchByEmailParams.php b/src/Utility/UtilityPrefetchByEmailParams.php new file mode 100644 index 00000000..60fc4dcb --- /dev/null +++ b/src/Utility/UtilityPrefetchByEmailParams.php @@ -0,0 +1,96 @@ + */ + use SdkModel; + use SdkParams; + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + #[Required] + public string $email; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * `new UtilityPrefetchByEmailParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UtilityPrefetchByEmailParams::with(email: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UtilityPrefetchByEmailParams)->withEmail(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $email, ?int $timeoutMs = null): self + { + $self = new self; + + $self['email'] = $email; + + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchByEmailResponse.php b/src/Utility/UtilityPrefetchByEmailResponse.php new file mode 100644 index 00000000..cc7f237a --- /dev/null +++ b/src/Utility/UtilityPrefetchByEmailResponse.php @@ -0,0 +1,124 @@ + */ + use SdkModel; + + /** + * The domain that was queued for prefetching. + */ + #[Optional] + public ?string $domain; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Success message. + */ + #[Optional] + public ?string $message; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + ?string $domain = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $message = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $domain && $self['domain'] = $domain; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $message && $self['message'] = $message; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * The domain that was queued for prefetching. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Success message. + */ + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php b/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php new file mode 100644 index 00000000..9966c76e --- /dev/null +++ b/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchParams.php b/src/Utility/UtilityPrefetchParams.php new file mode 100644 index 00000000..80ccac24 --- /dev/null +++ b/src/Utility/UtilityPrefetchParams.php @@ -0,0 +1,96 @@ + */ + use SdkModel; + use SdkParams; + + /** + * Domain name to prefetch brand data for. + */ + #[Required] + public string $domain; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * `new UtilityPrefetchParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UtilityPrefetchParams::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UtilityPrefetchParams)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $domain, ?int $timeoutMs = null): self + { + $self = new self; + + $self['domain'] = $domain; + + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Domain name to prefetch brand data for. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchResponse.php b/src/Utility/UtilityPrefetchResponse.php new file mode 100644 index 00000000..c66cf82e --- /dev/null +++ b/src/Utility/UtilityPrefetchResponse.php @@ -0,0 +1,124 @@ + */ + use SdkModel; + + /** + * The domain that was queued for prefetching. + */ + #[Optional] + public ?string $domain; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Success message. + */ + #[Optional] + public ?string $message; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + ?string $domain = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $message = null, + ?string $status = null, + ): self { + $self = new self; + + null !== $domain && $self['domain'] = $domain; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $message && $self['message'] = $message; + null !== $status && $self['status'] = $status; + + return $self; + } + + /** + * The domain that was queued for prefetching. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Success message. + */ + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchResponse/KeyMetadata.php b/src/Utility/UtilityPrefetchResponse/KeyMetadata.php new file mode 100644 index 00000000..d8ec29fe --- /dev/null +++ b/src/Utility/UtilityPrefetchResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Version.php b/src/Version.php new file mode 100644 index 00000000..3d7d9d39 --- /dev/null +++ b/src/Version.php @@ -0,0 +1,9 @@ + */ + use SdkModel; + use SdkParams; + + /** + * Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted and normalized to their domain. + */ + #[Required] + public string $domain; + + /** + * Exact number of direct competitors to return. Defaults to 5. + */ + #[Optional] + public ?int $numCompetitors; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * `new WebExtractCompetitorsParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebExtractCompetitorsParams::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebExtractCompetitorsParams)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $domain, + ?int $numCompetitors = null, + ?int $timeoutMs = null + ): self { + $self = new self; + + $self['domain'] = $domain; + + null !== $numCompetitors && $self['numCompetitors'] = $numCompetitors; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted and normalized to their domain. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Exact number of direct competitors to return. Defaults to 5. + */ + public function withNumCompetitors(int $numCompetitors): self + { + $self = clone $this; + $self['numCompetitors'] = $numCompetitors; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Web/WebExtractCompetitorsResponse.php b/src/Web/WebExtractCompetitorsResponse.php new file mode 100644 index 00000000..6accab2d --- /dev/null +++ b/src/Web/WebExtractCompetitorsResponse.php @@ -0,0 +1,184 @@ +, + * domain: string, + * status: Status|value-of, + * target: Target|TargetShape, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebExtractCompetitorsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Direct competitors ordered by relevance and confidence. + * + * @var list $competitors + */ + #[Required(list: Competitor::class)] + public array $competitors; + + /** + * Normalized input domain. + */ + #[Required] + public string $domain; + + /** + * Status of the response. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Target company profile inferred from the landing page. + */ + #[Required] + public Target $target; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebExtractCompetitorsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebExtractCompetitorsResponse::with( + * competitors: ..., domain: ..., status: ..., target: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebExtractCompetitorsResponse) + * ->withCompetitors(...) + * ->withDomain(...) + * ->withStatus(...) + * ->withTarget(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $competitors + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + array $competitors, + string $domain, + Status|string $status, + Target|array $target, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['competitors'] = $competitors; + $self['domain'] = $domain; + $self['status'] = $status; + $self['target'] = $target; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Direct competitors ordered by relevance and confidence. + * + * @param list $competitors + */ + public function withCompetitors(array $competitors): self + { + $self = clone $this; + $self['competitors'] = $competitors; + + return $self; + } + + /** + * Normalized input domain. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Status of the response. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Target company profile inferred from the landing page. + * + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebExtractCompetitorsResponse/Competitor.php b/src/Web/WebExtractCompetitorsResponse/Competitor.php new file mode 100644 index 00000000..8a43776d --- /dev/null +++ b/src/Web/WebExtractCompetitorsResponse/Competitor.php @@ -0,0 +1,196 @@ +, + * description: string, + * domain: string, + * name: string, + * sourceURLs: list, + * url: string, + * } + */ +final class Competitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Confidence that this company is a direct competitor. + * + * @var value-of $confidence + */ + #[Required(enum: Confidence::class)] + public string $confidence; + + /** + * Short description of the competitor. + */ + #[Required] + public string $description; + + /** + * Competitor's normalized official domain. + */ + #[Required] + public string $domain; + + /** + * Competitor company or product name. + */ + #[Required] + public string $name; + + /** + * Search result URLs used as evidence for this competitor. + * + * @var list $sourceURLs + */ + #[Required('sourceUrls', list: 'string')] + public array $sourceURLs; + + /** + * Competitor website URL. + */ + #[Required] + public string $url; + + /** + * `new Competitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Competitor::with( + * confidence: ..., + * description: ..., + * domain: ..., + * name: ..., + * sourceURLs: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Competitor) + * ->withConfidence(...) + * ->withDescription(...) + * ->withDomain(...) + * ->withName(...) + * ->withSourceURLs(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Confidence|value-of $confidence + * @param list $sourceURLs + */ + public static function with( + Confidence|string $confidence, + string $description, + string $domain, + string $name, + array $sourceURLs, + string $url, + ): self { + $self = new self; + + $self['confidence'] = $confidence; + $self['description'] = $description; + $self['domain'] = $domain; + $self['name'] = $name; + $self['sourceURLs'] = $sourceURLs; + $self['url'] = $url; + + return $self; + } + + /** + * Confidence that this company is a direct competitor. + * + * @param Confidence|value-of $confidence + */ + public function withConfidence(Confidence|string $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * Short description of the competitor. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * Competitor's normalized official domain. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Competitor company or product name. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Search result URLs used as evidence for this competitor. + * + * @param list $sourceURLs + */ + public function withSourceURLs(array $sourceURLs): self + { + $self = clone $this; + $self['sourceURLs'] = $sourceURLs; + + return $self; + } + + /** + * Competitor website URL. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Web/WebExtractCompetitorsResponse/Competitor/Confidence.php b/src/Web/WebExtractCompetitorsResponse/Competitor/Confidence.php new file mode 100644 index 00000000..abebf6b7 --- /dev/null +++ b/src/Web/WebExtractCompetitorsResponse/Competitor/Confidence.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebExtractCompetitorsResponse/Status.php b/src/Web/WebExtractCompetitorsResponse/Status.php new file mode 100644 index 00000000..2005f366 --- /dev/null +++ b/src/Web/WebExtractCompetitorsResponse/Status.php @@ -0,0 +1,13 @@ + */ + use SdkModel; + + /** + * Company or product name inferred from the landing page. + */ + #[Required] + public string $companyName; + + /** + * Specific operating field, product category, or market. + */ + #[Required] + public string $field; + + /** + * One-sentence description of what the target company sells and who it serves. + */ + #[Required] + public string $fieldDescription; + + /** + * Resolved URL used for the landing page analysis. + */ + #[Required('websiteUrl')] + public string $websiteURL; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with( + * companyName: ..., field: ..., fieldDescription: ..., websiteURL: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target) + * ->withCompanyName(...) + * ->withField(...) + * ->withFieldDescription(...) + * ->withWebsiteURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $companyName, + string $field, + string $fieldDescription, + string $websiteURL, + ): self { + $self = new self; + + $self['companyName'] = $companyName; + $self['field'] = $field; + $self['fieldDescription'] = $fieldDescription; + $self['websiteURL'] = $websiteURL; + + return $self; + } + + /** + * Company or product name inferred from the landing page. + */ + public function withCompanyName(string $companyName): self + { + $self = clone $this; + $self['companyName'] = $companyName; + + return $self; + } + + /** + * Specific operating field, product category, or market. + */ + public function withField(string $field): self + { + $self = clone $this; + $self['field'] = $field; + + return $self; + } + + /** + * One-sentence description of what the target company sells and who it serves. + */ + public function withFieldDescription(string $fieldDescription): self + { + $self = clone $this; + $self['fieldDescription'] = $fieldDescription; + + return $self; + } + + /** + * Resolved URL used for the landing page analysis. + */ + public function withWebsiteURL(string $websiteURL): self + { + $self = clone $this; + $self['websiteURL'] = $websiteURL; + + return $self; + } +} diff --git a/src/Web/WebExtractFontsParams.php b/src/Web/WebExtractFontsParams.php new file mode 100644 index 00000000..e8e51d16 --- /dev/null +++ b/src/Web/WebExtractFontsParams.php @@ -0,0 +1,123 @@ + */ + use SdkModel; + use SdkParams; + + /** + * A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + */ + #[Optional] + public ?string $directURL; + + /** + * Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + */ + #[Optional] + public ?string $domain; + + /** + * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $directURL = null, + ?string $domain = null, + ?int $maxAgeMs = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + null !== $directURL && $self['directURL'] = $directURL; + null !== $domain && $self['domain'] = $domain; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + */ + public function withDirectURL(string $directURL): self + { + $self = clone $this; + $self['directURL'] = $directURL; + + return $self; + } + + /** + * Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Web/WebExtractFontsResponse.php b/src/Web/WebExtractFontsResponse.php new file mode 100644 index 00000000..d4f3e9ca --- /dev/null +++ b/src/Web/WebExtractFontsResponse.php @@ -0,0 +1,198 @@ +, + * status: string, + * fontLinks?: array|null, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebExtractFontsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * HTTP status code, e.g., 200. + */ + #[Required] + public int $code; + + /** + * The normalized domain that was processed. + */ + #[Required] + public string $domain; + + /** + * Array of font usage information. + * + * @var list $fonts + */ + #[Required(list: Font::class)] + public array $fonts; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Required] + public string $status; + + /** + * Font assets keyed by family name as it appears in the fonts array (non-generic names only). Clients match entries in fonts to pick a file URL from files. Omitted when no families resolve to Google or custom @font-face URLs. + * + * @var array|null $fontLinks + */ + #[Optional(map: FontLink::class)] + public ?array $fontLinks; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebExtractFontsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebExtractFontsResponse::with(code: ..., domain: ..., fonts: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebExtractFontsResponse) + * ->withCode(...) + * ->withDomain(...) + * ->withFonts(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $fonts + * @param array|null $fontLinks + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + int $code, + string $domain, + array $fonts, + string $status, + ?array $fontLinks = null, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['code'] = $code; + $self['domain'] = $domain; + $self['fonts'] = $fonts; + $self['status'] = $status; + + null !== $fontLinks && $self['fontLinks'] = $fontLinks; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * HTTP status code, e.g., 200. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * The normalized domain that was processed. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Array of font usage information. + * + * @param list $fonts + */ + public function withFonts(array $fonts): self + { + $self = clone $this; + $self['fonts'] = $fonts; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Font assets keyed by family name as it appears in the fonts array (non-generic names only). Clients match entries in fonts to pick a file URL from files. Omitted when no families resolve to Google or custom @font-face URLs. + * + * @param array $fontLinks + */ + public function withFontLinks(array $fontLinks): self + { + $self = clone $this; + $self['fontLinks'] = $fontLinks; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebExtractFontsResponse/Font.php b/src/Web/WebExtractFontsResponse/Font.php new file mode 100644 index 00000000..9d8526ad --- /dev/null +++ b/src/Web/WebExtractFontsResponse/Font.php @@ -0,0 +1,217 @@ +, + * font: string, + * numElements: float, + * numWords: float, + * percentElements: float, + * percentWords: float, + * uses: list, + * } + */ +final class Font implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Array of fallback font families. + * + * @var list $fallbacks + */ + #[Required(list: 'string')] + public array $fallbacks; + + /** + * Font family name. + */ + #[Required] + public string $font; + + /** + * Number of elements using this font. + */ + #[Required('num_elements')] + public float $numElements; + + /** + * Number of words using this font. + */ + #[Required('num_words')] + public float $numWords; + + /** + * Percentage of elements using this font. + */ + #[Required('percent_elements')] + public float $percentElements; + + /** + * Percentage of words using this font. + */ + #[Required('percent_words')] + public float $percentWords; + + /** + * Array of CSS selectors or element types where this font is used. + * + * @var list $uses + */ + #[Required(list: 'string')] + public array $uses; + + /** + * `new Font()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Font::with( + * fallbacks: ..., + * font: ..., + * numElements: ..., + * numWords: ..., + * percentElements: ..., + * percentWords: ..., + * uses: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Font) + * ->withFallbacks(...) + * ->withFont(...) + * ->withNumElements(...) + * ->withNumWords(...) + * ->withPercentElements(...) + * ->withPercentWords(...) + * ->withUses(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $fallbacks + * @param list $uses + */ + public static function with( + array $fallbacks, + string $font, + float $numElements, + float $numWords, + float $percentElements, + float $percentWords, + array $uses, + ): self { + $self = new self; + + $self['fallbacks'] = $fallbacks; + $self['font'] = $font; + $self['numElements'] = $numElements; + $self['numWords'] = $numWords; + $self['percentElements'] = $percentElements; + $self['percentWords'] = $percentWords; + $self['uses'] = $uses; + + return $self; + } + + /** + * Array of fallback font families. + * + * @param list $fallbacks + */ + public function withFallbacks(array $fallbacks): self + { + $self = clone $this; + $self['fallbacks'] = $fallbacks; + + return $self; + } + + /** + * Font family name. + */ + public function withFont(string $font): self + { + $self = clone $this; + $self['font'] = $font; + + return $self; + } + + /** + * Number of elements using this font. + */ + public function withNumElements(float $numElements): self + { + $self = clone $this; + $self['numElements'] = $numElements; + + return $self; + } + + /** + * Number of words using this font. + */ + public function withNumWords(float $numWords): self + { + $self = clone $this; + $self['numWords'] = $numWords; + + return $self; + } + + /** + * Percentage of elements using this font. + */ + public function withPercentElements(float $percentElements): self + { + $self = clone $this; + $self['percentElements'] = $percentElements; + + return $self; + } + + /** + * Percentage of words using this font. + */ + public function withPercentWords(float $percentWords): self + { + $self = clone $this; + $self['percentWords'] = $percentWords; + + return $self; + } + + /** + * Array of CSS selectors or element types where this font is used. + * + * @param list $uses + */ + public function withUses(array $uses): self + { + $self = clone $this; + $self['uses'] = $uses; + + return $self; + } +} diff --git a/src/Web/WebExtractFontsResponse/FontLink.php b/src/Web/WebExtractFontsResponse/FontLink.php new file mode 100644 index 00000000..e7b97d6a --- /dev/null +++ b/src/Web/WebExtractFontsResponse/FontLink.php @@ -0,0 +1,139 @@ +, + * type: Type|value-of, + * category?: string|null, + * displayName?: string|null, + * } + */ +final class FontLink implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Upright font files keyed by weight string (e.g. "400" for regular, "500", "700"). Values are absolute URLs. + * + * @var array $files + */ + #[Required(map: 'string')] + public array $files; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Google Fonts category when type is google (e.g. sans-serif, serif, monospace, display, handwriting). Omitted for custom fonts when unknown. + */ + #[Optional] + public ?string $category; + + /** + * Present when type is custom: human-readable name derived from the fontLinks key (strip build/hash suffixes, split camelCase / PascalCase, normalize separators). Google entries omit this. + */ + #[Optional] + public ?string $displayName; + + /** + * `new FontLink()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * FontLink::with(files: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new FontLink)->withFiles(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array $files + * @param Type|value-of $type + */ + public static function with( + array $files, + Type|string $type, + ?string $category = null, + ?string $displayName = null, + ): self { + $self = new self; + + $self['files'] = $files; + $self['type'] = $type; + + null !== $category && $self['category'] = $category; + null !== $displayName && $self['displayName'] = $displayName; + + return $self; + } + + /** + * Upright font files keyed by weight string (e.g. "400" for regular, "500", "700"). Values are absolute URLs. + * + * @param array $files + */ + public function withFiles(array $files): self + { + $self = clone $this; + $self['files'] = $files; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Google Fonts category when type is google (e.g. sans-serif, serif, monospace, display, handwriting). Omitted for custom fonts when unknown. + */ + public function withCategory(string $category): self + { + $self = clone $this; + $self['category'] = $category; + + return $self; + } + + /** + * Present when type is custom: human-readable name derived from the fontLinks key (strip build/hash suffixes, split camelCase / PascalCase, normalize separators). Google entries omit this. + */ + public function withDisplayName(string $displayName): self + { + $self = clone $this; + $self['displayName'] = $displayName; + + return $self; + } +} diff --git a/src/Web/WebExtractFontsResponse/FontLink/Type.php b/src/Web/WebExtractFontsResponse/FontLink/Type.php new file mode 100644 index 00000000..2e0bb784 --- /dev/null +++ b/src/Web/WebExtractFontsResponse/FontLink/Type.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebExtractParams.php b/src/Web/WebExtractParams.php new file mode 100644 index 00000000..66234f55 --- /dev/null +++ b/src/Web/WebExtractParams.php @@ -0,0 +1,326 @@ +, + * url: string, + * factCheck?: bool|null, + * followSubdomains?: bool|null, + * includeFrames?: bool|null, + * instructions?: string|null, + * maxAgeMs?: int|null, + * maxDepth?: int|null, + * maxPages?: int|null, + * pdf?: null|Pdf|PdfShape, + * stopAfterMs?: int|null, + * timeoutMs?: int|null, + * waitForMs?: int|null, + * } + */ +final class WebExtractParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * + * @var array $schema + */ + #[Required(map: 'mixed')] + public array $schema; + + /** + * The starting website URL to crawl and extract from. Must include http:// or https://. + */ + #[Required] + public string $url; + + /** + * When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. + */ + #[Optional] + public ?bool $factCheck; + + /** + * When true, follow links on subdomains of the starting URL's domain. + */ + #[Optional] + public ?bool $followSubdomains; + + /** + * When true, iframe contents are included in Markdown before extraction. + */ + #[Optional] + public ?bool $includeFrames; + + /** + * Optional extraction guidance, such as which facts to prioritize or how to interpret fields in the schema. + */ + #[Optional] + public ?string $instructions; + + /** + * Return cached scrape results if a prior scrape for the same parameters is younger than this many milliseconds. Defaults to 7 days (604800000 ms). + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). If omitted, there is no crawl depth limit. + */ + #[Optional] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. + */ + #[Optional] + public ?int $maxPages; + + #[Optional] + public ?Pdf $pdf; + + /** + * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + */ + #[Optional] + public ?int $stopAfterMs; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * Optional browser wait time in milliseconds after initial page load for each crawled page. + */ + #[Optional] + public ?int $waitForMs; + + /** + * `new WebExtractParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebExtractParams::with(schema: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebExtractParams)->withSchema(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array $schema + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + array $schema, + string $url, + ?bool $factCheck = null, + ?bool $followSubdomains = null, + ?bool $includeFrames = null, + ?string $instructions = null, + ?int $maxAgeMs = null, + ?int $maxDepth = null, + ?int $maxPages = null, + Pdf|array|null $pdf = null, + ?int $stopAfterMs = null, + ?int $timeoutMs = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + $self['schema'] = $schema; + $self['url'] = $url; + + null !== $factCheck && $self['factCheck'] = $factCheck; + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $includeFrames && $self['includeFrames'] = $includeFrames; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $pdf && $self['pdf'] = $pdf; + null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } + + /** + * The starting website URL to crawl and extract from. Must include http:// or https://. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. + */ + public function withFactCheck(bool $factCheck): self + { + $self = clone $this; + $self['factCheck'] = $factCheck; + + return $self; + } + + /** + * When true, follow links on subdomains of the starting URL's domain. + */ + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * When true, iframe contents are included in Markdown before extraction. + */ + public function withIncludeFrames(bool $includeFrames): self + { + $self = clone $this; + $self['includeFrames'] = $includeFrames; + + return $self; + } + + /** + * Optional extraction guidance, such as which facts to prioritize or how to interpret fields in the schema. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Return cached scrape results if a prior scrape for the same parameters is younger than this many milliseconds. Defaults to 7 days (604800000 ms). + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). If omitted, there is no crawl depth limit. + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + */ + public function withStopAfterMs(int $stopAfterMs): self + { + $self = clone $this; + $self['stopAfterMs'] = $stopAfterMs; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Optional browser wait time in milliseconds after initial page load for each crawled page. + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Web/WebExtractParams/Pdf.php b/src/Web/WebExtractParams/Pdf.php new file mode 100644 index 00000000..6cb2b670 --- /dev/null +++ b/src/Web/WebExtractParams/Pdf.php @@ -0,0 +1,95 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, PDF pages are fetched and parsed. When false, PDF pages are skipped. + */ + #[Optional] + public ?bool $shouldParse; + + /** + * First 1-based PDF page to parse. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?int $end = null, + ?bool $shouldParse = null, + ?int $start = null + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, PDF pages are fetched and parsed. When false, PDF pages are skipped. + */ + public function withShouldParse(bool $shouldParse): self + { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Web/WebExtractResponse.php b/src/Web/WebExtractResponse.php new file mode 100644 index 00000000..3b44bdd0 --- /dev/null +++ b/src/Web/WebExtractResponse.php @@ -0,0 +1,197 @@ +, + * metadata: Metadata|MetadataShape, + * status: string, + * url: string, + * urlsAnalyzed: list, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebExtractResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Extracted data matching the request schema. + * + * @var array $data + */ + #[Required(map: 'mixed')] + public array $data; + + #[Required] + public Metadata $metadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Required] + public string $status; + + /** + * The starting URL that was analyzed. + */ + #[Required] + public string $url; + + /** + * List of URLs whose Markdown was used for extraction. + * + * @var list $urlsAnalyzed + */ + #[Required('urls_analyzed', list: 'string')] + public array $urlsAnalyzed; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebExtractResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebExtractResponse::with( + * data: ..., metadata: ..., status: ..., url: ..., urlsAnalyzed: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebExtractResponse) + * ->withData(...) + * ->withMetadata(...) + * ->withStatus(...) + * ->withURL(...) + * ->withURLsAnalyzed(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array $data + * @param Metadata|MetadataShape $metadata + * @param list $urlsAnalyzed + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + array $data, + Metadata|array $metadata, + string $status, + string $url, + array $urlsAnalyzed, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['data'] = $data; + $self['metadata'] = $metadata; + $self['status'] = $status; + $self['url'] = $url; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Extracted data matching the request schema. + * + * @param array $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * The starting URL that was analyzed. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * List of URLs whose Markdown was used for extraction. + * + * @param list $urlsAnalyzed + */ + public function withURLsAnalyzed(array $urlsAnalyzed): self + { + $self = clone $this; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebExtractResponse/KeyMetadata.php b/src/Web/WebExtractResponse/KeyMetadata.php new file mode 100644 index 00000000..dcc0f430 --- /dev/null +++ b/src/Web/WebExtractResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebExtractResponse/Metadata.php b/src/Web/WebExtractResponse/Metadata.php new file mode 100644 index 00000000..36928ce2 --- /dev/null +++ b/src/Web/WebExtractResponse/Metadata.php @@ -0,0 +1,132 @@ + */ + use SdkModel; + + #[Required] + public int $maxCrawlDepth; + + #[Required] + public int $numFailed; + + #[Required] + public int $numSkipped; + + #[Required] + public int $numSucceeded; + + #[Required('numUrls')] + public int $numURLs; + + /** + * `new Metadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metadata::with( + * maxCrawlDepth: ..., + * numFailed: ..., + * numSkipped: ..., + * numSucceeded: ..., + * numURLs: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metadata) + * ->withMaxCrawlDepth(...) + * ->withNumFailed(...) + * ->withNumSkipped(...) + * ->withNumSucceeded(...) + * ->withNumURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $maxCrawlDepth, + int $numFailed, + int $numSkipped, + int $numSucceeded, + int $numURLs, + ): self { + $self = new self; + + $self['maxCrawlDepth'] = $maxCrawlDepth; + $self['numFailed'] = $numFailed; + $self['numSkipped'] = $numSkipped; + $self['numSucceeded'] = $numSucceeded; + $self['numURLs'] = $numURLs; + + return $self; + } + + public function withMaxCrawlDepth(int $maxCrawlDepth): self + { + $self = clone $this; + $self['maxCrawlDepth'] = $maxCrawlDepth; + + return $self; + } + + public function withNumFailed(int $numFailed): self + { + $self = clone $this; + $self['numFailed'] = $numFailed; + + return $self; + } + + public function withNumSkipped(int $numSkipped): self + { + $self = clone $this; + $self['numSkipped'] = $numSkipped; + + return $self; + } + + public function withNumSucceeded(int $numSucceeded): self + { + $self = clone $this; + $self['numSucceeded'] = $numSucceeded; + + return $self; + } + + public function withNumURLs(int $numURLs): self + { + $self = clone $this; + $self['numURLs'] = $numURLs; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideParams.php b/src/Web/WebExtractStyleguideParams.php new file mode 100644 index 00000000..7dea9e1d --- /dev/null +++ b/src/Web/WebExtractStyleguideParams.php @@ -0,0 +1,123 @@ + */ + use SdkModel; + use SdkParams; + + /** + * A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + */ + #[Optional] + public ?string $directURL; + + /** + * Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + */ + #[Optional] + public ?string $domain; + + /** + * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $directURL = null, + ?string $domain = null, + ?int $maxAgeMs = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + null !== $directURL && $self['directURL'] = $directURL; + null !== $domain && $self['domain'] = $domain; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. + */ + public function withDirectURL(string $directURL): self + { + $self = clone $this; + $self['directURL'] = $directURL; + + return $self; + } + + /** + * Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse.php b/src/Web/WebExtractStyleguideResponse.php new file mode 100644 index 00000000..dc622db1 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse.php @@ -0,0 +1,149 @@ + */ + use SdkModel; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * The normalized domain that was processed. + */ + #[Optional] + public ?string $domain; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + /** + * Comprehensive styleguide data extracted from the website. + */ + #[Optional] + public ?Styleguide $styleguide; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + * @param Styleguide|StyleguideShape|null $styleguide + */ + public static function with( + ?int $code = null, + ?string $domain = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $status = null, + Styleguide|array|null $styleguide = null, + ): self { + $self = new self; + + null !== $code && $self['code'] = $code; + null !== $domain && $self['domain'] = $domain; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $status && $self['status'] = $status; + null !== $styleguide && $self['styleguide'] = $styleguide; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * The normalized domain that was processed. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Comprehensive styleguide data extracted from the website. + * + * @param Styleguide|StyleguideShape $styleguide + */ + public function withStyleguide(Styleguide|array $styleguide): self + { + $self = clone $this; + $self['styleguide'] = $styleguide; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/KeyMetadata.php b/src/Web/WebExtractStyleguideResponse/KeyMetadata.php new file mode 100644 index 00000000..e4ea1011 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide.php b/src/Web/WebExtractStyleguideResponse/Styleguide.php new file mode 100644 index 00000000..18a2e203 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide.php @@ -0,0 +1,249 @@ +, + * mode: Mode|value-of, + * shadows: Shadows|ShadowsShape, + * typography: Typography|TypographyShape, + * } + */ +final class Styleguide implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Primary colors used on the website. + */ + #[Required] + public Colors $colors; + + /** + * UI component styles. + */ + #[Required] + public Components $components; + + /** + * Spacing system used on the website. + */ + #[Required] + public ElementSpacing $elementSpacing; + + /** + * Font assets keyed by family name as it appears in fontFamily/fontFallbacks (non-generic names only). Clients match typography.fontFamily / fontWeight or button styles to pick a file URL from files. + * + * @var array $fontLinks + */ + #[Required(map: FontLink::class)] + public array $fontLinks; + + /** + * The primary color mode of the website design. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + /** + * Shadow styles used on the website. + */ + #[Required] + public Shadows $shadows; + + /** + * Typography styles used on the website. + */ + #[Required] + public Typography $typography; + + /** + * `new Styleguide()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Styleguide::with( + * colors: ..., + * components: ..., + * elementSpacing: ..., + * fontLinks: ..., + * mode: ..., + * shadows: ..., + * typography: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Styleguide) + * ->withColors(...) + * ->withComponents(...) + * ->withElementSpacing(...) + * ->withFontLinks(...) + * ->withMode(...) + * ->withShadows(...) + * ->withTypography(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Colors|ColorsShape $colors + * @param Components|ComponentsShape $components + * @param ElementSpacing|ElementSpacingShape $elementSpacing + * @param array $fontLinks + * @param Mode|value-of $mode + * @param Shadows|ShadowsShape $shadows + * @param Typography|TypographyShape $typography + */ + public static function with( + Colors|array $colors, + Components|array $components, + ElementSpacing|array $elementSpacing, + array $fontLinks, + Mode|string $mode, + Shadows|array $shadows, + Typography|array $typography, + ): self { + $self = new self; + + $self['colors'] = $colors; + $self['components'] = $components; + $self['elementSpacing'] = $elementSpacing; + $self['fontLinks'] = $fontLinks; + $self['mode'] = $mode; + $self['shadows'] = $shadows; + $self['typography'] = $typography; + + return $self; + } + + /** + * Primary colors used on the website. + * + * @param Colors|ColorsShape $colors + */ + public function withColors(Colors|array $colors): self + { + $self = clone $this; + $self['colors'] = $colors; + + return $self; + } + + /** + * UI component styles. + * + * @param Components|ComponentsShape $components + */ + public function withComponents(Components|array $components): self + { + $self = clone $this; + $self['components'] = $components; + + return $self; + } + + /** + * Spacing system used on the website. + * + * @param ElementSpacing|ElementSpacingShape $elementSpacing + */ + public function withElementSpacing( + ElementSpacing|array $elementSpacing + ): self { + $self = clone $this; + $self['elementSpacing'] = $elementSpacing; + + return $self; + } + + /** + * Font assets keyed by family name as it appears in fontFamily/fontFallbacks (non-generic names only). Clients match typography.fontFamily / fontWeight or button styles to pick a file URL from files. + * + * @param array $fontLinks + */ + public function withFontLinks(array $fontLinks): self + { + $self = clone $this; + $self['fontLinks'] = $fontLinks; + + return $self; + } + + /** + * The primary color mode of the website design. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Shadow styles used on the website. + * + * @param Shadows|ShadowsShape $shadows + */ + public function withShadows(Shadows|array $shadows): self + { + $self = clone $this; + $self['shadows'] = $shadows; + + return $self; + } + + /** + * Typography styles used on the website. + * + * @param Typography|TypographyShape $typography + */ + public function withTypography(Typography|array $typography): self + { + $self = clone $this; + $self['typography'] = $typography; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Colors.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Colors.php new file mode 100644 index 00000000..c3ff24a4 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Colors.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Accent color (hex format). + */ + #[Required] + public string $accent; + + /** + * Background color (hex format). + */ + #[Required] + public string $background; + + /** + * Text color (hex format). + */ + #[Required] + public string $text; + + /** + * `new Colors()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Colors::with(accent: ..., background: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Colors)->withAccent(...)->withBackground(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $accent, + string $background, + string $text + ): self { + $self = new self; + + $self['accent'] = $accent; + $self['background'] = $background; + $self['text'] = $text; + + return $self; + } + + /** + * Accent color (hex format). + */ + public function withAccent(string $accent): self + { + $self = clone $this; + $self['accent'] = $accent; + + return $self; + } + + /** + * Background color (hex format). + */ + public function withBackground(string $background): self + { + $self = clone $this; + $self['background'] = $background; + + return $self; + } + + /** + * Text color (hex format). + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Components.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Components.php new file mode 100644 index 00000000..1a35e696 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Components.php @@ -0,0 +1,106 @@ + */ + use SdkModel; + + /** + * Button component styles. + */ + #[Required] + public Button $button; + + /** + * Card component style. + */ + #[Optional] + public ?Card $card; + + /** + * `new Components()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Components::with(button: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Components)->withButton(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Button|ButtonShape $button + * @param Card|CardShape|null $card + */ + public static function with( + Button|array $button, + Card|array|null $card = null + ): self { + $self = new self; + + $self['button'] = $button; + + null !== $card && $self['card'] = $card; + + return $self; + } + + /** + * Button component styles. + * + * @param Button|ButtonShape $button + */ + public function withButton(Button|array $button): self + { + $self = clone $this; + $self['button'] = $button; + + return $self; + } + + /** + * Card component style. + * + * @param Card|CardShape $card + */ + public function withCard(Card|array $card): self + { + $self = clone $this; + $self['card'] = $card; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button.php new file mode 100644 index 00000000..64dd69f6 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button.php @@ -0,0 +1,101 @@ + */ + use SdkModel; + + #[Optional] + public ?Link $link; + + #[Optional] + public ?Primary $primary; + + #[Optional] + public ?Secondary $secondary; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Link|LinkShape|null $link + * @param Primary|PrimaryShape|null $primary + * @param Secondary|SecondaryShape|null $secondary + */ + public static function with( + Link|array|null $link = null, + Primary|array|null $primary = null, + Secondary|array|null $secondary = null, + ): self { + $self = new self; + + null !== $link && $self['link'] = $link; + null !== $primary && $self['primary'] = $primary; + null !== $secondary && $self['secondary'] = $secondary; + + return $self; + } + + /** + * @param Link|LinkShape $link + */ + public function withLink(Link|array $link): self + { + $self = clone $this; + $self['link'] = $link; + + return $self; + } + + /** + * @param Primary|PrimaryShape $primary + */ + public function withPrimary(Primary|array $primary): self + { + $self = clone $this; + $self['primary'] = $primary; + + return $self; + } + + /** + * @param Secondary|SecondaryShape $secondary + */ + public function withSecondary(Secondary|array $secondary): self + { + $self = clone $this; + $self['secondary'] = $secondary; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Link.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Link.php new file mode 100644 index 00000000..fd4f6c32 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Link.php @@ -0,0 +1,374 @@ +|null, + * fontFamily?: string|null, + * textDecorationColor?: string|null, + * } + */ +final class Link implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $backgroundColor; + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + #[Required] + public string $borderColor; + + #[Required] + public string $borderRadius; + + #[Required] + public string $borderStyle; + + #[Required] + public string $borderWidth; + + /** + * Computed box-shadow (comma-separated layers when present). + */ + #[Required] + public string $boxShadow; + + #[Required] + public string $color; + + /** + * Ready-to-use CSS declaration block for this component style. + */ + #[Required] + public string $css; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + /** + * Sampled minimum height of the button box (typically px). + */ + #[Required] + public string $minHeight; + + /** + * Sampled minimum width of the button box (typically px). + */ + #[Required] + public string $minWidth; + + #[Required] + public string $padding; + + #[Required] + public string $textDecoration; + + /** + * Full ordered font list from computed font-family. + * + * @var list|null $fontFallbacks + */ + #[Optional(list: 'string')] + public ?array $fontFallbacks; + + /** + * Primary button typeface (first in fontFallbacks). + */ + #[Optional] + public ?string $fontFamily; + + /** + * Hex color of the underline when it differs from the text color. + */ + #[Optional] + public ?string $textDecorationColor; + + /** + * `new Link()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Link::with( + * backgroundColor: ..., + * borderColor: ..., + * borderRadius: ..., + * borderStyle: ..., + * borderWidth: ..., + * boxShadow: ..., + * color: ..., + * css: ..., + * fontSize: ..., + * fontWeight: ..., + * minHeight: ..., + * minWidth: ..., + * padding: ..., + * textDecoration: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Link) + * ->withBackgroundColor(...) + * ->withBorderColor(...) + * ->withBorderRadius(...) + * ->withBorderStyle(...) + * ->withBorderWidth(...) + * ->withBoxShadow(...) + * ->withColor(...) + * ->withCss(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withMinHeight(...) + * ->withMinWidth(...) + * ->withPadding(...) + * ->withTextDecoration(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $fontFallbacks + */ + public static function with( + string $backgroundColor, + string $borderColor, + string $borderRadius, + string $borderStyle, + string $borderWidth, + string $boxShadow, + string $color, + string $css, + string $fontSize, + float $fontWeight, + string $minHeight, + string $minWidth, + string $padding, + string $textDecoration, + ?array $fontFallbacks = null, + ?string $fontFamily = null, + ?string $textDecorationColor = null, + ): self { + $self = new self; + + $self['backgroundColor'] = $backgroundColor; + $self['borderColor'] = $borderColor; + $self['borderRadius'] = $borderRadius; + $self['borderStyle'] = $borderStyle; + $self['borderWidth'] = $borderWidth; + $self['boxShadow'] = $boxShadow; + $self['color'] = $color; + $self['css'] = $css; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['minHeight'] = $minHeight; + $self['minWidth'] = $minWidth; + $self['padding'] = $padding; + $self['textDecoration'] = $textDecoration; + + null !== $fontFallbacks && $self['fontFallbacks'] = $fontFallbacks; + null !== $fontFamily && $self['fontFamily'] = $fontFamily; + null !== $textDecorationColor && $self['textDecorationColor'] = $textDecorationColor; + + return $self; + } + + public function withBackgroundColor(string $backgroundColor): self + { + $self = clone $this; + $self['backgroundColor'] = $backgroundColor; + + return $self; + } + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + public function withBorderColor(string $borderColor): self + { + $self = clone $this; + $self['borderColor'] = $borderColor; + + return $self; + } + + public function withBorderRadius(string $borderRadius): self + { + $self = clone $this; + $self['borderRadius'] = $borderRadius; + + return $self; + } + + public function withBorderStyle(string $borderStyle): self + { + $self = clone $this; + $self['borderStyle'] = $borderStyle; + + return $self; + } + + public function withBorderWidth(string $borderWidth): self + { + $self = clone $this; + $self['borderWidth'] = $borderWidth; + + return $self; + } + + /** + * Computed box-shadow (comma-separated layers when present). + */ + public function withBoxShadow(string $boxShadow): self + { + $self = clone $this; + $self['boxShadow'] = $boxShadow; + + return $self; + } + + public function withColor(string $color): self + { + $self = clone $this; + $self['color'] = $color; + + return $self; + } + + /** + * Ready-to-use CSS declaration block for this component style. + */ + public function withCss(string $css): self + { + $self = clone $this; + $self['css'] = $css; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + /** + * Sampled minimum height of the button box (typically px). + */ + public function withMinHeight(string $minHeight): self + { + $self = clone $this; + $self['minHeight'] = $minHeight; + + return $self; + } + + /** + * Sampled minimum width of the button box (typically px). + */ + public function withMinWidth(string $minWidth): self + { + $self = clone $this; + $self['minWidth'] = $minWidth; + + return $self; + } + + public function withPadding(string $padding): self + { + $self = clone $this; + $self['padding'] = $padding; + + return $self; + } + + public function withTextDecoration(string $textDecoration): self + { + $self = clone $this; + $self['textDecoration'] = $textDecoration; + + return $self; + } + + /** + * Full ordered font list from computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary button typeface (first in fontFallbacks). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + /** + * Hex color of the underline when it differs from the text color. + */ + public function withTextDecorationColor(string $textDecorationColor): self + { + $self = clone $this; + $self['textDecorationColor'] = $textDecorationColor; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Primary.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Primary.php new file mode 100644 index 00000000..1eb54754 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Primary.php @@ -0,0 +1,374 @@ +|null, + * fontFamily?: string|null, + * textDecorationColor?: string|null, + * } + */ +final class Primary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $backgroundColor; + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + #[Required] + public string $borderColor; + + #[Required] + public string $borderRadius; + + #[Required] + public string $borderStyle; + + #[Required] + public string $borderWidth; + + /** + * Computed box-shadow (comma-separated layers when present). + */ + #[Required] + public string $boxShadow; + + #[Required] + public string $color; + + /** + * Ready-to-use CSS declaration block for this component style. + */ + #[Required] + public string $css; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + /** + * Sampled minimum height of the button box (typically px). + */ + #[Required] + public string $minHeight; + + /** + * Sampled minimum width of the button box (typically px). + */ + #[Required] + public string $minWidth; + + #[Required] + public string $padding; + + #[Required] + public string $textDecoration; + + /** + * Full ordered font list from computed font-family. + * + * @var list|null $fontFallbacks + */ + #[Optional(list: 'string')] + public ?array $fontFallbacks; + + /** + * Primary button typeface (first in fontFallbacks). + */ + #[Optional] + public ?string $fontFamily; + + /** + * Hex color of the underline when it differs from the text color. + */ + #[Optional] + public ?string $textDecorationColor; + + /** + * `new Primary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Primary::with( + * backgroundColor: ..., + * borderColor: ..., + * borderRadius: ..., + * borderStyle: ..., + * borderWidth: ..., + * boxShadow: ..., + * color: ..., + * css: ..., + * fontSize: ..., + * fontWeight: ..., + * minHeight: ..., + * minWidth: ..., + * padding: ..., + * textDecoration: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Primary) + * ->withBackgroundColor(...) + * ->withBorderColor(...) + * ->withBorderRadius(...) + * ->withBorderStyle(...) + * ->withBorderWidth(...) + * ->withBoxShadow(...) + * ->withColor(...) + * ->withCss(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withMinHeight(...) + * ->withMinWidth(...) + * ->withPadding(...) + * ->withTextDecoration(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $fontFallbacks + */ + public static function with( + string $backgroundColor, + string $borderColor, + string $borderRadius, + string $borderStyle, + string $borderWidth, + string $boxShadow, + string $color, + string $css, + string $fontSize, + float $fontWeight, + string $minHeight, + string $minWidth, + string $padding, + string $textDecoration, + ?array $fontFallbacks = null, + ?string $fontFamily = null, + ?string $textDecorationColor = null, + ): self { + $self = new self; + + $self['backgroundColor'] = $backgroundColor; + $self['borderColor'] = $borderColor; + $self['borderRadius'] = $borderRadius; + $self['borderStyle'] = $borderStyle; + $self['borderWidth'] = $borderWidth; + $self['boxShadow'] = $boxShadow; + $self['color'] = $color; + $self['css'] = $css; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['minHeight'] = $minHeight; + $self['minWidth'] = $minWidth; + $self['padding'] = $padding; + $self['textDecoration'] = $textDecoration; + + null !== $fontFallbacks && $self['fontFallbacks'] = $fontFallbacks; + null !== $fontFamily && $self['fontFamily'] = $fontFamily; + null !== $textDecorationColor && $self['textDecorationColor'] = $textDecorationColor; + + return $self; + } + + public function withBackgroundColor(string $backgroundColor): self + { + $self = clone $this; + $self['backgroundColor'] = $backgroundColor; + + return $self; + } + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + public function withBorderColor(string $borderColor): self + { + $self = clone $this; + $self['borderColor'] = $borderColor; + + return $self; + } + + public function withBorderRadius(string $borderRadius): self + { + $self = clone $this; + $self['borderRadius'] = $borderRadius; + + return $self; + } + + public function withBorderStyle(string $borderStyle): self + { + $self = clone $this; + $self['borderStyle'] = $borderStyle; + + return $self; + } + + public function withBorderWidth(string $borderWidth): self + { + $self = clone $this; + $self['borderWidth'] = $borderWidth; + + return $self; + } + + /** + * Computed box-shadow (comma-separated layers when present). + */ + public function withBoxShadow(string $boxShadow): self + { + $self = clone $this; + $self['boxShadow'] = $boxShadow; + + return $self; + } + + public function withColor(string $color): self + { + $self = clone $this; + $self['color'] = $color; + + return $self; + } + + /** + * Ready-to-use CSS declaration block for this component style. + */ + public function withCss(string $css): self + { + $self = clone $this; + $self['css'] = $css; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + /** + * Sampled minimum height of the button box (typically px). + */ + public function withMinHeight(string $minHeight): self + { + $self = clone $this; + $self['minHeight'] = $minHeight; + + return $self; + } + + /** + * Sampled minimum width of the button box (typically px). + */ + public function withMinWidth(string $minWidth): self + { + $self = clone $this; + $self['minWidth'] = $minWidth; + + return $self; + } + + public function withPadding(string $padding): self + { + $self = clone $this; + $self['padding'] = $padding; + + return $self; + } + + public function withTextDecoration(string $textDecoration): self + { + $self = clone $this; + $self['textDecoration'] = $textDecoration; + + return $self; + } + + /** + * Full ordered font list from computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary button typeface (first in fontFallbacks). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + /** + * Hex color of the underline when it differs from the text color. + */ + public function withTextDecorationColor(string $textDecorationColor): self + { + $self = clone $this; + $self['textDecorationColor'] = $textDecorationColor; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Secondary.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Secondary.php new file mode 100644 index 00000000..bd605948 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Button/Secondary.php @@ -0,0 +1,374 @@ +|null, + * fontFamily?: string|null, + * textDecorationColor?: string|null, + * } + */ +final class Secondary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $backgroundColor; + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + #[Required] + public string $borderColor; + + #[Required] + public string $borderRadius; + + #[Required] + public string $borderStyle; + + #[Required] + public string $borderWidth; + + /** + * Computed box-shadow (comma-separated layers when present). + */ + #[Required] + public string $boxShadow; + + #[Required] + public string $color; + + /** + * Ready-to-use CSS declaration block for this component style. + */ + #[Required] + public string $css; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + /** + * Sampled minimum height of the button box (typically px). + */ + #[Required] + public string $minHeight; + + /** + * Sampled minimum width of the button box (typically px). + */ + #[Required] + public string $minWidth; + + #[Required] + public string $padding; + + #[Required] + public string $textDecoration; + + /** + * Full ordered font list from computed font-family. + * + * @var list|null $fontFallbacks + */ + #[Optional(list: 'string')] + public ?array $fontFallbacks; + + /** + * Primary button typeface (first in fontFallbacks). + */ + #[Optional] + public ?string $fontFamily; + + /** + * Hex color of the underline when it differs from the text color. + */ + #[Optional] + public ?string $textDecorationColor; + + /** + * `new Secondary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Secondary::with( + * backgroundColor: ..., + * borderColor: ..., + * borderRadius: ..., + * borderStyle: ..., + * borderWidth: ..., + * boxShadow: ..., + * color: ..., + * css: ..., + * fontSize: ..., + * fontWeight: ..., + * minHeight: ..., + * minWidth: ..., + * padding: ..., + * textDecoration: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Secondary) + * ->withBackgroundColor(...) + * ->withBorderColor(...) + * ->withBorderRadius(...) + * ->withBorderStyle(...) + * ->withBorderWidth(...) + * ->withBoxShadow(...) + * ->withColor(...) + * ->withCss(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withMinHeight(...) + * ->withMinWidth(...) + * ->withPadding(...) + * ->withTextDecoration(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $fontFallbacks + */ + public static function with( + string $backgroundColor, + string $borderColor, + string $borderRadius, + string $borderStyle, + string $borderWidth, + string $boxShadow, + string $color, + string $css, + string $fontSize, + float $fontWeight, + string $minHeight, + string $minWidth, + string $padding, + string $textDecoration, + ?array $fontFallbacks = null, + ?string $fontFamily = null, + ?string $textDecorationColor = null, + ): self { + $self = new self; + + $self['backgroundColor'] = $backgroundColor; + $self['borderColor'] = $borderColor; + $self['borderRadius'] = $borderRadius; + $self['borderStyle'] = $borderStyle; + $self['borderWidth'] = $borderWidth; + $self['boxShadow'] = $boxShadow; + $self['color'] = $color; + $self['css'] = $css; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['minHeight'] = $minHeight; + $self['minWidth'] = $minWidth; + $self['padding'] = $padding; + $self['textDecoration'] = $textDecoration; + + null !== $fontFallbacks && $self['fontFallbacks'] = $fontFallbacks; + null !== $fontFamily && $self['fontFamily'] = $fontFamily; + null !== $textDecorationColor && $self['textDecorationColor'] = $textDecorationColor; + + return $self; + } + + public function withBackgroundColor(string $backgroundColor): self + { + $self = clone $this; + $self['backgroundColor'] = $backgroundColor; + + return $self; + } + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + public function withBorderColor(string $borderColor): self + { + $self = clone $this; + $self['borderColor'] = $borderColor; + + return $self; + } + + public function withBorderRadius(string $borderRadius): self + { + $self = clone $this; + $self['borderRadius'] = $borderRadius; + + return $self; + } + + public function withBorderStyle(string $borderStyle): self + { + $self = clone $this; + $self['borderStyle'] = $borderStyle; + + return $self; + } + + public function withBorderWidth(string $borderWidth): self + { + $self = clone $this; + $self['borderWidth'] = $borderWidth; + + return $self; + } + + /** + * Computed box-shadow (comma-separated layers when present). + */ + public function withBoxShadow(string $boxShadow): self + { + $self = clone $this; + $self['boxShadow'] = $boxShadow; + + return $self; + } + + public function withColor(string $color): self + { + $self = clone $this; + $self['color'] = $color; + + return $self; + } + + /** + * Ready-to-use CSS declaration block for this component style. + */ + public function withCss(string $css): self + { + $self = clone $this; + $self['css'] = $css; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + /** + * Sampled minimum height of the button box (typically px). + */ + public function withMinHeight(string $minHeight): self + { + $self = clone $this; + $self['minHeight'] = $minHeight; + + return $self; + } + + /** + * Sampled minimum width of the button box (typically px). + */ + public function withMinWidth(string $minWidth): self + { + $self = clone $this; + $self['minWidth'] = $minWidth; + + return $self; + } + + public function withPadding(string $padding): self + { + $self = clone $this; + $self['padding'] = $padding; + + return $self; + } + + public function withTextDecoration(string $textDecoration): self + { + $self = clone $this; + $self['textDecoration'] = $textDecoration; + + return $self; + } + + /** + * Full ordered font list from computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary button typeface (first in fontFallbacks). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + /** + * Hex color of the underline when it differs from the text color. + */ + public function withTextDecorationColor(string $textDecorationColor): self + { + $self = clone $this; + $self['textDecorationColor'] = $textDecorationColor; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Card.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Card.php new file mode 100644 index 00000000..b77f597f --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Components/Card.php @@ -0,0 +1,210 @@ + */ + use SdkModel; + + #[Required] + public string $backgroundColor; + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + #[Required] + public string $borderColor; + + #[Required] + public string $borderRadius; + + #[Required] + public string $borderStyle; + + #[Required] + public string $borderWidth; + + #[Required] + public string $boxShadow; + + /** + * Ready-to-use CSS declaration block for this component style. + */ + #[Required] + public string $css; + + #[Required] + public string $padding; + + #[Required] + public string $textColor; + + /** + * `new Card()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Card::with( + * backgroundColor: ..., + * borderColor: ..., + * borderRadius: ..., + * borderStyle: ..., + * borderWidth: ..., + * boxShadow: ..., + * css: ..., + * padding: ..., + * textColor: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Card) + * ->withBackgroundColor(...) + * ->withBorderColor(...) + * ->withBorderRadius(...) + * ->withBorderStyle(...) + * ->withBorderWidth(...) + * ->withBoxShadow(...) + * ->withCss(...) + * ->withPadding(...) + * ->withTextColor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $backgroundColor, + string $borderColor, + string $borderRadius, + string $borderStyle, + string $borderWidth, + string $boxShadow, + string $css, + string $padding, + string $textColor, + ): self { + $self = new self; + + $self['backgroundColor'] = $backgroundColor; + $self['borderColor'] = $borderColor; + $self['borderRadius'] = $borderRadius; + $self['borderStyle'] = $borderStyle; + $self['borderWidth'] = $borderWidth; + $self['boxShadow'] = $boxShadow; + $self['css'] = $css; + $self['padding'] = $padding; + $self['textColor'] = $textColor; + + return $self; + } + + public function withBackgroundColor(string $backgroundColor): self + { + $self = clone $this; + $self['backgroundColor'] = $backgroundColor; + + return $self; + } + + /** + * Border color as CSS hex (#RRGGBB or #RRGGBBAA when computed border-color has alpha). + */ + public function withBorderColor(string $borderColor): self + { + $self = clone $this; + $self['borderColor'] = $borderColor; + + return $self; + } + + public function withBorderRadius(string $borderRadius): self + { + $self = clone $this; + $self['borderRadius'] = $borderRadius; + + return $self; + } + + public function withBorderStyle(string $borderStyle): self + { + $self = clone $this; + $self['borderStyle'] = $borderStyle; + + return $self; + } + + public function withBorderWidth(string $borderWidth): self + { + $self = clone $this; + $self['borderWidth'] = $borderWidth; + + return $self; + } + + public function withBoxShadow(string $boxShadow): self + { + $self = clone $this; + $self['boxShadow'] = $boxShadow; + + return $self; + } + + /** + * Ready-to-use CSS declaration block for this component style. + */ + public function withCss(string $css): self + { + $self = clone $this; + $self['css'] = $css; + + return $self; + } + + public function withPadding(string $padding): self + { + $self = clone $this; + $self['padding'] = $padding; + + return $self; + } + + public function withTextColor(string $textColor): self + { + $self = clone $this; + $self['textColor'] = $textColor; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/ElementSpacing.php b/src/Web/WebExtractStyleguideResponse/Styleguide/ElementSpacing.php new file mode 100644 index 00000000..869ad5fe --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/ElementSpacing.php @@ -0,0 +1,124 @@ + */ + use SdkModel; + + #[Required] + public string $lg; + + #[Required] + public string $md; + + #[Required] + public string $sm; + + #[Required] + public string $xl; + + #[Required] + public string $xs; + + /** + * `new ElementSpacing()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ElementSpacing::with(lg: ..., md: ..., sm: ..., xl: ..., xs: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ElementSpacing) + * ->withLg(...) + * ->withMd(...) + * ->withSm(...) + * ->withXl(...) + * ->withXs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $lg, + string $md, + string $sm, + string $xl, + string $xs + ): self { + $self = new self; + + $self['lg'] = $lg; + $self['md'] = $md; + $self['sm'] = $sm; + $self['xl'] = $xl; + $self['xs'] = $xs; + + return $self; + } + + public function withLg(string $lg): self + { + $self = clone $this; + $self['lg'] = $lg; + + return $self; + } + + public function withMd(string $md): self + { + $self = clone $this; + $self['md'] = $md; + + return $self; + } + + public function withSm(string $sm): self + { + $self = clone $this; + $self['sm'] = $sm; + + return $self; + } + + public function withXl(string $xl): self + { + $self = clone $this; + $self['xl'] = $xl; + + return $self; + } + + public function withXs(string $xs): self + { + $self = clone $this; + $self['xs'] = $xs; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/FontLink.php b/src/Web/WebExtractStyleguideResponse/Styleguide/FontLink.php new file mode 100644 index 00000000..7c701f7f --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/FontLink.php @@ -0,0 +1,139 @@ +, + * type: Type|value-of, + * category?: string|null, + * displayName?: string|null, + * } + */ +final class FontLink implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Upright font files keyed by weight string (e.g. "400" for regular, "500", "700"). Values are absolute URLs. + * + * @var array $files + */ + #[Required(map: 'string')] + public array $files; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Google Fonts category when type is google (e.g. sans-serif, serif, monospace, display, handwriting). Omitted for custom fonts when unknown. + */ + #[Optional] + public ?string $category; + + /** + * Present when type is custom: human-readable name derived from the fontLinks key (strip build/hash suffixes, split camelCase / PascalCase, normalize separators). Google entries omit this. + */ + #[Optional] + public ?string $displayName; + + /** + * `new FontLink()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * FontLink::with(files: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new FontLink)->withFiles(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array $files + * @param Type|value-of $type + */ + public static function with( + array $files, + Type|string $type, + ?string $category = null, + ?string $displayName = null, + ): self { + $self = new self; + + $self['files'] = $files; + $self['type'] = $type; + + null !== $category && $self['category'] = $category; + null !== $displayName && $self['displayName'] = $displayName; + + return $self; + } + + /** + * Upright font files keyed by weight string (e.g. "400" for regular, "500", "700"). Values are absolute URLs. + * + * @param array $files + */ + public function withFiles(array $files): self + { + $self = clone $this; + $self['files'] = $files; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Google Fonts category when type is google (e.g. sans-serif, serif, monospace, display, handwriting). Omitted for custom fonts when unknown. + */ + public function withCategory(string $category): self + { + $self = clone $this; + $self['category'] = $category; + + return $self; + } + + /** + * Present when type is custom: human-readable name derived from the fontLinks key (strip build/hash suffixes, split camelCase / PascalCase, normalize separators). Google entries omit this. + */ + public function withDisplayName(string $displayName): self + { + $self = clone $this; + $self['displayName'] = $displayName; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/FontLink/Type.php b/src/Web/WebExtractStyleguideResponse/Styleguide/FontLink/Type.php new file mode 100644 index 00000000..40a3f381 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/FontLink/Type.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + #[Required] + public string $inner; + + #[Required] + public string $lg; + + #[Required] + public string $md; + + #[Required] + public string $sm; + + #[Required] + public string $xl; + + /** + * `new Shadows()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Shadows::with(inner: ..., lg: ..., md: ..., sm: ..., xl: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Shadows) + * ->withInner(...) + * ->withLg(...) + * ->withMd(...) + * ->withSm(...) + * ->withXl(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $inner, + string $lg, + string $md, + string $sm, + string $xl + ): self { + $self = new self; + + $self['inner'] = $inner; + $self['lg'] = $lg; + $self['md'] = $md; + $self['sm'] = $sm; + $self['xl'] = $xl; + + return $self; + } + + public function withInner(string $inner): self + { + $self = clone $this; + $self['inner'] = $inner; + + return $self; + } + + public function withLg(string $lg): self + { + $self = clone $this; + $self['lg'] = $lg; + + return $self; + } + + public function withMd(string $md): self + { + $self = clone $this; + $self['md'] = $md; + + return $self; + } + + public function withSm(string $sm): self + { + $self = clone $this; + $self['sm'] = $sm; + + return $self; + } + + public function withXl(string $xl): self + { + $self = clone $this; + $self['xl'] = $xl; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Typography.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography.php new file mode 100644 index 00000000..0ee63570 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography.php @@ -0,0 +1,101 @@ + */ + use SdkModel; + + /** + * Heading styles. + */ + #[Required] + public Headings $headings; + + #[Optional] + public ?P $p; + + /** + * `new Typography()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Typography::with(headings: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Typography)->withHeadings(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Headings|HeadingsShape $headings + * @param P|PShape|null $p + */ + public static function with( + Headings|array $headings, + P|array|null $p = null + ): self { + $self = new self; + + $self['headings'] = $headings; + + null !== $p && $self['p'] = $p; + + return $self; + } + + /** + * Heading styles. + * + * @param Headings|HeadingsShape $headings + */ + public function withHeadings(Headings|array $headings): self + { + $self = clone $this; + $self['headings'] = $headings; + + return $self; + } + + /** + * @param P|PShape $p + */ + public function withP(P|array $p): self + { + $self = clone $this; + $self['p'] = $p; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings.php new file mode 100644 index 00000000..32c27f2d --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings.php @@ -0,0 +1,121 @@ + */ + use SdkModel; + + #[Optional] + public ?H1 $h1; + + #[Optional] + public ?H2 $h2; + + #[Optional] + public ?H3 $h3; + + #[Optional] + public ?H4 $h4; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param H1|H1Shape|null $h1 + * @param H2|H2Shape|null $h2 + * @param H3|H3Shape|null $h3 + * @param H4|H4Shape|null $h4 + */ + public static function with( + H1|array|null $h1 = null, + H2|array|null $h2 = null, + H3|array|null $h3 = null, + H4|array|null $h4 = null, + ): self { + $self = new self; + + null !== $h1 && $self['h1'] = $h1; + null !== $h2 && $self['h2'] = $h2; + null !== $h3 && $self['h3'] = $h3; + null !== $h4 && $self['h4'] = $h4; + + return $self; + } + + /** + * @param H1|H1Shape $h1 + */ + public function withH1(H1|array $h1): self + { + $self = clone $this; + $self['h1'] = $h1; + + return $self; + } + + /** + * @param H2|H2Shape $h2 + */ + public function withH2(H2|array $h2): self + { + $self = clone $this; + $self['h2'] = $h2; + + return $self; + } + + /** + * @param H3|H3Shape $h3 + */ + public function withH3(H3|array $h3): self + { + $self = clone $this; + $self['h3'] = $h3; + + return $self; + } + + /** + * @param H4|H4Shape $h4 + */ + public function withH4(H4|array $h4): self + { + $self = clone $this; + $self['h4'] = $h4; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H1.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H1.php new file mode 100644 index 00000000..5bb33fae --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H1.php @@ -0,0 +1,166 @@ +, + * fontFamily: string, + * fontSize: string, + * fontWeight: float, + * letterSpacing: string, + * lineHeight: string, + * } + */ +final class H1 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Full ordered font list from resolved computed font-family. + * + * @var list $fontFallbacks + */ + #[Required(list: 'string')] + public array $fontFallbacks; + + /** + * Primary face (first family in the computed stack). + */ + #[Required] + public string $fontFamily; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + #[Required] + public string $letterSpacing; + + #[Required] + public string $lineHeight; + + /** + * `new H1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * H1::with( + * fontFallbacks: ..., + * fontFamily: ..., + * fontSize: ..., + * fontWeight: ..., + * letterSpacing: ..., + * lineHeight: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new H1) + * ->withFontFallbacks(...) + * ->withFontFamily(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withLetterSpacing(...) + * ->withLineHeight(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $fontFallbacks + */ + public static function with( + array $fontFallbacks, + string $fontFamily, + string $fontSize, + float $fontWeight, + string $letterSpacing, + string $lineHeight, + ): self { + $self = new self; + + $self['fontFallbacks'] = $fontFallbacks; + $self['fontFamily'] = $fontFamily; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['letterSpacing'] = $letterSpacing; + $self['lineHeight'] = $lineHeight; + + return $self; + } + + /** + * Full ordered font list from resolved computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary face (first family in the computed stack). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + public function withLetterSpacing(string $letterSpacing): self + { + $self = clone $this; + $self['letterSpacing'] = $letterSpacing; + + return $self; + } + + public function withLineHeight(string $lineHeight): self + { + $self = clone $this; + $self['lineHeight'] = $lineHeight; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H2.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H2.php new file mode 100644 index 00000000..e30007e6 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H2.php @@ -0,0 +1,166 @@ +, + * fontFamily: string, + * fontSize: string, + * fontWeight: float, + * letterSpacing: string, + * lineHeight: string, + * } + */ +final class H2 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Full ordered font list from resolved computed font-family. + * + * @var list $fontFallbacks + */ + #[Required(list: 'string')] + public array $fontFallbacks; + + /** + * Primary face (first family in the computed stack). + */ + #[Required] + public string $fontFamily; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + #[Required] + public string $letterSpacing; + + #[Required] + public string $lineHeight; + + /** + * `new H2()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * H2::with( + * fontFallbacks: ..., + * fontFamily: ..., + * fontSize: ..., + * fontWeight: ..., + * letterSpacing: ..., + * lineHeight: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new H2) + * ->withFontFallbacks(...) + * ->withFontFamily(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withLetterSpacing(...) + * ->withLineHeight(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $fontFallbacks + */ + public static function with( + array $fontFallbacks, + string $fontFamily, + string $fontSize, + float $fontWeight, + string $letterSpacing, + string $lineHeight, + ): self { + $self = new self; + + $self['fontFallbacks'] = $fontFallbacks; + $self['fontFamily'] = $fontFamily; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['letterSpacing'] = $letterSpacing; + $self['lineHeight'] = $lineHeight; + + return $self; + } + + /** + * Full ordered font list from resolved computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary face (first family in the computed stack). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + public function withLetterSpacing(string $letterSpacing): self + { + $self = clone $this; + $self['letterSpacing'] = $letterSpacing; + + return $self; + } + + public function withLineHeight(string $lineHeight): self + { + $self = clone $this; + $self['lineHeight'] = $lineHeight; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H3.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H3.php new file mode 100644 index 00000000..a7c759f7 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H3.php @@ -0,0 +1,166 @@ +, + * fontFamily: string, + * fontSize: string, + * fontWeight: float, + * letterSpacing: string, + * lineHeight: string, + * } + */ +final class H3 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Full ordered font list from resolved computed font-family. + * + * @var list $fontFallbacks + */ + #[Required(list: 'string')] + public array $fontFallbacks; + + /** + * Primary face (first family in the computed stack). + */ + #[Required] + public string $fontFamily; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + #[Required] + public string $letterSpacing; + + #[Required] + public string $lineHeight; + + /** + * `new H3()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * H3::with( + * fontFallbacks: ..., + * fontFamily: ..., + * fontSize: ..., + * fontWeight: ..., + * letterSpacing: ..., + * lineHeight: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new H3) + * ->withFontFallbacks(...) + * ->withFontFamily(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withLetterSpacing(...) + * ->withLineHeight(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $fontFallbacks + */ + public static function with( + array $fontFallbacks, + string $fontFamily, + string $fontSize, + float $fontWeight, + string $letterSpacing, + string $lineHeight, + ): self { + $self = new self; + + $self['fontFallbacks'] = $fontFallbacks; + $self['fontFamily'] = $fontFamily; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['letterSpacing'] = $letterSpacing; + $self['lineHeight'] = $lineHeight; + + return $self; + } + + /** + * Full ordered font list from resolved computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary face (first family in the computed stack). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + public function withLetterSpacing(string $letterSpacing): self + { + $self = clone $this; + $self['letterSpacing'] = $letterSpacing; + + return $self; + } + + public function withLineHeight(string $lineHeight): self + { + $self = clone $this; + $self['lineHeight'] = $lineHeight; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H4.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H4.php new file mode 100644 index 00000000..23318fce --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/Headings/H4.php @@ -0,0 +1,166 @@ +, + * fontFamily: string, + * fontSize: string, + * fontWeight: float, + * letterSpacing: string, + * lineHeight: string, + * } + */ +final class H4 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Full ordered font list from resolved computed font-family. + * + * @var list $fontFallbacks + */ + #[Required(list: 'string')] + public array $fontFallbacks; + + /** + * Primary face (first family in the computed stack). + */ + #[Required] + public string $fontFamily; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + #[Required] + public string $letterSpacing; + + #[Required] + public string $lineHeight; + + /** + * `new H4()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * H4::with( + * fontFallbacks: ..., + * fontFamily: ..., + * fontSize: ..., + * fontWeight: ..., + * letterSpacing: ..., + * lineHeight: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new H4) + * ->withFontFallbacks(...) + * ->withFontFamily(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withLetterSpacing(...) + * ->withLineHeight(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $fontFallbacks + */ + public static function with( + array $fontFallbacks, + string $fontFamily, + string $fontSize, + float $fontWeight, + string $letterSpacing, + string $lineHeight, + ): self { + $self = new self; + + $self['fontFallbacks'] = $fontFallbacks; + $self['fontFamily'] = $fontFamily; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['letterSpacing'] = $letterSpacing; + $self['lineHeight'] = $lineHeight; + + return $self; + } + + /** + * Full ordered font list from resolved computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary face (first family in the computed stack). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + public function withLetterSpacing(string $letterSpacing): self + { + $self = clone $this; + $self['letterSpacing'] = $letterSpacing; + + return $self; + } + + public function withLineHeight(string $lineHeight): self + { + $self = clone $this; + $self['lineHeight'] = $lineHeight; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/P.php b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/P.php new file mode 100644 index 00000000..d8923805 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/Styleguide/Typography/P.php @@ -0,0 +1,166 @@ +, + * fontFamily: string, + * fontSize: string, + * fontWeight: float, + * letterSpacing: string, + * lineHeight: string, + * } + */ +final class P implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Full ordered font list from resolved computed font-family. + * + * @var list $fontFallbacks + */ + #[Required(list: 'string')] + public array $fontFallbacks; + + /** + * Primary face (first family in the computed stack). + */ + #[Required] + public string $fontFamily; + + #[Required] + public string $fontSize; + + #[Required] + public float $fontWeight; + + #[Required] + public string $letterSpacing; + + #[Required] + public string $lineHeight; + + /** + * `new P()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * P::with( + * fontFallbacks: ..., + * fontFamily: ..., + * fontSize: ..., + * fontWeight: ..., + * letterSpacing: ..., + * lineHeight: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new P) + * ->withFontFallbacks(...) + * ->withFontFamily(...) + * ->withFontSize(...) + * ->withFontWeight(...) + * ->withLetterSpacing(...) + * ->withLineHeight(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $fontFallbacks + */ + public static function with( + array $fontFallbacks, + string $fontFamily, + string $fontSize, + float $fontWeight, + string $letterSpacing, + string $lineHeight, + ): self { + $self = new self; + + $self['fontFallbacks'] = $fontFallbacks; + $self['fontFamily'] = $fontFamily; + $self['fontSize'] = $fontSize; + $self['fontWeight'] = $fontWeight; + $self['letterSpacing'] = $letterSpacing; + $self['lineHeight'] = $lineHeight; + + return $self; + } + + /** + * Full ordered font list from resolved computed font-family. + * + * @param list $fontFallbacks + */ + public function withFontFallbacks(array $fontFallbacks): self + { + $self = clone $this; + $self['fontFallbacks'] = $fontFallbacks; + + return $self; + } + + /** + * Primary face (first family in the computed stack). + */ + public function withFontFamily(string $fontFamily): self + { + $self = clone $this; + $self['fontFamily'] = $fontFamily; + + return $self; + } + + public function withFontSize(string $fontSize): self + { + $self = clone $this; + $self['fontSize'] = $fontSize; + + return $self; + } + + public function withFontWeight(float $fontWeight): self + { + $self = clone $this; + $self['fontWeight'] = $fontWeight; + + return $self; + } + + public function withLetterSpacing(string $letterSpacing): self + { + $self = clone $this; + $self['letterSpacing'] = $letterSpacing; + + return $self; + } + + public function withLineHeight(string $lineHeight): self + { + $self = clone $this; + $self['lineHeight'] = $lineHeight; + + return $self; + } +} diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php new file mode 100644 index 00000000..8f9f5865 --- /dev/null +++ b/src/Web/WebScreenshotParams.php @@ -0,0 +1,250 @@ +, + * handleCookiePopup?: null|HandleCookiePopup|value-of, + * maxAgeMs?: int|null, + * page?: null|Page|value-of, + * timeoutMs?: int|null, + * viewport?: null|Viewport|ViewportShape, + * waitForMs?: int|null, + * } + */ +final class WebScreenshotParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. + */ + #[Optional] + public ?string $directURL; + + /** + * Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + */ + #[Optional] + public ?string $domain; + + /** + * Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). + * + * @var value-of|null $fullScreenshot + */ + #[Optional(enum: FullScreenshot::class)] + public ?string $fullScreenshot; + + /** + * Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * + * @var value-of|null $handleCookiePopup + */ + #[Optional(enum: HandleCookiePopup::class)] + public ?string $handleCookiePopup; + + /** + * Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * + * @var value-of|null $page + */ + #[Optional(enum: Page::class)] + public ?string $page; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. + */ + #[Optional] + public ?Viewport $viewport; + + /** + * Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + */ + #[Optional] + public ?int $waitForMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param FullScreenshot|value-of|null $fullScreenshot + * @param HandleCookiePopup|value-of|null $handleCookiePopup + * @param Page|value-of|null $page + * @param Viewport|ViewportShape|null $viewport + */ + public static function with( + ?string $directURL = null, + ?string $domain = null, + FullScreenshot|string|null $fullScreenshot = null, + HandleCookiePopup|string|null $handleCookiePopup = null, + ?int $maxAgeMs = null, + Page|string|null $page = null, + ?int $timeoutMs = null, + Viewport|array|null $viewport = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + null !== $directURL && $self['directURL'] = $directURL; + null !== $domain && $self['domain'] = $domain; + null !== $fullScreenshot && $self['fullScreenshot'] = $fullScreenshot; + null !== $handleCookiePopup && $self['handleCookiePopup'] = $handleCookiePopup; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $page && $self['page'] = $page; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $viewport && $self['viewport'] = $viewport; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. + */ + public function withDirectURL(string $directURL): self + { + $self = clone $this; + $self['directURL'] = $directURL; + + return $self; + } + + /** + * Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). + * + * @param FullScreenshot|value-of $fullScreenshot + */ + public function withFullScreenshot( + FullScreenshot|string $fullScreenshot + ): self { + $self = clone $this; + $self['fullScreenshot'] = $fullScreenshot; + + return $self; + } + + /** + * Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * + * @param HandleCookiePopup|value-of $handleCookiePopup + */ + public function withHandleCookiePopup( + HandleCookiePopup|string $handleCookiePopup + ): self { + $self = clone $this; + $self['handleCookiePopup'] = $handleCookiePopup; + + return $self; + } + + /** + * Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * + * @param Page|value-of $page + */ + public function withPage(Page|string $page): self + { + $self = clone $this; + $self['page'] = $page; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. + * + * @param Viewport|ViewportShape $viewport + */ + public function withViewport(Viewport|array $viewport): self + { + $self = clone $this; + $self['viewport'] = $viewport; + + return $self; + } + + /** + * Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Web/WebScreenshotParams/FullScreenshot.php b/src/Web/WebScreenshotParams/FullScreenshot.php new file mode 100644 index 00000000..7d33ba50 --- /dev/null +++ b/src/Web/WebScreenshotParams/FullScreenshot.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * Viewport height in pixels. + */ + #[Optional] + public ?int $height; + + /** + * Viewport width in pixels. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?int $height = null, ?int $width = null): self + { + $self = new self; + + null !== $height && $self['height'] = $height; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Viewport height in pixels. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Viewport width in pixels. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Web/WebScreenshotResponse.php b/src/Web/WebScreenshotResponse.php new file mode 100644 index 00000000..2b1d8ab5 --- /dev/null +++ b/src/Web/WebScreenshotResponse.php @@ -0,0 +1,211 @@ +, + * status?: string|null, + * width?: int|null, + * } + */ +final class WebScreenshotResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * HTTP status code. + */ + #[Optional] + public ?int $code; + + /** + * The normalized domain that was processed. + */ + #[Optional] + public ?string $domain; + + /** + * Height in pixels of the returned screenshot image. + */ + #[Optional] + public ?int $height; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Public URL of the uploaded screenshot image. + */ + #[Optional] + public ?string $screenshot; + + /** + * Type of screenshot that was captured. + * + * @var value-of|null $screenshotType + */ + #[Optional(enum: ScreenshotType::class)] + public ?string $screenshotType; + + /** + * Status of the response, e.g., 'ok'. + */ + #[Optional] + public ?string $status; + + /** + * Width in pixels of the returned screenshot image. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + * @param ScreenshotType|value-of|null $screenshotType + */ + public static function with( + ?int $code = null, + ?string $domain = null, + ?int $height = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $screenshot = null, + ScreenshotType|string|null $screenshotType = null, + ?string $status = null, + ?int $width = null, + ): self { + $self = new self; + + null !== $code && $self['code'] = $code; + null !== $domain && $self['domain'] = $domain; + null !== $height && $self['height'] = $height; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $screenshot && $self['screenshot'] = $screenshot; + null !== $screenshotType && $self['screenshotType'] = $screenshotType; + null !== $status && $self['status'] = $status; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * HTTP status code. + */ + public function withCode(int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * The normalized domain that was processed. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Height in pixels of the returned screenshot image. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Public URL of the uploaded screenshot image. + */ + public function withScreenshot(string $screenshot): self + { + $self = clone $this; + $self['screenshot'] = $screenshot; + + return $self; + } + + /** + * Type of screenshot that was captured. + * + * @param ScreenshotType|value-of $screenshotType + */ + public function withScreenshotType( + ScreenshotType|string $screenshotType + ): self { + $self = clone $this; + $self['screenshotType'] = $screenshotType; + + return $self; + } + + /** + * Status of the response, e.g., 'ok'. + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Width in pixels of the returned screenshot image. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Web/WebScreenshotResponse/KeyMetadata.php b/src/Web/WebScreenshotResponse/KeyMetadata.php new file mode 100644 index 00000000..83fe7e5e --- /dev/null +++ b/src/Web/WebScreenshotResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebScreenshotResponse/ScreenshotType.php b/src/Web/WebScreenshotResponse/ScreenshotType.php new file mode 100644 index 00000000..217155c6 --- /dev/null +++ b/src/Web/WebScreenshotResponse/ScreenshotType.php @@ -0,0 +1,15 @@ +|null, + * freshness?: null|Freshness|value-of, + * includeDomains?: list|null, + * markdownOptions?: null|MarkdownOptions|MarkdownOptionsShape, + * queryFanout?: bool|null, + * timeoutMs?: int|null, + * } + */ +final class WebSearchParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Natural-language search query. + */ + #[Required] + public string $query; + + /** + * Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. + * + * @var list|null $excludeDomains + */ + #[Optional(list: 'string')] + public ?array $excludeDomains; + + /** + * Restrict results to content published within this window. + * + * @var value-of|null $freshness + */ + #[Optional(enum: Freshness::class)] + public ?string $freshness; + + /** + * Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"]. + * + * @var list|null $includeDomains + */ + #[Optional(list: 'string')] + public ?array $includeDomains; + + /** + * Inline Markdown scraping for each result. Set `enabled: true` to activate. + */ + #[Optional] + public ?MarkdownOptions $markdownOptions; + + /** + * Expand the query into multiple parallel variants for broader recall. + */ + #[Optional] + public ?bool $queryFanout; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * `new WebSearchParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebSearchParams::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebSearchParams)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $excludeDomains + * @param Freshness|value-of|null $freshness + * @param list|null $includeDomains + * @param MarkdownOptions|MarkdownOptionsShape|null $markdownOptions + */ + public static function with( + string $query, + ?array $excludeDomains = null, + Freshness|string|null $freshness = null, + ?array $includeDomains = null, + MarkdownOptions|array|null $markdownOptions = null, + ?bool $queryFanout = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $excludeDomains && $self['excludeDomains'] = $excludeDomains; + null !== $freshness && $self['freshness'] = $freshness; + null !== $includeDomains && $self['includeDomains'] = $includeDomains; + null !== $markdownOptions && $self['markdownOptions'] = $markdownOptions; + null !== $queryFanout && $self['queryFanout'] = $queryFanout; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Natural-language search query. + */ + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. + * + * @param list $excludeDomains + */ + public function withExcludeDomains(array $excludeDomains): self + { + $self = clone $this; + $self['excludeDomains'] = $excludeDomains; + + return $self; + } + + /** + * Restrict results to content published within this window. + * + * @param Freshness|value-of $freshness + */ + public function withFreshness(Freshness|string $freshness): self + { + $self = clone $this; + $self['freshness'] = $freshness; + + return $self; + } + + /** + * Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"]. + * + * @param list $includeDomains + */ + public function withIncludeDomains(array $includeDomains): self + { + $self = clone $this; + $self['includeDomains'] = $includeDomains; + + return $self; + } + + /** + * Inline Markdown scraping for each result. Set `enabled: true` to activate. + * + * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions + */ + public function withMarkdownOptions( + MarkdownOptions|array $markdownOptions + ): self { + $self = clone $this; + $self['markdownOptions'] = $markdownOptions; + + return $self; + } + + /** + * Expand the query into multiple parallel variants for broader recall. + */ + public function withQueryFanout(bool $queryFanout): self + { + $self = clone $this; + $self['queryFanout'] = $queryFanout; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Web/WebSearchParams/Freshness.php b/src/Web/WebSearchParams/Freshness.php new file mode 100644 index 00000000..09b47c2c --- /dev/null +++ b/src/Web/WebSearchParams/Freshness.php @@ -0,0 +1,19 @@ + */ + use SdkModel; + + /** + * Scrape each result to Markdown. Off by default to keep search cheap and fast. + */ + #[Optional] + public ?bool $enabled; + + /** + * Render iframe contents into the Markdown. + */ + #[Optional] + public ?bool $includeFrames; + + /** + * Emit image references in the Markdown. + */ + #[Optional] + public ?bool $includeImages; + + /** + * Keep hyperlinks in the Markdown. + */ + #[Optional] + public ?bool $includeLinks; + + /** + * Cache TTL in ms for scraped Markdown keyed by URL + options. Default 1 day, max 30 days. Set to 0 to force a fresh scrape. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * PDF handling. Use start/end to bound text extraction and OCR to a page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Truncate inline base64 image payloads to keep responses small. + */ + #[Optional] + public ?bool $shortenBase64Images; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * Strip nav, header, footer, and sidebar — keep only the primary article content. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * Extra wait after page load before rendering, in ms (0–30000). Useful for JS-heavy pages. + */ + #[Optional] + public ?int $waitForMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + ?bool $enabled = null, + ?bool $includeFrames = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, + ?int $maxAgeMs = null, + Pdf|array|null $pdf = null, + ?bool $shortenBase64Images = null, + ?int $timeoutMs = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + null !== $enabled && $self['enabled'] = $enabled; + null !== $includeFrames && $self['includeFrames'] = $includeFrames; + null !== $includeImages && $self['includeImages'] = $includeImages; + null !== $includeLinks && $self['includeLinks'] = $includeLinks; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $pdf && $self['pdf'] = $pdf; + null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Scrape each result to Markdown. Off by default to keep search cheap and fast. + */ + public function withEnabled(bool $enabled): self + { + $self = clone $this; + $self['enabled'] = $enabled; + + return $self; + } + + /** + * Render iframe contents into the Markdown. + */ + public function withIncludeFrames(bool $includeFrames): self + { + $self = clone $this; + $self['includeFrames'] = $includeFrames; + + return $self; + } + + /** + * Emit image references in the Markdown. + */ + public function withIncludeImages(bool $includeImages): self + { + $self = clone $this; + $self['includeImages'] = $includeImages; + + return $self; + } + + /** + * Keep hyperlinks in the Markdown. + */ + public function withIncludeLinks(bool $includeLinks): self + { + $self = clone $this; + $self['includeLinks'] = $includeLinks; + + return $self; + } + + /** + * Cache TTL in ms for scraped Markdown keyed by URL + options. Default 1 day, max 30 days. Set to 0 to force a fresh scrape. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * PDF handling. Use start/end to bound text extraction and OCR to a page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Truncate inline base64 image payloads to keep responses small. + */ + public function withShortenBase64Images(bool $shortenBase64Images): self + { + $self = clone $this; + $self['shortenBase64Images'] = $shortenBase64Images; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Strip nav, header, footer, and sidebar — keep only the primary article content. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * Extra wait after page load before rendering, in ms (0–30000). Useful for JS-heavy pages. + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Web/WebSearchParams/MarkdownOptions/Pdf.php b/src/Web/WebSearchParams/MarkdownOptions/Pdf.php new file mode 100644 index 00000000..808b7534 --- /dev/null +++ b/src/Web/WebSearchParams/MarkdownOptions/Pdf.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must be >= start. + */ + #[Optional] + public ?int $end; + + /** + * Parse PDF URLs. When false, PDF results are skipped with WEBSITE_ACCESS_ERROR. + */ + #[Optional] + public ?bool $shouldParse; + + /** + * First PDF page to parse (1-based, inclusive). Defaults to page 1. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?int $end = null, + ?bool $shouldParse = null, + ?int $start = null + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last PDF page to parse (1-based, inclusive). Defaults to the final page. Must be >= start. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * Parse PDF URLs. When false, PDF results are skipped with WEBSITE_ACCESS_ERROR. + */ + public function withShouldParse(bool $shouldParse): self + { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First PDF page to parse (1-based, inclusive). Defaults to page 1. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Web/WebSearchResponse.php b/src/Web/WebSearchResponse.php new file mode 100644 index 00000000..47db3621 --- /dev/null +++ b/src/Web/WebSearchResponse.php @@ -0,0 +1,121 @@ +, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebSearchResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Echo of the original query (useful when fanout was enabled). + */ + #[Required] + public string $query; + + /** @var list $results */ + #[Required(list: Result::class)] + public array $results; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebSearchResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebSearchResponse::with(query: ..., results: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebSearchResponse)->withQuery(...)->withResults(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $results + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + string $query, + array $results, + KeyMetadata|array|null $keyMetadata = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['results'] = $results; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Echo of the original query (useful when fanout was enabled). + */ + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param list $results + */ + public function withResults(array $results): self + { + $self = clone $this; + $self['results'] = $results; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebSearchResponse/KeyMetadata.php b/src/Web/WebSearchResponse/KeyMetadata.php new file mode 100644 index 00000000..bda49c20 --- /dev/null +++ b/src/Web/WebSearchResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebSearchResponse/Result.php b/src/Web/WebSearchResponse/Result.php new file mode 100644 index 00000000..07e8030d --- /dev/null +++ b/src/Web/WebSearchResponse/Result.php @@ -0,0 +1,171 @@ +, + * title: string, + * url: string, + * } + */ +final class Result implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Snippet excerpt from the page. + */ + #[Required] + public string $description; + + /** + * Markdown scrape status and content for this result. + */ + #[Required] + public Markdown $markdown; + + /** + * Relevance to the original query. + * + * @var value-of $relevance + */ + #[Required(enum: Relevance::class)] + public string $relevance; + + /** + * Page title. + */ + #[Required] + public string $title; + + /** + * Canonical result URL. + */ + #[Required] + public string $url; + + /** + * `new Result()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Result::with( + * description: ..., markdown: ..., relevance: ..., title: ..., url: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Result) + * ->withDescription(...) + * ->withMarkdown(...) + * ->withRelevance(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Markdown|MarkdownShape $markdown + * @param Relevance|value-of $relevance + */ + public static function with( + string $description, + Markdown|array $markdown, + Relevance|string $relevance, + string $title, + string $url, + ): self { + $self = new self; + + $self['description'] = $description; + $self['markdown'] = $markdown; + $self['relevance'] = $relevance; + $self['title'] = $title; + $self['url'] = $url; + + return $self; + } + + /** + * Snippet excerpt from the page. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * Markdown scrape status and content for this result. + * + * @param Markdown|MarkdownShape $markdown + */ + public function withMarkdown(Markdown|array $markdown): self + { + $self = clone $this; + $self['markdown'] = $markdown; + + return $self; + } + + /** + * Relevance to the original query. + * + * @param Relevance|value-of $relevance + */ + public function withRelevance(Relevance|string $relevance): self + { + $self = clone $this; + $self['relevance'] = $relevance; + + return $self; + } + + /** + * Page title. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Canonical result URL. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Web/WebSearchResponse/Result/Markdown.php b/src/Web/WebSearchResponse/Result/Markdown.php new file mode 100644 index 00000000..6743587a --- /dev/null +++ b/src/Web/WebSearchResponse/Result/Markdown.php @@ -0,0 +1,97 @@ +, markdown: string|null + * } + */ +final class Markdown implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Per-result scrape outcome. Inspect this before reading `markdown`. + * + * @var value-of $code + */ + #[Required(enum: Code::class)] + public string $code; + + /** + * GFM Markdown of the page. Null unless markdownOptions.enabled is true and scraping succeeded. + */ + #[Required] + public ?string $markdown; + + /** + * `new Markdown()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Markdown::with(code: ..., markdown: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Markdown)->withCode(...)->withMarkdown(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Code|value-of $code + */ + public static function with(Code|string $code, ?string $markdown): self + { + $self = new self; + + $self['code'] = $code; + $self['markdown'] = $markdown; + + return $self; + } + + /** + * Per-result scrape outcome. Inspect this before reading `markdown`. + * + * @param Code|value-of $code + */ + public function withCode(Code|string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * GFM Markdown of the page. Null unless markdownOptions.enabled is true and scraping succeeded. + */ + public function withMarkdown(?string $markdown): self + { + $self = clone $this; + $self['markdown'] = $markdown; + + return $self; + } +} diff --git a/src/Web/WebSearchResponse/Result/Markdown/Code.php b/src/Web/WebSearchResponse/Result/Markdown/Code.php new file mode 100644 index 00000000..38dfcb4b --- /dev/null +++ b/src/Web/WebSearchResponse/Result/Markdown/Code.php @@ -0,0 +1,21 @@ +|null, + * followSubdomains?: bool|null, + * includeFrames?: bool|null, + * includeImages?: bool|null, + * includeLinks?: bool|null, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, + * maxDepth?: int|null, + * maxPages?: int|null, + * pdf?: null|Pdf|PdfShape, + * shortenBase64Images?: bool|null, + * stopAfterMs?: int|null, + * timeoutMs?: int|null, + * urlRegex?: string|null, + * useMainContentOnly?: bool|null, + * waitForMs?: int|null, + * } + */ +final class WebWebCrawlMdParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * The starting URL for the crawl (must include http:// or https:// protocol). + */ + #[Required] + public string $url; + + /** + * CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * + * @var list|null $excludeSelectors + */ + #[Optional(list: 'string')] + public ?array $excludeSelectors; + + /** + * When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. + */ + #[Optional] + public ?bool $followSubdomains; + + /** + * When true, the contents of iframes are rendered to Markdown for each crawled page. + */ + #[Optional] + public ?bool $includeFrames; + + /** + * Include image references in the Markdown output. + */ + #[Optional] + public ?bool $includeImages; + + /** + * Preserve hyperlinks in the Markdown output. + */ + #[Optional] + public ?bool $includeLinks; + + /** + * CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before each crawled page is converted to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * + * @var list|null $includeSelectors + */ + #[Optional(list: 'string')] + public ?array $includeSelectors; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional] + public ?int $maxDepth; + + /** + * Maximum number of pages to crawl. Hard cap: 500. + */ + #[Optional] + public ?int $maxPages; + + /** + * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Truncate base64-encoded image data in the Markdown output. + */ + #[Optional] + public ?bool $shortenBase64Images; + + /** + * Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + */ + #[Optional] + public ?int $stopAfterMs; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * Regex pattern. Only URLs matching this pattern will be followed and scraped. + */ + #[Optional] + public ?string $urlRegex; + + /** + * Extract only the main content, stripping headers, footers, sidebars, and navigation. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + */ + #[Optional] + public ?int $waitForMs; + + /** + * `new WebWebCrawlMdParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebCrawlMdParams::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebCrawlMdParams)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $excludeSelectors + * @param list|null $includeSelectors + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + string $url, + ?array $excludeSelectors = null, + ?bool $followSubdomains = null, + ?bool $includeFrames = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, + ?array $includeSelectors = null, + ?int $maxAgeMs = null, + ?int $maxDepth = null, + ?int $maxPages = null, + Pdf|array|null $pdf = null, + ?bool $shortenBase64Images = null, + ?int $stopAfterMs = null, + ?int $timeoutMs = null, + ?string $urlRegex = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $includeFrames && $self['includeFrames'] = $includeFrames; + null !== $includeImages && $self['includeImages'] = $includeImages; + null !== $includeLinks && $self['includeLinks'] = $includeLinks; + null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $pdf && $self['pdf'] = $pdf; + null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $urlRegex && $self['urlRegex'] = $urlRegex; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * The starting URL for the crawl (must include http:// or https:// protocol). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * + * @param list $excludeSelectors + */ + public function withExcludeSelectors(array $excludeSelectors): self + { + $self = clone $this; + $self['excludeSelectors'] = $excludeSelectors; + + return $self; + } + + /** + * When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. + */ + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * When true, the contents of iframes are rendered to Markdown for each crawled page. + */ + public function withIncludeFrames(bool $includeFrames): self + { + $self = clone $this; + $self['includeFrames'] = $includeFrames; + + return $self; + } + + /** + * Include image references in the Markdown output. + */ + public function withIncludeImages(bool $includeImages): self + { + $self = clone $this; + $self['includeImages'] = $includeImages; + + return $self; + } + + /** + * Preserve hyperlinks in the Markdown output. + */ + public function withIncludeLinks(bool $includeLinks): self + { + $self = clone $this; + $self['includeLinks'] = $includeLinks; + + return $self; + } + + /** + * CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before each crawled page is converted to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * + * @param list $includeSelectors + */ + public function withIncludeSelectors(array $includeSelectors): self + { + $self = clone $this; + $self['includeSelectors'] = $includeSelectors; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to crawl. Hard cap: 500. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Truncate base64-encoded image data in the Markdown output. + */ + public function withShortenBase64Images(bool $shortenBase64Images): self + { + $self = clone $this; + $self['shortenBase64Images'] = $shortenBase64Images; + + return $self; + } + + /** + * Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + */ + public function withStopAfterMs(int $stopAfterMs): self + { + $self = clone $this; + $self['stopAfterMs'] = $stopAfterMs; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Regex pattern. Only URLs matching this pattern will be followed and scraped. + */ + public function withURLRegex(string $urlRegex): self + { + $self = clone $this; + $self['urlRegex'] = $urlRegex; + + return $self; + } + + /** + * Extract only the main content, stripping headers, footers, sidebars, and navigation. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdParams/Pdf.php b/src/Web/WebWebCrawlMdParams/Pdf.php new file mode 100644 index 00000000..b006142b --- /dev/null +++ b/src/Web/WebWebCrawlMdParams/Pdf.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, PDF pages are fetched and parsed. When false, PDF pages are skipped entirely (not included in results and not counted as failures). + */ + #[Optional] + public ?bool $shouldParse; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?int $end = null, + ?bool $shouldParse = null, + ?int $start = null + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, PDF pages are fetched and parsed. When false, PDF pages are skipped entirely (not included in results and not counted as failures). + */ + public function withShouldParse(bool $shouldParse): self + { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse.php b/src/Web/WebWebCrawlMdResponse.php new file mode 100644 index 00000000..920f873e --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse.php @@ -0,0 +1,121 @@ +, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebWebCrawlMdResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public Metadata $metadata; + + /** @var list $results */ + #[Required(list: Result::class)] + public array $results; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebWebCrawlMdResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebCrawlMdResponse::with(metadata: ..., results: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebCrawlMdResponse)->withMetadata(...)->withResults(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Metadata|MetadataShape $metadata + * @param list $results + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Metadata|array $metadata, + array $results, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['metadata'] = $metadata; + $self['results'] = $results; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * @param list $results + */ + public function withResults(array $results): self + { + $self = clone $this; + $self['results'] = $results; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/KeyMetadata.php b/src/Web/WebWebCrawlMdResponse/KeyMetadata.php new file mode 100644 index 00000000..4b467618 --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/Metadata.php b/src/Web/WebWebCrawlMdResponse/Metadata.php new file mode 100644 index 00000000..ccba6deb --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Metadata.php @@ -0,0 +1,162 @@ + */ + use SdkModel; + + /** + * Maximum crawl depth reached during the crawl. + */ + #[Required] + public int $maxCrawlDepth; + + /** + * Number of pages that failed to crawl. + */ + #[Required] + public int $numFailed; + + /** + * Number of URLs skipped (PDFs when pdf.shouldParse=false, or URLs not matching urlRegex). + */ + #[Required] + public int $numSkipped; + + /** + * Number of pages successfully crawled. + */ + #[Required] + public int $numSucceeded; + + /** + * Total number of URLs crawled. + */ + #[Required('numUrls')] + public int $numURLs; + + /** + * `new Metadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metadata::with( + * maxCrawlDepth: ..., + * numFailed: ..., + * numSkipped: ..., + * numSucceeded: ..., + * numURLs: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metadata) + * ->withMaxCrawlDepth(...) + * ->withNumFailed(...) + * ->withNumSkipped(...) + * ->withNumSucceeded(...) + * ->withNumURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $maxCrawlDepth, + int $numFailed, + int $numSkipped, + int $numSucceeded, + int $numURLs, + ): self { + $self = new self; + + $self['maxCrawlDepth'] = $maxCrawlDepth; + $self['numFailed'] = $numFailed; + $self['numSkipped'] = $numSkipped; + $self['numSucceeded'] = $numSucceeded; + $self['numURLs'] = $numURLs; + + return $self; + } + + /** + * Maximum crawl depth reached during the crawl. + */ + public function withMaxCrawlDepth(int $maxCrawlDepth): self + { + $self = clone $this; + $self['maxCrawlDepth'] = $maxCrawlDepth; + + return $self; + } + + /** + * Number of pages that failed to crawl. + */ + public function withNumFailed(int $numFailed): self + { + $self = clone $this; + $self['numFailed'] = $numFailed; + + return $self; + } + + /** + * Number of URLs skipped (PDFs when pdf.shouldParse=false, or URLs not matching urlRegex). + */ + public function withNumSkipped(int $numSkipped): self + { + $self = clone $this; + $self['numSkipped'] = $numSkipped; + + return $self; + } + + /** + * Number of pages successfully crawled. + */ + public function withNumSucceeded(int $numSucceeded): self + { + $self = clone $this; + $self['numSucceeded'] = $numSucceeded; + + return $self; + } + + /** + * Total number of URLs crawled. + */ + public function withNumURLs(int $numURLs): self + { + $self = clone $this; + $self['numURLs'] = $numURLs; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/Result.php b/src/Web/WebWebCrawlMdResponse/Result.php new file mode 100644 index 00000000..1e2f100c --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Result.php @@ -0,0 +1,94 @@ + */ + use SdkModel; + + /** + * Extracted page content as Markdown (empty string on failure). + */ + #[Required] + public string $markdown; + + #[Required] + public Metadata $metadata; + + /** + * `new Result()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Result::with(markdown: ..., metadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Result)->withMarkdown(...)->withMetadata(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Metadata|MetadataShape $metadata + */ + public static function with( + string $markdown, + Metadata|array $metadata, + ): self { + $self = new self; + + $self['markdown'] = $markdown; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * Extracted page content as Markdown (empty string on failure). + */ + public function withMarkdown(string $markdown): self + { + $self = clone $this; + $self['markdown'] = $markdown; + + return $self; + } + + /** + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata( + Metadata|array $metadata + ): self { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/Result/Metadata.php b/src/Web/WebWebCrawlMdResponse/Result/Metadata.php new file mode 100644 index 00000000..6da696ce --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Result/Metadata.php @@ -0,0 +1,572 @@ +|null, + * alternates?: list|null, + * author?: string|null, + * canonicalURL?: string|null, + * description?: string|null, + * favicon?: string|null, + * image?: string|null, + * jsonLd?: list>|null, + * keywords?: list|null, + * language?: string|null, + * modifiedTime?: string|null, + * openGraph?: array|null, + * publishedTime?: string|null, + * robots?: string|null, + * siteName?: string|null, + * twitter?: array|null, + * } + */ +final class Metadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Depth relative to the start URL. 0 = start URL, 1 = one link away. + */ + #[Required] + public int $crawlDepth; + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + #[Required('finalUrl')] + public string $finalURL; + + /** + * Original URL requested by the caller. + */ + #[Required('sourceUrl')] + public string $sourceURL; + + /** + * HTTP status code of the response. + */ + #[Required] + public int $statusCode; + + /** + * true if the page was fetched and parsed successfully. + */ + #[Required] + public bool $success; + + /** + * Best page title extracted from the page (empty string if unavailable). + */ + #[Required] + public string $title; + + /** + * The crawl URL fetched for this page. + */ + #[Required] + public string $url; + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @var array|null $additionalMeta + */ + #[Optional(map: AdditionalMeta::class)] + public ?array $additionalMeta; + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @var list|null $alternates + */ + #[Optional(list: Alternate::class)] + public ?array $alternates; + + /** + * Author metadata, when present. + */ + #[Optional] + public ?string $author; + + /** + * Resolved canonical URL, when present. + */ + #[Optional('canonicalUrl')] + public ?string $canonicalURL; + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + #[Optional] + public ?string $description; + + /** + * Resolved favicon URL, when present. + */ + #[Optional] + public ?string $favicon; + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + #[Optional] + public ?string $image; + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @var list>|null $jsonLd + */ + #[Optional(list: new MapOf('mixed'))] + public ?array $jsonLd; + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @var list|null $keywords + */ + #[Optional(list: 'string')] + public ?array $keywords; + + /** + * Language extracted from html lang or language meta tags. + */ + #[Optional] + public ?string $language; + + /** + * Modified timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $modifiedTime; + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @var array|null $openGraph + */ + #[Optional(map: OpenGraph::class)] + public ?array $openGraph; + + /** + * Published timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $publishedTime; + + /** + * Robots meta directive, when present. + */ + #[Optional] + public ?string $robots; + + /** + * Site or application name from page metadata. + */ + #[Optional] + public ?string $siteName; + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @var array|null $twitter + */ + #[Optional(map: Twitter::class)] + public ?array $twitter; + + /** + * `new Metadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metadata::with( + * crawlDepth: ..., + * finalURL: ..., + * sourceURL: ..., + * statusCode: ..., + * success: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metadata) + * ->withCrawlDepth(...) + * ->withFinalURL(...) + * ->withSourceURL(...) + * ->withStatusCode(...) + * ->withSuccess(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $additionalMeta + * @param list|null $alternates + * @param list>|null $jsonLd + * @param list|null $keywords + * @param array|null $openGraph + * @param array|null $twitter + */ + public static function with( + int $crawlDepth, + string $finalURL, + string $sourceURL, + int $statusCode, + bool $success, + string $title, + string $url, + ?array $additionalMeta = null, + ?array $alternates = null, + ?string $author = null, + ?string $canonicalURL = null, + ?string $description = null, + ?string $favicon = null, + ?string $image = null, + ?array $jsonLd = null, + ?array $keywords = null, + ?string $language = null, + ?string $modifiedTime = null, + ?array $openGraph = null, + ?string $publishedTime = null, + ?string $robots = null, + ?string $siteName = null, + ?array $twitter = null, + ): self { + $self = new self; + + $self['crawlDepth'] = $crawlDepth; + $self['finalURL'] = $finalURL; + $self['sourceURL'] = $sourceURL; + $self['statusCode'] = $statusCode; + $self['success'] = $success; + $self['title'] = $title; + $self['url'] = $url; + + null !== $additionalMeta && $self['additionalMeta'] = $additionalMeta; + null !== $alternates && $self['alternates'] = $alternates; + null !== $author && $self['author'] = $author; + null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; + null !== $description && $self['description'] = $description; + null !== $favicon && $self['favicon'] = $favicon; + null !== $image && $self['image'] = $image; + null !== $jsonLd && $self['jsonLd'] = $jsonLd; + null !== $keywords && $self['keywords'] = $keywords; + null !== $language && $self['language'] = $language; + null !== $modifiedTime && $self['modifiedTime'] = $modifiedTime; + null !== $openGraph && $self['openGraph'] = $openGraph; + null !== $publishedTime && $self['publishedTime'] = $publishedTime; + null !== $robots && $self['robots'] = $robots; + null !== $siteName && $self['siteName'] = $siteName; + null !== $twitter && $self['twitter'] = $twitter; + + return $self; + } + + /** + * Depth relative to the start URL. 0 = start URL, 1 = one link away. + */ + public function withCrawlDepth(int $crawlDepth): self + { + $self = clone $this; + $self['crawlDepth'] = $crawlDepth; + + return $self; + } + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + public function withFinalURL(string $finalURL): self + { + $self = clone $this; + $self['finalURL'] = $finalURL; + + return $self; + } + + /** + * Original URL requested by the caller. + */ + public function withSourceURL(string $sourceURL): self + { + $self = clone $this; + $self['sourceURL'] = $sourceURL; + + return $self; + } + + /** + * HTTP status code of the response. + */ + public function withStatusCode(int $statusCode): self + { + $self = clone $this; + $self['statusCode'] = $statusCode; + + return $self; + } + + /** + * true if the page was fetched and parsed successfully. + */ + public function withSuccess(bool $success): self + { + $self = clone $this; + $self['success'] = $success; + + return $self; + } + + /** + * Best page title extracted from the page (empty string if unavailable). + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * The crawl URL fetched for this page. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @param array $additionalMeta + */ + public function withAdditionalMeta(array $additionalMeta): self + { + $self = clone $this; + $self['additionalMeta'] = $additionalMeta; + + return $self; + } + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @param list $alternates + */ + public function withAlternates(array $alternates): self + { + $self = clone $this; + $self['alternates'] = $alternates; + + return $self; + } + + /** + * Author metadata, when present. + */ + public function withAuthor(string $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * Resolved canonical URL, when present. + */ + public function withCanonicalURL(string $canonicalURL): self + { + $self = clone $this; + $self['canonicalURL'] = $canonicalURL; + + return $self; + } + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * Resolved favicon URL, when present. + */ + public function withFavicon(string $favicon): self + { + $self = clone $this; + $self['favicon'] = $favicon; + + return $self; + } + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + public function withImage(string $image): self + { + $self = clone $this; + $self['image'] = $image; + + return $self; + } + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @param list> $jsonLd + */ + public function withJsonLd(array $jsonLd): self + { + $self = clone $this; + $self['jsonLd'] = $jsonLd; + + return $self; + } + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @param list $keywords + */ + public function withKeywords(array $keywords): self + { + $self = clone $this; + $self['keywords'] = $keywords; + + return $self; + } + + /** + * Language extracted from html lang or language meta tags. + */ + public function withLanguage(string $language): self + { + $self = clone $this; + $self['language'] = $language; + + return $self; + } + + /** + * Modified timestamp/date from page metadata, when present. + */ + public function withModifiedTime(string $modifiedTime): self + { + $self = clone $this; + $self['modifiedTime'] = $modifiedTime; + + return $self; + } + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @param array $openGraph + */ + public function withOpenGraph(array $openGraph): self + { + $self = clone $this; + $self['openGraph'] = $openGraph; + + return $self; + } + + /** + * Published timestamp/date from page metadata, when present. + */ + public function withPublishedTime(string $publishedTime): self + { + $self = clone $this; + $self['publishedTime'] = $publishedTime; + + return $self; + } + + /** + * Robots meta directive, when present. + */ + public function withRobots(string $robots): self + { + $self = clone $this; + $self['robots'] = $robots; + + return $self; + } + + /** + * Site or application name from page metadata. + */ + public function withSiteName(string $siteName): self + { + $self = clone $this; + $self['siteName'] = $siteName; + + return $self; + } + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @param array $twitter + */ + public function withTwitter(array $twitter): self + { + $self = clone $this; + $self['twitter'] = $twitter; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/Result/Metadata/AdditionalMeta.php b/src/Web/WebWebCrawlMdResponse/Result/Metadata/AdditionalMeta.php new file mode 100644 index 00000000..043a89ec --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Result/Metadata/AdditionalMeta.php @@ -0,0 +1,27 @@ + + * @phpstan-type AdditionalMetaShape = AdditionalMetaVariants + */ +final class AdditionalMeta implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/Result/Metadata/Alternate.php b/src/Web/WebWebCrawlMdResponse/Result/Metadata/Alternate.php new file mode 100644 index 00000000..36879260 --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Result/Metadata/Alternate.php @@ -0,0 +1,130 @@ + */ + use SdkModel; + + /** + * Resolved alternate URL. + */ + #[Required] + public string $href; + + /** + * Language or locale for the alternate URL, when present. + */ + #[Optional] + public ?string $hreflang; + + /** + * Alternate resource title, when present. + */ + #[Optional] + public ?string $title; + + /** + * Alternate resource MIME type, when present. + */ + #[Optional] + public ?string $type; + + /** + * `new Alternate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Alternate::with(href: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Alternate)->withHref(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $href, + ?string $hreflang = null, + ?string $title = null, + ?string $type = null, + ): self { + $self = new self; + + $self['href'] = $href; + + null !== $hreflang && $self['hreflang'] = $hreflang; + null !== $title && $self['title'] = $title; + null !== $type && $self['type'] = $type; + + return $self; + } + + /** + * Resolved alternate URL. + */ + public function withHref(string $href): self + { + $self = clone $this; + $self['href'] = $href; + + return $self; + } + + /** + * Language or locale for the alternate URL, when present. + */ + public function withHreflang(string $hreflang): self + { + $self = clone $this; + $self['hreflang'] = $hreflang; + + return $self; + } + + /** + * Alternate resource title, when present. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Alternate resource MIME type, when present. + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/Result/Metadata/OpenGraph.php b/src/Web/WebWebCrawlMdResponse/Result/Metadata/OpenGraph.php new file mode 100644 index 00000000..b6a240b1 --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Result/Metadata/OpenGraph.php @@ -0,0 +1,27 @@ + + * @phpstan-type OpenGraphShape = OpenGraphVariants + */ +final class OpenGraph implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/Result/Metadata/Twitter.php b/src/Web/WebWebCrawlMdResponse/Result/Metadata/Twitter.php new file mode 100644 index 00000000..f8966538 --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Result/Metadata/Twitter.php @@ -0,0 +1,27 @@ + + * @phpstan-type TwitterShape = TwitterVariants + */ +final class Twitter implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php new file mode 100644 index 00000000..cbe8261f --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -0,0 +1,281 @@ +|null, + * headers?: array|null, + * includeFrames?: bool|null, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, + * pdf?: null|Pdf|PdfShape, + * timeoutMs?: int|null, + * useMainContentOnly?: bool|null, + * waitForMs?: int|null, + * } + */ +final class WebWebScrapeHTMLParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Full URL to scrape (must include http:// or https:// protocol). + */ + #[Required] + public string $url; + + /** + * CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * + * @var list|null $excludeSelectors + */ + #[Optional(list: 'string')] + public ?array $excludeSelectors; + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * When true, iframes are rendered inline into the returned HTML. + */ + #[Optional] + public ?bool $includeFrames; + + /** + * CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * + * @var list|null $includeSelectors + */ + #[Optional(list: 'string')] + public ?array $includeSelectors; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + */ + #[Optional] + public ?int $waitForMs; + + /** + * `new WebWebScrapeHTMLParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeHTMLParams::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeHTMLParams)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $excludeSelectors + * @param array|null $headers + * @param list|null $includeSelectors + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + string $url, + ?array $excludeSelectors = null, + ?array $headers = null, + ?bool $includeFrames = null, + ?array $includeSelectors = null, + ?int $maxAgeMs = null, + Pdf|array|null $pdf = null, + ?int $timeoutMs = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $headers && $self['headers'] = $headers; + null !== $includeFrames && $self['includeFrames'] = $includeFrames; + null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $pdf && $self['pdf'] = $pdf; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Full URL to scrape (must include http:// or https:// protocol). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * + * @param list $excludeSelectors + */ + public function withExcludeSelectors(array $excludeSelectors): self + { + $self = clone $this; + $self['excludeSelectors'] = $excludeSelectors; + + return $self; + } + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * When true, iframes are rendered inline into the returned HTML. + */ + public function withIncludeFrames(bool $includeFrames): self + { + $self = clone $this; + $self['includeFrames'] = $includeFrames; + + return $self; + } + + /** + * CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * + * @param list $includeSelectors + */ + public function withIncludeSelectors(array $includeSelectors): self + { + $self = clone $this; + $self['includeSelectors'] = $includeSelectors; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf.php b/src/Web/WebWebScrapeHTMLParams/Pdf.php new file mode 100644 index 00000000..0dea8254 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Pdf.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + */ + #[Optional] + public ?bool $shouldParse; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?int $end = null, + ?bool $shouldParse = null, + ?int $start = null + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + */ + public function withShouldParse(bool $shouldParse): self + { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse.php b/src/Web/WebWebScrapeHTMLResponse.php new file mode 100644 index 00000000..cb950aae --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse.php @@ -0,0 +1,198 @@ +, + * url: string, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebWebScrapeHTMLResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * The scraped content of the page. For normal pages this is the raw HTML. When the page is a sitemap or feed served behind an XSL stylesheet (which browsers render into HTML), this is the underlying XML instead — see the `type` field. + */ + #[Required] + public string $html; + + /** + * Metadata extracted from the scraped page HTML. + */ + #[Required] + public Metadata $metadata; + + /** + * Indicates success. + */ + #[Required] + public bool $success; + + /** + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * The URL that was scraped. + */ + #[Required] + public string $url; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebWebScrapeHTMLResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeHTMLResponse::with( + * html: ..., metadata: ..., success: ..., type: ..., url: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeHTMLResponse) + * ->withHTML(...) + * ->withMetadata(...) + * ->withSuccess(...) + * ->withType(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Metadata|MetadataShape $metadata + * @param Type|value-of $type + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + string $html, + Metadata|array $metadata, + bool $success, + Type|string $type, + string $url, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['html'] = $html; + $self['metadata'] = $metadata; + $self['success'] = $success; + $self['type'] = $type; + $self['url'] = $url; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * The scraped content of the page. For normal pages this is the raw HTML. When the page is a sitemap or feed served behind an XSL stylesheet (which browsers render into HTML), this is the underlying XML instead — see the `type` field. + */ + public function withHTML(string $html): self + { + $self = clone $this; + $self['html'] = $html; + + return $self; + } + + /** + * Metadata extracted from the scraped page HTML. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * Indicates success. + */ + public function withSuccess(bool $success): self + { + $self = clone $this; + $self['success'] = $success; + + return $self; + } + + /** + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * The URL that was scraped. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/KeyMetadata.php b/src/Web/WebWebScrapeHTMLResponse/KeyMetadata.php new file mode 100644 index 00000000..f6af0702 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/Metadata.php b/src/Web/WebWebScrapeHTMLResponse/Metadata.php new file mode 100644 index 00000000..23b827a3 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/Metadata.php @@ -0,0 +1,479 @@ +|null, + * alternates?: list|null, + * author?: string|null, + * canonicalURL?: string|null, + * description?: string|null, + * favicon?: string|null, + * image?: string|null, + * jsonLd?: list>|null, + * keywords?: list|null, + * language?: string|null, + * modifiedTime?: string|null, + * openGraph?: array|null, + * publishedTime?: string|null, + * robots?: string|null, + * siteName?: string|null, + * title?: string|null, + * twitter?: array|null, + * } + */ +final class Metadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + #[Required('finalUrl')] + public string $finalURL; + + /** + * Original URL requested by the caller. + */ + #[Required('sourceUrl')] + public string $sourceURL; + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @var array|null $additionalMeta + */ + #[Optional(map: AdditionalMeta::class)] + public ?array $additionalMeta; + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @var list|null $alternates + */ + #[Optional(list: Alternate::class)] + public ?array $alternates; + + /** + * Author metadata, when present. + */ + #[Optional] + public ?string $author; + + /** + * Resolved canonical URL, when present. + */ + #[Optional('canonicalUrl')] + public ?string $canonicalURL; + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + #[Optional] + public ?string $description; + + /** + * Resolved favicon URL, when present. + */ + #[Optional] + public ?string $favicon; + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + #[Optional] + public ?string $image; + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @var list>|null $jsonLd + */ + #[Optional(list: new MapOf('mixed'))] + public ?array $jsonLd; + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @var list|null $keywords + */ + #[Optional(list: 'string')] + public ?array $keywords; + + /** + * Language extracted from html lang or language meta tags. + */ + #[Optional] + public ?string $language; + + /** + * Modified timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $modifiedTime; + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @var array|null $openGraph + */ + #[Optional(map: OpenGraph::class)] + public ?array $openGraph; + + /** + * Published timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $publishedTime; + + /** + * Robots meta directive, when present. + */ + #[Optional] + public ?string $robots; + + /** + * Site or application name from page metadata. + */ + #[Optional] + public ?string $siteName; + + /** + * Best title extracted from the page. + */ + #[Optional] + public ?string $title; + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @var array|null $twitter + */ + #[Optional(map: Twitter::class)] + public ?array $twitter; + + /** + * `new Metadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metadata::with(finalURL: ..., sourceURL: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metadata)->withFinalURL(...)->withSourceURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $additionalMeta + * @param list|null $alternates + * @param list>|null $jsonLd + * @param list|null $keywords + * @param array|null $openGraph + * @param array|null $twitter + */ + public static function with( + string $finalURL, + string $sourceURL, + ?array $additionalMeta = null, + ?array $alternates = null, + ?string $author = null, + ?string $canonicalURL = null, + ?string $description = null, + ?string $favicon = null, + ?string $image = null, + ?array $jsonLd = null, + ?array $keywords = null, + ?string $language = null, + ?string $modifiedTime = null, + ?array $openGraph = null, + ?string $publishedTime = null, + ?string $robots = null, + ?string $siteName = null, + ?string $title = null, + ?array $twitter = null, + ): self { + $self = new self; + + $self['finalURL'] = $finalURL; + $self['sourceURL'] = $sourceURL; + + null !== $additionalMeta && $self['additionalMeta'] = $additionalMeta; + null !== $alternates && $self['alternates'] = $alternates; + null !== $author && $self['author'] = $author; + null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; + null !== $description && $self['description'] = $description; + null !== $favicon && $self['favicon'] = $favicon; + null !== $image && $self['image'] = $image; + null !== $jsonLd && $self['jsonLd'] = $jsonLd; + null !== $keywords && $self['keywords'] = $keywords; + null !== $language && $self['language'] = $language; + null !== $modifiedTime && $self['modifiedTime'] = $modifiedTime; + null !== $openGraph && $self['openGraph'] = $openGraph; + null !== $publishedTime && $self['publishedTime'] = $publishedTime; + null !== $robots && $self['robots'] = $robots; + null !== $siteName && $self['siteName'] = $siteName; + null !== $title && $self['title'] = $title; + null !== $twitter && $self['twitter'] = $twitter; + + return $self; + } + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + public function withFinalURL(string $finalURL): self + { + $self = clone $this; + $self['finalURL'] = $finalURL; + + return $self; + } + + /** + * Original URL requested by the caller. + */ + public function withSourceURL(string $sourceURL): self + { + $self = clone $this; + $self['sourceURL'] = $sourceURL; + + return $self; + } + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @param array $additionalMeta + */ + public function withAdditionalMeta(array $additionalMeta): self + { + $self = clone $this; + $self['additionalMeta'] = $additionalMeta; + + return $self; + } + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @param list $alternates + */ + public function withAlternates(array $alternates): self + { + $self = clone $this; + $self['alternates'] = $alternates; + + return $self; + } + + /** + * Author metadata, when present. + */ + public function withAuthor(string $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * Resolved canonical URL, when present. + */ + public function withCanonicalURL(string $canonicalURL): self + { + $self = clone $this; + $self['canonicalURL'] = $canonicalURL; + + return $self; + } + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * Resolved favicon URL, when present. + */ + public function withFavicon(string $favicon): self + { + $self = clone $this; + $self['favicon'] = $favicon; + + return $self; + } + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + public function withImage(string $image): self + { + $self = clone $this; + $self['image'] = $image; + + return $self; + } + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @param list> $jsonLd + */ + public function withJsonLd(array $jsonLd): self + { + $self = clone $this; + $self['jsonLd'] = $jsonLd; + + return $self; + } + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @param list $keywords + */ + public function withKeywords(array $keywords): self + { + $self = clone $this; + $self['keywords'] = $keywords; + + return $self; + } + + /** + * Language extracted from html lang or language meta tags. + */ + public function withLanguage(string $language): self + { + $self = clone $this; + $self['language'] = $language; + + return $self; + } + + /** + * Modified timestamp/date from page metadata, when present. + */ + public function withModifiedTime(string $modifiedTime): self + { + $self = clone $this; + $self['modifiedTime'] = $modifiedTime; + + return $self; + } + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @param array $openGraph + */ + public function withOpenGraph(array $openGraph): self + { + $self = clone $this; + $self['openGraph'] = $openGraph; + + return $self; + } + + /** + * Published timestamp/date from page metadata, when present. + */ + public function withPublishedTime(string $publishedTime): self + { + $self = clone $this; + $self['publishedTime'] = $publishedTime; + + return $self; + } + + /** + * Robots meta directive, when present. + */ + public function withRobots(string $robots): self + { + $self = clone $this; + $self['robots'] = $robots; + + return $self; + } + + /** + * Site or application name from page metadata. + */ + public function withSiteName(string $siteName): self + { + $self = clone $this; + $self['siteName'] = $siteName; + + return $self; + } + + /** + * Best title extracted from the page. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @param array $twitter + */ + public function withTwitter(array $twitter): self + { + $self = clone $this; + $self['twitter'] = $twitter; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/Metadata/AdditionalMeta.php b/src/Web/WebWebScrapeHTMLResponse/Metadata/AdditionalMeta.php new file mode 100644 index 00000000..ed4b08c7 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/Metadata/AdditionalMeta.php @@ -0,0 +1,27 @@ + + * @phpstan-type AdditionalMetaShape = AdditionalMetaVariants + */ +final class AdditionalMeta implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/Metadata/Alternate.php b/src/Web/WebWebScrapeHTMLResponse/Metadata/Alternate.php new file mode 100644 index 00000000..045b52fc --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/Metadata/Alternate.php @@ -0,0 +1,130 @@ + */ + use SdkModel; + + /** + * Resolved alternate URL. + */ + #[Required] + public string $href; + + /** + * Language or locale for the alternate URL, when present. + */ + #[Optional] + public ?string $hreflang; + + /** + * Alternate resource title, when present. + */ + #[Optional] + public ?string $title; + + /** + * Alternate resource MIME type, when present. + */ + #[Optional] + public ?string $type; + + /** + * `new Alternate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Alternate::with(href: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Alternate)->withHref(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $href, + ?string $hreflang = null, + ?string $title = null, + ?string $type = null, + ): self { + $self = new self; + + $self['href'] = $href; + + null !== $hreflang && $self['hreflang'] = $hreflang; + null !== $title && $self['title'] = $title; + null !== $type && $self['type'] = $type; + + return $self; + } + + /** + * Resolved alternate URL. + */ + public function withHref(string $href): self + { + $self = clone $this; + $self['href'] = $href; + + return $self; + } + + /** + * Language or locale for the alternate URL, when present. + */ + public function withHreflang(string $hreflang): self + { + $self = clone $this; + $self['hreflang'] = $hreflang; + + return $self; + } + + /** + * Alternate resource title, when present. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Alternate resource MIME type, when present. + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/Metadata/OpenGraph.php b/src/Web/WebWebScrapeHTMLResponse/Metadata/OpenGraph.php new file mode 100644 index 00000000..44656fc6 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/Metadata/OpenGraph.php @@ -0,0 +1,27 @@ + + * @phpstan-type OpenGraphShape = OpenGraphVariants + */ +final class OpenGraph implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/Metadata/Twitter.php b/src/Web/WebWebScrapeHTMLResponse/Metadata/Twitter.php new file mode 100644 index 00000000..fd6e2897 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/Metadata/Twitter.php @@ -0,0 +1,27 @@ + + * @phpstan-type TwitterShape = TwitterVariants + */ +final class Twitter implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/Type.php b/src/Web/WebWebScrapeHTMLResponse/Type.php new file mode 100644 index 00000000..fab93ab2 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/Type.php @@ -0,0 +1,31 @@ +|null, + * maxAgeMs?: int|null, + * timeoutMs?: int|null, + * waitForMs?: int|null, + * } + */ +final class WebWebScrapeImagesParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Page URL to inspect. Must include http:// or https://. + */ + #[Required] + public string $url; + + /** + * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. + */ + #[Optional] + public ?Enrichment $enrichment; + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). + */ + #[Optional] + public ?int $waitForMs; + + /** + * `new WebWebScrapeImagesParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeImagesParams::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeImagesParams)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Enrichment|EnrichmentShape|null $enrichment + * @param array|null $headers + */ + public static function with( + string $url, + Enrichment|array|null $enrichment = null, + ?array $headers = null, + ?int $maxAgeMs = null, + ?int $timeoutMs = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $enrichment && $self['enrichment'] = $enrichment; + null !== $headers && $self['headers'] = $headers; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Page URL to inspect. Must include http:// or https://. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. + * + * @param Enrichment|EnrichmentShape $enrichment + */ + public function withEnrichment(Enrichment|array $enrichment): self + { + $self = clone $this; + $self['enrichment'] = $enrichment; + + return $self; + } + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Enrichment.php b/src/Web/WebWebScrapeImagesParams/Enrichment.php new file mode 100644 index 00000000..e7efbaf9 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Enrichment.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Classify each image by visual asset type. + */ + #[Optional] + public ?bool $classification; + + /** + * Host materializable images on the Brand.dev CDN and return their URL and MIME type. + */ + #[Optional('hostedUrl')] + public ?bool $hostedURL; + + /** + * Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000. + */ + #[Optional] + public ?int $maxTimePerMs; + + /** + * Measure image width and height when possible. + */ + #[Optional] + public ?bool $resolution; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?bool $classification = null, + ?bool $hostedURL = null, + ?int $maxTimePerMs = null, + ?bool $resolution = null, + ): self { + $self = new self; + + null !== $classification && $self['classification'] = $classification; + null !== $hostedURL && $self['hostedURL'] = $hostedURL; + null !== $maxTimePerMs && $self['maxTimePerMs'] = $maxTimePerMs; + null !== $resolution && $self['resolution'] = $resolution; + + return $self; + } + + /** + * Classify each image by visual asset type. + */ + public function withClassification(bool $classification): self + { + $self = clone $this; + $self['classification'] = $classification; + + return $self; + } + + /** + * Host materializable images on the Brand.dev CDN and return their URL and MIME type. + */ + public function withHostedURL(bool $hostedURL): self + { + $self = clone $this; + $self['hostedURL'] = $hostedURL; + + return $self; + } + + /** + * Per-image enrichment timeout in milliseconds. Default: 30000. Maximum: 60000. + */ + public function withMaxTimePerMs(int $maxTimePerMs): self + { + $self = clone $this; + $self['maxTimePerMs'] = $maxTimePerMs; + + return $self; + } + + /** + * Measure image width and height when possible. + */ + public function withResolution(bool $resolution): self + { + $self = clone $this; + $self['resolution'] = $resolution; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesResponse.php b/src/Web/WebWebScrapeImagesResponse.php new file mode 100644 index 00000000..621014f9 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse.php @@ -0,0 +1,150 @@ +, + * success: bool, + * url: string, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebWebScrapeImagesResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Images found on the page. + * + * @var list $images + */ + #[Required(list: Image::class)] + public array $images; + + /** + * Always true on success. + */ + #[Required] + public bool $success; + + /** + * Page URL that was scraped. + */ + #[Required] + public string $url; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebWebScrapeImagesResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeImagesResponse::with(images: ..., success: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeImagesResponse) + * ->withImages(...) + * ->withSuccess(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $images + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + array $images, + bool $success, + string $url, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['images'] = $images; + $self['success'] = $success; + $self['url'] = $url; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Images found on the page. + * + * @param list $images + */ + public function withImages(array $images): self + { + $self = clone $this; + $self['images'] = $images; + + return $self; + } + + /** + * Always true on success. + */ + public function withSuccess(bool $success): self + { + $self = clone $this; + $self['success'] = $success; + + return $self; + } + + /** + * Page URL that was scraped. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesResponse/Image.php b/src/Web/WebWebScrapeImagesResponse/Image.php new file mode 100644 index 00000000..9bdc1edb --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/Image.php @@ -0,0 +1,172 @@ +, + * src: string, + * type: Type|value-of, + * enrichment?: null|Enrichment|EnrichmentShape, + * } + */ +final class Image implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Image alt text, or null when unavailable. + */ + #[Required] + public ?string $alt; + + /** + * Where the image was found. + * + * @var value-of $element + */ + #[Required(enum: Element::class)] + public string $element; + + /** + * Original image value: URL, inline SVG or HTML, or base64 data URI. + */ + #[Required] + public string $src; + + /** + * Format of src. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Requested metadata for images that could be processed. + */ + #[Optional] + public ?Enrichment $enrichment; + + /** + * `new Image()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Image::with(alt: ..., element: ..., src: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Image)->withAlt(...)->withElement(...)->withSrc(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Element|value-of $element + * @param Type|value-of $type + * @param Enrichment|EnrichmentShape|null $enrichment + */ + public static function with( + ?string $alt, + Element|string $element, + string $src, + Type|string $type, + Enrichment|array|null $enrichment = null, + ): self { + $self = new self; + + $self['alt'] = $alt; + $self['element'] = $element; + $self['src'] = $src; + $self['type'] = $type; + + null !== $enrichment && $self['enrichment'] = $enrichment; + + return $self; + } + + /** + * Image alt text, or null when unavailable. + */ + public function withAlt(?string $alt): self + { + $self = clone $this; + $self['alt'] = $alt; + + return $self; + } + + /** + * Where the image was found. + * + * @param Element|value-of $element + */ + public function withElement(Element|string $element): self + { + $self = clone $this; + $self['element'] = $element; + + return $self; + } + + /** + * Original image value: URL, inline SVG or HTML, or base64 data URI. + */ + public function withSrc(string $src): self + { + $self = clone $this; + $self['src'] = $src; + + return $self; + } + + /** + * Format of src. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Requested metadata for images that could be processed. + * + * @param Enrichment|EnrichmentShape $enrichment + */ + public function withEnrichment(Enrichment|array $enrichment): self + { + $self = clone $this; + $self['enrichment'] = $enrichment; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesResponse/Image/Element.php b/src/Web/WebWebScrapeImagesResponse/Image/Element.php new file mode 100644 index 00000000..246a28a5 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/Image/Element.php @@ -0,0 +1,29 @@ +, + * url?: string|null, + * width?: int|null, + * } + */ +final class Enrichment implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Image height in pixels, when measured. + */ + #[Optional] + public ?int $height; + + /** + * Detected MIME type, when hosted. + */ + #[Optional] + public ?string $mimetype; + + /** + * Visual asset category, when classified. + * + * @var value-of|null $type + */ + #[Optional( + enum: Type::class, + )] + public ?string $type; + + /** + * Brand.dev CDN URL, when hosted. + */ + #[Optional] + public ?string $url; + + /** + * Image width in pixels, when measured. + */ + #[Optional] + public ?int $width; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of|null $type + */ + public static function with( + ?int $height = null, + ?string $mimetype = null, + Type|string|null $type = null, + ?string $url = null, + ?int $width = null, + ): self { + $self = new self; + + null !== $height && $self['height'] = $height; + null !== $mimetype && $self['mimetype'] = $mimetype; + null !== $type && $self['type'] = $type; + null !== $url && $self['url'] = $url; + null !== $width && $self['width'] = $width; + + return $self; + } + + /** + * Image height in pixels, when measured. + */ + public function withHeight(int $height): self + { + $self = clone $this; + $self['height'] = $height; + + return $self; + } + + /** + * Detected MIME type, when hosted. + */ + public function withMimetype(string $mimetype): self + { + $self = clone $this; + $self['mimetype'] = $mimetype; + + return $self; + } + + /** + * Visual asset category, when classified. + * + * @param Type|value-of $type + */ + public function withType( + Type|string $type, + ): self { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Brand.dev CDN URL, when hosted. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Image width in pixels, when measured. + */ + public function withWidth(int $width): self + { + $self = clone $this; + $self['width'] = $width; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesResponse/Image/Enrichment/Type.php b/src/Web/WebWebScrapeImagesResponse/Image/Enrichment/Type.php new file mode 100644 index 00000000..1cefee46 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/Image/Enrichment/Type.php @@ -0,0 +1,27 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php new file mode 100644 index 00000000..1efb7005 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams.php @@ -0,0 +1,341 @@ +|null, + * headers?: array|null, + * includeFrames?: bool|null, + * includeImages?: bool|null, + * includeLinks?: bool|null, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, + * pdf?: null|Pdf|PdfShape, + * shortenBase64Images?: bool|null, + * timeoutMs?: int|null, + * useMainContentOnly?: bool|null, + * waitForMs?: int|null, + * } + */ +final class WebWebScrapeMdParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol). + */ + #[Required] + public string $url; + + /** + * CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * + * @var list|null $excludeSelectors + */ + #[Optional(list: 'string')] + public ?array $excludeSelectors; + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * When true, the contents of iframes are rendered to Markdown. + */ + #[Optional] + public ?bool $includeFrames; + + /** + * Include image references in Markdown output. + */ + #[Optional] + public ?bool $includeImages; + + /** + * Preserve hyperlinks in Markdown output. + */ + #[Optional] + public ?bool $includeLinks; + + /** + * CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * + * @var list|null $includeSelectors + */ + #[Optional(list: 'string')] + public ?array $includeSelectors; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional] + public ?int $maxAgeMs; + + /** + * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Shorten base64-encoded image data in the Markdown output. + */ + #[Optional] + public ?bool $shortenBase64Images; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * Extract only the main content of the page, excluding headers, footers, sidebars, and navigation. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + */ + #[Optional] + public ?int $waitForMs; + + /** + * `new WebWebScrapeMdParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeMdParams::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeMdParams)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $excludeSelectors + * @param array|null $headers + * @param list|null $includeSelectors + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + string $url, + ?array $excludeSelectors = null, + ?array $headers = null, + ?bool $includeFrames = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, + ?array $includeSelectors = null, + ?int $maxAgeMs = null, + Pdf|array|null $pdf = null, + ?bool $shortenBase64Images = null, + ?int $timeoutMs = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $headers && $self['headers'] = $headers; + null !== $includeFrames && $self['includeFrames'] = $includeFrames; + null !== $includeImages && $self['includeImages'] = $includeImages; + null !== $includeLinks && $self['includeLinks'] = $includeLinks; + null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $pdf && $self['pdf'] = $pdf; + null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol). + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * + * @param list $excludeSelectors + */ + public function withExcludeSelectors(array $excludeSelectors): self + { + $self = clone $this; + $self['excludeSelectors'] = $excludeSelectors; + + return $self; + } + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * When true, the contents of iframes are rendered to Markdown. + */ + public function withIncludeFrames(bool $includeFrames): self + { + $self = clone $this; + $self['includeFrames'] = $includeFrames; + + return $self; + } + + /** + * Include image references in Markdown output. + */ + public function withIncludeImages(bool $includeImages): self + { + $self = clone $this; + $self['includeImages'] = $includeImages; + + return $self; + } + + /** + * Preserve hyperlinks in Markdown output. + */ + public function withIncludeLinks(bool $includeLinks): self + { + $self = clone $this; + $self['includeLinks'] = $includeLinks; + + return $self; + } + + /** + * CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * + * @param list $includeSelectors + */ + public function withIncludeSelectors(array $includeSelectors): self + { + $self = clone $this; + $self['includeSelectors'] = $includeSelectors; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Shorten base64-encoded image data in the Markdown output. + */ + public function withShortenBase64Images(bool $shortenBase64Images): self + { + $self = clone $this; + $self['shortenBase64Images'] = $shortenBase64Images; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Extract only the main content of the page, excluding headers, footers, sidebars, and navigation. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdParams/Pdf.php b/src/Web/WebWebScrapeMdParams/Pdf.php new file mode 100644 index 00000000..7418bbe7 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Pdf.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + */ + #[Optional] + public ?bool $shouldParse; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?int $end = null, + ?bool $shouldParse = null, + ?int $start = null + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + */ + public function withShouldParse(bool $shouldParse): self + { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse.php b/src/Web/WebWebScrapeMdResponse.php new file mode 100644 index 00000000..89e65b9c --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse.php @@ -0,0 +1,171 @@ + */ + use SdkModel; + + /** + * Page content converted to GitHub Flavored Markdown. + */ + #[Required] + public string $markdown; + + /** + * Metadata extracted from the scraped page HTML. + */ + #[Required] + public Metadata $metadata; + + /** + * Indicates success. + */ + #[Required] + public bool $success; + + /** + * The URL that was scraped. + */ + #[Required] + public string $url; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebWebScrapeMdResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeMdResponse::with( + * markdown: ..., metadata: ..., success: ..., url: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeMdResponse) + * ->withMarkdown(...) + * ->withMetadata(...) + * ->withSuccess(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Metadata|MetadataShape $metadata + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + string $markdown, + Metadata|array $metadata, + bool $success, + string $url, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['markdown'] = $markdown; + $self['metadata'] = $metadata; + $self['success'] = $success; + $self['url'] = $url; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Page content converted to GitHub Flavored Markdown. + */ + public function withMarkdown(string $markdown): self + { + $self = clone $this; + $self['markdown'] = $markdown; + + return $self; + } + + /** + * Metadata extracted from the scraped page HTML. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * Indicates success. + */ + public function withSuccess(bool $success): self + { + $self = clone $this; + $self['success'] = $success; + + return $self; + } + + /** + * The URL that was scraped. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/KeyMetadata.php b/src/Web/WebWebScrapeMdResponse/KeyMetadata.php new file mode 100644 index 00000000..4d8b3e61 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/Metadata.php b/src/Web/WebWebScrapeMdResponse/Metadata.php new file mode 100644 index 00000000..b7e67b79 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/Metadata.php @@ -0,0 +1,479 @@ +|null, + * alternates?: list|null, + * author?: string|null, + * canonicalURL?: string|null, + * description?: string|null, + * favicon?: string|null, + * image?: string|null, + * jsonLd?: list>|null, + * keywords?: list|null, + * language?: string|null, + * modifiedTime?: string|null, + * openGraph?: array|null, + * publishedTime?: string|null, + * robots?: string|null, + * siteName?: string|null, + * title?: string|null, + * twitter?: array|null, + * } + */ +final class Metadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + #[Required('finalUrl')] + public string $finalURL; + + /** + * Original URL requested by the caller. + */ + #[Required('sourceUrl')] + public string $sourceURL; + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @var array|null $additionalMeta + */ + #[Optional(map: AdditionalMeta::class)] + public ?array $additionalMeta; + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @var list|null $alternates + */ + #[Optional(list: Alternate::class)] + public ?array $alternates; + + /** + * Author metadata, when present. + */ + #[Optional] + public ?string $author; + + /** + * Resolved canonical URL, when present. + */ + #[Optional('canonicalUrl')] + public ?string $canonicalURL; + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + #[Optional] + public ?string $description; + + /** + * Resolved favicon URL, when present. + */ + #[Optional] + public ?string $favicon; + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + #[Optional] + public ?string $image; + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @var list>|null $jsonLd + */ + #[Optional(list: new MapOf('mixed'))] + public ?array $jsonLd; + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @var list|null $keywords + */ + #[Optional(list: 'string')] + public ?array $keywords; + + /** + * Language extracted from html lang or language meta tags. + */ + #[Optional] + public ?string $language; + + /** + * Modified timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $modifiedTime; + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @var array|null $openGraph + */ + #[Optional(map: OpenGraph::class)] + public ?array $openGraph; + + /** + * Published timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $publishedTime; + + /** + * Robots meta directive, when present. + */ + #[Optional] + public ?string $robots; + + /** + * Site or application name from page metadata. + */ + #[Optional] + public ?string $siteName; + + /** + * Best title extracted from the page. + */ + #[Optional] + public ?string $title; + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @var array|null $twitter + */ + #[Optional(map: Twitter::class)] + public ?array $twitter; + + /** + * `new Metadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metadata::with(finalURL: ..., sourceURL: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metadata)->withFinalURL(...)->withSourceURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $additionalMeta + * @param list|null $alternates + * @param list>|null $jsonLd + * @param list|null $keywords + * @param array|null $openGraph + * @param array|null $twitter + */ + public static function with( + string $finalURL, + string $sourceURL, + ?array $additionalMeta = null, + ?array $alternates = null, + ?string $author = null, + ?string $canonicalURL = null, + ?string $description = null, + ?string $favicon = null, + ?string $image = null, + ?array $jsonLd = null, + ?array $keywords = null, + ?string $language = null, + ?string $modifiedTime = null, + ?array $openGraph = null, + ?string $publishedTime = null, + ?string $robots = null, + ?string $siteName = null, + ?string $title = null, + ?array $twitter = null, + ): self { + $self = new self; + + $self['finalURL'] = $finalURL; + $self['sourceURL'] = $sourceURL; + + null !== $additionalMeta && $self['additionalMeta'] = $additionalMeta; + null !== $alternates && $self['alternates'] = $alternates; + null !== $author && $self['author'] = $author; + null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; + null !== $description && $self['description'] = $description; + null !== $favicon && $self['favicon'] = $favicon; + null !== $image && $self['image'] = $image; + null !== $jsonLd && $self['jsonLd'] = $jsonLd; + null !== $keywords && $self['keywords'] = $keywords; + null !== $language && $self['language'] = $language; + null !== $modifiedTime && $self['modifiedTime'] = $modifiedTime; + null !== $openGraph && $self['openGraph'] = $openGraph; + null !== $publishedTime && $self['publishedTime'] = $publishedTime; + null !== $robots && $self['robots'] = $robots; + null !== $siteName && $self['siteName'] = $siteName; + null !== $title && $self['title'] = $title; + null !== $twitter && $self['twitter'] = $twitter; + + return $self; + } + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + public function withFinalURL(string $finalURL): self + { + $self = clone $this; + $self['finalURL'] = $finalURL; + + return $self; + } + + /** + * Original URL requested by the caller. + */ + public function withSourceURL(string $sourceURL): self + { + $self = clone $this; + $self['sourceURL'] = $sourceURL; + + return $self; + } + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @param array $additionalMeta + */ + public function withAdditionalMeta(array $additionalMeta): self + { + $self = clone $this; + $self['additionalMeta'] = $additionalMeta; + + return $self; + } + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @param list $alternates + */ + public function withAlternates(array $alternates): self + { + $self = clone $this; + $self['alternates'] = $alternates; + + return $self; + } + + /** + * Author metadata, when present. + */ + public function withAuthor(string $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * Resolved canonical URL, when present. + */ + public function withCanonicalURL(string $canonicalURL): self + { + $self = clone $this; + $self['canonicalURL'] = $canonicalURL; + + return $self; + } + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * Resolved favicon URL, when present. + */ + public function withFavicon(string $favicon): self + { + $self = clone $this; + $self['favicon'] = $favicon; + + return $self; + } + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + public function withImage(string $image): self + { + $self = clone $this; + $self['image'] = $image; + + return $self; + } + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @param list> $jsonLd + */ + public function withJsonLd(array $jsonLd): self + { + $self = clone $this; + $self['jsonLd'] = $jsonLd; + + return $self; + } + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @param list $keywords + */ + public function withKeywords(array $keywords): self + { + $self = clone $this; + $self['keywords'] = $keywords; + + return $self; + } + + /** + * Language extracted from html lang or language meta tags. + */ + public function withLanguage(string $language): self + { + $self = clone $this; + $self['language'] = $language; + + return $self; + } + + /** + * Modified timestamp/date from page metadata, when present. + */ + public function withModifiedTime(string $modifiedTime): self + { + $self = clone $this; + $self['modifiedTime'] = $modifiedTime; + + return $self; + } + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @param array $openGraph + */ + public function withOpenGraph(array $openGraph): self + { + $self = clone $this; + $self['openGraph'] = $openGraph; + + return $self; + } + + /** + * Published timestamp/date from page metadata, when present. + */ + public function withPublishedTime(string $publishedTime): self + { + $self = clone $this; + $self['publishedTime'] = $publishedTime; + + return $self; + } + + /** + * Robots meta directive, when present. + */ + public function withRobots(string $robots): self + { + $self = clone $this; + $self['robots'] = $robots; + + return $self; + } + + /** + * Site or application name from page metadata. + */ + public function withSiteName(string $siteName): self + { + $self = clone $this; + $self['siteName'] = $siteName; + + return $self; + } + + /** + * Best title extracted from the page. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @param array $twitter + */ + public function withTwitter(array $twitter): self + { + $self = clone $this; + $self['twitter'] = $twitter; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/Metadata/AdditionalMeta.php b/src/Web/WebWebScrapeMdResponse/Metadata/AdditionalMeta.php new file mode 100644 index 00000000..af403903 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/Metadata/AdditionalMeta.php @@ -0,0 +1,27 @@ + + * @phpstan-type AdditionalMetaShape = AdditionalMetaVariants + */ +final class AdditionalMeta implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/Metadata/Alternate.php b/src/Web/WebWebScrapeMdResponse/Metadata/Alternate.php new file mode 100644 index 00000000..6b715e21 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/Metadata/Alternate.php @@ -0,0 +1,130 @@ + */ + use SdkModel; + + /** + * Resolved alternate URL. + */ + #[Required] + public string $href; + + /** + * Language or locale for the alternate URL, when present. + */ + #[Optional] + public ?string $hreflang; + + /** + * Alternate resource title, when present. + */ + #[Optional] + public ?string $title; + + /** + * Alternate resource MIME type, when present. + */ + #[Optional] + public ?string $type; + + /** + * `new Alternate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Alternate::with(href: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Alternate)->withHref(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $href, + ?string $hreflang = null, + ?string $title = null, + ?string $type = null, + ): self { + $self = new self; + + $self['href'] = $href; + + null !== $hreflang && $self['hreflang'] = $hreflang; + null !== $title && $self['title'] = $title; + null !== $type && $self['type'] = $type; + + return $self; + } + + /** + * Resolved alternate URL. + */ + public function withHref(string $href): self + { + $self = clone $this; + $self['href'] = $href; + + return $self; + } + + /** + * Language or locale for the alternate URL, when present. + */ + public function withHreflang(string $hreflang): self + { + $self = clone $this; + $self['hreflang'] = $hreflang; + + return $self; + } + + /** + * Alternate resource title, when present. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Alternate resource MIME type, when present. + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/Metadata/OpenGraph.php b/src/Web/WebWebScrapeMdResponse/Metadata/OpenGraph.php new file mode 100644 index 00000000..f646d616 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/Metadata/OpenGraph.php @@ -0,0 +1,27 @@ + + * @phpstan-type OpenGraphShape = OpenGraphVariants + */ +final class OpenGraph implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/Metadata/Twitter.php b/src/Web/WebWebScrapeMdResponse/Metadata/Twitter.php new file mode 100644 index 00000000..50a64d29 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/Metadata/Twitter.php @@ -0,0 +1,27 @@ + + * @phpstan-type TwitterShape = TwitterVariants + */ +final class Twitter implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Web/WebWebScrapeSitemapParams.php b/src/Web/WebWebScrapeSitemapParams.php new file mode 100644 index 00000000..e1802872 --- /dev/null +++ b/src/Web/WebWebScrapeSitemapParams.php @@ -0,0 +1,165 @@ +|null, + * maxLinks?: int|null, + * timeoutMs?: int|null, + * urlRegex?: string|null, + * } + */ +final class WebWebScrapeSitemapParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Domain to build a sitemap for. + */ + #[Required] + public string $domain; + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @var array|null $headers + */ + #[Optional(map: 'string')] + public ?array $headers; + + /** + * Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + */ + #[Optional] + public ?int $maxLinks; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional] + public ?int $timeoutMs; + + /** + * Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. + */ + #[Optional] + public ?string $urlRegex; + + /** + * `new WebWebScrapeSitemapParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeSitemapParams::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeSitemapParams)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $headers + */ + public static function with( + string $domain, + ?array $headers = null, + ?int $maxLinks = null, + ?int $timeoutMs = null, + ?string $urlRegex = null, + ): self { + $self = new self; + + $self['domain'] = $domain; + + null !== $headers && $self['headers'] = $headers; + null !== $maxLinks && $self['maxLinks'] = $maxLinks; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $urlRegex && $self['urlRegex'] = $urlRegex; + + return $self; + } + + /** + * Domain to build a sitemap for. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. + * + * @param array $headers + */ + public function withHeaders(array $headers): self + { + $self = clone $this; + $self['headers'] = $headers; + + return $self; + } + + /** + * Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + */ + public function withMaxLinks(int $maxLinks): self + { + $self = clone $this; + $self['maxLinks'] = $maxLinks; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. + */ + public function withURLRegex(string $urlRegex): self + { + $self = clone $this; + $self['urlRegex'] = $urlRegex; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeSitemapResponse.php b/src/Web/WebWebScrapeSitemapResponse.php new file mode 100644 index 00000000..4d606f4b --- /dev/null +++ b/src/Web/WebWebScrapeSitemapResponse.php @@ -0,0 +1,176 @@ +, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class WebWebScrapeSitemapResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * The normalized domain that was crawled. + */ + #[Required] + public string $domain; + + /** + * Metadata about the sitemap crawl operation. + */ + #[Required] + public Meta $meta; + + /** + * Indicates success. + */ + #[Required] + public bool $success; + + /** + * Array of discovered page URLs from the sitemap (max 500). + * + * @var list $urls + */ + #[Required(list: 'string')] + public array $urls; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new WebWebScrapeSitemapResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebWebScrapeSitemapResponse::with( + * domain: ..., meta: ..., success: ..., urls: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebWebScrapeSitemapResponse) + * ->withDomain(...) + * ->withMeta(...) + * ->withSuccess(...) + * ->withURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Meta|MetaShape $meta + * @param list $urls + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + string $domain, + Meta|array $meta, + bool $success, + array $urls, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['domain'] = $domain; + $self['meta'] = $meta; + $self['success'] = $success; + $self['urls'] = $urls; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * The normalized domain that was crawled. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Metadata about the sitemap crawl operation. + * + * @param Meta|MetaShape $meta + */ + public function withMeta(Meta|array $meta): self + { + $self = clone $this; + $self['meta'] = $meta; + + return $self; + } + + /** + * Indicates success. + */ + public function withSuccess(bool $success): self + { + $self = clone $this; + $self['success'] = $success; + + return $self; + } + + /** + * Array of discovered page URLs from the sitemap (max 500). + * + * @param list $urls + */ + public function withURLs(array $urls): self + { + $self = clone $this; + $self['urls'] = $urls; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeSitemapResponse/KeyMetadata.php b/src/Web/WebWebScrapeSitemapResponse/KeyMetadata.php new file mode 100644 index 00000000..8e402492 --- /dev/null +++ b/src/Web/WebWebScrapeSitemapResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeSitemapResponse/Meta.php b/src/Web/WebWebScrapeSitemapResponse/Meta.php new file mode 100644 index 00000000..101d4078 --- /dev/null +++ b/src/Web/WebWebScrapeSitemapResponse/Meta.php @@ -0,0 +1,142 @@ + */ + use SdkModel; + + /** + * Number of errors encountered during crawling. + */ + #[Required] + public int $errors; + + /** + * Total number of sitemap files discovered. + */ + #[Required] + public int $sitemapsDiscovered; + + /** + * Number of sitemap files successfully fetched and parsed. + */ + #[Required] + public int $sitemapsFetched; + + /** + * Number of sitemap files skipped (due to errors, timeouts, or limits). + */ + #[Required] + public int $sitemapsSkipped; + + /** + * `new Meta()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Meta::with( + * errors: ..., + * sitemapsDiscovered: ..., + * sitemapsFetched: ..., + * sitemapsSkipped: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Meta) + * ->withErrors(...) + * ->withSitemapsDiscovered(...) + * ->withSitemapsFetched(...) + * ->withSitemapsSkipped(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $errors, + int $sitemapsDiscovered, + int $sitemapsFetched, + int $sitemapsSkipped, + ): self { + $self = new self; + + $self['errors'] = $errors; + $self['sitemapsDiscovered'] = $sitemapsDiscovered; + $self['sitemapsFetched'] = $sitemapsFetched; + $self['sitemapsSkipped'] = $sitemapsSkipped; + + return $self; + } + + /** + * Number of errors encountered during crawling. + */ + public function withErrors(int $errors): self + { + $self = clone $this; + $self['errors'] = $errors; + + return $self; + } + + /** + * Total number of sitemap files discovered. + */ + public function withSitemapsDiscovered(int $sitemapsDiscovered): self + { + $self = clone $this; + $self['sitemapsDiscovered'] = $sitemapsDiscovered; + + return $self; + } + + /** + * Number of sitemap files successfully fetched and parsed. + */ + public function withSitemapsFetched(int $sitemapsFetched): self + { + $self = clone $this; + $self['sitemapsFetched'] = $sitemapsFetched; + + return $self; + } + + /** + * Number of sitemap files skipped (due to errors, timeouts, or limits). + */ + public function withSitemapsSkipped(int $sitemapsSkipped): self + { + $self = clone $this; + $self['sitemapsSkipped'] = $sitemapsSkipped; + + return $self; + } +} diff --git a/tests/ClientTest.php b/tests/ClientTest.php new file mode 100644 index 00000000..a7109cbd --- /dev/null +++ b/tests/ClientTest.php @@ -0,0 +1,44 @@ +createResponse() + ->withStatus(200) + ->withHeader('Content-Type', 'application/json') + ->withBody(Psr17FactoryDiscovery::findStreamFactory()->createStream(json_encode([], flags: Util::JSON_ENCODE_FLAGS) ?: '')) + ; + + $transporter->setDefaultResponse($mockRsp); + + $client = new \ContextDev\Client( + baseUrl: 'http://localhost', + apiKey: 'My API Key', + requestOptions: ['transporter' => $transporter], + ); + + $client->brand->retrieve(domain: 'domain'); + + $this->assertNotFalse($requested = $transporter->getRequests()[0] ?? false); + + foreach (['accept', 'content-type'] as $header) { + $sent = $requested->getHeaderLine($header); + $this->assertNotEmpty($sent); + } + } +} diff --git a/tests/Core/ModelTest.php b/tests/Core/ModelTest.php new file mode 100644 index 00000000..eb1417f6 --- /dev/null +++ b/tests/Core/ModelTest.php @@ -0,0 +1,144 @@ +> */ + use SdkModel; + + #[Required] + public string $name; + + #[Required('age_years')] + public int $ageYears; + + /** @var list|null */ + #[Optional] + public ?array $friends; + + #[Required] + public ?string $owner; + + /** + * @param list|null $friends + */ + public function __construct( + string $name, + int $ageYears, + ?string $owner, + ?array $friends = null, + ) { + $this->initialize(); + + $this->name = $name; + $this->ageYears = $ageYears; + $this->owner = $owner; + + null !== $friends && $this['friends'] = $friends; + } +} + +/** + * @internal + * + * @coversNothing + */ +#[CoversNothing] +class ModelTest extends TestCase +{ + #[Test] + public function testBasicGetAndSet(): void + { + $model = new Dog(name: 'Bob', ageYears: 12, owner: null); + $this->assertEquals(12, $model->ageYears); + + ++$model->ageYears; + $this->assertEquals(13, $model->ageYears); + } + + #[Test] + public function testNullAccess(): void + { + $model = new Dog(name: 'Bob', ageYears: 12, owner: null); + $this->assertNull($model->owner); + $this->assertNull($model->friends); + } + + #[Test] + public function testArrayGetAndSet(): void + { + $model = new Dog(name: 'Bob', ageYears: 12, owner: null); + $model->friends ??= []; + $this->assertEquals([], $model->friends); + $model->friends[] = 'Alice'; + $this->assertEquals(['Alice'], $model->friends); + } + + #[Test] + public function testDiscernsBetweenNullAndUnset(): void + { + $modelUnsetFriends = new Dog(name: 'Bob', ageYears: 12, owner: null); + $modelNullFriends = new Dog(name: 'bob', ageYears: 12, owner: null); + $modelNullFriends->friends = null; + + $this->assertEquals(12, $modelUnsetFriends->ageYears); + $this->assertEquals(12, $modelNullFriends->ageYears); + + $this->assertTrue($modelUnsetFriends->offsetExists('ageYears')); + $this->assertTrue($modelNullFriends->offsetExists('ageYears')); + + $this->assertNull($modelUnsetFriends->friends); + $this->assertNull($modelNullFriends->friends); + + $this->assertFalse($modelUnsetFriends->offsetExists('friends')); + $this->assertTrue($modelNullFriends->offsetExists('friends')); + } + + #[Test] + public function testIssetOnOmittedProperties(): void + { + $model = new Dog(name: 'Bob', ageYears: 12, owner: null); + $this->assertFalse(isset($model->owner)); + $this->assertFalse(isset($model->friends)); + } + + #[Test] + public function testSerializeBasicModel(): void + { + $model = new Dog(name: 'Bob', ageYears: 12, owner: 'Eve', friends: ['Alice', 'Charlie']); + $this->assertEquals( + '{"name":"Bob","age_years":12,"friends":["Alice","Charlie"],"owner":"Eve"}', + json_encode($model) + ); + } + + #[Test] + public function testSerializeModelWithOmittedProperties(): void + { + $model = new Dog(name: 'Bob', ageYears: 12, owner: null); + $this->assertEquals( + '{"name":"Bob","age_years":12,"owner":null}', + json_encode($model) + ); + } + + #[Test] + public function testSerializeModelWithExplicitNull(): void + { + $model = new Dog(name: 'Bob', ageYears: 12, owner: null); + $model->friends = null; + $this->assertEquals( + '{"name":"Bob","age_years":12,"friends":null,"owner":null}', + json_encode($model) + ); + } +} diff --git a/tests/Core/StreamingTransportTest.php b/tests/Core/StreamingTransportTest.php new file mode 100644 index 00000000..e2560290 --- /dev/null +++ b/tests/Core/StreamingTransportTest.php @@ -0,0 +1,122 @@ + true, + 'application/x-ndjson' => true, + 'application/x-ldjson' => true, + 'application/jsonl' => true, + 'application/x-jsonl' => true, + 'text/event-stream; charset=utf-8' => true, + 'application/json' => false, + 'text/plain' => false, + '' => false, + ]; + + foreach ($cases as $accept => $expected) { + $req = $factory->createRequest('GET', 'http://localhost'); + if ('' !== $accept) { + $req = $req->withHeader('Accept', $accept); + } + $this->assertSame( + $expected, + Util::isStreamingRequest($req), + "Accept: '{$accept}'", + ); + } + } + + #[Test] + public function testRoutesNonStreamingRequestToTransporter(): void + { + [$client, $plain, $streaming] = $this->buildClient(); + + $client->request('GET', '/'); + + $this->assertCount(1, $plain->getRequests()); + $this->assertCount(0, $streaming->getRequests()); + } + + #[Test] + public function testRoutesStreamingRequestToStreamingTransporter(): void + { + [$client, $plain, $streaming] = $this->buildClient(); + + $client->request('GET', '/', headers: ['Accept' => 'text/event-stream']); + + $this->assertCount(0, $plain->getRequests()); + $this->assertCount(1, $streaming->getRequests()); + + $sent = $streaming->getRequests()[0]; + $this->assertStringContainsString('text/event-stream', $sent->getHeaderLine('Accept')); + } + + /** + * @return array{BaseClient, MockClient, MockClient} + */ + private function buildClient(): array + { + $plain = new MockClient; + $plain->setDefaultResponse($this->jsonResponse()); + + $streaming = new MockClient; + $streaming->setDefaultResponse($this->sseResponse()); + + $options = RequestOptions::with( + transporter: $plain, + streamingTransporter: $streaming, + uriFactory: Psr17FactoryDiscovery::findUriFactory(), + requestFactory: Psr17FactoryDiscovery::findRequestFactory(), + streamFactory: Psr17FactoryDiscovery::findStreamFactory(), + ); + + $client = new class(headers: [], baseUrl: 'http://localhost', options: $options) extends BaseClient {}; + + return [$client, $plain, $streaming]; + } + + private function jsonResponse(): ResponseInterface + { + $responseFactory = Psr17FactoryDiscovery::findResponseFactory(); + $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); + + return $responseFactory->createResponse(200) + ->withHeader('Content-Type', 'application/json') + ->withBody($streamFactory->createStream('{}')) + ; + } + + private function sseResponse(): ResponseInterface + { + $responseFactory = Psr17FactoryDiscovery::findResponseFactory(); + $streamFactory = Psr17FactoryDiscovery::findStreamFactory(); + + return $responseFactory->createResponse(200) + ->withHeader('Content-Type', 'text/event-stream') + ->withBody($streamFactory->createStream('')) + ; + } +} diff --git a/tests/Core/UtilTest.php b/tests/Core/UtilTest.php new file mode 100644 index 00000000..70b98bd6 --- /dev/null +++ b/tests/Core/UtilTest.php @@ -0,0 +1,90 @@ + $v, + ], + [ + ['a' => null, 'b' => [null, null], 'c' => ['d' => null, 'e' => 0], 'f' => ['g' => null]], + ['b' => [null, null], 'c' => ['e' => 0], 'f' => []], + static fn ($vs) => is_array($vs) && !array_is_list($vs) ? array_filter($vs, callback: static fn ($v) => !is_null($v)) : $vs, + ], + [ + ['a' => null, 'b' => 2, 'c' => true, 'd' => [1, 2]], + ['a' => null, 'b' => '2', 'c' => true, 'd' => ['1', '2']], + static fn ($v) => is_bool($v) || is_numeric($v) ? Util::strVal($v) : $v, + ], + ]; + + foreach ($cases as [$input, $expected, $xform]) { + $actual = Util::mapRecursive($xform, value: $input); + $this->assertEquals($expected, $actual); + } + } + + #[Test] + public function testJoinUri(): void + { + $factory = Psr17FactoryDiscovery::findUriFactory(); + $base = $factory->createUri('http://localhost'); + $cases = [ + [ + '', + [], + 'http://localhost', + ], + [ + 'dog', + [], + 'http://localhost/dog', + ], + [ + '', + ['dog' => 'dog'], + 'http://localhost?dog=dog', + ], + [ + '', + ['dog' => ['dog']], + 'http://localhost?dog[0]=dog', + ], + [ + '', + ['dog' => [true, false]], + 'http://localhost?dog[0]=true&dog[1]=false', + ], + [ + '', + ['dog' => ['dog' => ['dog']]], + 'http://localhost?dog[dog][0]=dog', + ], + ]; + + foreach ($cases as [$path, $query, $output]) { + $expected = $factory->createUri($output); + $actual = Util::joinUri($base, path: $path, query: $query); + $this->assertEquals($expected, $actual); + } + } +} diff --git a/tests/Services/AITest.php b/tests/Services/AITest.php new file mode 100644 index 00000000..9295e6c7 --- /dev/null +++ b/tests/Services/AITest.php @@ -0,0 +1,159 @@ +client = $client; + } + + #[Test] + public function testAIQuery(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->ai->aiQuery( + dataToExtract: [ + [ + 'datapointDescription' => 'datapoint_description', + 'datapointExample' => 'datapoint_example', + 'datapointName' => 'datapoint_name', + 'datapointType' => 'text', + ], + ], + domain: 'domain', + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(AIAIQueryResponse::class, $result); + } + + #[Test] + public function testAIQueryWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->ai->aiQuery( + dataToExtract: [ + [ + 'datapointDescription' => 'datapoint_description', + 'datapointExample' => 'datapoint_example', + 'datapointName' => 'datapoint_name', + 'datapointType' => 'text', + 'datapointListType' => 'string', + 'datapointObjectSchema' => [ + 'testimonial_text' => 'string', 'testimonial_author' => 'string', + ], + ], + ], + domain: 'domain', + specificPages: [ + 'aboutUs' => true, + 'blog' => true, + 'careers' => true, + 'contactUs' => true, + 'faq' => true, + 'homePage' => true, + 'pricing' => true, + 'privacyPolicy' => true, + 'termsAndConditions' => true, + ], + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(AIAIQueryResponse::class, $result); + } + + #[Test] + public function testExtractProduct(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->ai->extractProduct(url: 'https://example.com'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(AIExtractProductResponse::class, $result); + } + + #[Test] + public function testExtractProductWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->ai->extractProduct( + url: 'https://example.com', + maxAgeMs: 0, + timeoutMs: 1000 + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(AIExtractProductResponse::class, $result); + } + + #[Test] + public function testExtractProducts(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->ai->extractProducts( + domain: 'domain', + directURL: 'https://example.com' + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(AIExtractProductsResponse::class, $result); + } + + #[Test] + public function testExtractProductsWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->ai->extractProducts( + domain: 'domain', + maxAgeMs: 0, + maxProducts: 1, + timeoutMs: 1000, + directURL: 'https://example.com', + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(AIExtractProductsResponse::class, $result); + } +} diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php new file mode 100644 index 00000000..8f0dadbd --- /dev/null +++ b/tests/Services/BrandTest.php @@ -0,0 +1,272 @@ +client = $client; + } + + #[Test] + public function testRetrieve(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieve(domain: 'domain'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetResponse::class, $result); + } + + #[Test] + public function testRetrieveWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieve( + domain: 'domain', + forceLanguage: 'afrikaans', + maxAgeMs: 86400000, + maxSpeed: true, + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetResponse::class, $result); + } + + #[Test] + public function testIdentifyFromTransaction(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->identifyFromTransaction( + transactionInfo: 'transaction_info' + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf( + BrandIdentifyFromTransactionResponse::class, + $result + ); + } + + #[Test] + public function testIdentifyFromTransactionWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->identifyFromTransaction( + transactionInfo: 'transaction_info', + city: 'city', + countryGl: 'ad', + forceLanguage: 'afrikaans', + highConfidenceOnly: true, + maxSpeed: true, + mcc: 'mcc', + phone: 0, + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf( + BrandIdentifyFromTransactionResponse::class, + $result + ); + } + + #[Test] + public function testRetrieveByEmail(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByEmail(email: 'dev@stainless.com'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByEmailResponse::class, $result); + } + + #[Test] + public function testRetrieveByEmailWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByEmail( + email: 'dev@stainless.com', + forceLanguage: 'afrikaans', + maxAgeMs: 86400000, + maxSpeed: true, + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByEmailResponse::class, $result); + } + + #[Test] + public function testRetrieveByIsin(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByIsin(isin: 'SE60513A9993'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByIsinResponse::class, $result); + } + + #[Test] + public function testRetrieveByIsinWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByIsin( + isin: 'SE60513A9993', + forceLanguage: 'afrikaans', + maxAgeMs: 86400000, + maxSpeed: true, + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByIsinResponse::class, $result); + } + + #[Test] + public function testRetrieveByName(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByName(name: 'xxx'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByNameResponse::class, $result); + } + + #[Test] + public function testRetrieveByNameWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByName( + name: 'xxx', + countryGl: 'ad', + forceLanguage: 'afrikaans', + maxAgeMs: 86400000, + maxSpeed: true, + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByNameResponse::class, $result); + } + + #[Test] + public function testRetrieveByTicker(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByTicker(ticker: 'ticker'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByTickerResponse::class, $result); + } + + #[Test] + public function testRetrieveByTickerWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveByTicker( + ticker: 'ticker', + forceLanguage: 'afrikaans', + maxAgeMs: 86400000, + maxSpeed: true, + tickerExchange: 'AMEX', + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetByTickerResponse::class, $result); + } + + #[Test] + public function testRetrieveSimplified(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveSimplified(domain: 'domain'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetSimplifiedResponse::class, $result); + } + + #[Test] + public function testRetrieveSimplifiedWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->retrieveSimplified( + domain: 'domain', + maxAgeMs: 86400000, + timeoutMs: 1000 + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandGetSimplifiedResponse::class, $result); + } +} diff --git a/tests/Services/IndustryTest.php b/tests/Services/IndustryTest.php new file mode 100644 index 00000000..51c80f14 --- /dev/null +++ b/tests/Services/IndustryTest.php @@ -0,0 +1,94 @@ +client = $client; + } + + #[Test] + public function testRetrieveNaics(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->industry->retrieveNaics(input: 'input'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(IndustryGetNaicsResponse::class, $result); + } + + #[Test] + public function testRetrieveNaicsWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->industry->retrieveNaics( + input: 'input', + maxResults: 1, + minResults: 1, + timeoutMs: 1000 + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(IndustryGetNaicsResponse::class, $result); + } + + #[Test] + public function testRetrieveSic(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->industry->retrieveSic(input: 'input'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(IndustryGetSicResponse::class, $result); + } + + #[Test] + public function testRetrieveSicWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->industry->retrieveSic( + input: 'input', + maxResults: 1, + minResults: 1, + timeoutMs: 1000, + type: 'original_sic', + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(IndustryGetSicResponse::class, $result); + } +} diff --git a/tests/Services/UtilityTest.php b/tests/Services/UtilityTest.php new file mode 100644 index 00000000..8f236c57 --- /dev/null +++ b/tests/Services/UtilityTest.php @@ -0,0 +1,91 @@ +client = $client; + } + + #[Test] + public function testPrefetch(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->utility->prefetch(domain: 'domain'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(UtilityPrefetchResponse::class, $result); + } + + #[Test] + public function testPrefetchWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->utility->prefetch( + domain: 'domain', + timeoutMs: 1000 + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(UtilityPrefetchResponse::class, $result); + } + + #[Test] + public function testPrefetchByEmail(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->utility->prefetchByEmail( + email: 'dev@stainless.com' + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(UtilityPrefetchByEmailResponse::class, $result); + } + + #[Test] + public function testPrefetchByEmailWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->utility->prefetchByEmail( + email: 'dev@stainless.com', + timeoutMs: 1000 + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(UtilityPrefetchByEmailResponse::class, $result); + } +} diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php new file mode 100644 index 00000000..6a50237d --- /dev/null +++ b/tests/Services/WebTest.php @@ -0,0 +1,398 @@ +client = $client; + } + + #[Test] + public function testExtract(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->extract( + schema: [ + 'type' => 'bar', + 'properties' => 'bar', + 'required' => 'bar', + 'additionalProperties' => 'bar', + ], + url: 'https://example.com', + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebExtractResponse::class, $result); + } + + #[Test] + public function testExtractWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->extract( + schema: [ + 'type' => 'bar', + 'properties' => 'bar', + 'required' => 'bar', + 'additionalProperties' => 'bar', + ], + url: 'https://example.com', + factCheck: true, + followSubdomains: true, + includeFrames: true, + instructions: 'instructions', + maxAgeMs: 0, + maxDepth: 0, + maxPages: 1, + pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + stopAfterMs: 10000, + timeoutMs: 1000, + waitForMs: 0, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebExtractResponse::class, $result); + } + + #[Test] + public function testExtractCompetitors(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->extractCompetitors(domain: 'xxx'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebExtractCompetitorsResponse::class, $result); + } + + #[Test] + public function testExtractCompetitorsWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->extractCompetitors( + domain: 'xxx', + numCompetitors: 1, + timeoutMs: 1000 + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebExtractCompetitorsResponse::class, $result); + } + + #[Test] + public function testExtractFonts(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->extractFonts(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebExtractFontsResponse::class, $result); + } + + #[Test] + public function testExtractStyleguide(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->extractStyleguide(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebExtractStyleguideResponse::class, $result); + } + + #[Test] + public function testScreenshot(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->screenshot(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebScreenshotResponse::class, $result); + } + + #[Test] + public function testSearch(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->search(query: 'x'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebSearchResponse::class, $result); + } + + #[Test] + public function testSearchWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->search( + query: 'x', + excludeDomains: ['string'], + freshness: 'last_24_hours', + includeDomains: ['string'], + markdownOptions: [ + 'enabled' => true, + 'includeFrames' => true, + 'includeImages' => true, + 'includeLinks' => true, + 'maxAgeMs' => 0, + 'pdf' => ['end' => 1, 'shouldParse' => true, 'start' => 1], + 'shortenBase64Images' => true, + 'timeoutMs' => 1000, + 'useMainContentOnly' => true, + 'waitForMs' => 0, + ], + queryFanout: true, + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebSearchResponse::class, $result); + } + + #[Test] + public function testWebCrawlMd(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webCrawlMd(url: 'https://example.com'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebCrawlMdResponse::class, $result); + } + + #[Test] + public function testWebCrawlMdWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webCrawlMd( + url: 'https://example.com', + excludeSelectors: ['string'], + followSubdomains: true, + includeFrames: true, + includeImages: true, + includeLinks: true, + includeSelectors: ['string'], + maxAgeMs: 0, + maxDepth: 0, + maxPages: 1, + pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + shortenBase64Images: true, + stopAfterMs: 10000, + timeoutMs: 1000, + urlRegex: '^https?://[^/]+/blog/', + useMainContentOnly: true, + waitForMs: 0, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebCrawlMdResponse::class, $result); + } + + #[Test] + public function testWebScrapeHTML(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeHTML(url: 'https://example.com'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeHTMLResponse::class, $result); + } + + #[Test] + public function testWebScrapeHTMLWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeHTML( + url: 'https://example.com', + excludeSelectors: ['string'], + headers: ['foo' => 'J!'], + includeFrames: true, + includeSelectors: ['string'], + maxAgeMs: 0, + pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + timeoutMs: 1000, + useMainContentOnly: true, + waitForMs: 0, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeHTMLResponse::class, $result); + } + + #[Test] + public function testWebScrapeImages(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeImages(url: 'https://example.com'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeImagesResponse::class, $result); + } + + #[Test] + public function testWebScrapeImagesWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeImages( + url: 'https://example.com', + enrichment: [ + 'classification' => true, + 'hostedURL' => true, + 'maxTimePerMs' => 1, + 'resolution' => true, + ], + headers: ['foo' => 'J!'], + maxAgeMs: 0, + timeoutMs: 1000, + waitForMs: 0, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeImagesResponse::class, $result); + } + + #[Test] + public function testWebScrapeMd(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeMd(url: 'https://example.com'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeMdResponse::class, $result); + } + + #[Test] + public function testWebScrapeMdWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeMd( + url: 'https://example.com', + excludeSelectors: ['string'], + headers: ['foo' => 'J!'], + includeFrames: true, + includeImages: true, + includeLinks: true, + includeSelectors: ['string'], + maxAgeMs: 0, + pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + shortenBase64Images: true, + timeoutMs: 1000, + useMainContentOnly: true, + waitForMs: 0, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeMdResponse::class, $result); + } + + #[Test] + public function testWebScrapeSitemap(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeSitemap(domain: 'domain'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeSitemapResponse::class, $result); + } + + #[Test] + public function testWebScrapeSitemapWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->web->webScrapeSitemap( + domain: 'domain', + headers: ['foo' => 'J!'], + maxLinks: 1, + timeoutMs: 1000, + urlRegex: '^https?://[^/]+/blog/', + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(WebWebScrapeSitemapResponse::class, $result); + } +} diff --git a/tests/UnsupportedMockTests.php b/tests/UnsupportedMockTests.php new file mode 100644 index 00000000..f57ac900 --- /dev/null +++ b/tests/UnsupportedMockTests.php @@ -0,0 +1,8 @@ + Date: Sun, 21 Jun 2026 23:48:14 +0000 Subject: [PATCH 002/130] chore: update SDK settings --- .github/workflows/release-doctor.yml | 2 +- .stats.yml | 4 ++-- README.md | 8 ++++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index 966c967a..37630632 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -9,7 +9,7 @@ jobs: release_doctor: name: release doctor runs-on: ubuntu-latest - if: github.repository == 'stainless-sdks/context.dev-php' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + if: github.repository == 'context-dot-dev/context-php-sdk' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 diff --git a/.stats.yml b/.stats.yml index 052ef103..2a9603a5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e10718ebeb5bc263af75fe2341f7d1e91442f3e64b703bf7d416f8e7f328d2f9.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-af8edc351fec4471435b010cd9b7ccfabf2c2ccef20e6404ad2516a0be212645.yml openapi_spec_hash: ab3a6473e575381cacd245bf54dcf0f7 -config_hash: 48c9231dff85f546e8210338751ccb41 +config_hash: f5846595c44dc42376e820c14465a4c6 diff --git a/README.md b/README.md index 821c95fc..52b9cf68 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,14 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte To use this package, install via Composer by adding the following to your application's `composer.json`: + + ```json { "repositories": [ { "type": "vcs", - "url": "git@github.com:stainless-sdks/context.dev-php.git" + "url": "git@github.com:context-dot-dev/context-php-sdk.git" } ], "require": { @@ -26,6 +28,8 @@ To use this package, install via Composer by adding the following to your applic } ``` + + ## Usage This library uses named parameters to specify optional arguments. @@ -167,4 +171,4 @@ PHP 8.1.0 or higher. ## Contributing -See [the contributing documentation](https://github.com/stainless-sdks/context.dev-php/tree/main/CONTRIBUTING.md). +See [the contributing documentation](https://github.com/context-dot-dev/context-php-sdk/tree/main/CONTRIBUTING.md). From 77081da8df0bc8ae296c704541c14df3fc4c72b2 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Jun 2026 23:53:25 +0000 Subject: [PATCH 003/130] feat(api): manual updates --- .github/workflows/publish-packagist.yml | 21 +++++++++++++++++++++ .stats.yml | 4 ++-- README.md | 16 ++-------------- 3 files changed, 25 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/publish-packagist.yml diff --git a/.github/workflows/publish-packagist.yml b/.github/workflows/publish-packagist.yml new file mode 100644 index 00000000..93526d3e --- /dev/null +++ b/.github/workflows/publish-packagist.yml @@ -0,0 +1,21 @@ +name: Publish Packagist +on: + workflow_dispatch: + + release: + types: [published] + +jobs: + publish: + name: publish + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + + - name: Publish to Packagist + run: |- + curl --fail-with-body -X POST -H 'Content-Type: application/json' "https://packagist.org/api/update-package?username=${PACKAGIST_USERNAME}&apiToken=${PACKAGIST_SAFE_KEY}" -d '{"repository":"https://github.com/context-dot-dev/context-php-sdk"}' + env: + PACKAGIST_USERNAME: ${{ secrets.CONTEXT_DEV_PACKAGIST_USERNAME || secrets.PACKAGIST_USERNAME }} + PACKAGIST_SAFE_KEY: ${{ secrets.CONTEXT_DEV_PACKAGIST_SAFE_KEY || secrets.PACKAGIST_SAFE_KEY }} \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 2a9603a5..bacd5688 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-af8edc351fec4471435b010cd9b7ccfabf2c2ccef20e6404ad2516a0be212645.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-3024c2681b0acf12535d68f39c1b49113330548513a54b276116cd3f2eda182e.yml openapi_spec_hash: ab3a6473e575381cacd245bf54dcf0f7 -config_hash: f5846595c44dc42376e820c14465a4c6 +config_hash: b0f343b2ab3baebad7b0d6d51f0f16fc diff --git a/README.md b/README.md index 52b9cf68..17c18346 100644 --- a/README.md +++ b/README.md @@ -10,22 +10,10 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ## Installation -To use this package, install via Composer by adding the following to your application's `composer.json`: - -```json -{ - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:context-dot-dev/context-php-sdk.git" - } - ], - "require": { - "org-placeholder/context-dev": "dev-main" - } -} +``` +composer require "org-placeholder/context-dev 0.0.1" ``` From 102e48648748c2119c7e5077ff094f44fc337584 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 21 Jun 2026 23:58:57 +0000 Subject: [PATCH 004/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1332969b..fea34540 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.0.1" + ".": "1.0.0" } \ No newline at end of file diff --git a/README.md b/README.md index 17c18346..7f97bc07 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "org-placeholder/context-dev 0.0.1" +composer require "org-placeholder/context-dev 1.0.0" ``` diff --git a/src/Client.php b/src/Client.php index 88d79bf3..d06c31a1 100644 --- a/src/Client.php +++ b/src/Client.php @@ -83,7 +83,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '0.0.1', + 'X-Stainless-Package-Version' => '1.0.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 3d7d9d39..7469c943 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '0.0.1'; +const VERSION = '1.0.0'; // x-release-please-end From dad3f7429317b37c0d0a897f26a3ed0232d1b7c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2026 00:07:15 +0000 Subject: [PATCH 005/130] feat(api): manual updates --- .stats.yml | 4 ++-- README.md | 2 +- composer.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index bacd5688..99ba378f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-3024c2681b0acf12535d68f39c1b49113330548513a54b276116cd3f2eda182e.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2460611c25145e2ca049b14c32be0f9ac9f4ded0b95154d29a83b4a6c1453f3e.yml openapi_spec_hash: ab3a6473e575381cacd245bf54dcf0f7 -config_hash: b0f343b2ab3baebad7b0d6d51f0f16fc +config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/README.md b/README.md index 7f97bc07..c7bc355b 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "org-placeholder/context-dev 1.0.0" +composer require "context-dev/context-dev-php 1.0.0" ``` diff --git a/composer.json b/composer.json index efc976e0..6f16f0e9 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "sort-packages": true }, "description": "Context Dev PHP SDK", - "name": "org-placeholder/context-dev", + "name": "context-dev/context-dev-php", "require": { "php": "^8.1", "php-http/discovery": "^1", From 492d77bb6e4882082d0e540410a830d6a41fdc72 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2026 00:08:31 +0000 Subject: [PATCH 006/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index fea34540..2601677b 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.0.0" + ".": "1.1.0" } \ No newline at end of file diff --git a/README.md b/README.md index c7bc355b..8a0625d1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 1.0.0" +composer require "context-dev/context-dev-php 1.1.0" ``` diff --git a/src/Client.php b/src/Client.php index d06c31a1..4b3d1aeb 100644 --- a/src/Client.php +++ b/src/Client.php @@ -83,7 +83,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '1.0.0', + 'X-Stainless-Package-Version' => '1.1.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 7469c943..6d157e5d 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '1.0.0'; +const VERSION = '1.1.0'; // x-release-please-end From 6075e102e569040e739a6ce30b0bdf131199fcca Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 08:39:53 +0000 Subject: [PATCH 007/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 2 ++ src/Services/WebRawService.php | 1 + src/Services/WebService.php | 3 +++ src/Web/WebScreenshotParams.php | 20 ++++++++++++++++++++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 99ba378f..e34b116d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2460611c25145e2ca049b14c32be0f9ac9f4ded0b95154d29a83b4a6c1453f3e.yml -openapi_spec_hash: ab3a6473e575381cacd245bf54dcf0f7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4903d5902cec6a80f42b9adaa9cf0defa9805ff22d7ae96970d209a4f867e195.yml +openapi_spec_hash: 1097891c23530dfe0155f23170daf973 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 0fa57c1f..b6b02881 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -139,6 +139,7 @@ public function extractStyleguide( * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. @@ -153,6 +154,7 @@ public function screenshot( HandleCookiePopup|string $handleCookiePopup = 'false', int $maxAgeMs = 86400000, Page|string|null $page = null, + ?int $scrollOffset = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], int $waitForMs = 3000, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 8e98d664..c6f04596 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -221,6 +221,7 @@ public function extractStyleguide( * handleCookiePopup?: HandleCookiePopup|value-of, * maxAgeMs?: int, * page?: Page|value-of, + * scrollOffset?: int, * timeoutMs?: int, * viewport?: Viewport|ViewportShape, * waitForMs?: int, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index cdf405e6..224efa21 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -229,6 +229,7 @@ public function extractStyleguide( * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. + * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. @@ -243,6 +244,7 @@ public function screenshot( HandleCookiePopup|string $handleCookiePopup = 'false', int $maxAgeMs = 86400000, Page|string|null $page = null, + ?int $scrollOffset = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], int $waitForMs = 3000, @@ -256,6 +258,7 @@ public function screenshot( 'handleCookiePopup' => $handleCookiePopup, 'maxAgeMs' => $maxAgeMs, 'page' => $page, + 'scrollOffset' => $scrollOffset, 'timeoutMs' => $timeoutMs, 'viewport' => $viewport, 'waitForMs' => $waitForMs, diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index 8f9f5865..56d3b651 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -27,6 +27,7 @@ * handleCookiePopup?: null|HandleCookiePopup|value-of, * maxAgeMs?: int|null, * page?: null|Page|value-of, + * scrollOffset?: int|null, * timeoutMs?: int|null, * viewport?: null|Viewport|ViewportShape, * waitForMs?: int|null, @@ -80,6 +81,12 @@ final class WebScreenshotParams implements BaseModel #[Optional(enum: Page::class)] public ?string $page; + /** + * Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + */ + #[Optional] + public ?int $scrollOffset; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -120,6 +127,7 @@ public static function with( HandleCookiePopup|string|null $handleCookiePopup = null, ?int $maxAgeMs = null, Page|string|null $page = null, + ?int $scrollOffset = null, ?int $timeoutMs = null, Viewport|array|null $viewport = null, ?int $waitForMs = null, @@ -132,6 +140,7 @@ public static function with( null !== $handleCookiePopup && $self['handleCookiePopup'] = $handleCookiePopup; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $page && $self['page'] = $page; + null !== $scrollOffset && $self['scrollOffset'] = $scrollOffset; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $viewport && $self['viewport'] = $viewport; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -213,6 +222,17 @@ public function withPage(Page|string $page): self return $self; } + /** + * Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + */ + public function withScrollOffset(int $scrollOffset): self + { + $self = clone $this; + $self['scrollOffset'] = $scrollOffset; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ From 511683a04733169949e050e969962fb11f75ed27 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 25 Jun 2026 08:52:59 +0000 Subject: [PATCH 008/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2601677b..d0ab6645 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.1.0" + ".": "1.2.0" } \ No newline at end of file diff --git a/README.md b/README.md index 8a0625d1..ee10b94d 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 1.1.0" +composer require "context-dev/context-dev-php 1.2.0" ``` diff --git a/src/Client.php b/src/Client.php index 4b3d1aeb..de8df22f 100644 --- a/src/Client.php +++ b/src/Client.php @@ -83,7 +83,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '1.1.0', + 'X-Stainless-Package-Version' => '1.2.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 6d157e5d..664fee60 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '1.1.0'; +const VERSION = '1.2.0'; // x-release-please-end From 53a2a00e18e11157921e7633ba8cc34216645dc5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 16:47:01 +0000 Subject: [PATCH 009/130] feat(api): api update --- .stats.yml | 4 +- src/ServiceContracts/WebContract.php | 9 + src/Services/WebRawService.php | 5 + src/Services/WebService.php | 13 + src/Web/WebScreenshotParams.php | 26 ++ src/Web/WebScreenshotParams/Country.php | 419 +++++++++++++++++++++ src/Web/WebWebCrawlMdParams.php | 26 ++ src/Web/WebWebCrawlMdParams/Country.php | 419 +++++++++++++++++++++ src/Web/WebWebScrapeHTMLParams.php | 26 ++ src/Web/WebWebScrapeHTMLParams/Country.php | 419 +++++++++++++++++++++ src/Web/WebWebScrapeMdParams.php | 26 ++ src/Web/WebWebScrapeMdParams/Country.php | 419 +++++++++++++++++++++ tests/Services/WebTest.php | 3 + 13 files changed, 1812 insertions(+), 2 deletions(-) create mode 100644 src/Web/WebScreenshotParams/Country.php create mode 100644 src/Web/WebWebCrawlMdParams/Country.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Country.php create mode 100644 src/Web/WebWebScrapeMdParams/Country.php diff --git a/.stats.yml b/.stats.yml index e34b116d..24c57ba3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4903d5902cec6a80f42b9adaa9cf0defa9805ff22d7ae96970d209a4f867e195.yml -openapi_spec_hash: 1097891c23530dfe0155f23170daf973 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-00c5b8f1ebfe212bc8fb46204f5c05507630afa55b10f77e3a43c66d21edbb77.yml +openapi_spec_hash: 8bf4489b9bce0e52a89480109ffc5257 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index b6b02881..47cdf4a7 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -11,6 +11,7 @@ use ContextDev\Web\WebExtractParams\Pdf; use ContextDev\Web\WebExtractResponse; use ContextDev\Web\WebExtractStyleguideResponse; +use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; use ContextDev\Web\WebScreenshotParams\Page; @@ -133,6 +134,7 @@ public function extractStyleguide( /** * @api * + * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). @@ -148,6 +150,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( + Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, @@ -190,6 +193,7 @@ public function search( * @api * * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) + * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page @@ -212,6 +216,7 @@ public function search( */ public function webCrawlMd( string $url, + \ContextDev\Web\WebWebCrawlMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, bool $followSubdomains = false, bool $includeFrames = false, @@ -237,6 +242,7 @@ public function webCrawlMd( * @api * * @param string $url Full URL to scrape (must include http:// or https:// protocol) + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param list $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML @@ -252,6 +258,7 @@ public function webCrawlMd( */ public function webScrapeHTML( string $url, + \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, bool $includeFrames = false, @@ -293,6 +300,7 @@ public function webScrapeImages( * @api * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param list $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown @@ -311,6 +319,7 @@ public function webScrapeImages( */ public function webScrapeMd( string $url, + \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, bool $includeFrames = false, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index c6f04596..0d032529 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -20,6 +20,7 @@ use ContextDev\Web\WebExtractStyleguideParams; use ContextDev\Web\WebExtractStyleguideResponse; use ContextDev\Web\WebScreenshotParams; +use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; use ContextDev\Web\WebScreenshotParams\Page; @@ -215,6 +216,7 @@ public function extractStyleguide( * Capture a screenshot of a website. * * @param array{ + * country?: value-of, * directURL?: string, * domain?: string, * fullScreenshot?: FullScreenshot|value-of, @@ -300,6 +302,7 @@ public function search( * * @param array{ * url: string, + * country?: value-of, * excludeSelectors?: list, * followSubdomains?: bool, * includeFrames?: bool, @@ -349,6 +352,7 @@ public function webCrawlMd( * * @param array{ * url: string, + * country?: value-of, * excludeSelectors?: list, * headers?: array, * includeFrames?: bool, @@ -429,6 +433,7 @@ public function webScrapeImages( * * @param array{ * url: string, + * country?: value-of, * excludeSelectors?: list, * headers?: array, * includeFrames?: bool, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 224efa21..426ce6eb 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -14,6 +14,7 @@ use ContextDev\Web\WebExtractParams\Pdf; use ContextDev\Web\WebExtractResponse; use ContextDev\Web\WebExtractStyleguideResponse; +use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; use ContextDev\Web\WebScreenshotParams\Page; @@ -223,6 +224,7 @@ public function extractStyleguide( * * Capture a screenshot of a website. * + * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). @@ -238,6 +240,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( + Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, @@ -252,6 +255,7 @@ public function screenshot( ): WebScreenshotResponse { $params = Util::removeNulls( [ + 'country' => $country, 'directURL' => $directURL, 'domain' => $domain, 'fullScreenshot' => $fullScreenshot, @@ -321,6 +325,7 @@ public function search( * Performs a crawl starting from a given URL, extracts page content as Markdown, and returns results for all crawled pages. * * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) + * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page @@ -343,6 +348,7 @@ public function search( */ public function webCrawlMd( string $url, + \ContextDev\Web\WebWebCrawlMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, bool $followSubdomains = false, bool $includeFrames = false, @@ -366,6 +372,7 @@ public function webCrawlMd( $params = Util::removeNulls( [ 'url' => $url, + 'country' => $country, 'excludeSelectors' => $excludeSelectors, 'followSubdomains' => $followSubdomains, 'includeFrames' => $includeFrames, @@ -397,6 +404,7 @@ public function webCrawlMd( * Scrapes the given URL and returns the raw HTML content of the page. * * @param string $url Full URL to scrape (must include http:// or https:// protocol) + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param list $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML @@ -412,6 +420,7 @@ public function webCrawlMd( */ public function webScrapeHTML( string $url, + \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, bool $includeFrames = false, @@ -428,6 +437,7 @@ public function webScrapeHTML( $params = Util::removeNulls( [ 'url' => $url, + 'country' => $country, 'excludeSelectors' => $excludeSelectors, 'headers' => $headers, 'includeFrames' => $includeFrames, @@ -493,6 +503,7 @@ public function webScrapeImages( * Scrapes the given URL into LLM usable Markdown. * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param list $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown @@ -511,6 +522,7 @@ public function webScrapeImages( */ public function webScrapeMd( string $url, + \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, bool $includeFrames = false, @@ -530,6 +542,7 @@ public function webScrapeMd( $params = Util::removeNulls( [ 'url' => $url, + 'country' => $country, 'excludeSelectors' => $excludeSelectors, 'headers' => $headers, 'includeFrames' => $includeFrames, diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index 56d3b651..e0385eee 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -8,6 +8,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; use ContextDev\Web\WebScreenshotParams\Page; @@ -21,6 +22,7 @@ * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * * @phpstan-type WebScreenshotParamsShape = array{ + * country?: null|Country|value-of, * directURL?: string|null, * domain?: string|null, * fullScreenshot?: null|FullScreenshot|value-of, @@ -39,6 +41,14 @@ final class WebScreenshotParams implements BaseModel use SdkModel; use SdkParams; + /** + * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + /** * A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. */ @@ -115,12 +125,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Country|value-of|null $country * @param FullScreenshot|value-of|null $fullScreenshot * @param HandleCookiePopup|value-of|null $handleCookiePopup * @param Page|value-of|null $page * @param Viewport|ViewportShape|null $viewport */ public static function with( + Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, @@ -134,6 +146,7 @@ public static function with( ): self { $self = new self; + null !== $country && $self['country'] = $country; null !== $directURL && $self['directURL'] = $directURL; null !== $domain && $self['domain'] = $domain; null !== $fullScreenshot && $self['fullScreenshot'] = $fullScreenshot; @@ -148,6 +161,19 @@ public static function with( return $self; } + /** + * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + /** * A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. */ diff --git a/src/Web/WebScreenshotParams/Country.php b/src/Web/WebScreenshotParams/Country.php new file mode 100644 index 00000000..912e4350 --- /dev/null +++ b/src/Web/WebScreenshotParams/Country.php @@ -0,0 +1,419 @@ +, * excludeSelectors?: list|null, * followSubdomains?: bool|null, * includeFrames?: bool|null, @@ -50,6 +52,14 @@ final class WebWebCrawlMdParams implements BaseModel #[Required] public string $url; + /** + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + /** * CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @@ -174,12 +184,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf */ public static function with( string $url, + Country|string|null $country = null, ?array $excludeSelectors = null, ?bool $followSubdomains = null, ?bool $includeFrames = null, @@ -201,6 +213,7 @@ public static function with( $self['url'] = $url; + null !== $country && $self['country'] = $country; null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; null !== $includeFrames && $self['includeFrames'] = $includeFrames; @@ -232,6 +245,19 @@ public function withURL(string $url): self return $self; } + /** + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + /** * CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * diff --git a/src/Web/WebWebCrawlMdParams/Country.php b/src/Web/WebWebCrawlMdParams/Country.php new file mode 100644 index 00000000..e3c0594d --- /dev/null +++ b/src/Web/WebWebCrawlMdParams/Country.php @@ -0,0 +1,419 @@ +, * excludeSelectors?: list|null, * headers?: array|null, * includeFrames?: bool|null, @@ -43,6 +45,14 @@ final class WebWebScrapeHTMLParams implements BaseModel #[Required] public string $url; + /** + * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + /** * CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @@ -127,6 +137,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers * @param list|null $includeSelectors @@ -134,6 +145,7 @@ public function __construct() */ public static function with( string $url, + Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, ?bool $includeFrames = null, @@ -148,6 +160,7 @@ public static function with( $self['url'] = $url; + null !== $country && $self['country'] = $country; null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; null !== $headers && $self['headers'] = $headers; null !== $includeFrames && $self['includeFrames'] = $includeFrames; @@ -172,6 +185,19 @@ public function withURL(string $url): self return $self; } + /** + * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + /** * CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * diff --git a/src/Web/WebWebScrapeHTMLParams/Country.php b/src/Web/WebWebScrapeHTMLParams/Country.php new file mode 100644 index 00000000..6c784e4c --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Country.php @@ -0,0 +1,419 @@ +, * excludeSelectors?: list|null, * headers?: array|null, * includeFrames?: bool|null, @@ -46,6 +48,14 @@ final class WebWebScrapeMdParams implements BaseModel #[Required] public string $url; + /** + * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + /** * CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @@ -148,6 +158,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers * @param list|null $includeSelectors @@ -155,6 +166,7 @@ public function __construct() */ public static function with( string $url, + Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, ?bool $includeFrames = null, @@ -172,6 +184,7 @@ public static function with( $self['url'] = $url; + null !== $country && $self['country'] = $country; null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; null !== $headers && $self['headers'] = $headers; null !== $includeFrames && $self['includeFrames'] = $includeFrames; @@ -199,6 +212,19 @@ public function withURL(string $url): self return $self; } + /** + * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + /** * CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * diff --git a/src/Web/WebWebScrapeMdParams/Country.php b/src/Web/WebWebScrapeMdParams/Country.php new file mode 100644 index 00000000..3d1460eb --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Country.php @@ -0,0 +1,419 @@ +client->web->webCrawlMd( url: 'https://example.com', + country: 'de', excludeSelectors: ['string'], followSubdomains: true, includeFrames: true, @@ -271,6 +272,7 @@ public function testWebScrapeHTMLWithOptionalParams(): void $result = $this->client->web->webScrapeHTML( url: 'https://example.com', + country: 'de', excludeSelectors: ['string'], headers: ['foo' => 'J!'], includeFrames: true, @@ -346,6 +348,7 @@ public function testWebScrapeMdWithOptionalParams(): void $result = $this->client->web->webScrapeMd( url: 'https://example.com', + country: 'de', excludeSelectors: ['string'], headers: ['foo' => 'J!'], includeFrames: true, From aa8edf1dfbfbb23bff93c139913132a2707c6837 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 26 Jun 2026 21:26:42 +0000 Subject: [PATCH 010/130] feat(api): api update --- .stats.yml | 4 +- src/ServiceContracts/WebContract.php | 6 +- src/Services/WebRawService.php | 2 + src/Services/WebService.php | 8 +- src/Web/WebSearchParams.php | 50 ++- src/Web/WebSearchParams/Country.php | 489 +++++++++++++++++++++++++++ tests/Services/WebTest.php | 2 + 7 files changed, 555 insertions(+), 6 deletions(-) create mode 100644 src/Web/WebSearchParams/Country.php diff --git a/.stats.yml b/.stats.yml index 24c57ba3..9dc6067a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-00c5b8f1ebfe212bc8fb46204f5c05507630afa55b10f77e3a43c66d21edbb77.yml -openapi_spec_hash: 8bf4489b9bce0e52a89480109ffc5257 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d3da262409c68576e457536f6c0e7ecc538219e0af19df415111c18f8fe92cfd.yml +openapi_spec_hash: 25009575202702d24bc6672472eb8506 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 47cdf4a7..14a1f550 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -167,11 +167,13 @@ public function screenshot( /** * @api * - * @param string $query natural-language search query + * @param string $query Search query. Accepts natural language as well as Google-style search operators such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. + * @param \ContextDev\Web\WebSearchParams\Country|value-of<\ContextDev\Web\WebSearchParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de". * @param list $excludeDomains Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. * @param Freshness|value-of $freshness restrict results to content published within this window * @param list $includeDomains Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"]. * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. + * @param int $numResults Number of results to request and return (10–100). Defaults to 10. * @param bool $queryFanout expand the query into multiple parallel variants for broader recall * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -180,10 +182,12 @@ public function screenshot( */ public function search( string $query, + \ContextDev\Web\WebSearchParams\Country|string|null $country = null, ?array $excludeDomains = null, Freshness|string|null $freshness = null, ?array $includeDomains = null, MarkdownOptions|array|null $markdownOptions = null, + int $numResults = 10, ?bool $queryFanout = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 0d032529..6505344d 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -263,10 +263,12 @@ public function screenshot( * * @param array{ * query: string, + * country?: value-of, * excludeDomains?: list, * freshness?: Freshness|value-of, * includeDomains?: list, * markdownOptions?: MarkdownOptions|MarkdownOptionsShape, + * numResults?: int, * queryFanout?: bool, * timeoutMs?: int, * }|WebSearchParams $params diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 426ce6eb..84a997a2 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -280,11 +280,13 @@ public function screenshot( * * Search the web and optionally scrape each result to Markdown in one round-trip. * - * @param string $query natural-language search query + * @param string $query Search query. Accepts natural language as well as Google-style search operators such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. + * @param \ContextDev\Web\WebSearchParams\Country|value-of<\ContextDev\Web\WebSearchParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de". * @param list $excludeDomains Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. * @param Freshness|value-of $freshness restrict results to content published within this window * @param list $includeDomains Allowlist — only return results from these domains. Example: ["arxiv.org", "github.com"]. * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. + * @param int $numResults Number of results to request and return (10–100). Defaults to 10. * @param bool $queryFanout expand the query into multiple parallel variants for broader recall * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -293,10 +295,12 @@ public function screenshot( */ public function search( string $query, + \ContextDev\Web\WebSearchParams\Country|string|null $country = null, ?array $excludeDomains = null, Freshness|string|null $freshness = null, ?array $includeDomains = null, MarkdownOptions|array|null $markdownOptions = null, + int $numResults = 10, ?bool $queryFanout = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, @@ -304,10 +308,12 @@ public function search( $params = Util::removeNulls( [ 'query' => $query, + 'country' => $country, 'excludeDomains' => $excludeDomains, 'freshness' => $freshness, 'includeDomains' => $includeDomains, 'markdownOptions' => $markdownOptions, + 'numResults' => $numResults, 'queryFanout' => $queryFanout, 'timeoutMs' => $timeoutMs, ], diff --git a/src/Web/WebSearchParams.php b/src/Web/WebSearchParams.php index d7257d06..82e5f481 100644 --- a/src/Web/WebSearchParams.php +++ b/src/Web/WebSearchParams.php @@ -9,6 +9,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebSearchParams\Country; use ContextDev\Web\WebSearchParams\Freshness; use ContextDev\Web\WebSearchParams\MarkdownOptions; @@ -21,10 +22,12 @@ * * @phpstan-type WebSearchParamsShape = array{ * query: string, + * country?: null|Country|value-of, * excludeDomains?: list|null, * freshness?: null|Freshness|value-of, * includeDomains?: list|null, * markdownOptions?: null|MarkdownOptions|MarkdownOptionsShape, + * numResults?: int|null, * queryFanout?: bool|null, * timeoutMs?: int|null, * } @@ -36,11 +39,19 @@ final class WebSearchParams implements BaseModel use SdkParams; /** - * Natural-language search query. + * Search query. Accepts natural language as well as Google-style search operators such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. */ #[Required] public string $query; + /** + * Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de". + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + /** * Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. * @@ -71,6 +82,12 @@ final class WebSearchParams implements BaseModel #[Optional] public ?MarkdownOptions $markdownOptions; + /** + * Number of results to request and return (10–100). Defaults to 10. + */ + #[Optional] + public ?int $numResults; + /** * Expand the query into multiple parallel variants for broader recall. */ @@ -107,6 +124,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Country|value-of|null $country * @param list|null $excludeDomains * @param Freshness|value-of|null $freshness * @param list|null $includeDomains @@ -114,10 +132,12 @@ public function __construct() */ public static function with( string $query, + Country|string|null $country = null, ?array $excludeDomains = null, Freshness|string|null $freshness = null, ?array $includeDomains = null, MarkdownOptions|array|null $markdownOptions = null, + ?int $numResults = null, ?bool $queryFanout = null, ?int $timeoutMs = null, ): self { @@ -125,10 +145,12 @@ public static function with( $self['query'] = $query; + null !== $country && $self['country'] = $country; null !== $excludeDomains && $self['excludeDomains'] = $excludeDomains; null !== $freshness && $self['freshness'] = $freshness; null !== $includeDomains && $self['includeDomains'] = $includeDomains; null !== $markdownOptions && $self['markdownOptions'] = $markdownOptions; + null !== $numResults && $self['numResults'] = $numResults; null !== $queryFanout && $self['queryFanout'] = $queryFanout; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; @@ -136,7 +158,7 @@ public static function with( } /** - * Natural-language search query. + * Search query. Accepts natural language as well as Google-style search operators such as `site:`, `-site:`, `inurl:`, `intitle:`, quoted phrases, and `OR`. */ public function withQuery(string $query): self { @@ -146,6 +168,19 @@ public function withQuery(string $query): self return $self; } + /** + * Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific country (maps to Google's `gl` parameter). Example: "us", "gb", "de". + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + /** * Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.com"]. * @@ -199,6 +234,17 @@ public function withMarkdownOptions( return $self; } + /** + * Number of results to request and return (10–100). Defaults to 10. + */ + public function withNumResults(int $numResults): self + { + $self = clone $this; + $self['numResults'] = $numResults; + + return $self; + } + /** * Expand the query into multiple parallel variants for broader recall. */ diff --git a/src/Web/WebSearchParams/Country.php b/src/Web/WebSearchParams/Country.php new file mode 100644 index 00000000..4b7a183d --- /dev/null +++ b/src/Web/WebSearchParams/Country.php @@ -0,0 +1,489 @@ +client->web->search( query: 'x', + country: 'af', excludeDomains: ['string'], freshness: 'last_24_hours', includeDomains: ['string'], @@ -197,6 +198,7 @@ public function testSearchWithOptionalParams(): void 'useMainContentOnly' => true, 'waitForMs' => 0, ], + numResults: 10, queryFanout: true, timeoutMs: 1000, ); From 5989db0360c1c1cc5338249580807b345d088fd4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 27 Jun 2026 20:25:19 +0000 Subject: [PATCH 011/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 3 +++ src/Services/WebRawService.php | 2 ++ src/Services/WebService.php | 4 ++++ src/Web/WebScreenshotParams.php | 26 +++++++++++++++++++++ src/Web/WebScreenshotParams/ColorScheme.php | 15 ++++++++++++ 6 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 src/Web/WebScreenshotParams/ColorScheme.php diff --git a/.stats.yml b/.stats.yml index 9dc6067a..0e801d62 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d3da262409c68576e457536f6c0e7ecc538219e0af19df415111c18f8fe92cfd.yml -openapi_spec_hash: 25009575202702d24bc6672472eb8506 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a4f78808dc23a76896b451576b3b44b0d663977f2032eaed0271dd386b20c43c.yml +openapi_spec_hash: 01f9e1ae0d635f8b874f48e3ba461476 config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 14a1f550..af805173 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -11,6 +11,7 @@ use ContextDev\Web\WebExtractParams\Pdf; use ContextDev\Web\WebExtractResponse; use ContextDev\Web\WebExtractStyleguideResponse; +use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; @@ -134,6 +135,7 @@ public function extractStyleguide( /** * @api * + * @param ColorScheme|value-of $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. @@ -150,6 +152,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( + ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 6505344d..dc86ad47 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -20,6 +20,7 @@ use ContextDev\Web\WebExtractStyleguideParams; use ContextDev\Web\WebExtractStyleguideResponse; use ContextDev\Web\WebScreenshotParams; +use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; @@ -216,6 +217,7 @@ public function extractStyleguide( * Capture a screenshot of a website. * * @param array{ + * colorScheme?: ColorScheme|value-of, * country?: value-of, * directURL?: string, * domain?: string, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 84a997a2..793a8f7a 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -14,6 +14,7 @@ use ContextDev\Web\WebExtractParams\Pdf; use ContextDev\Web\WebExtractResponse; use ContextDev\Web\WebExtractStyleguideResponse; +use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; @@ -224,6 +225,7 @@ public function extractStyleguide( * * Capture a screenshot of a website. * + * @param ColorScheme|value-of $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. @@ -240,6 +242,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( + ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, @@ -255,6 +258,7 @@ public function screenshot( ): WebScreenshotResponse { $params = Util::removeNulls( [ + 'colorScheme' => $colorScheme, 'country' => $country, 'directURL' => $directURL, 'domain' => $domain, diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index e0385eee..ffc9eee3 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -8,6 +8,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; @@ -22,6 +23,7 @@ * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * * @phpstan-type WebScreenshotParamsShape = array{ + * colorScheme?: null|ColorScheme|value-of, * country?: null|Country|value-of, * directURL?: string|null, * domain?: string|null, @@ -41,6 +43,14 @@ final class WebScreenshotParams implements BaseModel use SdkModel; use SdkParams; + /** + * Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. + * + * @var value-of|null $colorScheme + */ + #[Optional(enum: ColorScheme::class)] + public ?string $colorScheme; + /** * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @@ -125,6 +135,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param ColorScheme|value-of|null $colorScheme * @param Country|value-of|null $country * @param FullScreenshot|value-of|null $fullScreenshot * @param HandleCookiePopup|value-of|null $handleCookiePopup @@ -132,6 +143,7 @@ public function __construct() * @param Viewport|ViewportShape|null $viewport */ public static function with( + ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, @@ -146,6 +158,7 @@ public static function with( ): self { $self = new self; + null !== $colorScheme && $self['colorScheme'] = $colorScheme; null !== $country && $self['country'] = $country; null !== $directURL && $self['directURL'] = $directURL; null !== $domain && $self['domain'] = $domain; @@ -161,6 +174,19 @@ public static function with( return $self; } + /** + * Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. + * + * @param ColorScheme|value-of $colorScheme + */ + public function withColorScheme(ColorScheme|string $colorScheme): self + { + $self = clone $this; + $self['colorScheme'] = $colorScheme; + + return $self; + } + /** * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * diff --git a/src/Web/WebScreenshotParams/ColorScheme.php b/src/Web/WebScreenshotParams/ColorScheme.php new file mode 100644 index 00000000..7b50b43e --- /dev/null +++ b/src/Web/WebScreenshotParams/ColorScheme.php @@ -0,0 +1,15 @@ + Date: Sat, 27 Jun 2026 21:20:21 +0000 Subject: [PATCH 012/130] feat(api): api update --- .stats.yml | 4 +-- src/ServiceContracts/WebContract.php | 8 +++--- src/Services/WebRawService.php | 10 ++++--- src/Services/WebService.php | 9 ++++--- src/Web/WebExtractStyleguideParams.php | 27 +++++++++++++++++++ .../ColorScheme.php | 15 +++++++++++ 6 files changed, 62 insertions(+), 11 deletions(-) create mode 100644 src/Web/WebExtractStyleguideParams/ColorScheme.php diff --git a/.stats.yml b/.stats.yml index 0e801d62..5bb2078a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a4f78808dc23a76896b451576b3b44b0d663977f2032eaed0271dd386b20c43c.yml -openapi_spec_hash: 01f9e1ae0d635f8b874f48e3ba461476 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-021b48afe1d6e3f54c4ebe3d0da4beb3fb8b69a6d384a4aeadbc5bab7f967603.yml +openapi_spec_hash: 2aa5b59d78c708b094acf29cc0d9a68a config_hash: c7b0cdaba3b9797b77efd89e1754d803 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index af805173..c067c5a5 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -10,8 +10,8 @@ use ContextDev\Web\WebExtractFontsResponse; use ContextDev\Web\WebExtractParams\Pdf; use ContextDev\Web\WebExtractResponse; +use ContextDev\Web\WebExtractStyleguideParams\ColorScheme; use ContextDev\Web\WebExtractStyleguideResponse; -use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; @@ -116,6 +116,7 @@ public function extractFonts( /** * @api * + * @param ColorScheme|value-of $colorScheme Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key. * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. @@ -125,6 +126,7 @@ public function extractFonts( * @throws APIException */ public function extractStyleguide( + ColorScheme|string|null $colorScheme = null, ?string $directURL = null, ?string $domain = null, int $maxAgeMs = 7776000000, @@ -135,7 +137,7 @@ public function extractStyleguide( /** * @api * - * @param ColorScheme|value-of $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. + * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. @@ -152,7 +154,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( - ColorScheme|string|null $colorScheme = null, + \ContextDev\Web\WebScreenshotParams\ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index dc86ad47..1464af22 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -18,9 +18,9 @@ use ContextDev\Web\WebExtractParams\Pdf; use ContextDev\Web\WebExtractResponse; use ContextDev\Web\WebExtractStyleguideParams; +use ContextDev\Web\WebExtractStyleguideParams\ColorScheme; use ContextDev\Web\WebExtractStyleguideResponse; use ContextDev\Web\WebScreenshotParams; -use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; @@ -181,7 +181,11 @@ public function extractFonts( * Extract a comprehensive design system from a website including colors, typography, spacing, shadows, and UI components. * * @param array{ - * directURL?: string, domain?: string, maxAgeMs?: int, timeoutMs?: int + * colorScheme?: ColorScheme|value-of, + * directURL?: string, + * domain?: string, + * maxAgeMs?: int, + * timeoutMs?: int, * }|WebExtractStyleguideParams $params * @param RequestOpts|null $requestOptions * @@ -217,7 +221,7 @@ public function extractStyleguide( * Capture a screenshot of a website. * * @param array{ - * colorScheme?: ColorScheme|value-of, + * colorScheme?: WebScreenshotParams\ColorScheme|value-of, * country?: value-of, * directURL?: string, * domain?: string, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 793a8f7a..c7ad6ad3 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -13,8 +13,8 @@ use ContextDev\Web\WebExtractFontsResponse; use ContextDev\Web\WebExtractParams\Pdf; use ContextDev\Web\WebExtractResponse; +use ContextDev\Web\WebExtractStyleguideParams\ColorScheme; use ContextDev\Web\WebExtractStyleguideResponse; -use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; @@ -190,6 +190,7 @@ public function extractFonts( * * Extract a comprehensive design system from a website including colors, typography, spacing, shadows, and UI components. * + * @param ColorScheme|value-of $colorScheme Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key. * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. @@ -199,6 +200,7 @@ public function extractFonts( * @throws APIException */ public function extractStyleguide( + ColorScheme|string|null $colorScheme = null, ?string $directURL = null, ?string $domain = null, int $maxAgeMs = 7776000000, @@ -207,6 +209,7 @@ public function extractStyleguide( ): WebExtractStyleguideResponse { $params = Util::removeNulls( [ + 'colorScheme' => $colorScheme, 'directURL' => $directURL, 'domain' => $domain, 'maxAgeMs' => $maxAgeMs, @@ -225,7 +228,7 @@ public function extractStyleguide( * * Capture a screenshot of a website. * - * @param ColorScheme|value-of $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. + * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. @@ -242,7 +245,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( - ColorScheme|string|null $colorScheme = null, + \ContextDev\Web\WebScreenshotParams\ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, ?string $domain = null, diff --git a/src/Web/WebExtractStyleguideParams.php b/src/Web/WebExtractStyleguideParams.php index 7dea9e1d..a4ba242f 100644 --- a/src/Web/WebExtractStyleguideParams.php +++ b/src/Web/WebExtractStyleguideParams.php @@ -8,6 +8,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebExtractStyleguideParams\ColorScheme; /** * Extract a comprehensive design system from a website including colors, typography, spacing, shadows, and UI components. @@ -15,6 +16,7 @@ * @see ContextDev\Services\WebService::extractStyleguide() * * @phpstan-type WebExtractStyleguideParamsShape = array{ + * colorScheme?: null|ColorScheme|value-of, * directURL?: string|null, * domain?: string|null, * maxAgeMs?: int|null, @@ -27,6 +29,14 @@ final class WebExtractStyleguideParams implements BaseModel use SdkModel; use SdkParams; + /** + * Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key. + * + * @var value-of|null $colorScheme + */ + #[Optional(enum: ColorScheme::class)] + public ?string $colorScheme; + /** * A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. */ @@ -60,8 +70,11 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param ColorScheme|value-of|null $colorScheme */ public static function with( + ColorScheme|string|null $colorScheme = null, ?string $directURL = null, ?string $domain = null, ?int $maxAgeMs = null, @@ -69,6 +82,7 @@ public static function with( ): self { $self = new self; + null !== $colorScheme && $self['colorScheme'] = $colorScheme; null !== $directURL && $self['directURL'] = $directURL; null !== $domain && $self['domain'] = $domain; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; @@ -77,6 +91,19 @@ public static function with( return $self; } + /** + * Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key. + * + * @param ColorScheme|value-of $colorScheme + */ + public function withColorScheme(ColorScheme|string $colorScheme): self + { + $self = clone $this; + $self['colorScheme'] = $colorScheme; + + return $self; + } + /** * A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. */ diff --git a/src/Web/WebExtractStyleguideParams/ColorScheme.php b/src/Web/WebExtractStyleguideParams/ColorScheme.php new file mode 100644 index 00000000..9d38a1fd --- /dev/null +++ b/src/Web/WebExtractStyleguideParams/ColorScheme.php @@ -0,0 +1,15 @@ + Date: Sat, 27 Jun 2026 22:00:51 +0000 Subject: [PATCH 013/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d0ab6645..2a8f4ffd 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.2.0" + ".": "1.3.0" } \ No newline at end of file diff --git a/README.md b/README.md index ee10b94d..bf4e14c7 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 1.2.0" +composer require "context-dev/context-dev-php 1.3.0" ``` diff --git a/src/Client.php b/src/Client.php index de8df22f..02664691 100644 --- a/src/Client.php +++ b/src/Client.php @@ -83,7 +83,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '1.2.0', + 'X-Stainless-Package-Version' => '1.3.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 664fee60..348143f2 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '1.2.0'; +const VERSION = '1.3.0'; // x-release-please-end From 3b22b59a52f7d08836cec4e346e33db446e2decf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 05:36:24 +0000 Subject: [PATCH 014/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5bb2078a..0a0c76c5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-021b48afe1d6e3f54c4ebe3d0da4beb3fb8b69a6d384a4aeadbc5bab7f967603.yml -openapi_spec_hash: 2aa5b59d78c708b094acf29cc0d9a68a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d04e3c285c2f57723b288ee69b1d78b7bb928aae403203b2cdd524dd195e55b2.yml +openapi_spec_hash: e33db883d584bc8573897391f3edb105 config_hash: c7b0cdaba3b9797b77efd89e1754d803 From bf6f3473e194e403f03d92f1375989398386c4b5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 29 Jun 2026 05:41:59 +0000 Subject: [PATCH 015/130] feat(api): manual updates --- .stats.yml | 6 +- src/Client.php | 7 + src/Monitors/MonitorCreateParams.php | 197 ++++++++ .../MonitorCreateParams/ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + src/Monitors/MonitorCreateParams/Schedule.php | 112 +++++ .../MonitorCreateParams/Schedule/Type.php | 10 + .../MonitorCreateParams/Schedule/Unit.php | 14 + src/Monitors/MonitorCreateParams/Target.php | 193 ++++++++ .../MonitorCreateParams/Target/Type.php | 10 + src/Monitors/MonitorCreateParams/Webhook.php | 88 ++++ src/Monitors/MonitorDeleteResponse.php | 74 +++ src/Monitors/MonitorGetChangeResponse.php | 42 ++ .../MonitorsExtractSemanticChange.php | 342 ++++++++++++++ .../ChangeDetectionType.php | 10 + .../Evidence.php | 111 +++++ .../Importance.php | 14 + .../TargetType.php | 10 + .../MonitorsPageExactChange.php | 271 +++++++++++ .../ChangeDetectionType.php | 10 + .../MonitorsPageExactChange/TargetType.php | 10 + .../MonitorsPageSemanticChange.php | 299 ++++++++++++ .../ChangeDetectionType.php | 10 + .../MonitorsPageSemanticChange/Evidence.php | 74 +++ .../MonitorsPageSemanticChange/Importance.php | 14 + .../MonitorsPageSemanticChange/TargetType.php | 10 + .../MonitorsSitemapExactChange.php | 295 ++++++++++++ .../ChangeDetectionType.php | 10 + .../MonitorsSitemapExactChange/TargetType.php | 10 + src/Monitors/MonitorGetResponse.php | 42 ++ .../MonitorsExtractSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsExtractSemanticMonitor/Status.php | 14 + .../MonitorsExtractSemanticMonitor/Target.php | 193 ++++++++ .../Target/Type.php | 10 + .../Webhook.php | 88 ++++ .../MonitorsPageExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsPageExactMonitor/Status.php | 14 + .../MonitorsPageExactMonitor/Target.php | 106 +++++ .../MonitorsPageExactMonitor/Target/Type.php | 10 + .../MonitorsPageExactMonitor/Webhook.php | 88 ++++ .../MonitorsPageSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageSemanticMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsPageSemanticMonitor/Status.php | 14 + .../MonitorsPageSemanticMonitor/Target.php | 106 +++++ .../Target/Type.php | 10 + .../MonitorsPageSemanticMonitor/Webhook.php | 88 ++++ .../MonitorsSitemapExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsSitemapExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsSitemapExactMonitor/Status.php | 14 + .../MonitorsSitemapExactMonitor/Target.php | 158 +++++++ .../Target/Type.php | 10 + .../MonitorsSitemapExactMonitor/Webhook.php | 88 ++++ .../MonitorListAccountChangesParams.php | 175 +++++++ .../ChangeDetectionType.php | 12 + .../TargetType.php | 14 + .../MonitorListAccountChangesResponse.php | 106 +++++ .../Data.php | 42 ++ .../MonitorsExtractSemanticChangeSummary.php | 275 +++++++++++ .../ChangeDetectionType.php | 10 + .../Importance.php | 14 + .../TargetType.php | 10 + .../Data/MonitorsPageExactChangeSummary.php | 221 +++++++++ .../ChangeDetectionType.php | 10 + .../TargetType.php | 10 + .../MonitorsPageSemanticChangeSummary.php | 259 ++++++++++ .../ChangeDetectionType.php | 10 + .../Importance.php | 14 + .../TargetType.php | 10 + .../MonitorsSitemapExactChangeSummary.php | 253 ++++++++++ .../ChangeDetectionType.php | 10 + .../TargetType.php | 10 + src/Monitors/MonitorListAccountRunsParams.php | 90 ++++ .../MonitorListAccountRunsParams/Status.php | 16 + .../MonitorListAccountRunsResponse.php | 103 ++++ .../MonitorListAccountRunsResponse/Data.php | 283 +++++++++++ .../Data/ChangeDetectionType.php | 12 + .../Data/Error.php | 74 +++ .../Data/RunType.php | 15 + .../Data/Status.php | 16 + .../Data/TargetType.php | 14 + src/Monitors/MonitorListChangesParams.php | 119 +++++ src/Monitors/MonitorListChangesResponse.php | 104 +++++ .../MonitorListChangesResponse/Data.php | 42 ++ .../MonitorsExtractSemanticChangeSummary.php | 275 +++++++++++ .../ChangeDetectionType.php | 10 + .../Importance.php | 14 + .../TargetType.php | 10 + .../Data/MonitorsPageExactChangeSummary.php | 221 +++++++++ .../ChangeDetectionType.php | 10 + .../TargetType.php | 10 + .../MonitorsPageSemanticChangeSummary.php | 259 ++++++++++ .../ChangeDetectionType.php | 10 + .../Importance.php | 14 + .../TargetType.php | 10 + .../MonitorsSitemapExactChangeSummary.php | 253 ++++++++++ .../ChangeDetectionType.php | 10 + .../TargetType.php | 10 + src/Monitors/MonitorListParams.php | 153 ++++++ .../MonitorListParams/ChangeDetectionType.php | 12 + src/Monitors/MonitorListParams/Status.php | 14 + src/Monitors/MonitorListParams/TargetType.php | 14 + src/Monitors/MonitorListResponse.php | 101 ++++ src/Monitors/MonitorListResponse/Data.php | 42 ++ .../Data/MonitorsExtractSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsExtractSemanticMonitor/Status.php | 14 + .../MonitorsExtractSemanticMonitor/Target.php | 193 ++++++++ .../Target/Type.php | 10 + .../Webhook.php | 88 ++++ .../Data/MonitorsPageExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../Data/MonitorsPageExactMonitor/Status.php | 14 + .../Data/MonitorsPageExactMonitor/Target.php | 106 +++++ .../MonitorsPageExactMonitor/Target/Type.php | 10 + .../Data/MonitorsPageExactMonitor/Webhook.php | 88 ++++ .../Data/MonitorsPageSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageSemanticMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsPageSemanticMonitor/Status.php | 14 + .../MonitorsPageSemanticMonitor/Target.php | 106 +++++ .../Target/Type.php | 10 + .../MonitorsPageSemanticMonitor/Webhook.php | 88 ++++ .../Data/MonitorsSitemapExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsSitemapExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsSitemapExactMonitor/Status.php | 14 + .../MonitorsSitemapExactMonitor/Target.php | 158 +++++++ .../Target/Type.php | 10 + .../MonitorsSitemapExactMonitor/Webhook.php | 88 ++++ src/Monitors/MonitorListRunsParams.php | 90 ++++ src/Monitors/MonitorListRunsParams/Status.php | 16 + src/Monitors/MonitorListRunsResponse.php | 103 ++++ src/Monitors/MonitorListRunsResponse/Data.php | 283 +++++++++++ .../Data/ChangeDetectionType.php | 12 + .../MonitorListRunsResponse/Data/Error.php | 74 +++ .../MonitorListRunsResponse/Data/RunType.php | 15 + .../MonitorListRunsResponse/Data/Status.php | 16 + .../Data/TargetType.php | 14 + src/Monitors/MonitorNewResponse.php | 42 ++ .../MonitorsExtractSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsExtractSemanticMonitor/Status.php | 14 + .../MonitorsExtractSemanticMonitor/Target.php | 193 ++++++++ .../Target/Type.php | 10 + .../Webhook.php | 88 ++++ .../MonitorsPageExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsPageExactMonitor/Status.php | 14 + .../MonitorsPageExactMonitor/Target.php | 106 +++++ .../MonitorsPageExactMonitor/Target/Type.php | 10 + .../MonitorsPageExactMonitor/Webhook.php | 88 ++++ .../MonitorsPageSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageSemanticMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsPageSemanticMonitor/Status.php | 14 + .../MonitorsPageSemanticMonitor/Target.php | 106 +++++ .../Target/Type.php | 10 + .../MonitorsPageSemanticMonitor/Webhook.php | 88 ++++ .../MonitorsSitemapExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsSitemapExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsSitemapExactMonitor/Status.php | 14 + .../MonitorsSitemapExactMonitor/Target.php | 158 +++++++ .../Target/Type.php | 10 + .../MonitorsSitemapExactMonitor/Webhook.php | 88 ++++ src/Monitors/MonitorRunResponse.php | 74 +++ src/Monitors/MonitorUpdateParams.php | 217 +++++++++ .../MonitorUpdateParams/ChangeDetection.php | 41 ++ .../MonitorsExactChangeDetection.php | 50 ++ .../MonitorsSemanticChangeDetection.php | 97 ++++ src/Monitors/MonitorUpdateParams/Schedule.php | 112 +++++ .../MonitorUpdateParams/Schedule/Type.php | 10 + .../MonitorUpdateParams/Schedule/Unit.php | 14 + src/Monitors/MonitorUpdateParams/Status.php | 12 + src/Monitors/MonitorUpdateParams/Target.php | 44 ++ .../Target/MonitorsExtractTarget.php | 189 ++++++++ .../Target/MonitorsPageTarget.php | 101 ++++ .../Target/MonitorsSitemapTarget.php | 154 ++++++ src/Monitors/MonitorUpdateParams/Webhook.php | 90 ++++ src/Monitors/MonitorUpdateResponse.php | 42 ++ .../MonitorsExtractSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsExtractSemanticMonitor/Status.php | 14 + .../MonitorsExtractSemanticMonitor/Target.php | 193 ++++++++ .../Target/Type.php | 10 + .../Webhook.php | 88 ++++ .../MonitorsPageExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsPageExactMonitor/Status.php | 14 + .../MonitorsPageExactMonitor/Target.php | 106 +++++ .../MonitorsPageExactMonitor/Target/Type.php | 10 + .../MonitorsPageExactMonitor/Webhook.php | 88 ++++ .../MonitorsPageSemanticMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 102 ++++ .../ChangeDetection/Type.php | 10 + .../MonitorsPageSemanticMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsPageSemanticMonitor/Status.php | 14 + .../MonitorsPageSemanticMonitor/Target.php | 106 +++++ .../Target/Type.php | 10 + .../MonitorsPageSemanticMonitor/Webhook.php | 88 ++++ .../MonitorsSitemapExactMonitor.php | 294 ++++++++++++ .../ChangeDetection.php | 71 +++ .../ChangeDetection/Type.php | 10 + .../MonitorsSitemapExactMonitor/Schedule.php | 112 +++++ .../Schedule/Type.php | 10 + .../Schedule/Unit.php | 14 + .../MonitorsSitemapExactMonitor/Status.php | 14 + .../MonitorsSitemapExactMonitor/Target.php | 158 +++++++ .../Target/Type.php | 10 + .../MonitorsSitemapExactMonitor/Webhook.php | 88 ++++ src/ServiceContracts/MonitorsContract.php | 236 ++++++++++ src/ServiceContracts/MonitorsRawContract.php | 201 ++++++++ src/Services/MonitorsRawService.php | 441 ++++++++++++++++++ src/Services/MonitorsService.php | 396 ++++++++++++++++ tests/Services/MonitorsTest.php | 219 +++++++++ 271 files changed, 22082 insertions(+), 3 deletions(-) create mode 100644 src/Monitors/MonitorCreateParams.php create mode 100644 src/Monitors/MonitorCreateParams/ChangeDetection.php create mode 100644 src/Monitors/MonitorCreateParams/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorCreateParams/Schedule.php create mode 100644 src/Monitors/MonitorCreateParams/Schedule/Type.php create mode 100644 src/Monitors/MonitorCreateParams/Schedule/Unit.php create mode 100644 src/Monitors/MonitorCreateParams/Target.php create mode 100644 src/Monitors/MonitorCreateParams/Target/Type.php create mode 100644 src/Monitors/MonitorCreateParams/Webhook.php create mode 100644 src/Monitors/MonitorDeleteResponse.php create mode 100644 src/Monitors/MonitorGetChangeResponse.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Evidence.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Importance.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/TargetType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/TargetType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Evidence.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Importance.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/TargetType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/TargetType.php create mode 100644 src/Monitors/MonitorGetResponse.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Status.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Webhook.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Status.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Webhook.php create mode 100644 src/Monitors/MonitorListAccountChangesParams.php create mode 100644 src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListAccountChangesParams/TargetType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/Importance.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/Importance.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListAccountRunsParams.php create mode 100644 src/Monitors/MonitorListAccountRunsParams/Status.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/Error.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/RunType.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/Status.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/TargetType.php create mode 100644 src/Monitors/MonitorListChangesParams.php create mode 100644 src/Monitors/MonitorListChangesResponse.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/Importance.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/Importance.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListParams.php create mode 100644 src/Monitors/MonitorListParams/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListParams/Status.php create mode 100644 src/Monitors/MonitorListParams/TargetType.php create mode 100644 src/Monitors/MonitorListResponse.php create mode 100644 src/Monitors/MonitorListResponse/Data.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Status.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Webhook.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Status.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Webhook.php create mode 100644 src/Monitors/MonitorListRunsParams.php create mode 100644 src/Monitors/MonitorListRunsParams/Status.php create mode 100644 src/Monitors/MonitorListRunsResponse.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/ChangeDetectionType.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/Error.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/RunType.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/Status.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/TargetType.php create mode 100644 src/Monitors/MonitorNewResponse.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Status.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Webhook.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Status.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Webhook.php create mode 100644 src/Monitors/MonitorRunResponse.php create mode 100644 src/Monitors/MonitorUpdateParams.php create mode 100644 src/Monitors/MonitorUpdateParams/ChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsExactChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateParams/Schedule.php create mode 100644 src/Monitors/MonitorUpdateParams/Schedule/Type.php create mode 100644 src/Monitors/MonitorUpdateParams/Schedule/Unit.php create mode 100644 src/Monitors/MonitorUpdateParams/Status.php create mode 100644 src/Monitors/MonitorUpdateParams/Target.php create mode 100644 src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php create mode 100644 src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php create mode 100644 src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php create mode 100644 src/Monitors/MonitorUpdateParams/Webhook.php create mode 100644 src/Monitors/MonitorUpdateResponse.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Status.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Webhook.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Status.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Webhook.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Status.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target/Type.php create mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Webhook.php create mode 100644 src/ServiceContracts/MonitorsContract.php create mode 100644 src/ServiceContracts/MonitorsRawContract.php create mode 100644 src/Services/MonitorsRawService.php create mode 100644 src/Services/MonitorsService.php create mode 100644 tests/Services/MonitorsTest.php diff --git a/.stats.yml b/.stats.yml index 0a0c76c5..2f86aeb8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 25 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d04e3c285c2f57723b288ee69b1d78b7bb928aae403203b2cdd524dd195e55b2.yml +configured_endpoints: 36 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8667763c416101820f5086c97d542bf13bb3bb12b57f5f604da671d9dcea0599.yml openapi_spec_hash: e33db883d584bc8573897391f3edb105 -config_hash: c7b0cdaba3b9797b77efd89e1754d803 +config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/Client.php b/src/Client.php index 02664691..63da523e 100644 --- a/src/Client.php +++ b/src/Client.php @@ -10,6 +10,7 @@ use ContextDev\Services\AIService; use ContextDev\Services\BrandService; use ContextDev\Services\IndustryService; +use ContextDev\Services\MonitorsService; use ContextDev\Services\UtilityService; use ContextDev\Services\WebService; use Http\Discovery\Psr17FactoryDiscovery; @@ -48,6 +49,11 @@ class Client extends BaseClient */ public UtilityService $utility; + /** + * @api + */ + public MonitorsService $monitors; + /** * @param RequestOpts|null $requestOptions */ @@ -111,6 +117,7 @@ public function __construct( $this->brand = new BrandService($this); $this->industry = new IndustryService($this); $this->utility = new UtilityService($this); + $this->monitors = new MonitorsService($this); } /** @return array */ diff --git a/src/Monitors/MonitorCreateParams.php b/src/Monitors/MonitorCreateParams.php new file mode 100644 index 00000000..58b56b38 --- /dev/null +++ b/src/Monitors/MonitorCreateParams.php @@ -0,0 +1,197 @@ +|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorCreateParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + #[Required] + public Target $target; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorCreateParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorCreateParams::with( + * changeDetection: ..., name: ..., schedule: ..., target: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorCreateParams) + * ->withChangeDetection(...) + * ->withName(...) + * ->withSchedule(...) + * ->withTarget(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + ChangeDetection|array $changeDetection, + string $name, + Schedule|array $schedule, + Target|array $target, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['changeDetection'] = $changeDetection; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['target'] = $target; + + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection.php new file mode 100644 index 00000000..6706e21e --- /dev/null +++ b/src/Monitors/MonitorCreateParams/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/Type.php b/src/Monitors/MonitorCreateParams/ChangeDetection/Type.php new file mode 100644 index 00000000..7c5304e6 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/Schedule/Type.php b/src/Monitors/MonitorCreateParams/Schedule/Type.php new file mode 100644 index 00000000..19fc3698 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * followSubdomains?: bool|null, + * instructions?: string|null, + * maxDepth?: int|null, + * maxPages?: int|null, + * schema?: array|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param array|null $schema + */ + public static function with( + Type|string $type, + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorCreateParams/Target/Type.php b/src/Monitors/MonitorCreateParams/Target/Type.php new file mode 100644 index 00000000..036fedf3 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorDeleteResponse.php b/src/Monitors/MonitorDeleteResponse.php new file mode 100644 index 00000000..b8ec288f --- /dev/null +++ b/src/Monitors/MonitorDeleteResponse.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $id; + + #[Required] + public bool $deleted; + + /** + * `new MonitorDeleteResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorDeleteResponse::with(id: ..., deleted: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorDeleteResponse)->withID(...)->withDeleted(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $id, bool $deleted): self + { + $self = new self; + + $self['id'] = $id; + $self['deleted'] = $deleted; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + public function withDeleted(bool $deleted): self + { + $self = clone $this; + $self['deleted'] = $deleted; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse.php b/src/Monitors/MonitorGetChangeResponse.php new file mode 100644 index 00000000..6823192b --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse.php @@ -0,0 +1,42 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageExactChange::class, + MonitorsSitemapExactChange::class, + MonitorsPageSemanticChange::class, + MonitorsExtractSemanticChange::class, + ]; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange.php b/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange.php new file mode 100644 index 00000000..1148f148 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange.php @@ -0,0 +1,342 @@ +, + * confidence: float, + * detectedAt: \DateTimeInterface, + * evidence: list, + * importance: Importance|value-of, + * matchedURLCount: int, + * matchedURLs: list, + * monitorID: string, + * query: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsExtractSemanticChange implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required] + public float $confidence; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** @var list $evidence */ + #[Required(list: Evidence::class)] + public array $evidence; + + /** @var value-of $importance */ + #[Required(enum: Importance::class)] + public string $importance; + + #[Required('matched_url_count')] + public int $matchedURLCount; + + /** @var list $matchedURLs */ + #[Required('matched_urls', list: 'string')] + public array $matchedURLs; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $query; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + /** + * Root URL of the extract target. + */ + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsExtractSemanticChange()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractSemanticChange::with( + * id: ..., + * changeDetectionType: ..., + * confidence: ..., + * detectedAt: ..., + * evidence: ..., + * importance: ..., + * matchedURLCount: ..., + * matchedURLs: ..., + * monitorID: ..., + * query: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractSemanticChange) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withConfidence(...) + * ->withDetectedAt(...) + * ->withEvidence(...) + * ->withImportance(...) + * ->withMatchedURLCount(...) + * ->withMatchedURLs(...) + * ->withMonitorID(...) + * ->withQuery(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param list $evidence + * @param Importance|value-of $importance + * @param list $matchedURLs + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + float $confidence, + \DateTimeInterface $detectedAt, + array $evidence, + Importance|string $importance, + int $matchedURLCount, + array $matchedURLs, + string $monitorID, + string $query, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['confidence'] = $confidence; + $self['detectedAt'] = $detectedAt; + $self['evidence'] = $evidence; + $self['importance'] = $importance; + $self['matchedURLCount'] = $matchedURLCount; + $self['matchedURLs'] = $matchedURLs; + $self['monitorID'] = $monitorID; + $self['query'] = $query; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * @param list $evidence + */ + public function withEvidence(array $evidence): self + { + $self = clone $this; + $self['evidence'] = $evidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + /** + * @param list $matchedURLs + */ + public function withMatchedURLs(array $matchedURLs): self + { + $self = clone $this; + $self['matchedURLs'] = $matchedURLs; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Root URL of the extract target. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/ChangeDetectionType.php new file mode 100644 index 00000000..f02a79f1 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/ChangeDetectionType.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Snapshot of the extracted data after the change. + */ + #[Required] + public string $after; + + /** + * Snapshot of the extracted data before the change. + */ + #[Required] + public string $before; + + /** + * Optional URL the evidence relates to. Absent for whole-target extract diffs. + */ + #[Optional] + public ?string $url; + + /** + * `new Evidence()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Evidence::with(after: ..., before: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Evidence)->withAfter(...)->withBefore(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $after, + string $before, + ?string $url = null + ): self { + $self = new self; + + $self['after'] = $after; + $self['before'] = $before; + + null !== $url && $self['url'] = $url; + + return $self; + } + + /** + * Snapshot of the extracted data after the change. + */ + public function withAfter(string $after): self + { + $self = clone $this; + $self['after'] = $after; + + return $self; + } + + /** + * Snapshot of the extracted data before the change. + */ + public function withBefore(string $before): self + { + $self = clone $this; + $self['before'] = $before; + + return $self; + } + + /** + * Optional URL the evidence relates to. Absent for whole-target extract diffs. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Importance.php b/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Importance.php new file mode 100644 index 00000000..5afe5309 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Importance.php @@ -0,0 +1,14 @@ +, + * detectedAt: \DateTimeInterface, + * diff: string, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * afterTextExcerpt?: string|null, + * beforeTextExcerpt?: string|null, + * tags?: list|null, + * } + */ +final class MonitorsPageExactChange implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** + * Text diff between the previous and current page baseline. + */ + #[Required] + public string $diff; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + #[Optional('after_text_excerpt')] + public ?string $afterTextExcerpt; + + #[Optional('before_text_excerpt')] + public ?string $beforeTextExcerpt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsPageExactChange()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageExactChange::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * diff: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageExactChange) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withDiff(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + string $diff, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?string $afterTextExcerpt = null, + ?string $beforeTextExcerpt = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['diff'] = $diff; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $afterTextExcerpt && $self['afterTextExcerpt'] = $afterTextExcerpt; + null !== $beforeTextExcerpt && $self['beforeTextExcerpt'] = $beforeTextExcerpt; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * Text diff between the previous and current page baseline. + */ + public function withDiff(string $diff): self + { + $self = clone $this; + $self['diff'] = $diff; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withAfterTextExcerpt(string $afterTextExcerpt): self + { + $self = clone $this; + $self['afterTextExcerpt'] = $afterTextExcerpt; + + return $self; + } + + public function withBeforeTextExcerpt(string $beforeTextExcerpt): self + { + $self = clone $this; + $self['beforeTextExcerpt'] = $beforeTextExcerpt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php new file mode 100644 index 00000000..9933c2af --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * confidence: float, + * detectedAt: \DateTimeInterface, + * evidence: list, + * importance: Importance|value-of, + * monitorID: string, + * query: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsPageSemanticChange implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required] + public float $confidence; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** @var list $evidence */ + #[Required(list: Evidence::class)] + public array $evidence; + + /** @var value-of $importance */ + #[Required(enum: Importance::class)] + public string $importance; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $query; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsPageSemanticChange()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageSemanticChange::with( + * id: ..., + * changeDetectionType: ..., + * confidence: ..., + * detectedAt: ..., + * evidence: ..., + * importance: ..., + * monitorID: ..., + * query: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageSemanticChange) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withConfidence(...) + * ->withDetectedAt(...) + * ->withEvidence(...) + * ->withImportance(...) + * ->withMonitorID(...) + * ->withQuery(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param list $evidence + * @param Importance|value-of $importance + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + float $confidence, + \DateTimeInterface $detectedAt, + array $evidence, + Importance|string $importance, + string $monitorID, + string $query, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['confidence'] = $confidence; + $self['detectedAt'] = $detectedAt; + $self['evidence'] = $evidence; + $self['importance'] = $importance; + $self['monitorID'] = $monitorID; + $self['query'] = $query; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * @param list $evidence + */ + public function withEvidence(array $evidence): self + { + $self = clone $this; + $self['evidence'] = $evidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/ChangeDetectionType.php new file mode 100644 index 00000000..ddb88ec3 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/ChangeDetectionType.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + #[Required] + public string $after; + + #[Required] + public string $before; + + /** + * `new Evidence()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Evidence::with(after: ..., before: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Evidence)->withAfter(...)->withBefore(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $after, string $before): self + { + $self = new self; + + $self['after'] = $after; + $self['before'] = $before; + + return $self; + } + + public function withAfter(string $after): self + { + $self = clone $this; + $self['after'] = $after; + + return $self; + } + + public function withBefore(string $before): self + { + $self = clone $this; + $self['before'] = $before; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Importance.php b/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Importance.php new file mode 100644 index 00000000..59f3d57d --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Importance.php @@ -0,0 +1,14 @@ +, + * changeDetectionType: ChangeDetectionType|value-of, + * detectedAt: \DateTimeInterface, + * monitorID: string, + * removedURLCount: int, + * removedURLs: list, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsSitemapExactChange implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + #[Required('added_url_count')] + public int $addedURLCount; + + /** @var list $addedURLs */ + #[Required('added_urls', list: 'string')] + public array $addedURLs; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required('removed_url_count')] + public int $removedURLCount; + + /** @var list $removedURLs */ + #[Required('removed_urls', list: 'string')] + public array $removedURLs; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsSitemapExactChange()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapExactChange::with( + * id: ..., + * addedURLCount: ..., + * addedURLs: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * monitorID: ..., + * removedURLCount: ..., + * removedURLs: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapExactChange) + * ->withID(...) + * ->withAddedURLCount(...) + * ->withAddedURLs(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMonitorID(...) + * ->withRemovedURLCount(...) + * ->withRemovedURLs(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $addedURLs + * @param ChangeDetectionType|value-of $changeDetectionType + * @param list $removedURLs + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + int $addedURLCount, + array $addedURLs, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + string $monitorID, + int $removedURLCount, + array $removedURLs, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['addedURLCount'] = $addedURLCount; + $self['addedURLs'] = $addedURLs; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['monitorID'] = $monitorID; + $self['removedURLCount'] = $removedURLCount; + $self['removedURLs'] = $removedURLs; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + /** + * @param list $addedURLs + */ + public function withAddedURLs(array $addedURLs): self + { + $self = clone $this; + $self['addedURLs'] = $addedURLs; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } + + /** + * @param list $removedURLs + */ + public function withRemovedURLs(array $removedURLs): self + { + $self = clone $this; + $self['removedURLs'] = $removedURLs; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php new file mode 100644 index 00000000..c43f35e6 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageExactMonitor::class, + MonitorsSitemapExactMonitor::class, + MonitorsPageSemanticMonitor::class, + MonitorsExtractSemanticMonitor::class, + ]; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor.php b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor.php new file mode 100644 index 00000000..bea71075 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsExtractSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..ce590d5a --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..7122a0db --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..fe55ef02 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * followSubdomains?: bool|null, + * instructions?: string|null, + * maxDepth?: int|null, + * maxPages?: int|null, + * schema?: array|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param array|null $schema + */ + public static function with( + Type|string $type, + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target/Type.php b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..53593e43 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php new file mode 100644 index 00000000..be585cfa --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..7d341e4d --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..c0dbee3d --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..42f3457f --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target/Type.php new file mode 100644 index 00000000..86283cb7 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor.php b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor.php new file mode 100644 index 00000000..d3392fcc --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..47bc9f55 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..4dff921f --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..32451c12 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..8f84a355 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor.php b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor.php new file mode 100644 index 00000000..0df755a1 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsSitemapExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..d658a65e --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..46d294de --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..050474a6 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * exclude?: list|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + Type|string $type, + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target/Type.php b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target/Type.php new file mode 100644 index 00000000..f2529d8d --- /dev/null +++ b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesParams.php b/src/Monitors/MonitorListAccountChangesParams.php new file mode 100644 index 00000000..53cfc419 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesParams.php @@ -0,0 +1,175 @@ +, + * cursor?: string|null, + * limit?: int|null, + * monitorID?: string|null, + * since?: \DateTimeInterface|null, + * tag?: string|null, + * targetType?: null|TargetType|value-of, + * until?: \DateTimeInterface|null, + * } + */ +final class MonitorListAccountChangesParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** @var value-of|null $changeDetectionType */ + #[Optional(enum: ChangeDetectionType::class)] + public ?string $changeDetectionType; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + #[Optional] + public ?string $monitorID; + + #[Optional] + public ?\DateTimeInterface $since; + + /** + * Filter to items that have this tag. + */ + #[Optional] + public ?string $tag; + + /** @var value-of|null $targetType */ + #[Optional(enum: TargetType::class)] + public ?string $targetType; + + #[Optional] + public ?\DateTimeInterface $until; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of|null $changeDetectionType + * @param TargetType|value-of|null $targetType + */ + public static function with( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + ?int $limit = null, + ?string $monitorID = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + TargetType|string|null $targetType = null, + ?\DateTimeInterface $until = null, + ): self { + $self = new self; + + null !== $changeDetectionType && $self['changeDetectionType'] = $changeDetectionType; + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $monitorID && $self['monitorID'] = $monitorID; + null !== $since && $self['since'] = $since; + null !== $tag && $self['tag'] = $tag; + null !== $targetType && $self['targetType'] = $targetType; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSince(\DateTimeInterface $since): self + { + $self = clone $this; + $self['since'] = $since; + + return $self; + } + + /** + * Filter to items that have this tag. + */ + public function withTag(string $tag): self + { + $self = clone $this; + $self['tag'] = $tag; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withUntil(\DateTimeInterface $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php new file mode 100644 index 00000000..6890569a --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php @@ -0,0 +1,12 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListAccountChangesResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListAccountChangesResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListAccountChangesResponse::with( + * data: ..., hasMore: ..., nextCursor: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListAccountChangesResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data.php b/src/Monitors/MonitorListAccountChangesResponse/Data.php new file mode 100644 index 00000000..e1a18ad5 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data.php @@ -0,0 +1,42 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageExactChangeSummary::class, + MonitorsSitemapExactChangeSummary::class, + MonitorsPageSemanticChangeSummary::class, + MonitorsExtractSemanticChangeSummary::class, + ]; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php new file mode 100644 index 00000000..7dffe88d --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php @@ -0,0 +1,275 @@ +, + * confidence: float, + * detectedAt: \DateTimeInterface, + * importance: Importance|value-of, + * matchedURLCount: int, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsExtractSemanticChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required] + public float $confidence; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** @var value-of $importance */ + #[Required(enum: Importance::class)] + public string $importance; + + #[Required('matched_url_count')] + public int $matchedURLCount; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsExtractSemanticChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractSemanticChangeSummary::with( + * id: ..., + * changeDetectionType: ..., + * confidence: ..., + * detectedAt: ..., + * importance: ..., + * matchedURLCount: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractSemanticChangeSummary) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withConfidence(...) + * ->withDetectedAt(...) + * ->withImportance(...) + * ->withMatchedURLCount(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Importance|value-of $importance + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + float $confidence, + \DateTimeInterface $detectedAt, + Importance|string $importance, + int $matchedURLCount, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['confidence'] = $confidence; + $self['detectedAt'] = $detectedAt; + $self['importance'] = $importance; + $self['matchedURLCount'] = $matchedURLCount; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..c3b7783a --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * detectedAt: \DateTimeInterface, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsPageExactChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsPageExactChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageExactChangeSummary::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageExactChangeSummary) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..09b05a74 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * confidence: float, + * detectedAt: \DateTimeInterface, + * importance: Importance|value-of, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsPageSemanticChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required] + public float $confidence; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** @var value-of $importance */ + #[Required(enum: Importance::class)] + public string $importance; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsPageSemanticChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageSemanticChangeSummary::with( + * id: ..., + * changeDetectionType: ..., + * confidence: ..., + * detectedAt: ..., + * importance: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageSemanticChangeSummary) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withConfidence(...) + * ->withDetectedAt(...) + * ->withImportance(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Importance|value-of $importance + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + float $confidence, + \DateTimeInterface $detectedAt, + Importance|string $importance, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['confidence'] = $confidence; + $self['detectedAt'] = $detectedAt; + $self['importance'] = $importance; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..327db938 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * detectedAt: \DateTimeInterface, + * monitorID: string, + * removedURLCount: int, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsSitemapExactChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + #[Required('added_url_count')] + public int $addedURLCount; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required('removed_url_count')] + public int $removedURLCount; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsSitemapExactChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapExactChangeSummary::with( + * id: ..., + * addedURLCount: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * monitorID: ..., + * removedURLCount: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapExactChangeSummary) + * ->withID(...) + * ->withAddedURLCount(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMonitorID(...) + * ->withRemovedURLCount(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + int $addedURLCount, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + string $monitorID, + int $removedURLCount, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['addedURLCount'] = $addedURLCount; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['monitorID'] = $monitorID; + $self['removedURLCount'] = $removedURLCount; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..5eb5b1fd --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ + + * } + */ +final class MonitorListAccountRunsParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + /** @var value-of|null $status */ + #[Optional(enum: Status::class)] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of|null $status + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $status && $self['status'] = $status; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsParams/Status.php b/src/Monitors/MonitorListAccountRunsParams/Status.php new file mode 100644 index 00000000..c768dd7f --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsParams/Status.php @@ -0,0 +1,16 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListAccountRunsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListAccountRunsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListAccountRunsResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListAccountRunsResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data.php b/src/Monitors/MonitorListAccountRunsResponse/Data.php new file mode 100644 index 00000000..4e8a7c75 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data.php @@ -0,0 +1,283 @@ +, + * monitorID: string, + * runType: RunType|value-of, + * status: Status|value-of, + * targetType: TargetType|value-of, + * changeID?: string|null, + * completedAt?: \DateTimeInterface|null, + * error?: null|Error|ErrorShape, + * startedAt?: \DateTimeInterface|null, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + #[Required('baseline_created')] + public bool $baselineCreated; + + #[Required('change_detected')] + public bool $changeDetected; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('monitor_id')] + public string $monitorID; + + /** + * The first run after monitor creation is a baseline run. + * + * @var value-of $runType + */ + #[Required('run_type', enum: RunType::class)] + public string $runType; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Optional('change_id', nullable: true)] + public ?string $changeID; + + #[Optional('completed_at', nullable: true)] + public ?\DateTimeInterface $completedAt; + + #[Optional(nullable: true)] + public ?Error $error; + + #[Optional('started_at', nullable: true)] + public ?\DateTimeInterface $startedAt; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * baselineCreated: ..., + * changeDetected: ..., + * changeDetectionType: ..., + * monitorID: ..., + * runType: ..., + * status: ..., + * targetType: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withBaselineCreated(...) + * ->withChangeDetected(...) + * ->withChangeDetectionType(...) + * ->withMonitorID(...) + * ->withRunType(...) + * ->withStatus(...) + * ->withTargetType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param RunType|value-of $runType + * @param Status|value-of $status + * @param TargetType|value-of $targetType + * @param Error|ErrorShape|null $error + */ + public static function with( + string $id, + bool $baselineCreated, + bool $changeDetected, + ChangeDetectionType|string $changeDetectionType, + string $monitorID, + RunType|string $runType, + Status|string $status, + TargetType|string $targetType, + ?string $changeID = null, + ?\DateTimeInterface $completedAt = null, + Error|array|null $error = null, + ?\DateTimeInterface $startedAt = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['baselineCreated'] = $baselineCreated; + $self['changeDetected'] = $changeDetected; + $self['changeDetectionType'] = $changeDetectionType; + $self['monitorID'] = $monitorID; + $self['runType'] = $runType; + $self['status'] = $status; + $self['targetType'] = $targetType; + + null !== $changeID && $self['changeID'] = $changeID; + null !== $completedAt && $self['completedAt'] = $completedAt; + null !== $error && $self['error'] = $error; + null !== $startedAt && $self['startedAt'] = $startedAt; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + public function withBaselineCreated(bool $baselineCreated): self + { + $self = clone $this; + $self['baselineCreated'] = $baselineCreated; + + return $self; + } + + public function withChangeDetected(bool $changeDetected): self + { + $self = clone $this; + $self['changeDetected'] = $changeDetected; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + /** + * The first run after monitor creation is a baseline run. + * + * @param RunType|value-of $runType + */ + public function withRunType(RunType|string $runType): self + { + $self = clone $this; + $self['runType'] = $runType; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withChangeID(?string $changeID): self + { + $self = clone $this; + $self['changeID'] = $changeID; + + return $self; + } + + public function withCompletedAt(?\DateTimeInterface $completedAt): self + { + $self = clone $this; + $self['completedAt'] = $completedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError(Error|array|null $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + public function withStartedAt(?\DateTimeInterface $startedAt): self + { + $self = clone $this; + $self['startedAt'] = $startedAt; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/ChangeDetectionType.php b/src/Monitors/MonitorListAccountRunsResponse/Data/ChangeDetectionType.php new file mode 100644 index 00000000..f420d6ea --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/ChangeDetectionType.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/RunType.php b/src/Monitors/MonitorListAccountRunsResponse/Data/RunType.php new file mode 100644 index 00000000..9062a516 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/RunType.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + use SdkParams; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + #[Optional] + public ?\DateTimeInterface $since; + + /** + * Filter to items that have this tag. + */ + #[Optional] + public ?string $tag; + + #[Optional] + public ?\DateTimeInterface $until; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + ?\DateTimeInterface $until = null, + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $since && $self['since'] = $since; + null !== $tag && $self['tag'] = $tag; + null !== $until && $self['until'] = $until; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + public function withSince(\DateTimeInterface $since): self + { + $self = clone $this; + $self['since'] = $since; + + return $self; + } + + /** + * Filter to items that have this tag. + */ + public function withTag(string $tag): self + { + $self = clone $this; + $self['tag'] = $tag; + + return $self; + } + + public function withUntil(\DateTimeInterface $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse.php b/src/Monitors/MonitorListChangesResponse.php new file mode 100644 index 00000000..07cbcbc8 --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse.php @@ -0,0 +1,104 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListChangesResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListChangesResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListChangesResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListChangesResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data.php b/src/Monitors/MonitorListChangesResponse/Data.php new file mode 100644 index 00000000..4cdf38ce --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data.php @@ -0,0 +1,42 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageExactChangeSummary::class, + MonitorsSitemapExactChangeSummary::class, + MonitorsPageSemanticChangeSummary::class, + MonitorsExtractSemanticChangeSummary::class, + ]; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php new file mode 100644 index 00000000..8e503827 --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php @@ -0,0 +1,275 @@ +, + * confidence: float, + * detectedAt: \DateTimeInterface, + * importance: Importance|value-of, + * matchedURLCount: int, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsExtractSemanticChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required] + public float $confidence; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** @var value-of $importance */ + #[Required(enum: Importance::class)] + public string $importance; + + #[Required('matched_url_count')] + public int $matchedURLCount; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsExtractSemanticChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractSemanticChangeSummary::with( + * id: ..., + * changeDetectionType: ..., + * confidence: ..., + * detectedAt: ..., + * importance: ..., + * matchedURLCount: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractSemanticChangeSummary) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withConfidence(...) + * ->withDetectedAt(...) + * ->withImportance(...) + * ->withMatchedURLCount(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Importance|value-of $importance + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + float $confidence, + \DateTimeInterface $detectedAt, + Importance|string $importance, + int $matchedURLCount, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['confidence'] = $confidence; + $self['detectedAt'] = $detectedAt; + $self['importance'] = $importance; + $self['matchedURLCount'] = $matchedURLCount; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..4bbabfa3 --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * detectedAt: \DateTimeInterface, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsPageExactChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsPageExactChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageExactChangeSummary::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageExactChangeSummary) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..b3023c42 --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * confidence: float, + * detectedAt: \DateTimeInterface, + * importance: Importance|value-of, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsPageSemanticChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required] + public float $confidence; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** @var value-of $importance */ + #[Required(enum: Importance::class)] + public string $importance; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsPageSemanticChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageSemanticChangeSummary::with( + * id: ..., + * changeDetectionType: ..., + * confidence: ..., + * detectedAt: ..., + * importance: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageSemanticChangeSummary) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withConfidence(...) + * ->withDetectedAt(...) + * ->withImportance(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Importance|value-of $importance + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + float $confidence, + \DateTimeInterface $detectedAt, + Importance|string $importance, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['confidence'] = $confidence; + $self['detectedAt'] = $detectedAt; + $self['importance'] = $importance; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..bedc5028 --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * detectedAt: \DateTimeInterface, + * monitorID: string, + * removedURLCount: int, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * tags?: list|null, + * } + */ +final class MonitorsSitemapExactChangeSummary implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + #[Required('added_url_count')] + public int $addedURLCount; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required('removed_url_count')] + public int $removedURLCount; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorsSitemapExactChangeSummary()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapExactChangeSummary::with( + * id: ..., + * addedURLCount: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * monitorID: ..., + * removedURLCount: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapExactChangeSummary) + * ->withID(...) + * ->withAddedURLCount(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMonitorID(...) + * ->withRemovedURLCount(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param TargetType|value-of $targetType + * @param list|null $tags + */ + public static function with( + string $id, + int $addedURLCount, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + string $monitorID, + int $removedURLCount, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['addedURLCount'] = $addedURLCount; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['monitorID'] = $monitorID; + $self['removedURLCount'] = $removedURLCount; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php new file mode 100644 index 00000000..47c649ad --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php @@ -0,0 +1,10 @@ +, + * cursor?: string|null, + * limit?: int|null, + * status?: null|Status|value-of, + * tag?: string|null, + * targetType?: null|TargetType|value-of, + * } + */ +final class MonitorListParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** @var value-of|null $changeDetectionType */ + #[Optional(enum: ChangeDetectionType::class)] + public ?string $changeDetectionType; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + /** @var value-of|null $status */ + #[Optional(enum: Status::class)] + public ?string $status; + + /** + * Filter to items that have this tag. + */ + #[Optional] + public ?string $tag; + + /** @var value-of|null $targetType */ + #[Optional(enum: TargetType::class)] + public ?string $targetType; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of|null $changeDetectionType + * @param Status|value-of|null $status + * @param TargetType|value-of|null $targetType + */ + public static function with( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null, + ?string $tag = null, + TargetType|string|null $targetType = null, + ): self { + $self = new self; + + null !== $changeDetectionType && $self['changeDetectionType'] = $changeDetectionType; + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $status && $self['status'] = $status; + null !== $tag && $self['tag'] = $tag; + null !== $targetType && $self['targetType'] = $targetType; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Filter to items that have this tag. + */ + public function withTag(string $tag): self + { + $self = clone $this; + $self['tag'] = $tag; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } +} diff --git a/src/Monitors/MonitorListParams/ChangeDetectionType.php b/src/Monitors/MonitorListParams/ChangeDetectionType.php new file mode 100644 index 00000000..d0e29720 --- /dev/null +++ b/src/Monitors/MonitorListParams/ChangeDetectionType.php @@ -0,0 +1,12 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListResponse)->withData(...)->withHasMore(...)->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data.php b/src/Monitors/MonitorListResponse/Data.php new file mode 100644 index 00000000..93bd7c84 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data.php @@ -0,0 +1,42 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageExactMonitor::class, + MonitorsSitemapExactMonitor::class, + MonitorsPageSemanticMonitor::class, + MonitorsExtractSemanticMonitor::class, + ]; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor.php new file mode 100644 index 00000000..45d8c987 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsExtractSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..78f72ce5 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..eb363f81 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..bbc868a5 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * followSubdomains?: bool|null, + * instructions?: string|null, + * maxDepth?: int|null, + * maxPages?: int|null, + * schema?: array|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param array|null $schema + */ + public static function with( + Type|string $type, + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..40b75c82 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php new file mode 100644 index 00000000..e544534b --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..b34eb694 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..d5b7d587 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..c2f18561 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php new file mode 100644 index 00000000..bafa9dce --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php new file mode 100644 index 00000000..f6c49006 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..02fd9e6a --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..9c8a97b9 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..72300b63 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..c34575a0 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php new file mode 100644 index 00000000..a7826478 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsSitemapExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..de76148f --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..658a10f4 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..4c2daa9d --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * exclude?: list|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + Type|string $type, + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target/Type.php new file mode 100644 index 00000000..b5e2681a --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsParams.php b/src/Monitors/MonitorListRunsParams.php new file mode 100644 index 00000000..477023ef --- /dev/null +++ b/src/Monitors/MonitorListRunsParams.php @@ -0,0 +1,90 @@ + + * } + */ +final class MonitorListRunsParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + #[Optional] + public ?string $cursor; + + #[Optional] + public ?int $limit; + + /** @var value-of|null $status */ + #[Optional(enum: Status::class)] + public ?string $status; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of|null $status + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $status && $self['status'] = $status; + + return $self; + } + + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsParams/Status.php b/src/Monitors/MonitorListRunsParams/Status.php new file mode 100644 index 00000000..a65b54a5 --- /dev/null +++ b/src/Monitors/MonitorListRunsParams/Status.php @@ -0,0 +1,16 @@ +, hasMore: bool, nextCursor: string|null + * } + */ +final class MonitorListRunsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * `new MonitorListRunsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorListRunsResponse::with(data: ..., hasMore: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorListRunsResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with( + array $data, + bool $hasMore, + ?string $nextCursor + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data.php b/src/Monitors/MonitorListRunsResponse/Data.php new file mode 100644 index 00000000..b779d323 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data.php @@ -0,0 +1,283 @@ +, + * monitorID: string, + * runType: RunType|value-of, + * status: Status|value-of, + * targetType: TargetType|value-of, + * changeID?: string|null, + * completedAt?: \DateTimeInterface|null, + * error?: null|Error|ErrorShape, + * startedAt?: \DateTimeInterface|null, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + #[Required('baseline_created')] + public bool $baselineCreated; + + #[Required('change_detected')] + public bool $changeDetected; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('monitor_id')] + public string $monitorID; + + /** + * The first run after monitor creation is a baseline run. + * + * @var value-of $runType + */ + #[Required('run_type', enum: RunType::class)] + public string $runType; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Optional('change_id', nullable: true)] + public ?string $changeID; + + #[Optional('completed_at', nullable: true)] + public ?\DateTimeInterface $completedAt; + + #[Optional(nullable: true)] + public ?Error $error; + + #[Optional('started_at', nullable: true)] + public ?\DateTimeInterface $startedAt; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * baselineCreated: ..., + * changeDetected: ..., + * changeDetectionType: ..., + * monitorID: ..., + * runType: ..., + * status: ..., + * targetType: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withBaselineCreated(...) + * ->withChangeDetected(...) + * ->withChangeDetectionType(...) + * ->withMonitorID(...) + * ->withRunType(...) + * ->withStatus(...) + * ->withTargetType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param RunType|value-of $runType + * @param Status|value-of $status + * @param TargetType|value-of $targetType + * @param Error|ErrorShape|null $error + */ + public static function with( + string $id, + bool $baselineCreated, + bool $changeDetected, + ChangeDetectionType|string $changeDetectionType, + string $monitorID, + RunType|string $runType, + Status|string $status, + TargetType|string $targetType, + ?string $changeID = null, + ?\DateTimeInterface $completedAt = null, + Error|array|null $error = null, + ?\DateTimeInterface $startedAt = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['baselineCreated'] = $baselineCreated; + $self['changeDetected'] = $changeDetected; + $self['changeDetectionType'] = $changeDetectionType; + $self['monitorID'] = $monitorID; + $self['runType'] = $runType; + $self['status'] = $status; + $self['targetType'] = $targetType; + + null !== $changeID && $self['changeID'] = $changeID; + null !== $completedAt && $self['completedAt'] = $completedAt; + null !== $error && $self['error'] = $error; + null !== $startedAt && $self['startedAt'] = $startedAt; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * True when this run established the monitor's initial baseline; baseline runs perform no change detection. + */ + public function withBaselineCreated(bool $baselineCreated): self + { + $self = clone $this; + $self['baselineCreated'] = $baselineCreated; + + return $self; + } + + public function withChangeDetected(bool $changeDetected): self + { + $self = clone $this; + $self['changeDetected'] = $changeDetected; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + /** + * The first run after monitor creation is a baseline run. + * + * @param RunType|value-of $runType + */ + public function withRunType(RunType|string $runType): self + { + $self = clone $this; + $self['runType'] = $runType; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withChangeID(?string $changeID): self + { + $self = clone $this; + $self['changeID'] = $changeID; + + return $self; + } + + public function withCompletedAt(?\DateTimeInterface $completedAt): self + { + $self = clone $this; + $self['completedAt'] = $completedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError(Error|array|null $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + public function withStartedAt(?\DateTimeInterface $startedAt): self + { + $self = clone $this; + $self['startedAt'] = $startedAt; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/ChangeDetectionType.php b/src/Monitors/MonitorListRunsResponse/Data/ChangeDetectionType.php new file mode 100644 index 00000000..4fa53317 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/ChangeDetectionType.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/RunType.php b/src/Monitors/MonitorListRunsResponse/Data/RunType.php new file mode 100644 index 00000000..f6c2d829 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/RunType.php @@ -0,0 +1,15 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageExactMonitor::class, + MonitorsSitemapExactMonitor::class, + MonitorsPageSemanticMonitor::class, + MonitorsExtractSemanticMonitor::class, + ]; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor.php b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor.php new file mode 100644 index 00000000..19e15838 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsExtractSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..a72c366f --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..fd9b8fc3 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..e9537d36 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * followSubdomains?: bool|null, + * instructions?: string|null, + * maxDepth?: int|null, + * maxPages?: int|null, + * schema?: array|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param array|null $schema + */ + public static function with( + Type|string $type, + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target/Type.php b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..872688c0 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php new file mode 100644 index 00000000..e5a105f0 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..281d9b28 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..bc8b9aed --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..85bd10ea --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target/Type.php new file mode 100644 index 00000000..55ddd607 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor.php b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor.php new file mode 100644 index 00000000..d92e27b4 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..7ba9992f --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..f255088d --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..abf1bd86 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..d64838ac --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php new file mode 100644 index 00000000..7f08c4ce --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsSitemapExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..eacb2f0c --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..3cd3652c --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..688ed4ea --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * exclude?: list|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + Type|string $type, + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target/Type.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target/Type.php new file mode 100644 index 00000000..d0996d28 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorRunResponse.php b/src/Monitors/MonitorRunResponse.php new file mode 100644 index 00000000..c9a5f074 --- /dev/null +++ b/src/Monitors/MonitorRunResponse.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public bool $queued; + + /** + * `new MonitorRunResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorRunResponse::with(monitorID: ..., queued: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorRunResponse)->withMonitorID(...)->withQueued(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $monitorID, bool $queued): self + { + $self = new self; + + $self['monitorID'] = $monitorID; + $self['queued'] = $queued; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withQueued(bool $queued): self + { + $self = clone $this; + $self['queued'] = $queued; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams.php b/src/Monitors/MonitorUpdateParams.php new file mode 100644 index 00000000..606b67ce --- /dev/null +++ b/src/Monitors/MonitorUpdateParams.php @@ -0,0 +1,217 @@ +, + * tags?: list|null, + * target?: TargetShape|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorUpdateParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants|null $changeDetection + */ + #[Optional('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection|null $changeDetection; + + #[Optional] + public ?string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Optional] + public ?Schedule $schedule; + + /** @var value-of|null $status */ + #[Optional(enum: Status::class)] + public ?string $status; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants|null $target + */ + #[Optional(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget|null $target; + + /** + * Set to null to remove the webhook. + */ + #[Optional(nullable: true)] + public ?Webhook $webhook; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape|null $changeDetection + * @param Schedule|ScheduleShape|null $schedule + * @param Status|value-of|null $status + * @param list|null $tags + * @param TargetShape|null $target + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, + ?string $name = null, + Schedule|array|null $schedule = null, + Status|string|null $status = null, + ?array $tags = null, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget|null $target = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + null !== $changeDetection && $self['changeDetection'] = $changeDetection; + null !== $name && $self['name'] = $name; + null !== $schedule && $self['schedule'] = $schedule; + null !== $status && $self['status'] = $status; + null !== $tags && $self['tags'] = $tags; + null !== $target && $self['target'] = $target; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + /** + * Set to null to remove the webhook. + * + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection.php new file mode 100644 index 00000000..8d76be7d --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 00000000..a9162ee2 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 00000000..e97261cb --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Schedule.php b/src/Monitors/MonitorUpdateParams/Schedule.php new file mode 100644 index 00000000..21976785 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Schedule.php @@ -0,0 +1,112 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Schedule/Type.php b/src/Monitors/MonitorUpdateParams/Schedule/Type.php new file mode 100644 index 00000000..5501da4d --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Schedule/Type.php @@ -0,0 +1,10 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php new file mode 100644 index 00000000..9dd110b1 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php @@ -0,0 +1,189 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php new file mode 100644 index 00000000..0e8425a0 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php @@ -0,0 +1,101 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php new file mode 100644 index 00000000..1e18b694 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php @@ -0,0 +1,154 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateParams/Webhook.php b/src/Monitors/MonitorUpdateParams/Webhook.php new file mode 100644 index 00000000..c03b5a90 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Webhook.php @@ -0,0 +1,90 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse.php b/src/Monitors/MonitorUpdateResponse.php new file mode 100644 index 00000000..145d8ecd --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse.php @@ -0,0 +1,42 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageExactMonitor::class, + MonitorsSitemapExactMonitor::class, + MonitorsPageSemanticMonitor::class, + MonitorsExtractSemanticMonitor::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor.php new file mode 100644 index 00000000..04fa8c81 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsExtractSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..cd63925a --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..73704d8d --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..1642e52e --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * followSubdomains?: bool|null, + * instructions?: string|null, + * maxDepth?: int|null, + * maxPages?: int|null, + * schema?: array|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param array|null $schema + */ + public static function with( + Type|string $type, + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..2b932fd7 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php new file mode 100644 index 00000000..1b034603 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..9d3a77a4 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..3b3dd9b3 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..3c3c2400 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php new file mode 100644 index 00000000..55fe5030 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php new file mode 100644 index 00000000..6d5bb508 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsPageSemanticMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect meaning-level changes that match a natural language query. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageSemanticMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageSemanticMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect meaning-level changes that match a natural language query. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php new file mode 100644 index 00000000..21697015 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php @@ -0,0 +1,102 @@ +, confidenceThreshold?: float|null + * } + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $query; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(query: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withQuery(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + string $query, + Type|string $type, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + $self['type'] = $type; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..67990408 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php new file mode 100644 index 00000000..3665f855 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, url: string, normalizeWhitespace?: bool|null + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with( + Type|string $type, + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php new file mode 100644 index 00000000..0b6aac26 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php new file mode 100644 index 00000000..2cb8a409 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php @@ -0,0 +1,294 @@ +, + * target: Target|TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } + */ +final class MonitorsSitemapExactMonitor implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + */ + #[Required('change_detection')] + public ChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Target $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapExactMonitor::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapExactMonitor) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param Target|TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + ChangeDetection|array $changeDetection, + \DateTimeInterface $createdAt, + string $name, + Schedule|array $schedule, + Status|string $status, + Target|array $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + ChangeDetection|array $changeDetection + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + + /** + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Target|TargetShape $target + */ + public function withTarget(Target|array $target): self + { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php new file mode 100644 index 00000000..633ed16b --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php @@ -0,0 +1,71 @@ +} + */ +final class ChangeDetection implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new ChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ChangeDetection::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ChangeDetection)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php new file mode 100644 index 00000000..424dbdf6 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php @@ -0,0 +1,10 @@ +, unit: Unit|value-of + * } + */ +final class Schedule implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + #[Required] + public int $frequency; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** @var value-of $unit */ + #[Required(enum: Unit::class)] + public string $unit; + + /** + * `new Schedule()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Schedule::with(frequency: ..., type: ..., unit: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param Unit|value-of $unit + */ + public static function with( + int $frequency, + Type|string $type, + Unit|string $unit + ): self { + $self = new self; + + $self['frequency'] = $frequency; + $self['type'] = $type; + $self['unit'] = $unit; + + return $self; + } + + /** + * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). + */ + public function withFrequency(int $frequency): self + { + $self = clone $this; + $self['frequency'] = $frequency; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * @param Unit|value-of $unit + */ + public function withUnit(Unit|string $unit): self + { + $self = clone $this; + $self['unit'] = $unit; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php new file mode 100644 index 00000000..7ed9445b --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php @@ -0,0 +1,10 @@ +, + * url: string, + * exclude?: list|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class Target implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new Target()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Target::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Target)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + Type|string $type, + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target/Type.php new file mode 100644 index 00000000..e163d556 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target/Type.php @@ -0,0 +1,10 @@ + */ + use SdkModel; + + /** + * Webhook URL called when a change is detected. + */ + #[Required] + public string $url; + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + #[Optional] + public ?string $secret; + + /** + * `new Webhook()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Webhook::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Webhook)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $url, ?string $secret = null): self + { + $self = new self; + + $self['url'] = $url; + + null !== $secret && $self['secret'] = $secret; + + return $self; + } + + /** + * Webhook URL called when a change is detected. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. + */ + public function withSecret(string $secret): self + { + $self = clone $this; + $self['secret'] = $secret; + + return $self; + } +} diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php new file mode 100644 index 00000000..4fd43d16 --- /dev/null +++ b/src/ServiceContracts/MonitorsContract.php @@ -0,0 +1,236 @@ + $tags user-defined tags for grouping and filtering monitors and their changes + * @param Webhook|WebhookShape|null $webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function create( + ChangeDetection|array $changeDetection, + string $name, + Schedule|array $schedule, + Target|array $target, + ?array $tags = null, + Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorsPageExactMonitor|MonitorsSitemapExactMonitor|MonitorsPageSemanticMonitor|MonitorsExtractSemanticMonitor; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): \ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor; + + /** + * @api + * + * @param ChangeDetectionShape1 $changeDetection discriminated union describing how changes are detected + * @param \ContextDev\Monitors\MonitorUpdateParams\Schedule|ScheduleShape1 $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * @param Status|value-of $status + * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param TargetShape1 $target discriminated union describing what the monitor watches + * @param \ContextDev\Monitors\MonitorUpdateParams\Webhook|WebhookShape1|null $webhook set to null to remove the webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function update( + string $monitorID, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, + ?string $name = null, + \ContextDev\Monitors\MonitorUpdateParams\Schedule|array|null $schedule = null, + Status|string|null $status = null, + ?array $tags = null, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget|null $target = null, + \ContextDev\Monitors\MonitorUpdateParams\Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): \ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor; + + /** + * @api + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status + * @param string $tag filter to items that have this tag + * @param TargetType|value-of $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function list( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, + ?string $tag = null, + TargetType|string|null $targetType = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorDeleteResponse; + + /** + * @api + * + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType + * @param string $tag filter to items that have this tag + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountChanges( + \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + ?string $monitorID = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|string|null $targetType = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountChangesResponse; + + /** + * @api + * + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountRuns( + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListAccountRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountRunsResponse; + + /** + * @api + * + * @param string $tag filter to items that have this tag + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + ?\DateTimeInterface $since = null, + ?string $tag = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListChangesResponse; + + /** + * @api + * + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListRunsResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): MonitorsPageExactChange|MonitorsSitemapExactChange|MonitorsPageSemanticChange|MonitorsExtractSemanticChange; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorRunResponse; +} diff --git a/src/ServiceContracts/MonitorsRawContract.php b/src/ServiceContracts/MonitorsRawContract.php new file mode 100644 index 00000000..b61fb391 --- /dev/null +++ b/src/ServiceContracts/MonitorsRawContract.php @@ -0,0 +1,201 @@ +|MonitorCreateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|MonitorCreateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse<\ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor,> + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorUpdateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse<\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor,> + * + * @throws APIException + */ + public function update( + string $monitorID, + array|MonitorUpdateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function list( + array|MonitorListParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListAccountChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountChanges( + array|MonitorListAccountChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListAccountRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountRuns( + array|MonitorListAccountRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + array|MonitorListChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|MonitorListRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + array|MonitorListRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; +} diff --git a/src/Services/MonitorsRawService.php b/src/Services/MonitorsRawService.php new file mode 100644 index 00000000..27498428 --- /dev/null +++ b/src/Services/MonitorsRawService.php @@ -0,0 +1,441 @@ +, + * webhook?: Webhook|WebhookShape|null, + * }|MonitorCreateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function create( + array|MonitorCreateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorCreateParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'monitors', + body: (object) $parsed, + options: $options, + convert: MonitorNewResponse::class, + ); + } + + /** + * @api + * + * Get a monitor + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/%1$s', $monitorID], + options: $requestOptions, + convert: MonitorGetResponse::class, + ); + } + + /** + * @api + * + * Updates a monitor. If `target` or `change_detection` changes, the monitor creates a new baseline. Unsupported target/change detection combinations are rejected. + * + * @param array{ + * changeDetection?: ChangeDetectionShape1, + * name?: string, + * schedule?: MonitorUpdateParams\Schedule|ScheduleShape1, + * status?: Status|value-of, + * tags?: list, + * target?: TargetShape1, + * webhook?: MonitorUpdateParams\Webhook|WebhookShape1|null, + * }|MonitorUpdateParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function update( + string $monitorID, + array|MonitorUpdateParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorUpdateParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'patch', + path: ['monitors/%1$s', $monitorID], + body: (object) $parsed, + options: $options, + convert: MonitorUpdateResponse::class, + ); + } + + /** + * @api + * + * List monitors + * + * @param array{ + * changeDetectionType?: ChangeDetectionType|value-of, + * cursor?: string, + * limit?: int, + * status?: MonitorListParams\Status|value-of, + * tag?: string, + * targetType?: TargetType|value-of, + * }|MonitorListParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function list( + array|MonitorListParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors', + query: Util::array_transform_keys( + $parsed, + [ + 'changeDetectionType' => 'change_detection_type', + 'targetType' => 'target_type', + ], + ), + options: $options, + convert: MonitorListResponse::class, + ); + } + + /** + * @api + * + * Delete a monitor + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'delete', + path: ['monitors/%1$s', $monitorID], + options: $requestOptions, + convert: MonitorDeleteResponse::class, + ); + } + + /** + * @api + * + * Returns an account-wide feed of detected changes across monitors. + * + * @param array{ + * changeDetectionType?: MonitorListAccountChangesParams\ChangeDetectionType|value-of, + * cursor?: string, + * limit?: int, + * monitorID?: string, + * since?: \DateTimeInterface, + * tag?: string, + * targetType?: MonitorListAccountChangesParams\TargetType|value-of, + * until?: \DateTimeInterface, + * }|MonitorListAccountChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountChanges( + array|MonitorListAccountChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListAccountChangesParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors/changes', + query: Util::array_transform_keys( + $parsed, + [ + 'changeDetectionType' => 'change_detection_type', + 'monitorID' => 'monitor_id', + 'targetType' => 'target_type', + ], + ), + options: $options, + convert: MonitorListAccountChangesResponse::class, + ); + } + + /** + * @api + * + * Returns an account-wide feed of monitor runs across all monitors. + * + * @param array{ + * cursor?: string, + * limit?: int, + * status?: MonitorListAccountRunsParams\Status|value-of, + * }|MonitorListAccountRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listAccountRuns( + array|MonitorListAccountRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListAccountRunsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors/runs', + query: $parsed, + options: $options, + convert: MonitorListAccountRunsResponse::class, + ); + } + + /** + * @api + * + * List changes for a monitor + * + * @param array{ + * cursor?: string, + * limit?: int, + * since?: \DateTimeInterface, + * tag?: string, + * until?: \DateTimeInterface, + * }|MonitorListChangesParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + array|MonitorListChangesParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListChangesParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/%1$s/changes', $monitorID], + query: $parsed, + options: $options, + convert: MonitorListChangesResponse::class, + ); + } + + /** + * @api + * + * List monitor runs + * + * @param array{ + * cursor?: string, + * limit?: int, + * status?: MonitorListRunsParams\Status|value-of, + * }|MonitorListRunsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + array|MonitorListRunsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorListRunsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/%1$s/runs', $monitorID], + query: $parsed, + options: $options, + convert: MonitorListRunsResponse::class, + ); + } + + /** + * @api + * + * Get a change + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['monitors/changes/%1$s', $changeID], + options: $requestOptions, + convert: MonitorGetChangeResponse::class, + ); + } + + /** + * @api + * + * Triggers an immediate run of the monitor outside its normal schedule. The run is queued and processed asynchronously. + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: ['monitors/%1$s/run', $monitorID], + options: $requestOptions, + convert: MonitorRunResponse::class, + ); + } +} diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php new file mode 100644 index 00000000..8df4453e --- /dev/null +++ b/src/Services/MonitorsService.php @@ -0,0 +1,396 @@ +raw = new MonitorsRawService($client); + } + + /** + * @api + * + * Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline. + * + * @param ChangeDetection|ChangeDetectionShape $changeDetection detect meaning-level changes that match a natural language query + * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * @param Target|TargetShape $target + * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param Webhook|WebhookShape|null $webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function create( + ChangeDetection|array $changeDetection, + string $name, + Schedule|array $schedule, + Target|array $target, + ?array $tags = null, + Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorsPageExactMonitor|MonitorsSitemapExactMonitor|MonitorsPageSemanticMonitor|MonitorsExtractSemanticMonitor { + $params = Util::removeNulls( + [ + 'changeDetection' => $changeDetection, + 'name' => $name, + 'schedule' => $schedule, + 'target' => $target, + 'tags' => $tags, + 'webhook' => $webhook, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->create(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Get a monitor + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): \ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve($monitorID, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Updates a monitor. If `target` or `change_detection` changes, the monitor creates a new baseline. Unsupported target/change detection combinations are rejected. + * + * @param ChangeDetectionShape1 $changeDetection discriminated union describing how changes are detected + * @param \ContextDev\Monitors\MonitorUpdateParams\Schedule|ScheduleShape1 $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * @param Status|value-of $status + * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param TargetShape1 $target discriminated union describing what the monitor watches + * @param \ContextDev\Monitors\MonitorUpdateParams\Webhook|WebhookShape1|null $webhook set to null to remove the webhook + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function update( + string $monitorID, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, + ?string $name = null, + \ContextDev\Monitors\MonitorUpdateParams\Schedule|array|null $schedule = null, + Status|string|null $status = null, + ?array $tags = null, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget|null $target = null, + \ContextDev\Monitors\MonitorUpdateParams\Webhook|array|null $webhook = null, + RequestOptions|array|null $requestOptions = null, + ): \ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor { + $params = Util::removeNulls( + [ + 'changeDetection' => $changeDetection, + 'name' => $name, + 'schedule' => $schedule, + 'status' => $status, + 'tags' => $tags, + 'target' => $target, + 'webhook' => $webhook, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->update($monitorID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * List monitors + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status + * @param string $tag filter to items that have this tag + * @param TargetType|value-of $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function list( + ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, + ?string $tag = null, + TargetType|string|null $targetType = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListResponse { + $params = Util::removeNulls( + [ + 'changeDetectionType' => $changeDetectionType, + 'cursor' => $cursor, + 'limit' => $limit, + 'status' => $status, + 'tag' => $tag, + 'targetType' => $targetType, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->list(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Delete a monitor + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function delete( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorDeleteResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->delete($monitorID, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Returns an account-wide feed of detected changes across monitors. + * + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType + * @param string $tag filter to items that have this tag + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountChanges( + \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|string|null $changeDetectionType = null, + ?string $cursor = null, + int $limit = 25, + ?string $monitorID = null, + ?\DateTimeInterface $since = null, + ?string $tag = null, + \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|string|null $targetType = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountChangesResponse { + $params = Util::removeNulls( + [ + 'changeDetectionType' => $changeDetectionType, + 'cursor' => $cursor, + 'limit' => $limit, + 'monitorID' => $monitorID, + 'since' => $since, + 'tag' => $tag, + 'targetType' => $targetType, + 'until' => $until, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listAccountChanges(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Returns an account-wide feed of monitor runs across all monitors. + * + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listAccountRuns( + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListAccountRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListAccountRunsResponse { + $params = Util::removeNulls( + ['cursor' => $cursor, 'limit' => $limit, 'status' => $status] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listAccountRuns(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * List changes for a monitor + * + * @param string $tag filter to items that have this tag + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listChanges( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + ?\DateTimeInterface $since = null, + ?string $tag = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListChangesResponse { + $params = Util::removeNulls( + [ + 'cursor' => $cursor, + 'limit' => $limit, + 'since' => $since, + 'tag' => $tag, + 'until' => $until, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listChanges($monitorID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * List monitor runs + * + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function listRuns( + string $monitorID, + ?string $cursor = null, + int $limit = 25, + \ContextDev\Monitors\MonitorListRunsParams\Status|string|null $status = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorListRunsResponse { + $params = Util::removeNulls( + ['cursor' => $cursor, 'limit' => $limit, 'status' => $status] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->listRuns($monitorID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Get a change + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieveChange( + string $changeID, + RequestOptions|array|null $requestOptions = null + ): MonitorsPageExactChange|MonitorsSitemapExactChange|MonitorsPageSemanticChange|MonitorsExtractSemanticChange { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieveChange($changeID, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Triggers an immediate run of the monitor outside its normal schedule. The run is queued and processed asynchronously. + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function run( + string $monitorID, + RequestOptions|array|null $requestOptions = null + ): MonitorRunResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->run($monitorID, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/tests/Services/MonitorsTest.php b/tests/Services/MonitorsTest.php new file mode 100644 index 00000000..2e62023c --- /dev/null +++ b/tests/Services/MonitorsTest.php @@ -0,0 +1,219 @@ +client = $client; + } + + #[Test] + public function testCreate(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->create( + changeDetection: [ + 'query' => 'Tell me when pricing, packaging, plan limits, or discounts change.', + 'type' => 'semantic', + ], + name: 'Acme pricing monitor', + schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], + target: ['type' => 'extract', 'url' => 'https://acme.com'], + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertNotNull($result); + } + + #[Test] + public function testCreateWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->create( + changeDetection: [ + 'query' => 'Tell me when pricing, packaging, plan limits, or discounts change.', + 'type' => 'semantic', + 'confidenceThreshold' => 0, + ], + name: 'Acme pricing monitor', + schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], + target: [ + 'type' => 'extract', + 'url' => 'https://acme.com', + 'followSubdomains' => true, + 'instructions' => 'Extract every pricing plan with its monthly price and included limits.', + 'maxDepth' => 0, + 'maxPages' => 1, + 'schema' => ['type' => 'bar', 'properties' => 'bar'], + ], + tags: ['pricing', 'competitor'], + webhook: ['url' => 'https://example.com/webhook'], + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertNotNull($result); + } + + #[Test] + public function testRetrieve(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->retrieve('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertNotNull($result); + } + + #[Test] + public function testUpdate(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->update('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertNotNull($result); + } + + #[Test] + public function testList(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->list(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListResponse::class, $result); + } + + #[Test] + public function testDelete(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->delete('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorDeleteResponse::class, $result); + } + + #[Test] + public function testListAccountChanges(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listAccountChanges(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListAccountChangesResponse::class, $result); + } + + #[Test] + public function testListAccountRuns(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listAccountRuns(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListAccountRunsResponse::class, $result); + } + + #[Test] + public function testListChanges(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listChanges('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListChangesResponse::class, $result); + } + + #[Test] + public function testListRuns(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->listRuns('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorListRunsResponse::class, $result); + } + + #[Test] + public function testRetrieveChange(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->retrieveChange('chg_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertNotNull($result); + } + + #[Test] + public function testRun(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->run('mon_123'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorRunResponse::class, $result); + } +} From a32b7011e086e57bcb35fc23c11a7a5341005e68 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Jun 2026 01:13:43 +0000 Subject: [PATCH 016/130] feat(api): api update --- .stats.yml | 4 +- src/Monitors/MonitorCreateParams.php | 77 ++- .../MonitorCreateParams/ChangeDetection.php | 103 +--- .../MonitorsExactChangeDetection.php | 50 ++ .../MonitorsSemanticChangeDetection.php} | 33 +- .../ChangeDetection/Type.php | 10 - src/Monitors/MonitorCreateParams/Mode.php | 13 + src/Monitors/MonitorCreateParams/Target.php | 199 +------- .../Target/MonitorsExtractTarget.php} | 32 +- .../Target/MonitorsPageTarget.php} | 33 +- .../Target/MonitorsSitemapTarget.php} | 32 +- .../MonitorCreateParams/Target/Type.php | 10 - src/Monitors/MonitorGetChangeResponse.php | 474 +++++++++++++++++- .../ChangeDetectionType.php | 4 +- .../Evidence.php | 14 +- .../Importance.php | 2 +- .../MonitorGetChangeResponse/Mode.php | 13 + .../MonitorsExtractSemanticChange.php | 342 ------------- .../TargetType.php | 10 - .../MonitorsPageExactChange.php | 271 ---------- .../ChangeDetectionType.php | 10 - .../MonitorsPageExactChange/TargetType.php | 10 - .../MonitorsPageSemanticChange.php | 299 ----------- .../MonitorsPageSemanticChange/Evidence.php | 74 --- .../MonitorsPageSemanticChange/TargetType.php | 10 - .../MonitorsSitemapExactChange.php | 295 ----------- .../ChangeDetectionType.php | 10 - .../MonitorsSitemapExactChange/TargetType.php | 10 - .../MonitorGetChangeResponse/TargetType.php | 14 + src/Monitors/MonitorGetResponse.php | 345 ++++++++++++- .../MonitorGetResponse/ChangeDetection.php | 41 ++ .../MonitorsExactChangeDetection.php | 50 ++ .../MonitorsSemanticChangeDetection.php} | 33 +- src/Monitors/MonitorGetResponse/Mode.php | 13 + .../MonitorsExtractSemanticMonitor.php | 294 ----------- .../ChangeDetection/Type.php | 10 - .../Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsExtractSemanticMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../Webhook.php | 88 ---- .../MonitorsPageExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../MonitorsPageExactMonitor/Target/Type.php | 10 - .../MonitorsPageSemanticMonitor.php | 294 ----------- .../ChangeDetection/Type.php | 10 - .../Target/Type.php | 10 - .../MonitorsSitemapExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../Target/Type.php | 10 - .../Schedule.php | 6 +- .../Schedule/Type.php | 2 +- .../Schedule/Unit.php | 2 +- .../Status.php | 2 +- src/Monitors/MonitorGetResponse/Target.php | 44 ++ .../MonitorsExtractTarget.php} | 32 +- .../MonitorsPageTarget.php} | 33 +- .../MonitorsSitemapTarget.php} | 32 +- .../Webhook.php | 2 +- .../MonitorListAccountChangesResponse.php | 9 +- .../Data.php | 335 ++++++++++++- .../ChangeDetectionType.php | 4 +- .../Importance.php | 2 +- .../Data/Mode.php | 13 + .../MonitorsExtractSemanticChangeSummary.php | 275 ---------- .../ChangeDetectionType.php | 10 - .../Importance.php | 14 - .../Data/MonitorsPageExactChangeSummary.php | 221 -------- .../ChangeDetectionType.php | 10 - .../TargetType.php | 10 - .../MonitorsPageSemanticChangeSummary.php | 259 ---------- .../TargetType.php | 10 - .../MonitorsSitemapExactChangeSummary.php | 253 ---------- .../ChangeDetectionType.php | 10 - .../TargetType.php | 10 - .../TargetType.php | 6 +- src/Monitors/MonitorListChangesResponse.php | 9 +- .../MonitorListChangesResponse/Data.php | 335 ++++++++++++- .../Data}/ChangeDetectionType.php | 4 +- .../Data}/Importance.php | 2 +- .../MonitorListChangesResponse/Data/Mode.php | 13 + .../MonitorsExtractSemanticChangeSummary.php | 275 ---------- .../ChangeDetectionType.php | 10 - .../Importance.php | 14 - .../TargetType.php | 10 - .../Data/MonitorsPageExactChangeSummary.php | 221 -------- .../ChangeDetectionType.php | 10 - .../TargetType.php | 10 - .../MonitorsPageSemanticChangeSummary.php | 259 ---------- .../ChangeDetectionType.php | 10 - .../Importance.php | 14 - .../TargetType.php | 10 - .../MonitorsSitemapExactChangeSummary.php | 253 ---------- .../ChangeDetectionType.php | 10 - .../TargetType.php | 10 - .../Data/TargetType.php | 14 + src/Monitors/MonitorListParams.php | 99 +++- src/Monitors/MonitorListParams/SearchBy.php | 16 + src/Monitors/MonitorListParams/SearchType.php | 15 + src/Monitors/MonitorListResponse.php | 9 +- src/Monitors/MonitorListResponse/Data.php | 345 ++++++++++++- .../Data/ChangeDetection.php | 41 ++ .../MonitorsExactChangeDetection.php | 50 ++ .../MonitorsSemanticChangeDetection.php} | 33 +- .../MonitorListResponse/Data/Mode.php | 13 + .../Data/MonitorsExtractSemanticMonitor.php | 294 ----------- .../ChangeDetection.php | 102 ---- .../ChangeDetection/Type.php | 10 - .../Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsExtractSemanticMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../Webhook.php | 88 ---- .../Data/MonitorsPageExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../MonitorsPageExactMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../Data/MonitorsPageExactMonitor/Status.php | 14 - .../Data/MonitorsPageExactMonitor/Target.php | 106 ---- .../MonitorsPageExactMonitor/Target/Type.php | 10 - .../Data/MonitorsPageExactMonitor/Webhook.php | 88 ---- .../Data/MonitorsPageSemanticMonitor.php | 294 ----------- .../ChangeDetection.php | 102 ---- .../ChangeDetection/Type.php | 10 - .../MonitorsPageSemanticMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsPageSemanticMonitor/Status.php | 14 - .../MonitorsPageSemanticMonitor/Target.php | 106 ---- .../Target/Type.php | 10 - .../MonitorsPageSemanticMonitor/Webhook.php | 88 ---- .../Data/MonitorsSitemapExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../MonitorsSitemapExactMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsSitemapExactMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../MonitorsSitemapExactMonitor/Webhook.php | 88 ---- .../Data}/Schedule.php | 6 +- .../Data}/Schedule/Type.php | 2 +- .../Data}/Schedule/Unit.php | 2 +- .../Data}/Status.php | 2 +- .../MonitorListResponse/Data/Target.php | 44 ++ .../Data/Target/MonitorsExtractTarget.php} | 32 +- .../Data/Target/MonitorsPageTarget.php} | 33 +- .../Data/Target/MonitorsSitemapTarget.php} | 32 +- .../Data}/Webhook.php | 2 +- src/Monitors/MonitorNewResponse.php | 345 ++++++++++++- .../MonitorNewResponse/ChangeDetection.php | 41 ++ .../MonitorsExactChangeDetection.php | 50 ++ .../MonitorsSemanticChangeDetection.php} | 33 +- src/Monitors/MonitorNewResponse/Mode.php | 13 + .../MonitorsExtractSemanticMonitor.php | 294 ----------- .../ChangeDetection/Type.php | 10 - .../Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsExtractSemanticMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../Webhook.php | 88 ---- .../MonitorsPageExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../MonitorsPageExactMonitor/Target/Type.php | 10 - .../MonitorsPageSemanticMonitor.php | 294 ----------- .../ChangeDetection/Type.php | 10 - .../MonitorsPageSemanticMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsPageSemanticMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../MonitorsPageSemanticMonitor/Webhook.php | 88 ---- .../MonitorsSitemapExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../MonitorsSitemapExactMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsSitemapExactMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../MonitorsSitemapExactMonitor/Webhook.php | 88 ---- .../Schedule.php | 6 +- .../Schedule/Type.php | 2 +- .../Schedule/Unit.php | 2 +- .../Status.php | 2 +- src/Monitors/MonitorNewResponse/Target.php | 44 ++ .../Target/MonitorsExtractTarget.php} | 32 +- .../Target/MonitorsPageTarget.php} | 33 +- .../Target/MonitorsSitemapTarget.php} | 32 +- .../Webhook.php | 2 +- .../Target/MonitorsExtractTarget.php | 2 + .../Target/MonitorsPageTarget.php | 2 + .../Target/MonitorsSitemapTarget.php | 2 + src/Monitors/MonitorUpdateResponse.php | 345 ++++++++++++- .../MonitorUpdateResponse/ChangeDetection.php | 41 ++ .../MonitorsExactChangeDetection.php | 50 ++ .../MonitorsSemanticChangeDetection.php | 97 ++++ src/Monitors/MonitorUpdateResponse/Mode.php | 13 + .../MonitorsExtractSemanticMonitor.php | 294 ----------- .../ChangeDetection.php | 102 ---- .../ChangeDetection/Type.php | 10 - .../Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsExtractSemanticMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../Webhook.php | 88 ---- .../MonitorsPageExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../MonitorsPageExactMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsPageExactMonitor/Status.php | 14 - .../MonitorsPageExactMonitor/Target.php | 106 ---- .../MonitorsPageExactMonitor/Target/Type.php | 10 - .../MonitorsPageExactMonitor/Webhook.php | 88 ---- .../MonitorsPageSemanticMonitor.php | 294 ----------- .../ChangeDetection.php | 102 ---- .../ChangeDetection/Type.php | 10 - .../MonitorsPageSemanticMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsPageSemanticMonitor/Status.php | 14 - .../MonitorsPageSemanticMonitor/Target.php | 106 ---- .../Target/Type.php | 10 - .../MonitorsPageSemanticMonitor/Webhook.php | 88 ---- .../MonitorsSitemapExactMonitor.php | 294 ----------- .../ChangeDetection.php | 71 --- .../ChangeDetection/Type.php | 10 - .../MonitorsSitemapExactMonitor/Schedule.php | 112 ----- .../Schedule/Type.php | 10 - .../Schedule/Unit.php | 14 - .../MonitorsSitemapExactMonitor/Status.php | 14 - .../Target/Type.php | 10 - .../MonitorsSitemapExactMonitor/Webhook.php | 88 ---- .../Schedule.php | 6 +- .../Schedule/Type.php | 2 +- .../Schedule/Unit.php | 2 +- .../Status.php | 2 +- src/Monitors/MonitorUpdateResponse/Target.php | 44 ++ .../Target/MonitorsExtractTarget.php | 191 +++++++ .../Target/MonitorsPageTarget.php | 103 ++++ .../Target/MonitorsSitemapTarget.php | 156 ++++++ .../Webhook.php | 2 +- src/ServiceContracts/MonitorsContract.php | 57 ++- src/ServiceContracts/MonitorsRawContract.php | 20 +- src/Services/MonitorsRawService.php | 34 +- src/Services/MonitorsService.php | 64 ++- tests/Services/MonitorsTest.php | 42 +- 258 files changed, 4279 insertions(+), 13730 deletions(-) create mode 100644 src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsExactChangeDetection.php rename src/Monitors/{MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php => MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php} (64%) delete mode 100644 src/Monitors/MonitorCreateParams/ChangeDetection/Type.php create mode 100644 src/Monitors/MonitorCreateParams/Mode.php rename src/Monitors/{MonitorNewResponse/MonitorsExtractSemanticMonitor/Target.php => MonitorCreateParams/Target/MonitorsExtractTarget.php} (84%) rename src/Monitors/{MonitorNewResponse/MonitorsPageExactMonitor/Target.php => MonitorCreateParams/Target/MonitorsPageTarget.php} (67%) rename src/Monitors/{MonitorNewResponse/MonitorsSitemapExactMonitor/Target.php => MonitorCreateParams/Target/MonitorsSitemapTarget.php} (78%) delete mode 100644 src/Monitors/MonitorCreateParams/Target/Type.php rename src/Monitors/MonitorGetChangeResponse/{MonitorsPageSemanticChange => }/ChangeDetectionType.php (55%) rename src/Monitors/MonitorGetChangeResponse/{MonitorsExtractSemanticChange => }/Evidence.php (85%) rename src/Monitors/MonitorGetChangeResponse/{MonitorsPageSemanticChange => }/Importance.php (62%) create mode 100644 src/Monitors/MonitorGetChangeResponse/Mode.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/TargetType.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/TargetType.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Evidence.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/TargetType.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/TargetType.php create mode 100644 src/Monitors/MonitorGetChangeResponse/TargetType.php create mode 100644 src/Monitors/MonitorGetResponse/ChangeDetection.php create mode 100644 src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsExactChangeDetection.php rename src/Monitors/MonitorGetResponse/{MonitorsPageSemanticMonitor/ChangeDetection.php => ChangeDetection/MonitorsSemanticChangeDetection.php} (64%) create mode 100644 src/Monitors/MonitorGetResponse/Mode.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Status.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target/Type.php rename src/Monitors/MonitorGetResponse/{MonitorsPageExactMonitor => }/Schedule.php (92%) rename src/Monitors/{MonitorNewResponse/MonitorsPageExactMonitor => MonitorGetResponse}/Schedule/Type.php (51%) rename src/Monitors/{MonitorNewResponse/MonitorsPageExactMonitor => MonitorGetResponse}/Schedule/Unit.php (62%) rename src/Monitors/{MonitorNewResponse/MonitorsPageExactMonitor => MonitorGetResponse}/Status.php (65%) create mode 100644 src/Monitors/MonitorGetResponse/Target.php rename src/Monitors/MonitorGetResponse/{MonitorsExtractSemanticMonitor/Target.php => Target/MonitorsExtractTarget.php} (84%) rename src/Monitors/MonitorGetResponse/{MonitorsPageExactMonitor/Target.php => Target/MonitorsPageTarget.php} (67%) rename src/Monitors/MonitorGetResponse/{MonitorsSitemapExactMonitor/Target.php => Target/MonitorsSitemapTarget.php} (78%) rename src/Monitors/MonitorGetResponse/{MonitorsPageExactMonitor => }/Webhook.php (96%) rename src/Monitors/MonitorListAccountChangesResponse/Data/{MonitorsPageSemanticChangeSummary => }/ChangeDetectionType.php (80%) rename src/Monitors/MonitorListAccountChangesResponse/Data/{MonitorsPageSemanticChangeSummary => }/Importance.php (83%) create mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/Mode.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/Importance.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/TargetType.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/TargetType.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/TargetType.php rename src/Monitors/MonitorListAccountChangesResponse/Data/{MonitorsExtractSemanticChangeSummary => }/TargetType.php (71%) rename src/Monitors/{MonitorGetChangeResponse/MonitorsExtractSemanticChange => MonitorListChangesResponse/Data}/ChangeDetectionType.php (53%) rename src/Monitors/{MonitorGetChangeResponse/MonitorsExtractSemanticChange => MonitorListChangesResponse/Data}/Importance.php (61%) create mode 100644 src/Monitors/MonitorListChangesResponse/Data/Mode.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/Importance.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/TargetType.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/TargetType.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/Importance.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/TargetType.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php delete mode 100644 src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/TargetType.php create mode 100644 src/Monitors/MonitorListChangesResponse/Data/TargetType.php create mode 100644 src/Monitors/MonitorListParams/SearchBy.php create mode 100644 src/Monitors/MonitorListParams/SearchType.php create mode 100644 src/Monitors/MonitorListResponse/Data/ChangeDetection.php create mode 100644 src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsExactChangeDetection.php rename src/Monitors/{MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php => MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php} (64%) create mode 100644 src/Monitors/MonitorListResponse/Data/Mode.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Status.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Status.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Status.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Status.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Webhook.php rename src/Monitors/{MonitorNewResponse/MonitorsPageExactMonitor => MonitorListResponse/Data}/Schedule.php (92%) rename src/Monitors/{MonitorGetResponse/MonitorsPageExactMonitor => MonitorListResponse/Data}/Schedule/Type.php (51%) rename src/Monitors/{MonitorGetResponse/MonitorsPageExactMonitor => MonitorListResponse/Data}/Schedule/Unit.php (62%) rename src/Monitors/{MonitorGetResponse/MonitorsPageExactMonitor => MonitorListResponse/Data}/Status.php (65%) create mode 100644 src/Monitors/MonitorListResponse/Data/Target.php rename src/Monitors/{MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target.php => MonitorListResponse/Data/Target/MonitorsExtractTarget.php} (84%) rename src/Monitors/{MonitorNewResponse/MonitorsPageSemanticMonitor/Target.php => MonitorListResponse/Data/Target/MonitorsPageTarget.php} (67%) rename src/Monitors/{MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target.php => MonitorListResponse/Data/Target/MonitorsSitemapTarget.php} (78%) rename src/Monitors/{MonitorNewResponse/MonitorsPageExactMonitor => MonitorListResponse/Data}/Webhook.php (96%) create mode 100644 src/Monitors/MonitorNewResponse/ChangeDetection.php create mode 100644 src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsExactChangeDetection.php rename src/Monitors/MonitorNewResponse/{MonitorsExtractSemanticMonitor/ChangeDetection.php => ChangeDetection/MonitorsSemanticChangeDetection.php} (64%) create mode 100644 src/Monitors/MonitorNewResponse/Mode.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Status.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Status.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Status.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Webhook.php rename src/Monitors/{MonitorGetResponse/MonitorsSitemapExactMonitor => MonitorNewResponse}/Schedule.php (91%) rename src/Monitors/{MonitorGetResponse/MonitorsPageSemanticMonitor => MonitorNewResponse}/Schedule/Type.php (50%) rename src/Monitors/{MonitorGetResponse/MonitorsPageSemanticMonitor => MonitorNewResponse}/Schedule/Unit.php (61%) rename src/Monitors/{MonitorGetResponse/MonitorsPageSemanticMonitor => MonitorNewResponse}/Status.php (64%) create mode 100644 src/Monitors/MonitorNewResponse/Target.php rename src/Monitors/{MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target.php => MonitorNewResponse/Target/MonitorsExtractTarget.php} (84%) rename src/Monitors/{MonitorGetResponse/MonitorsPageSemanticMonitor/Target.php => MonitorNewResponse/Target/MonitorsPageTarget.php} (67%) rename src/Monitors/{MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target.php => MonitorNewResponse/Target/MonitorsSitemapTarget.php} (77%) rename src/Monitors/{MonitorGetResponse/MonitorsPageSemanticMonitor => MonitorNewResponse}/Webhook.php (96%) create mode 100644 src/Monitors/MonitorUpdateResponse/ChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsExactChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php create mode 100644 src/Monitors/MonitorUpdateResponse/Mode.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Status.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Status.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Status.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Webhook.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Status.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target/Type.php delete mode 100644 src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Webhook.php rename src/Monitors/{MonitorGetResponse/MonitorsPageSemanticMonitor => MonitorUpdateResponse}/Schedule.php (91%) rename src/Monitors/{MonitorGetResponse/MonitorsSitemapExactMonitor => MonitorUpdateResponse}/Schedule/Type.php (50%) rename src/Monitors/{MonitorGetResponse/MonitorsSitemapExactMonitor => MonitorUpdateResponse}/Schedule/Unit.php (61%) rename src/Monitors/{MonitorGetResponse/MonitorsSitemapExactMonitor => MonitorUpdateResponse}/Status.php (64%) create mode 100644 src/Monitors/MonitorUpdateResponse/Target.php create mode 100644 src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php create mode 100644 src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php create mode 100644 src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php rename src/Monitors/{MonitorGetResponse/MonitorsSitemapExactMonitor => MonitorUpdateResponse}/Webhook.php (96%) diff --git a/.stats.yml b/.stats.yml index 2f86aeb8..0115b3b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8667763c416101820f5086c97d542bf13bb3bb12b57f5f604da671d9dcea0599.yml -openapi_spec_hash: e33db883d584bc8573897391f3edb105 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-66a3bf68b47ba61c9b61406d36f614a079ff752b8964a8df8062e485391d5598.yml +openapi_spec_hash: b17d6cfe3710dd0605078f3907a1a419 config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/Monitors/MonitorCreateParams.php b/src/Monitors/MonitorCreateParams.php index 58b56b38..292b75b6 100644 --- a/src/Monitors/MonitorCreateParams.php +++ b/src/Monitors/MonitorCreateParams.php @@ -10,8 +10,14 @@ use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; use ContextDev\Monitors\MonitorCreateParams\ChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsExactChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\Mode; use ContextDev\Monitors\MonitorCreateParams\Schedule; use ContextDev\Monitors\MonitorCreateParams\Target; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsExtractTarget; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsPageTarget; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsSitemapTarget; use ContextDev\Monitors\MonitorCreateParams\Webhook; /** @@ -19,16 +25,19 @@ * * @see ContextDev\Services\MonitorsService::create() * + * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection + * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorCreateParams\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorCreateParams\Webhook * * @phpstan-type MonitorCreateParamsShape = array{ - * changeDetection: ChangeDetection|ChangeDetectionShape, + * changeDetection: ChangeDetectionShape, * name: string, * schedule: Schedule|ScheduleShape, - * target: Target|TargetShape, + * target: TargetShape, + * mode?: null|Mode|value-of, * tags?: list|null, * webhook?: null|Webhook|WebhookShape, * } @@ -40,10 +49,12 @@ final class MonitorCreateParams implements BaseModel use SdkParams; /** - * Detect meaning-level changes that match a natural language query. + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; #[Required] public string $name; @@ -54,8 +65,21 @@ final class MonitorCreateParams implements BaseModel #[Required] public Schedule $schedule; - #[Required] - public Target $target; + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of|null $mode + */ + #[Optional(enum: Mode::class)] + public ?string $mode; /** * User-defined tags for grouping and filtering monitors and their changes. @@ -98,17 +122,19 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param ChangeDetectionShape $changeDetection * @param Schedule|ScheduleShape $schedule - * @param Target|TargetShape $target + * @param TargetShape $target + * @param Mode|value-of|null $mode * @param list|null $tags * @param Webhook|WebhookShape|null $webhook */ public static function with( - ChangeDetection|array $changeDetection, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, string $name, Schedule|array $schedule, - Target|array $target, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + Mode|string|null $mode = null, ?array $tags = null, Webhook|array|null $webhook = null, ): self { @@ -119,6 +145,7 @@ public static function with( $self['schedule'] = $schedule; $self['target'] = $target; + null !== $mode && $self['mode'] = $mode; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; @@ -126,12 +153,12 @@ public static function with( } /** - * Detect meaning-level changes that match a natural language query. + * Discriminated union describing how changes are detected. * - * @param ChangeDetection|ChangeDetectionShape $changeDetection + * @param ChangeDetectionShape $changeDetection */ public function withChangeDetection( - ChangeDetection|array $changeDetection + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, ): self { $self = clone $this; $self['changeDetection'] = $changeDetection; @@ -161,16 +188,32 @@ public function withSchedule(Schedule|array $schedule): self } /** - * @param Target|TargetShape $target + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target */ - public function withTarget(Target|array $target): self - { + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { $self = clone $this; $self['target'] = $target; return $self; } + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + /** * User-defined tags for grouping and filtering monitors and their changes. * diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection.php index 6706e21e..c3d29e89 100644 --- a/src/Monitors/MonitorCreateParams/ChangeDetection.php +++ b/src/Monitors/MonitorCreateParams/ChangeDetection.php @@ -4,99 +4,38 @@ namespace ContextDev\Monitors\MonitorCreateParams; -use ContextDev\Core\Attributes\Optional; -use ContextDev\Core\Attributes\Required; -use ContextDev\Core\Concerns\SdkModel; -use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\Type; +use ContextDev\Core\Concerns\SdkUnion; +use ContextDev\Core\Conversion\Contracts\Converter; +use ContextDev\Core\Conversion\Contracts\ConverterSource; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsExactChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsSemanticChangeDetection; /** - * Detect meaning-level changes that match a natural language query. + * Discriminated union describing how changes are detected. * - * @phpstan-type ChangeDetectionShape = array{ - * query: string, type: Type|value-of, confidenceThreshold?: float|null - * } + * @phpstan-import-type MonitorsExactChangeDetectionShape from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsExactChangeDetection + * @phpstan-import-type MonitorsSemanticChangeDetectionShape from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsSemanticChangeDetection + * + * @phpstan-type ChangeDetectionVariants = MonitorsExactChangeDetection|MonitorsSemanticChangeDetection + * @phpstan-type ChangeDetectionShape = ChangeDetectionVariants|MonitorsExactChangeDetectionShape|MonitorsSemanticChangeDetectionShape */ -final class ChangeDetection implements BaseModel +final class ChangeDetection implements ConverterSource { - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $query; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Optional('confidence_threshold')] - public ?float $confidenceThreshold; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(query: ..., type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - string $query, - Type|string $type, - ?float $confidenceThreshold = null - ): self { - $self = new self; - - $self['query'] = $query; - $self['type'] = $type; - - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + use SdkUnion; - return $self; - } - - public function withQuery(string $query): self + public static function discriminator(): string { - $self = clone $this; - $self['query'] = $query; - - return $self; + return 'type'; } /** - * @param Type|value-of $type + * @return list|array */ - public function withType(Type|string $type): self + public static function variants(): array { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withConfidenceThreshold(float $confidenceThreshold): self - { - $self = clone $this; - $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; } } diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 00000000..d69644b1 --- /dev/null +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php similarity index 64% rename from src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php rename to src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php index 7ba9992f..8297408e 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection.php +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -2,48 +2,47 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor; +namespace ContextDev\Monitors\MonitorCreateParams\ChangeDetection; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor\ChangeDetection\Type; /** * Detect meaning-level changes that match a natural language query. * - * @phpstan-type ChangeDetectionShape = array{ - * query: string, type: Type|value-of, confidenceThreshold?: float|null + * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ + * query: string, type: 'semantic', confidenceThreshold?: float|null * } */ -final class ChangeDetection implements BaseModel +final class MonitorsSemanticChangeDetection implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; + /** @var 'semantic' $type */ #[Required] - public string $query; + public string $type = 'semantic'; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + #[Required] + public string $query; #[Optional('confidence_threshold')] public ?float $confidenceThreshold; /** - * `new ChangeDetection()` is missing required properties by the API. + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ChangeDetection::with(query: ..., type: ...) + * MonitorsSemanticChangeDetection::with(query: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) + * (new MonitorsSemanticChangeDetection)->withQuery(...) * ``` */ public function __construct() @@ -55,18 +54,14 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( string $query, - Type|string $type, ?float $confidenceThreshold = null ): self { $self = new self; $self['query'] = $query; - $self['type'] = $type; null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; @@ -82,9 +77,9 @@ public function withQuery(string $query): self } /** - * @param Type|value-of $type + * @param 'semantic' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/Type.php b/src/Monitors/MonitorCreateParams/ChangeDetection/Type.php deleted file mode 100644 index 7c5304e6..00000000 --- a/src/Monitors/MonitorCreateParams/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * url: string, - * followSubdomains?: bool|null, - * instructions?: string|null, - * maxDepth?: int|null, - * maxPages?: int|null, - * schema?: array|null, - * } + * Discriminated union describing what the monitor watches. + * + * @phpstan-import-type MonitorsPageTargetShape from \ContextDev\Monitors\MonitorCreateParams\Target\MonitorsPageTarget + * @phpstan-import-type MonitorsSitemapTargetShape from \ContextDev\Monitors\MonitorCreateParams\Target\MonitorsSitemapTarget + * @phpstan-import-type MonitorsExtractTargetShape from \ContextDev\Monitors\MonitorCreateParams\Target\MonitorsExtractTarget + * + * @phpstan-type TargetVariants = MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget + * @phpstan-type TargetShape = TargetVariants|MonitorsPageTargetShape|MonitorsSitemapTargetShape|MonitorsExtractTargetShape */ -final class Target implements BaseModel +final class Target implements ConverterSource { - /** @use SdkModel */ - use SdkModel; + use SdkUnion; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * Root URL to extract structured data from. - */ - #[Required] - public string $url; - - #[Optional('follow_subdomains')] - public ?bool $followSubdomains; - - /** - * Optional natural-language instructions guiding what to extract. - */ - #[Optional] - public ?string $instructions; - - /** - * Optional maximum link depth from the starting URL (0 = only the starting page). - */ - #[Optional('max_depth')] - public ?int $maxDepth; - - /** - * Maximum number of pages to analyze during extraction. - */ - #[Optional('max_pages')] - public ?int $maxPages; - - /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. - * - * @var array|null $schema - */ - #[Optional(map: 'mixed')] - public ?array $schema; - - /** - * `new Target()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Target::with(type: ..., url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Target)->withType(...)->withURL(...) - * ``` - */ - public function __construct() + public static function discriminator(): string { - $this->initialize(); + return 'type'; } /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param array|null $schema + * @return list|array */ - public static function with( - Type|string $type, - string $url, - ?bool $followSubdomains = null, - ?string $instructions = null, - ?int $maxDepth = null, - ?int $maxPages = null, - ?array $schema = null, - ): self { - $self = new self; - - $self['type'] = $type; - $self['url'] = $url; - - null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; - null !== $instructions && $self['instructions'] = $instructions; - null !== $maxDepth && $self['maxDepth'] = $maxDepth; - null !== $maxPages && $self['maxPages'] = $maxPages; - null !== $schema && $self['schema'] = $schema; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self + public static function variants(): array { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * Root URL to extract structured data from. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - public function withFollowSubdomains(bool $followSubdomains): self - { - $self = clone $this; - $self['followSubdomains'] = $followSubdomains; - - return $self; - } - - /** - * Optional natural-language instructions guiding what to extract. - */ - public function withInstructions(string $instructions): self - { - $self = clone $this; - $self['instructions'] = $instructions; - - return $self; - } - - /** - * Optional maximum link depth from the starting URL (0 = only the starting page). - */ - public function withMaxDepth(int $maxDepth): self - { - $self = clone $this; - $self['maxDepth'] = $maxDepth; - - return $self; - } - - /** - * Maximum number of pages to analyze during extraction. - */ - public function withMaxPages(int $maxPages): self - { - $self = clone $this; - $self['maxPages'] = $maxPages; - - return $self; - } - - /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. - * - * @param array $schema - */ - public function withSchema(array $schema): self - { - $self = clone $this; - $self['schema'] = $schema; - - return $self; + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; } } diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target.php b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php similarity index 84% rename from src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target.php rename to src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php index a833cbb0..05903625 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Target.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php @@ -2,17 +2,18 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor; +namespace ContextDev\Monitors\MonitorCreateParams\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a site's extracted structured data. + * + * @phpstan-type MonitorsExtractTargetShape = array{ + * type: 'extract', * url: string, * followSubdomains?: bool|null, * instructions?: string|null, @@ -21,14 +22,14 @@ * schema?: array|null, * } */ -final class Target implements BaseModel +final class MonitorsExtractTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; /** * Root URL to extract structured data from. @@ -66,17 +67,17 @@ final class Target implements BaseModel public ?array $schema; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsExtractTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsExtractTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsExtractTarget)->withURL(...) * ``` */ public function __construct() @@ -89,11 +90,9 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param array|null $schema */ public static function with( - Type|string $type, string $url, ?bool $followSubdomains = null, ?string $instructions = null, @@ -103,7 +102,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; @@ -116,9 +114,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'extract' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target.php b/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php similarity index 67% rename from src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target.php rename to src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php index 7e3beeb2..c5908acc 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Target.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php @@ -2,27 +2,28 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; +namespace ContextDev\Monitors\MonitorCreateParams\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, url: string, normalizeWhitespace?: bool|null + * Watch a single web page. + * + * @phpstan-type MonitorsPageTargetShape = array{ + * type: 'page', url: string, normalizeWhitespace?: bool|null * } */ -final class Target implements BaseModel +final class MonitorsPageTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; #[Required] public string $url; @@ -34,17 +35,17 @@ final class Target implements BaseModel public ?bool $normalizeWhitespace; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsPageTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsPageTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsPageTarget)->withURL(...) * ``` */ public function __construct() @@ -56,17 +57,13 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( - Type|string $type, string $url, ?bool $normalizeWhitespace = null ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; @@ -75,9 +72,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'page' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target.php b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php similarity index 78% rename from src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target.php rename to src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php index ca31f7bc..f0bf27e5 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Target.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php @@ -2,31 +2,32 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor; +namespace ContextDev\Monitors\MonitorCreateParams\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a sitemap for URL additions and removals. + * + * @phpstan-type MonitorsSitemapTargetShape = array{ + * type: 'sitemap', * url: string, * exclude?: list|null, * include?: list|null, * maxURLs?: int|null, * } */ -final class Target implements BaseModel +final class MonitorsSitemapTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; /** * Sitemap URL to monitor. @@ -54,17 +55,17 @@ final class Target implements BaseModel public ?int $maxURLs; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsSitemapTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsSitemapTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsSitemapTarget)->withURL(...) * ``` */ public function __construct() @@ -77,12 +78,10 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param list|null $exclude * @param list|null $include */ public static function with( - Type|string $type, string $url, ?array $exclude = null, ?array $include = null, @@ -90,7 +89,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $exclude && $self['exclude'] = $exclude; @@ -101,9 +99,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'sitemap' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorCreateParams/Target/Type.php b/src/Monitors/MonitorCreateParams/Target/Type.php deleted file mode 100644 index 036fedf3..00000000 --- a/src/Monitors/MonitorCreateParams/Target/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, + * detectedAt: \DateTimeInterface, + * mode: Mode|value-of, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * addedURLCount?: int|null, + * addedURLs?: list|null, + * afterTextExcerpt?: string|null, + * beforeTextExcerpt?: string|null, + * confidence?: float|null, + * diff?: string|null, + * evidence?: list|null, + * importance?: null|Importance|value-of, + * matchedURLCount?: int|null, + * matchedURLs?: list|null, + * query?: string|null, + * removedURLCount?: int|null, + * removedURLs?: list|null, + * tags?: list|null, + * } */ -final class MonitorGetChangeResponse implements ConverterSource +final class MonitorGetChangeResponse implements BaseModel { - use SdkUnion; + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + #[Optional('added_url_count')] + public ?int $addedURLCount; + + /** @var list|null $addedURLs */ + #[Optional('added_urls', list: 'string')] + public ?array $addedURLs; + + #[Optional('after_text_excerpt')] + public ?string $afterTextExcerpt; + + #[Optional('before_text_excerpt')] + public ?string $beforeTextExcerpt; + + #[Optional] + public ?float $confidence; + + /** + * Text diff between the previous and current page baseline (page targets). + */ + #[Optional] + public ?string $diff; + + /** @var list|null $evidence */ + #[Optional(list: Evidence::class)] + public ?array $evidence; + + /** @var value-of|null $importance */ + #[Optional(enum: Importance::class)] + public ?string $importance; + + #[Optional('matched_url_count')] + public ?int $matchedURLCount; + + /** @var list|null $matchedURLs */ + #[Optional('matched_urls', list: 'string')] + public ?array $matchedURLs; + + #[Optional] + public ?string $query; + + #[Optional('removed_url_count')] + public ?int $removedURLCount; + + /** @var list|null $removedURLs */ + #[Optional('removed_urls', list: 'string')] + public ?array $removedURLs; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new MonitorGetChangeResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorGetChangeResponse::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * mode: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorGetChangeResponse) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMode(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Mode|value-of $mode + * @param TargetType|value-of $targetType + * @param list|null $addedURLs + * @param list|null $evidence + * @param Importance|value-of|null $importance + * @param list|null $matchedURLs + * @param list|null $removedURLs + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + Mode|string $mode, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?int $addedURLCount = null, + ?array $addedURLs = null, + ?string $afterTextExcerpt = null, + ?string $beforeTextExcerpt = null, + ?float $confidence = null, + ?string $diff = null, + ?array $evidence = null, + Importance|string|null $importance = null, + ?int $matchedURLCount = null, + ?array $matchedURLs = null, + ?string $query = null, + ?int $removedURLCount = null, + ?array $removedURLs = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['mode'] = $mode; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $addedURLCount && $self['addedURLCount'] = $addedURLCount; + null !== $addedURLs && $self['addedURLs'] = $addedURLs; + null !== $afterTextExcerpt && $self['afterTextExcerpt'] = $afterTextExcerpt; + null !== $beforeTextExcerpt && $self['beforeTextExcerpt'] = $beforeTextExcerpt; + null !== $confidence && $self['confidence'] = $confidence; + null !== $diff && $self['diff'] = $diff; + null !== $evidence && $self['evidence'] = $evidence; + null !== $importance && $self['importance'] = $importance; + null !== $matchedURLCount && $self['matchedURLCount'] = $matchedURLCount; + null !== $matchedURLs && $self['matchedURLs'] = $matchedURLs; + null !== $query && $self['query'] = $query; + null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; + null !== $removedURLs && $self['removedURLs'] = $removedURLs; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } /** - * @return list|array + * @param ChangeDetectionType|value-of $changeDetectionType */ - public static function variants(): array + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self { - return [ - MonitorsPageExactChange::class, - MonitorsSitemapExactChange::class, - MonitorsPageSemanticChange::class, - MonitorsExtractSemanticChange::class, - ]; + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + /** + * @param list $addedURLs + */ + public function withAddedURLs(array $addedURLs): self + { + $self = clone $this; + $self['addedURLs'] = $addedURLs; + + return $self; + } + + public function withAfterTextExcerpt(string $afterTextExcerpt): self + { + $self = clone $this; + $self['afterTextExcerpt'] = $afterTextExcerpt; + + return $self; + } + + public function withBeforeTextExcerpt(string $beforeTextExcerpt): self + { + $self = clone $this; + $self['beforeTextExcerpt'] = $beforeTextExcerpt; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * Text diff between the previous and current page baseline (page targets). + */ + public function withDiff(string $diff): self + { + $self = clone $this; + $self['diff'] = $diff; + + return $self; + } + + /** + * @param list $evidence + */ + public function withEvidence(array $evidence): self + { + $self = clone $this; + $self['evidence'] = $evidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + /** + * @param list $matchedURLs + */ + public function withMatchedURLs(array $matchedURLs): self + { + $self = clone $this; + $self['matchedURLs'] = $matchedURLs; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } + + /** + * @param list $removedURLs + */ + public function withRemovedURLs(array $removedURLs): self + { + $self = clone $this; + $self['removedURLs'] = $removedURLs; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; } } diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/ChangeDetectionType.php similarity index 55% rename from src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/ChangeDetectionType.php rename to src/Monitors/MonitorGetChangeResponse/ChangeDetectionType.php index ddb88ec3..7b921c47 100644 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/ChangeDetectionType.php +++ b/src/Monitors/MonitorGetChangeResponse/ChangeDetectionType.php @@ -2,9 +2,11 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageSemanticChange; +namespace ContextDev\Monitors\MonitorGetChangeResponse; enum ChangeDetectionType: string { + case EXACT = 'exact'; + case SEMANTIC = 'semantic'; } diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Evidence.php b/src/Monitors/MonitorGetChangeResponse/Evidence.php similarity index 85% rename from src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Evidence.php rename to src/Monitors/MonitorGetChangeResponse/Evidence.php index 67b4d015..f55b5948 100644 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Evidence.php +++ b/src/Monitors/MonitorGetChangeResponse/Evidence.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetChangeResponse\MonitorsExtractSemanticChange; +namespace ContextDev\Monitors\MonitorGetChangeResponse; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; @@ -20,19 +20,19 @@ final class Evidence implements BaseModel use SdkModel; /** - * Snapshot of the extracted data after the change. + * Snapshot of the content after the change. */ #[Required] public string $after; /** - * Snapshot of the extracted data before the change. + * Snapshot of the content before the change. */ #[Required] public string $before; /** - * Optional URL the evidence relates to. Absent for whole-target extract diffs. + * Optional URL the evidence relates to. Absent for whole-target diffs. */ #[Optional] public ?string $url; @@ -77,7 +77,7 @@ public static function with( } /** - * Snapshot of the extracted data after the change. + * Snapshot of the content after the change. */ public function withAfter(string $after): self { @@ -88,7 +88,7 @@ public function withAfter(string $after): self } /** - * Snapshot of the extracted data before the change. + * Snapshot of the content before the change. */ public function withBefore(string $before): self { @@ -99,7 +99,7 @@ public function withBefore(string $before): self } /** - * Optional URL the evidence relates to. Absent for whole-target extract diffs. + * Optional URL the evidence relates to. Absent for whole-target diffs. */ public function withURL(string $url): self { diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Importance.php b/src/Monitors/MonitorGetChangeResponse/Importance.php similarity index 62% rename from src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Importance.php rename to src/Monitors/MonitorGetChangeResponse/Importance.php index 59f3d57d..61ba1c32 100644 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Importance.php +++ b/src/Monitors/MonitorGetChangeResponse/Importance.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageSemanticChange; +namespace ContextDev\Monitors\MonitorGetChangeResponse; enum Importance: string { diff --git a/src/Monitors/MonitorGetChangeResponse/Mode.php b/src/Monitors/MonitorGetChangeResponse/Mode.php new file mode 100644 index 00000000..624bfeb9 --- /dev/null +++ b/src/Monitors/MonitorGetChangeResponse/Mode.php @@ -0,0 +1,13 @@ +, - * confidence: float, - * detectedAt: \DateTimeInterface, - * evidence: list, - * importance: Importance|value-of, - * matchedURLCount: int, - * matchedURLs: list, - * monitorID: string, - * query: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsExtractSemanticChange implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required] - public float $confidence; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - /** @var list $evidence */ - #[Required(list: Evidence::class)] - public array $evidence; - - /** @var value-of $importance */ - #[Required(enum: Importance::class)] - public string $importance; - - #[Required('matched_url_count')] - public int $matchedURLCount; - - /** @var list $matchedURLs */ - #[Required('matched_urls', list: 'string')] - public array $matchedURLs; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $query; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - /** - * Root URL of the extract target. - */ - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsExtractSemanticChange()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsExtractSemanticChange::with( - * id: ..., - * changeDetectionType: ..., - * confidence: ..., - * detectedAt: ..., - * evidence: ..., - * importance: ..., - * matchedURLCount: ..., - * matchedURLs: ..., - * monitorID: ..., - * query: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsExtractSemanticChange) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withConfidence(...) - * ->withDetectedAt(...) - * ->withEvidence(...) - * ->withImportance(...) - * ->withMatchedURLCount(...) - * ->withMatchedURLs(...) - * ->withMonitorID(...) - * ->withQuery(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param list $evidence - * @param Importance|value-of $importance - * @param list $matchedURLs - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - float $confidence, - \DateTimeInterface $detectedAt, - array $evidence, - Importance|string $importance, - int $matchedURLCount, - array $matchedURLs, - string $monitorID, - string $query, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['confidence'] = $confidence; - $self['detectedAt'] = $detectedAt; - $self['evidence'] = $evidence; - $self['importance'] = $importance; - $self['matchedURLCount'] = $matchedURLCount; - $self['matchedURLs'] = $matchedURLs; - $self['monitorID'] = $monitorID; - $self['query'] = $query; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withConfidence(float $confidence): self - { - $self = clone $this; - $self['confidence'] = $confidence; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - /** - * @param list $evidence - */ - public function withEvidence(array $evidence): self - { - $self = clone $this; - $self['evidence'] = $evidence; - - return $self; - } - - /** - * @param Importance|value-of $importance - */ - public function withImportance(Importance|string $importance): self - { - $self = clone $this; - $self['importance'] = $importance; - - return $self; - } - - public function withMatchedURLCount(int $matchedURLCount): self - { - $self = clone $this; - $self['matchedURLCount'] = $matchedURLCount; - - return $self; - } - - /** - * @param list $matchedURLs - */ - public function withMatchedURLs(array $matchedURLs): self - { - $self = clone $this; - $self['matchedURLs'] = $matchedURLs; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - /** - * Root URL of the extract target. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/TargetType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/TargetType.php deleted file mode 100644 index d915bbb0..00000000 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/TargetType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * detectedAt: \DateTimeInterface, - * diff: string, - * monitorID: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * afterTextExcerpt?: string|null, - * beforeTextExcerpt?: string|null, - * tags?: list|null, - * } - */ -final class MonitorsPageExactChange implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - /** - * Text diff between the previous and current page baseline. - */ - #[Required] - public string $diff; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - #[Optional('after_text_excerpt')] - public ?string $afterTextExcerpt; - - #[Optional('before_text_excerpt')] - public ?string $beforeTextExcerpt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsPageExactChange()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageExactChange::with( - * id: ..., - * changeDetectionType: ..., - * detectedAt: ..., - * diff: ..., - * monitorID: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageExactChange) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withDetectedAt(...) - * ->withDiff(...) - * ->withMonitorID(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - \DateTimeInterface $detectedAt, - string $diff, - string $monitorID, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?string $afterTextExcerpt = null, - ?string $beforeTextExcerpt = null, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['detectedAt'] = $detectedAt; - $self['diff'] = $diff; - $self['monitorID'] = $monitorID; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $afterTextExcerpt && $self['afterTextExcerpt'] = $afterTextExcerpt; - null !== $beforeTextExcerpt && $self['beforeTextExcerpt'] = $beforeTextExcerpt; - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - /** - * Text diff between the previous and current page baseline. - */ - public function withDiff(string $diff): self - { - $self = clone $this; - $self['diff'] = $diff; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - public function withAfterTextExcerpt(string $afterTextExcerpt): self - { - $self = clone $this; - $self['afterTextExcerpt'] = $afterTextExcerpt; - - return $self; - } - - public function withBeforeTextExcerpt(string $beforeTextExcerpt): self - { - $self = clone $this; - $self['beforeTextExcerpt'] = $beforeTextExcerpt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php deleted file mode 100644 index 9933c2af..00000000 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsPageExactChange/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * confidence: float, - * detectedAt: \DateTimeInterface, - * evidence: list, - * importance: Importance|value-of, - * monitorID: string, - * query: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsPageSemanticChange implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required] - public float $confidence; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - /** @var list $evidence */ - #[Required(list: Evidence::class)] - public array $evidence; - - /** @var value-of $importance */ - #[Required(enum: Importance::class)] - public string $importance; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $query; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsPageSemanticChange()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageSemanticChange::with( - * id: ..., - * changeDetectionType: ..., - * confidence: ..., - * detectedAt: ..., - * evidence: ..., - * importance: ..., - * monitorID: ..., - * query: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageSemanticChange) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withConfidence(...) - * ->withDetectedAt(...) - * ->withEvidence(...) - * ->withImportance(...) - * ->withMonitorID(...) - * ->withQuery(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param list $evidence - * @param Importance|value-of $importance - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - float $confidence, - \DateTimeInterface $detectedAt, - array $evidence, - Importance|string $importance, - string $monitorID, - string $query, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['confidence'] = $confidence; - $self['detectedAt'] = $detectedAt; - $self['evidence'] = $evidence; - $self['importance'] = $importance; - $self['monitorID'] = $monitorID; - $self['query'] = $query; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withConfidence(float $confidence): self - { - $self = clone $this; - $self['confidence'] = $confidence; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - /** - * @param list $evidence - */ - public function withEvidence(array $evidence): self - { - $self = clone $this; - $self['evidence'] = $evidence; - - return $self; - } - - /** - * @param Importance|value-of $importance - */ - public function withImportance(Importance|string $importance): self - { - $self = clone $this; - $self['importance'] = $importance; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Evidence.php b/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Evidence.php deleted file mode 100644 index e64b0174..00000000 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/Evidence.php +++ /dev/null @@ -1,74 +0,0 @@ - */ - use SdkModel; - - #[Required] - public string $after; - - #[Required] - public string $before; - - /** - * `new Evidence()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Evidence::with(after: ..., before: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Evidence)->withAfter(...)->withBefore(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $after, string $before): self - { - $self = new self; - - $self['after'] = $after; - $self['before'] = $before; - - return $self; - } - - public function withAfter(string $after): self - { - $self = clone $this; - $self['after'] = $after; - - return $self; - } - - public function withBefore(string $before): self - { - $self = clone $this; - $self['before'] = $before; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/TargetType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/TargetType.php deleted file mode 100644 index 4e7563fc..00000000 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsPageSemanticChange/TargetType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * changeDetectionType: ChangeDetectionType|value-of, - * detectedAt: \DateTimeInterface, - * monitorID: string, - * removedURLCount: int, - * removedURLs: list, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsSitemapExactChange implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - #[Required('added_url_count')] - public int $addedURLCount; - - /** @var list $addedURLs */ - #[Required('added_urls', list: 'string')] - public array $addedURLs; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required('removed_url_count')] - public int $removedURLCount; - - /** @var list $removedURLs */ - #[Required('removed_urls', list: 'string')] - public array $removedURLs; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsSitemapExactChange()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSitemapExactChange::with( - * id: ..., - * addedURLCount: ..., - * addedURLs: ..., - * changeDetectionType: ..., - * detectedAt: ..., - * monitorID: ..., - * removedURLCount: ..., - * removedURLs: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSitemapExactChange) - * ->withID(...) - * ->withAddedURLCount(...) - * ->withAddedURLs(...) - * ->withChangeDetectionType(...) - * ->withDetectedAt(...) - * ->withMonitorID(...) - * ->withRemovedURLCount(...) - * ->withRemovedURLs(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list $addedURLs - * @param ChangeDetectionType|value-of $changeDetectionType - * @param list $removedURLs - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - int $addedURLCount, - array $addedURLs, - ChangeDetectionType|string $changeDetectionType, - \DateTimeInterface $detectedAt, - string $monitorID, - int $removedURLCount, - array $removedURLs, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['addedURLCount'] = $addedURLCount; - $self['addedURLs'] = $addedURLs; - $self['changeDetectionType'] = $changeDetectionType; - $self['detectedAt'] = $detectedAt; - $self['monitorID'] = $monitorID; - $self['removedURLCount'] = $removedURLCount; - $self['removedURLs'] = $removedURLs; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - public function withAddedURLCount(int $addedURLCount): self - { - $self = clone $this; - $self['addedURLCount'] = $addedURLCount; - - return $self; - } - - /** - * @param list $addedURLs - */ - public function withAddedURLs(array $addedURLs): self - { - $self = clone $this; - $self['addedURLs'] = $addedURLs; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withRemovedURLCount(int $removedURLCount): self - { - $self = clone $this; - $self['removedURLCount'] = $removedURLCount; - - return $self; - } - - /** - * @param list $removedURLs - */ - public function withRemovedURLs(array $removedURLs): self - { - $self = clone $this; - $self['removedURLs'] = $removedURLs; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php b/src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php deleted file mode 100644 index c43f35e6..00000000 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsSitemapExactChange/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } */ -final class MonitorGetResponse implements ConverterSource +final class MonitorGetResponse implements BaseModel { - use SdkUnion; + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorGetResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorGetResponse::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorGetResponse) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } /** - * @return list|array + * @param Status|value-of $status */ - public static function variants(): array + public function withStatus(Status|string $status): self { - return [ - MonitorsPageExactMonitor::class, - MonitorsSitemapExactMonitor::class, - MonitorsPageSemanticMonitor::class, - MonitorsExtractSemanticMonitor::class, - ]; + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; } } diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection.php new file mode 100644 index 00000000..35d59250 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 00000000..0aada696 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php similarity index 64% rename from src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection.php rename to src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index 47bc9f55..c7046049 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection.php +++ b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -2,48 +2,47 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor; +namespace ContextDev\Monitors\MonitorGetResponse\ChangeDetection; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor\ChangeDetection\Type; /** * Detect meaning-level changes that match a natural language query. * - * @phpstan-type ChangeDetectionShape = array{ - * query: string, type: Type|value-of, confidenceThreshold?: float|null + * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ + * query: string, type: 'semantic', confidenceThreshold?: float|null * } */ -final class ChangeDetection implements BaseModel +final class MonitorsSemanticChangeDetection implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; + /** @var 'semantic' $type */ #[Required] - public string $query; + public string $type = 'semantic'; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + #[Required] + public string $query; #[Optional('confidence_threshold')] public ?float $confidenceThreshold; /** - * `new ChangeDetection()` is missing required properties by the API. + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ChangeDetection::with(query: ..., type: ...) + * MonitorsSemanticChangeDetection::with(query: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) + * (new MonitorsSemanticChangeDetection)->withQuery(...) * ``` */ public function __construct() @@ -55,18 +54,14 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( string $query, - Type|string $type, ?float $confidenceThreshold = null ): self { $self = new self; $self['query'] = $query; - $self['type'] = $type; null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; @@ -82,9 +77,9 @@ public function withQuery(string $query): self } /** - * @param Type|value-of $type + * @param 'semantic' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorGetResponse/Mode.php b/src/Monitors/MonitorGetResponse/Mode.php new file mode 100644 index 00000000..d7261b4f --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Mode.php @@ -0,0 +1,13 @@ +, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsExtractSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsExtractSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsExtractSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index 7122a0db..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php deleted file mode 100644 index fe55ef02..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php deleted file mode 100644 index be585cfa..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php deleted file mode 100644 index 7d341e4d..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index c0dbee3d..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index 4dff921f..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsSitemapExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSitemapExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSitemapExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php deleted file mode 100644 index d658a65e..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index 46d294de..00000000 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target.php b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php similarity index 84% rename from src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target.php rename to src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php index 1feee751..c5d50b5d 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/Target.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php @@ -2,17 +2,18 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor; +namespace ContextDev\Monitors\MonitorGetResponse\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a site's extracted structured data. + * + * @phpstan-type MonitorsExtractTargetShape = array{ + * type: 'extract', * url: string, * followSubdomains?: bool|null, * instructions?: string|null, @@ -21,14 +22,14 @@ * schema?: array|null, * } */ -final class Target implements BaseModel +final class MonitorsExtractTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; /** * Root URL to extract structured data from. @@ -66,17 +67,17 @@ final class Target implements BaseModel public ?array $schema; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsExtractTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsExtractTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsExtractTarget)->withURL(...) * ``` */ public function __construct() @@ -89,11 +90,9 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param array|null $schema */ public static function with( - Type|string $type, string $url, ?bool $followSubdomains = null, ?string $instructions = null, @@ -103,7 +102,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; @@ -116,9 +114,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'extract' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target.php b/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php similarity index 67% rename from src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target.php rename to src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php index d22f74da..0689dc39 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Target.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php @@ -2,27 +2,28 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor; +namespace ContextDev\Monitors\MonitorGetResponse\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, url: string, normalizeWhitespace?: bool|null + * Watch a single web page. + * + * @phpstan-type MonitorsPageTargetShape = array{ + * type: 'page', url: string, normalizeWhitespace?: bool|null * } */ -final class Target implements BaseModel +final class MonitorsPageTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; #[Required] public string $url; @@ -34,17 +35,17 @@ final class Target implements BaseModel public ?bool $normalizeWhitespace; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsPageTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsPageTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsPageTarget)->withURL(...) * ``` */ public function __construct() @@ -56,17 +57,13 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( - Type|string $type, string $url, ?bool $normalizeWhitespace = null ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; @@ -75,9 +72,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'page' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target.php b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php similarity index 78% rename from src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target.php rename to src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php index 52190f49..9ff46192 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Target.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php @@ -2,31 +2,32 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor; +namespace ContextDev\Monitors\MonitorGetResponse\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a sitemap for URL additions and removals. + * + * @phpstan-type MonitorsSitemapTargetShape = array{ + * type: 'sitemap', * url: string, * exclude?: list|null, * include?: list|null, * maxURLs?: int|null, * } */ -final class Target implements BaseModel +final class MonitorsSitemapTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; /** * Sitemap URL to monitor. @@ -54,17 +55,17 @@ final class Target implements BaseModel public ?int $maxURLs; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsSitemapTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsSitemapTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsSitemapTarget)->withURL(...) * ``` */ public function __construct() @@ -77,12 +78,10 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param list|null $exclude * @param list|null $include */ public static function with( - Type|string $type, string $url, ?array $exclude = null, ?array $include = null, @@ -90,7 +89,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $exclude && $self['exclude'] = $exclude; @@ -101,9 +99,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'sitemap' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Webhook.php b/src/Monitors/MonitorGetResponse/Webhook.php similarity index 96% rename from src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Webhook.php rename to src/Monitors/MonitorGetResponse/Webhook.php index 42f1c62f..a54b4a2b 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Webhook.php +++ b/src/Monitors/MonitorGetResponse/Webhook.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor; +namespace ContextDev\Monitors\MonitorGetResponse; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; diff --git a/src/Monitors/MonitorListAccountChangesResponse.php b/src/Monitors/MonitorListAccountChangesResponse.php index 22f27d12..231bc5b3 100644 --- a/src/Monitors/MonitorListAccountChangesResponse.php +++ b/src/Monitors/MonitorListAccountChangesResponse.php @@ -10,11 +10,10 @@ use ContextDev\Monitors\MonitorListAccountChangesResponse\Data; /** - * @phpstan-import-type DataVariants from \ContextDev\Monitors\MonitorListAccountChangesResponse\Data * @phpstan-import-type DataShape from \ContextDev\Monitors\MonitorListAccountChangesResponse\Data * * @phpstan-type MonitorListAccountChangesResponseShape = array{ - * data: list, hasMore: bool, nextCursor: string|null + * data: list, hasMore: bool, nextCursor: string|null * } */ final class MonitorListAccountChangesResponse implements BaseModel @@ -22,7 +21,7 @@ final class MonitorListAccountChangesResponse implements BaseModel /** @use SdkModel */ use SdkModel; - /** @var list $data */ + /** @var list $data */ #[Required(list: Data::class)] public array $data; @@ -61,7 +60,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $data + * @param list $data */ public static function with( array $data, @@ -78,7 +77,7 @@ public static function with( } /** - * @param list $data + * @param list $data */ public function withData(array $data): self { diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data.php b/src/Monitors/MonitorListAccountChangesResponse/Data.php index e1a18ad5..9d2a5609 100644 --- a/src/Monitors/MonitorListAccountChangesResponse/Data.php +++ b/src/Monitors/MonitorListAccountChangesResponse/Data.php @@ -4,39 +4,324 @@ namespace ContextDev\Monitors\MonitorListAccountChangesResponse; -use ContextDev\Core\Concerns\SdkUnion; -use ContextDev\Core\Conversion\Contracts\Converter; -use ContextDev\Core\Conversion\Contracts\ConverterSource; -use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsExtractSemanticChangeSummary; -use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsPageExactChangeSummary; -use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsPageSemanticChangeSummary; -use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsSitemapExactChangeSummary; +use ContextDev\Core\Attributes\Optional; +use ContextDev\Core\Attributes\Required; +use ContextDev\Core\Concerns\SdkModel; +use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\ChangeDetectionType; +use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\Importance; +use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\Mode; +use ContextDev\Monitors\MonitorListAccountChangesResponse\Data\TargetType; /** - * Union of lightweight change summaries. + * A lightweight change summary. `mode` is the constant `web`; `target_type` and `change_detection_type` describe the change, and which optional fields are present depends on them (e.g. sitemap changes include `added_url_count`/`removed_url_count`; semantic changes include `confidence`/`importance`). * - * @phpstan-import-type MonitorsPageExactChangeSummaryShape from \ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsPageExactChangeSummary - * @phpstan-import-type MonitorsSitemapExactChangeSummaryShape from \ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsSitemapExactChangeSummary - * @phpstan-import-type MonitorsPageSemanticChangeSummaryShape from \ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsPageSemanticChangeSummary - * @phpstan-import-type MonitorsExtractSemanticChangeSummaryShape from \ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsExtractSemanticChangeSummary - * - * @phpstan-type DataVariants = MonitorsPageExactChangeSummary|MonitorsSitemapExactChangeSummary|MonitorsPageSemanticChangeSummary|MonitorsExtractSemanticChangeSummary - * @phpstan-type DataShape = DataVariants|MonitorsPageExactChangeSummaryShape|MonitorsSitemapExactChangeSummaryShape|MonitorsPageSemanticChangeSummaryShape|MonitorsExtractSemanticChangeSummaryShape + * @phpstan-type DataShape = array{ + * id: string, + * changeDetectionType: ChangeDetectionType|value-of, + * detectedAt: \DateTimeInterface, + * mode: Mode|value-of, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * addedURLCount?: int|null, + * confidence?: float|null, + * importance?: null|Importance|value-of, + * matchedURLCount?: int|null, + * removedURLCount?: int|null, + * tags?: list|null, + * } */ -final class Data implements ConverterSource +final class Data implements BaseModel { - use SdkUnion; + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + #[Optional('added_url_count')] + public ?int $addedURLCount; + + #[Optional] + public ?float $confidence; + + /** @var value-of|null $importance */ + #[Optional(enum: Importance::class)] + public ?string $importance; + + #[Optional('matched_url_count')] + public ?int $matchedURLCount; + + #[Optional('removed_url_count')] + public ?int $removedURLCount; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * mode: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMode(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Mode|value-of $mode + * @param TargetType|value-of $targetType + * @param Importance|value-of|null $importance + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + Mode|string $mode, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?int $addedURLCount = null, + ?float $confidence = null, + Importance|string|null $importance = null, + ?int $matchedURLCount = null, + ?int $removedURLCount = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['mode'] = $mode; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $addedURLCount && $self['addedURLCount'] = $addedURLCount; + null !== $confidence && $self['confidence'] = $confidence; + null !== $importance && $self['importance'] = $importance; + null !== $matchedURLCount && $self['matchedURLCount'] = $matchedURLCount; + null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } /** - * @return list|array + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags */ - public static function variants(): array + public function withTags(array $tags): self { - return [ - MonitorsPageExactChangeSummary::class, - MonitorsSitemapExactChangeSummary::class, - MonitorsPageSemanticChangeSummary::class, - MonitorsExtractSemanticChangeSummary::class, - ]; + $self = clone $this; + $self['tags'] = $tags; + + return $self; } } diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/ChangeDetectionType.php similarity index 80% rename from src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php rename to src/Monitors/MonitorListAccountChangesResponse/Data/ChangeDetectionType.php index 327db938..b3d95b3d 100644 --- a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/ChangeDetectionType.php @@ -2,9 +2,11 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsPageSemanticChangeSummary; +namespace ContextDev\Monitors\MonitorListAccountChangesResponse\Data; enum ChangeDetectionType: string { + case EXACT = 'exact'; + case SEMANTIC = 'semantic'; } diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/Importance.php b/src/Monitors/MonitorListAccountChangesResponse/Data/Importance.php similarity index 83% rename from src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/Importance.php rename to src/Monitors/MonitorListAccountChangesResponse/Data/Importance.php index a43832c0..b9d0b143 100644 --- a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/Importance.php +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/Importance.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListAccountChangesResponse\Data\MonitorsPageSemanticChangeSummary; +namespace ContextDev\Monitors\MonitorListAccountChangesResponse\Data; enum Importance: string { diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/Mode.php b/src/Monitors/MonitorListAccountChangesResponse/Data/Mode.php new file mode 100644 index 00000000..fb6e69c3 --- /dev/null +++ b/src/Monitors/MonitorListAccountChangesResponse/Data/Mode.php @@ -0,0 +1,13 @@ +, - * confidence: float, - * detectedAt: \DateTimeInterface, - * importance: Importance|value-of, - * matchedURLCount: int, - * monitorID: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsExtractSemanticChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required] - public float $confidence; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - /** @var value-of $importance */ - #[Required(enum: Importance::class)] - public string $importance; - - #[Required('matched_url_count')] - public int $matchedURLCount; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsExtractSemanticChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsExtractSemanticChangeSummary::with( - * id: ..., - * changeDetectionType: ..., - * confidence: ..., - * detectedAt: ..., - * importance: ..., - * matchedURLCount: ..., - * monitorID: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsExtractSemanticChangeSummary) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withConfidence(...) - * ->withDetectedAt(...) - * ->withImportance(...) - * ->withMatchedURLCount(...) - * ->withMonitorID(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param Importance|value-of $importance - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - float $confidence, - \DateTimeInterface $detectedAt, - Importance|string $importance, - int $matchedURLCount, - string $monitorID, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['confidence'] = $confidence; - $self['detectedAt'] = $detectedAt; - $self['importance'] = $importance; - $self['matchedURLCount'] = $matchedURLCount; - $self['monitorID'] = $monitorID; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withConfidence(float $confidence): self - { - $self = clone $this; - $self['confidence'] = $confidence; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - /** - * @param Importance|value-of $importance - */ - public function withImportance(Importance|string $importance): self - { - $self = clone $this; - $self['importance'] = $importance; - - return $self; - } - - public function withMatchedURLCount(int $matchedURLCount): self - { - $self = clone $this; - $self['matchedURLCount'] = $matchedURLCount; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php deleted file mode 100644 index c3b7783a..00000000 --- a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * detectedAt: \DateTimeInterface, - * monitorID: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsPageExactChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsPageExactChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageExactChangeSummary::with( - * id: ..., - * changeDetectionType: ..., - * detectedAt: ..., - * monitorID: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageExactChangeSummary) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withDetectedAt(...) - * ->withMonitorID(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - \DateTimeInterface $detectedAt, - string $monitorID, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['detectedAt'] = $detectedAt; - $self['monitorID'] = $monitorID; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php deleted file mode 100644 index 09b05a74..00000000 --- a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * confidence: float, - * detectedAt: \DateTimeInterface, - * importance: Importance|value-of, - * monitorID: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsPageSemanticChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required] - public float $confidence; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - /** @var value-of $importance */ - #[Required(enum: Importance::class)] - public string $importance; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsPageSemanticChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageSemanticChangeSummary::with( - * id: ..., - * changeDetectionType: ..., - * confidence: ..., - * detectedAt: ..., - * importance: ..., - * monitorID: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageSemanticChangeSummary) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withConfidence(...) - * ->withDetectedAt(...) - * ->withImportance(...) - * ->withMonitorID(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param Importance|value-of $importance - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - float $confidence, - \DateTimeInterface $detectedAt, - Importance|string $importance, - string $monitorID, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['confidence'] = $confidence; - $self['detectedAt'] = $detectedAt; - $self['importance'] = $importance; - $self['monitorID'] = $monitorID; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withConfidence(float $confidence): self - { - $self = clone $this; - $self['confidence'] = $confidence; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - /** - * @param Importance|value-of $importance - */ - public function withImportance(Importance|string $importance): self - { - $self = clone $this; - $self['importance'] = $importance; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/TargetType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/TargetType.php deleted file mode 100644 index 91db5f7a..00000000 --- a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsPageSemanticChangeSummary/TargetType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * detectedAt: \DateTimeInterface, - * monitorID: string, - * removedURLCount: int, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsSitemapExactChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - #[Required('added_url_count')] - public int $addedURLCount; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required('removed_url_count')] - public int $removedURLCount; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsSitemapExactChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSitemapExactChangeSummary::with( - * id: ..., - * addedURLCount: ..., - * changeDetectionType: ..., - * detectedAt: ..., - * monitorID: ..., - * removedURLCount: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSitemapExactChangeSummary) - * ->withID(...) - * ->withAddedURLCount(...) - * ->withChangeDetectionType(...) - * ->withDetectedAt(...) - * ->withMonitorID(...) - * ->withRemovedURLCount(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - int $addedURLCount, - ChangeDetectionType|string $changeDetectionType, - \DateTimeInterface $detectedAt, - string $monitorID, - int $removedURLCount, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['addedURLCount'] = $addedURLCount; - $self['changeDetectionType'] = $changeDetectionType; - $self['detectedAt'] = $detectedAt; - $self['monitorID'] = $monitorID; - $self['removedURLCount'] = $removedURLCount; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - public function withAddedURLCount(int $addedURLCount): self - { - $self = clone $this; - $self['addedURLCount'] = $addedURLCount; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withRemovedURLCount(int $removedURLCount): self - { - $self = clone $this; - $self['removedURLCount'] = $removedURLCount; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php deleted file mode 100644 index 5eb5b1fd..00000000 --- a/src/Monitors/MonitorListAccountChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, hasMore: bool, nextCursor: string|null + * data: list, hasMore: bool, nextCursor: string|null * } */ final class MonitorListChangesResponse implements BaseModel @@ -22,7 +21,7 @@ final class MonitorListChangesResponse implements BaseModel /** @use SdkModel */ use SdkModel; - /** @var list $data */ + /** @var list $data */ #[Required(list: Data::class)] public array $data; @@ -59,7 +58,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $data + * @param list $data */ public static function with( array $data, @@ -76,7 +75,7 @@ public static function with( } /** - * @param list $data + * @param list $data */ public function withData(array $data): self { diff --git a/src/Monitors/MonitorListChangesResponse/Data.php b/src/Monitors/MonitorListChangesResponse/Data.php index 4cdf38ce..cf01a7a4 100644 --- a/src/Monitors/MonitorListChangesResponse/Data.php +++ b/src/Monitors/MonitorListChangesResponse/Data.php @@ -4,39 +4,324 @@ namespace ContextDev\Monitors\MonitorListChangesResponse; -use ContextDev\Core\Concerns\SdkUnion; -use ContextDev\Core\Conversion\Contracts\Converter; -use ContextDev\Core\Conversion\Contracts\ConverterSource; -use ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsExtractSemanticChangeSummary; -use ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsPageExactChangeSummary; -use ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsPageSemanticChangeSummary; -use ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsSitemapExactChangeSummary; +use ContextDev\Core\Attributes\Optional; +use ContextDev\Core\Attributes\Required; +use ContextDev\Core\Concerns\SdkModel; +use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorListChangesResponse\Data\ChangeDetectionType; +use ContextDev\Monitors\MonitorListChangesResponse\Data\Importance; +use ContextDev\Monitors\MonitorListChangesResponse\Data\Mode; +use ContextDev\Monitors\MonitorListChangesResponse\Data\TargetType; /** - * Union of lightweight change summaries. + * A lightweight change summary. `mode` is the constant `web`; `target_type` and `change_detection_type` describe the change, and which optional fields are present depends on them (e.g. sitemap changes include `added_url_count`/`removed_url_count`; semantic changes include `confidence`/`importance`). * - * @phpstan-import-type MonitorsPageExactChangeSummaryShape from \ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsPageExactChangeSummary - * @phpstan-import-type MonitorsSitemapExactChangeSummaryShape from \ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsSitemapExactChangeSummary - * @phpstan-import-type MonitorsPageSemanticChangeSummaryShape from \ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsPageSemanticChangeSummary - * @phpstan-import-type MonitorsExtractSemanticChangeSummaryShape from \ContextDev\Monitors\MonitorListChangesResponse\Data\MonitorsExtractSemanticChangeSummary - * - * @phpstan-type DataVariants = MonitorsPageExactChangeSummary|MonitorsSitemapExactChangeSummary|MonitorsPageSemanticChangeSummary|MonitorsExtractSemanticChangeSummary - * @phpstan-type DataShape = DataVariants|MonitorsPageExactChangeSummaryShape|MonitorsSitemapExactChangeSummaryShape|MonitorsPageSemanticChangeSummaryShape|MonitorsExtractSemanticChangeSummaryShape + * @phpstan-type DataShape = array{ + * id: string, + * changeDetectionType: ChangeDetectionType|value-of, + * detectedAt: \DateTimeInterface, + * mode: Mode|value-of, + * monitorID: string, + * summary: string, + * targetType: TargetType|value-of, + * title: string, + * url: string, + * addedURLCount?: int|null, + * confidence?: float|null, + * importance?: null|Importance|value-of, + * matchedURLCount?: int|null, + * removedURLCount?: int|null, + * tags?: list|null, + * } */ -final class Data implements ConverterSource +final class Data implements BaseModel { - use SdkUnion; + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var value-of $changeDetectionType */ + #[Required('change_detection_type', enum: ChangeDetectionType::class)] + public string $changeDetectionType; + + #[Required('detected_at')] + public \DateTimeInterface $detectedAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required('monitor_id')] + public string $monitorID; + + #[Required] + public string $summary; + + /** @var value-of $targetType */ + #[Required('target_type', enum: TargetType::class)] + public string $targetType; + + #[Required] + public string $title; + + #[Required] + public string $url; + + #[Optional('added_url_count')] + public ?int $addedURLCount; + + #[Optional] + public ?float $confidence; + + /** @var value-of|null $importance */ + #[Optional(enum: Importance::class)] + public ?string $importance; + + #[Optional('matched_url_count')] + public ?int $matchedURLCount; + + #[Optional('removed_url_count')] + public ?int $removedURLCount; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * changeDetectionType: ..., + * detectedAt: ..., + * mode: ..., + * monitorID: ..., + * summary: ..., + * targetType: ..., + * title: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withChangeDetectionType(...) + * ->withDetectedAt(...) + * ->withMode(...) + * ->withMonitorID(...) + * ->withSummary(...) + * ->withTargetType(...) + * ->withTitle(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionType|value-of $changeDetectionType + * @param Mode|value-of $mode + * @param TargetType|value-of $targetType + * @param Importance|value-of|null $importance + * @param list|null $tags + */ + public static function with( + string $id, + ChangeDetectionType|string $changeDetectionType, + \DateTimeInterface $detectedAt, + Mode|string $mode, + string $monitorID, + string $summary, + TargetType|string $targetType, + string $title, + string $url, + ?int $addedURLCount = null, + ?float $confidence = null, + Importance|string|null $importance = null, + ?int $matchedURLCount = null, + ?int $removedURLCount = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetectionType'] = $changeDetectionType; + $self['detectedAt'] = $detectedAt; + $self['mode'] = $mode; + $self['monitorID'] = $monitorID; + $self['summary'] = $summary; + $self['targetType'] = $targetType; + $self['title'] = $title; + $self['url'] = $url; + + null !== $addedURLCount && $self['addedURLCount'] = $addedURLCount; + null !== $confidence && $self['confidence'] = $confidence; + null !== $importance && $self['importance'] = $importance; + null !== $matchedURLCount && $self['matchedURLCount'] = $matchedURLCount; + null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param ChangeDetectionType|value-of $changeDetectionType + */ + public function withChangeDetectionType( + ChangeDetectionType|string $changeDetectionType + ): self { + $self = clone $this; + $self['changeDetectionType'] = $changeDetectionType; + + return $self; + } + + public function withDetectedAt(\DateTimeInterface $detectedAt): self + { + $self = clone $this; + $self['detectedAt'] = $detectedAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } + + /** + * @param TargetType|value-of $targetType + */ + public function withTargetType(TargetType|string $targetType): self + { + $self = clone $this; + $self['targetType'] = $targetType; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withAddedURLCount(int $addedURLCount): self + { + $self = clone $this; + $self['addedURLCount'] = $addedURLCount; + + return $self; + } + + public function withConfidence(float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * @param Importance|value-of $importance + */ + public function withImportance(Importance|string $importance): self + { + $self = clone $this; + $self['importance'] = $importance; + + return $self; + } + + public function withMatchedURLCount(int $matchedURLCount): self + { + $self = clone $this; + $self['matchedURLCount'] = $matchedURLCount; + + return $self; + } + + public function withRemovedURLCount(int $removedURLCount): self + { + $self = clone $this; + $self['removedURLCount'] = $removedURLCount; + + return $self; + } /** - * @return list|array + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags */ - public static function variants(): array + public function withTags(array $tags): self { - return [ - MonitorsPageExactChangeSummary::class, - MonitorsSitemapExactChangeSummary::class, - MonitorsPageSemanticChangeSummary::class, - MonitorsExtractSemanticChangeSummary::class, - ]; + $self = clone $this; + $self['tags'] = $tags; + + return $self; } } diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/ChangeDetectionType.php similarity index 53% rename from src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/ChangeDetectionType.php rename to src/Monitors/MonitorListChangesResponse/Data/ChangeDetectionType.php index f02a79f1..ce8548e7 100644 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/ChangeDetectionType.php +++ b/src/Monitors/MonitorListChangesResponse/Data/ChangeDetectionType.php @@ -2,9 +2,11 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetChangeResponse\MonitorsExtractSemanticChange; +namespace ContextDev\Monitors\MonitorListChangesResponse\Data; enum ChangeDetectionType: string { + case EXACT = 'exact'; + case SEMANTIC = 'semantic'; } diff --git a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Importance.php b/src/Monitors/MonitorListChangesResponse/Data/Importance.php similarity index 61% rename from src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Importance.php rename to src/Monitors/MonitorListChangesResponse/Data/Importance.php index 5afe5309..ff1c8f92 100644 --- a/src/Monitors/MonitorGetChangeResponse/MonitorsExtractSemanticChange/Importance.php +++ b/src/Monitors/MonitorListChangesResponse/Data/Importance.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetChangeResponse\MonitorsExtractSemanticChange; +namespace ContextDev\Monitors\MonitorListChangesResponse\Data; enum Importance: string { diff --git a/src/Monitors/MonitorListChangesResponse/Data/Mode.php b/src/Monitors/MonitorListChangesResponse/Data/Mode.php new file mode 100644 index 00000000..fe3c9c74 --- /dev/null +++ b/src/Monitors/MonitorListChangesResponse/Data/Mode.php @@ -0,0 +1,13 @@ +, - * confidence: float, - * detectedAt: \DateTimeInterface, - * importance: Importance|value-of, - * matchedURLCount: int, - * monitorID: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsExtractSemanticChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required] - public float $confidence; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - /** @var value-of $importance */ - #[Required(enum: Importance::class)] - public string $importance; - - #[Required('matched_url_count')] - public int $matchedURLCount; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsExtractSemanticChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsExtractSemanticChangeSummary::with( - * id: ..., - * changeDetectionType: ..., - * confidence: ..., - * detectedAt: ..., - * importance: ..., - * matchedURLCount: ..., - * monitorID: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsExtractSemanticChangeSummary) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withConfidence(...) - * ->withDetectedAt(...) - * ->withImportance(...) - * ->withMatchedURLCount(...) - * ->withMonitorID(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param Importance|value-of $importance - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - float $confidence, - \DateTimeInterface $detectedAt, - Importance|string $importance, - int $matchedURLCount, - string $monitorID, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['confidence'] = $confidence; - $self['detectedAt'] = $detectedAt; - $self['importance'] = $importance; - $self['matchedURLCount'] = $matchedURLCount; - $self['monitorID'] = $monitorID; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withConfidence(float $confidence): self - { - $self = clone $this; - $self['confidence'] = $confidence; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - /** - * @param Importance|value-of $importance - */ - public function withImportance(Importance|string $importance): self - { - $self = clone $this; - $self['importance'] = $importance; - - return $self; - } - - public function withMatchedURLCount(int $matchedURLCount): self - { - $self = clone $this; - $self['matchedURLCount'] = $matchedURLCount; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php deleted file mode 100644 index 4bbabfa3..00000000 --- a/src/Monitors/MonitorListChangesResponse/Data/MonitorsExtractSemanticChangeSummary/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * detectedAt: \DateTimeInterface, - * monitorID: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsPageExactChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsPageExactChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageExactChangeSummary::with( - * id: ..., - * changeDetectionType: ..., - * detectedAt: ..., - * monitorID: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageExactChangeSummary) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withDetectedAt(...) - * ->withMonitorID(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - \DateTimeInterface $detectedAt, - string $monitorID, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['detectedAt'] = $detectedAt; - $self['monitorID'] = $monitorID; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php deleted file mode 100644 index b3023c42..00000000 --- a/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageExactChangeSummary/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * confidence: float, - * detectedAt: \DateTimeInterface, - * importance: Importance|value-of, - * monitorID: string, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsPageSemanticChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required] - public float $confidence; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - /** @var value-of $importance */ - #[Required(enum: Importance::class)] - public string $importance; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsPageSemanticChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageSemanticChangeSummary::with( - * id: ..., - * changeDetectionType: ..., - * confidence: ..., - * detectedAt: ..., - * importance: ..., - * monitorID: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageSemanticChangeSummary) - * ->withID(...) - * ->withChangeDetectionType(...) - * ->withConfidence(...) - * ->withDetectedAt(...) - * ->withImportance(...) - * ->withMonitorID(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param Importance|value-of $importance - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - ChangeDetectionType|string $changeDetectionType, - float $confidence, - \DateTimeInterface $detectedAt, - Importance|string $importance, - string $monitorID, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetectionType'] = $changeDetectionType; - $self['confidence'] = $confidence; - $self['detectedAt'] = $detectedAt; - $self['importance'] = $importance; - $self['monitorID'] = $monitorID; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withConfidence(float $confidence): self - { - $self = clone $this; - $self['confidence'] = $confidence; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - /** - * @param Importance|value-of $importance - */ - public function withImportance(Importance|string $importance): self - { - $self = clone $this; - $self['importance'] = $importance; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php deleted file mode 100644 index bedc5028..00000000 --- a/src/Monitors/MonitorListChangesResponse/Data/MonitorsPageSemanticChangeSummary/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * detectedAt: \DateTimeInterface, - * monitorID: string, - * removedURLCount: int, - * summary: string, - * targetType: TargetType|value-of, - * title: string, - * url: string, - * tags?: list|null, - * } - */ -final class MonitorsSitemapExactChangeSummary implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - #[Required('added_url_count')] - public int $addedURLCount; - - /** @var value-of $changeDetectionType */ - #[Required('change_detection_type', enum: ChangeDetectionType::class)] - public string $changeDetectionType; - - #[Required('detected_at')] - public \DateTimeInterface $detectedAt; - - #[Required('monitor_id')] - public string $monitorID; - - #[Required('removed_url_count')] - public int $removedURLCount; - - #[Required] - public string $summary; - - /** @var value-of $targetType */ - #[Required('target_type', enum: TargetType::class)] - public string $targetType; - - #[Required] - public string $title; - - #[Required] - public string $url; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - /** - * `new MonitorsSitemapExactChangeSummary()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSitemapExactChangeSummary::with( - * id: ..., - * addedURLCount: ..., - * changeDetectionType: ..., - * detectedAt: ..., - * monitorID: ..., - * removedURLCount: ..., - * summary: ..., - * targetType: ..., - * title: ..., - * url: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSitemapExactChangeSummary) - * ->withID(...) - * ->withAddedURLCount(...) - * ->withChangeDetectionType(...) - * ->withDetectedAt(...) - * ->withMonitorID(...) - * ->withRemovedURLCount(...) - * ->withSummary(...) - * ->withTargetType(...) - * ->withTitle(...) - * ->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetectionType|value-of $changeDetectionType - * @param TargetType|value-of $targetType - * @param list|null $tags - */ - public static function with( - string $id, - int $addedURLCount, - ChangeDetectionType|string $changeDetectionType, - \DateTimeInterface $detectedAt, - string $monitorID, - int $removedURLCount, - string $summary, - TargetType|string $targetType, - string $title, - string $url, - ?array $tags = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['addedURLCount'] = $addedURLCount; - $self['changeDetectionType'] = $changeDetectionType; - $self['detectedAt'] = $detectedAt; - $self['monitorID'] = $monitorID; - $self['removedURLCount'] = $removedURLCount; - $self['summary'] = $summary; - $self['targetType'] = $targetType; - $self['title'] = $title; - $self['url'] = $url; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - public function withAddedURLCount(int $addedURLCount): self - { - $self = clone $this; - $self['addedURLCount'] = $addedURLCount; - - return $self; - } - - /** - * @param ChangeDetectionType|value-of $changeDetectionType - */ - public function withChangeDetectionType( - ChangeDetectionType|string $changeDetectionType - ): self { - $self = clone $this; - $self['changeDetectionType'] = $changeDetectionType; - - return $self; - } - - public function withDetectedAt(\DateTimeInterface $detectedAt): self - { - $self = clone $this; - $self['detectedAt'] = $detectedAt; - - return $self; - } - - public function withMonitorID(string $monitorID): self - { - $self = clone $this; - $self['monitorID'] = $monitorID; - - return $self; - } - - public function withRemovedURLCount(int $removedURLCount): self - { - $self = clone $this; - $self['removedURLCount'] = $removedURLCount; - - return $self; - } - - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } - - /** - * @param TargetType|value-of $targetType - */ - public function withTargetType(TargetType|string $targetType): self - { - $self = clone $this; - $self['targetType'] = $targetType; - - return $self; - } - - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php b/src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php deleted file mode 100644 index 47c649ad..00000000 --- a/src/Monitors/MonitorListChangesResponse/Data/MonitorsSitemapExactChangeSummary/ChangeDetectionType.php +++ /dev/null @@ -1,10 +0,0 @@ -, * cursor?: string|null, * limit?: int|null, + * q?: string|null, + * searchBy?: list>|null, + * searchType?: null|SearchType|value-of, * status?: null|Status|value-of, * tag?: string|null, + * tags?: list|null, * targetType?: null|TargetType|value-of, * } */ @@ -42,6 +48,28 @@ final class MonitorListParams implements BaseModel #[Optional] public ?int $limit; + /** + * Free-text search term, matched against the fields named in `search_by`. + */ + #[Optional] + public ?string $q; + + /** + * Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * + * @var list>|null $searchBy + */ + #[Optional(list: SearchBy::class)] + public ?array $searchBy; + + /** + * `prefix` for as-you-type prefix matching (default), `exact` for full-token matching. + * + * @var value-of|null $searchType + */ + #[Optional(enum: SearchType::class)] + public ?string $searchType; + /** @var value-of|null $status */ #[Optional(enum: Status::class)] public ?string $status; @@ -52,6 +80,14 @@ final class MonitorListParams implements BaseModel #[Optional] public ?string $tag; + /** + * Comma-separated list of tags to filter by (matches monitors having any of them). + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** @var value-of|null $targetType */ #[Optional(enum: TargetType::class)] public ?string $targetType; @@ -67,15 +103,22 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param ChangeDetectionType|value-of|null $changeDetectionType + * @param list>|null $searchBy + * @param SearchType|value-of|null $searchType * @param Status|value-of|null $status + * @param list|null $tags * @param TargetType|value-of|null $targetType */ public static function with( ChangeDetectionType|string|null $changeDetectionType = null, ?string $cursor = null, ?int $limit = null, + ?string $q = null, + ?array $searchBy = null, + SearchType|string|null $searchType = null, Status|string|null $status = null, ?string $tag = null, + ?array $tags = null, TargetType|string|null $targetType = null, ): self { $self = new self; @@ -83,8 +126,12 @@ public static function with( null !== $changeDetectionType && $self['changeDetectionType'] = $changeDetectionType; null !== $cursor && $self['cursor'] = $cursor; null !== $limit && $self['limit'] = $limit; + null !== $q && $self['q'] = $q; + null !== $searchBy && $self['searchBy'] = $searchBy; + null !== $searchType && $self['searchType'] = $searchType; null !== $status && $self['status'] = $status; null !== $tag && $self['tag'] = $tag; + null !== $tags && $self['tags'] = $tags; null !== $targetType && $self['targetType'] = $targetType; return $self; @@ -118,6 +165,43 @@ public function withLimit(int $limit): self return $self; } + /** + * Free-text search term, matched against the fields named in `search_by`. + */ + public function withQ(string $q): self + { + $self = clone $this; + $self['q'] = $q; + + return $self; + } + + /** + * Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * + * @param list> $searchBy + */ + public function withSearchBy(array $searchBy): self + { + $self = clone $this; + $self['searchBy'] = $searchBy; + + return $self; + } + + /** + * `prefix` for as-you-type prefix matching (default), `exact` for full-token matching. + * + * @param SearchType|value-of $searchType + */ + public function withSearchType(SearchType|string $searchType): self + { + $self = clone $this; + $self['searchType'] = $searchType; + + return $self; + } + /** * @param Status|value-of $status */ @@ -140,6 +224,19 @@ public function withTag(string $tag): self return $self; } + /** + * Comma-separated list of tags to filter by (matches monitors having any of them). + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * @param TargetType|value-of $targetType */ diff --git a/src/Monitors/MonitorListParams/SearchBy.php b/src/Monitors/MonitorListParams/SearchBy.php new file mode 100644 index 00000000..e35ffc6e --- /dev/null +++ b/src/Monitors/MonitorListParams/SearchBy.php @@ -0,0 +1,16 @@ +, hasMore: bool, nextCursor: string|null + * data: list, hasMore: bool, nextCursor: string|null * } */ final class MonitorListResponse implements BaseModel @@ -22,7 +21,7 @@ final class MonitorListResponse implements BaseModel /** @use SdkModel */ use SdkModel; - /** @var list $data */ + /** @var list $data */ #[Required(list: Data::class)] public array $data; @@ -56,7 +55,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param list $data + * @param list $data */ public static function with( array $data, @@ -73,7 +72,7 @@ public static function with( } /** - * @param list $data + * @param list $data */ public function withData(array $data): self { diff --git a/src/Monitors/MonitorListResponse/Data.php b/src/Monitors/MonitorListResponse/Data.php index 93bd7c84..e7335e95 100644 --- a/src/Monitors/MonitorListResponse/Data.php +++ b/src/Monitors/MonitorListResponse/Data.php @@ -4,39 +4,336 @@ namespace ContextDev\Monitors\MonitorListResponse; -use ContextDev\Core\Concerns\SdkUnion; -use ContextDev\Core\Conversion\Contracts\Converter; -use ContextDev\Core\Conversion\Contracts\ConverterSource; -use ContextDev\Monitors\MonitorListResponse\Data\MonitorsExtractSemanticMonitor; -use ContextDev\Monitors\MonitorListResponse\Data\MonitorsPageExactMonitor; -use ContextDev\Monitors\MonitorListResponse\Data\MonitorsPageSemanticMonitor; -use ContextDev\Monitors\MonitorListResponse\Data\MonitorsSitemapExactMonitor; +use ContextDev\Core\Attributes\Optional; +use ContextDev\Core\Attributes\Required; +use ContextDev\Core\Concerns\SdkModel; +use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection; +use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection\MonitorsExactChangeDetection; +use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorListResponse\Data\Mode; +use ContextDev\Monitors\MonitorListResponse\Data\Schedule; +use ContextDev\Monitors\MonitorListResponse\Data\Status; +use ContextDev\Monitors\MonitorListResponse\Data\Target; +use ContextDev\Monitors\MonitorListResponse\Data\Target\MonitorsExtractTarget; +use ContextDev\Monitors\MonitorListResponse\Data\Target\MonitorsPageTarget; +use ContextDev\Monitors\MonitorListResponse\Data\Target\MonitorsSitemapTarget; +use ContextDev\Monitors\MonitorListResponse\Data\Webhook; /** - * Union of monitor response shapes. + * A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic). * - * @phpstan-import-type MonitorsPageExactMonitorShape from \ContextDev\Monitors\MonitorListResponse\Data\MonitorsPageExactMonitor - * @phpstan-import-type MonitorsSitemapExactMonitorShape from \ContextDev\Monitors\MonitorListResponse\Data\MonitorsSitemapExactMonitor - * @phpstan-import-type MonitorsPageSemanticMonitorShape from \ContextDev\Monitors\MonitorListResponse\Data\MonitorsPageSemanticMonitor - * @phpstan-import-type MonitorsExtractSemanticMonitorShape from \ContextDev\Monitors\MonitorListResponse\Data\MonitorsExtractSemanticMonitor + * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection + * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorListResponse\Data\Target + * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection + * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorListResponse\Data\Schedule + * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorListResponse\Data\Target + * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorListResponse\Data\Webhook * - * @phpstan-type DataVariants = MonitorsPageExactMonitor|MonitorsSitemapExactMonitor|MonitorsPageSemanticMonitor|MonitorsExtractSemanticMonitor - * @phpstan-type DataShape = DataVariants|MonitorsPageExactMonitorShape|MonitorsSitemapExactMonitorShape|MonitorsPageSemanticMonitorShape|MonitorsExtractSemanticMonitorShape + * @phpstan-type DataShape = array{ + * id: string, + * changeDetection: ChangeDetectionShape, + * createdAt: \DateTimeInterface, + * mode: Mode|value-of, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } */ -final class Data implements ConverterSource +final class Data implements BaseModel { - use SdkUnion; + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } /** - * @return list|array + * @param Status|value-of $status */ - public static function variants(): array + public function withStatus(Status|string $status): self { - return [ - MonitorsPageExactMonitor::class, - MonitorsSitemapExactMonitor::class, - MonitorsPageSemanticMonitor::class, - MonitorsExtractSemanticMonitor::class, - ]; + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; } } diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection.php new file mode 100644 index 00000000..5b039232 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 00000000..c8284948 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php similarity index 64% rename from src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php rename to src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php index ce590d5a..9a6a4689 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -2,48 +2,47 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor; +namespace ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor\ChangeDetection\Type; /** * Detect meaning-level changes that match a natural language query. * - * @phpstan-type ChangeDetectionShape = array{ - * query: string, type: Type|value-of, confidenceThreshold?: float|null + * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ + * query: string, type: 'semantic', confidenceThreshold?: float|null * } */ -final class ChangeDetection implements BaseModel +final class MonitorsSemanticChangeDetection implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; + /** @var 'semantic' $type */ #[Required] - public string $query; + public string $type = 'semantic'; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + #[Required] + public string $query; #[Optional('confidence_threshold')] public ?float $confidenceThreshold; /** - * `new ChangeDetection()` is missing required properties by the API. + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ChangeDetection::with(query: ..., type: ...) + * MonitorsSemanticChangeDetection::with(query: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) + * (new MonitorsSemanticChangeDetection)->withQuery(...) * ``` */ public function __construct() @@ -55,18 +54,14 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( string $query, - Type|string $type, ?float $confidenceThreshold = null ): self { $self = new self; $self['query'] = $query; - $self['type'] = $type; null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; @@ -82,9 +77,9 @@ public function withQuery(string $query): self } /** - * @param Type|value-of $type + * @param 'semantic' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorListResponse/Data/Mode.php b/src/Monitors/MonitorListResponse/Data/Mode.php new file mode 100644 index 00000000..8c4af84d --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Mode.php @@ -0,0 +1,13 @@ +, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsExtractSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsExtractSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsExtractSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php deleted file mode 100644 index 78f72ce5..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection.php +++ /dev/null @@ -1,102 +0,0 @@ -, confidenceThreshold?: float|null - * } - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $query; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Optional('confidence_threshold')] - public ?float $confidenceThreshold; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(query: ..., type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - string $query, - Type|string $type, - ?float $confidenceThreshold = null - ): self { - $self = new self; - - $self['query'] = $query; - $self['type'] = $type; - - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } - - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withConfidenceThreshold(float $confidenceThreshold): self - { - $self = clone $this; - $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index eb363f81..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php deleted file mode 100644 index bbc868a5..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php deleted file mode 100644 index e544534b..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php deleted file mode 100644 index b34eb694..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index d5b7d587..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php deleted file mode 100644 index c2f18561..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, url: string, normalizeWhitespace?: bool|null - * } - */ -final class Target implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Required] - public string $url; - - /** - * Normalize whitespace before comparing or analyzing text. - */ - #[Optional('normalize_whitespace')] - public ?bool $normalizeWhitespace; - - /** - * `new Target()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Target::with(type: ..., url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Target)->withType(...)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - Type|string $type, - string $url, - ?bool $normalizeWhitespace = null - ): self { - $self = new self; - - $self['type'] = $type; - $self['url'] = $url; - - null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Normalize whitespace before comparing or analyzing text. - */ - public function withNormalizeWhitespace(bool $normalizeWhitespace): self - { - $self = clone $this; - $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php deleted file mode 100644 index bafa9dce..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageExactMonitor/Target/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php deleted file mode 100644 index f6c49006..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php deleted file mode 100644 index 02fd9e6a..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection.php +++ /dev/null @@ -1,102 +0,0 @@ -, confidenceThreshold?: float|null - * } - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $query; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Optional('confidence_threshold')] - public ?float $confidenceThreshold; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(query: ..., type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - string $query, - Type|string $type, - ?float $confidenceThreshold = null - ): self { - $self = new self; - - $self['query'] = $query; - $self['type'] = $type; - - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } - - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withConfidenceThreshold(float $confidenceThreshold): self - { - $self = clone $this; - $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index 9c8a97b9..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php deleted file mode 100644 index 72300b63..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, url: string, normalizeWhitespace?: bool|null - * } - */ -final class Target implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Required] - public string $url; - - /** - * Normalize whitespace before comparing or analyzing text. - */ - #[Optional('normalize_whitespace')] - public ?bool $normalizeWhitespace; - - /** - * `new Target()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Target::with(type: ..., url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Target)->withType(...)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - Type|string $type, - string $url, - ?bool $normalizeWhitespace = null - ): self { - $self = new self; - - $self['type'] = $type; - $self['url'] = $url; - - null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Normalize whitespace before comparing or analyzing text. - */ - public function withNormalizeWhitespace(bool $normalizeWhitespace): self - { - $self = clone $this; - $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php deleted file mode 100644 index c34575a0..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsPageSemanticMonitor/Target/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php deleted file mode 100644 index a7826478..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsSitemapExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSitemapExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSitemapExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php deleted file mode 100644 index de76148f..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index 658a10f4..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php deleted file mode 100644 index 4c2daa9d..00000000 --- a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule.php b/src/Monitors/MonitorListResponse/Data/Schedule.php similarity index 92% rename from src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule.php rename to src/Monitors/MonitorListResponse/Data/Schedule.php index a7cd6809..bc94489d 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Schedule.php +++ b/src/Monitors/MonitorListResponse/Data/Schedule.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; +namespace ContextDev\Monitors\MonitorListResponse\Data; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor\Schedule\Type; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor\Schedule\Unit; +use ContextDev\Monitors\MonitorListResponse\Data\Schedule\Type; +use ContextDev\Monitors\MonitorListResponse\Data\Schedule\Unit; /** * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Type.php b/src/Monitors/MonitorListResponse/Data/Schedule/Type.php similarity index 51% rename from src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Type.php rename to src/Monitors/MonitorListResponse/Data/Schedule/Type.php index 42f3457f..b2b156c8 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Type.php +++ b/src/Monitors/MonitorListResponse/Data/Schedule/Type.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor\Schedule; +namespace ContextDev\Monitors\MonitorListResponse\Data\Schedule; enum Type: string { diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Unit.php b/src/Monitors/MonitorListResponse/Data/Schedule/Unit.php similarity index 62% rename from src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Unit.php rename to src/Monitors/MonitorListResponse/Data/Schedule/Unit.php index 904a60b3..28d0cf53 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Schedule/Unit.php +++ b/src/Monitors/MonitorListResponse/Data/Schedule/Unit.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor\Schedule; +namespace ContextDev\Monitors\MonitorListResponse\Data\Schedule; enum Unit: string { diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Status.php b/src/Monitors/MonitorListResponse/Data/Status.php similarity index 65% rename from src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Status.php rename to src/Monitors/MonitorListResponse/Data/Status.php index 0c7e8e83..bdc7bce7 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageExactMonitor/Status.php +++ b/src/Monitors/MonitorListResponse/Data/Status.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor; +namespace ContextDev\Monitors\MonitorListResponse\Data; enum Status: string { diff --git a/src/Monitors/MonitorListResponse/Data/Target.php b/src/Monitors/MonitorListResponse/Data/Target.php new file mode 100644 index 00000000..0d5c9995 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Target.php @@ -0,0 +1,44 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php similarity index 84% rename from src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target.php rename to src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php index 22f4c3ce..c092e11d 100644 --- a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Target.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php @@ -2,17 +2,18 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor; +namespace ContextDev\Monitors\MonitorListResponse\Data\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a site's extracted structured data. + * + * @phpstan-type MonitorsExtractTargetShape = array{ + * type: 'extract', * url: string, * followSubdomains?: bool|null, * instructions?: string|null, @@ -21,14 +22,14 @@ * schema?: array|null, * } */ -final class Target implements BaseModel +final class MonitorsExtractTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; /** * Root URL to extract structured data from. @@ -66,17 +67,17 @@ final class Target implements BaseModel public ?array $schema; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsExtractTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsExtractTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsExtractTarget)->withURL(...) * ``` */ public function __construct() @@ -89,11 +90,9 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param array|null $schema */ public static function with( - Type|string $type, string $url, ?bool $followSubdomains = null, ?string $instructions = null, @@ -103,7 +102,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; @@ -116,9 +114,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'extract' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php similarity index 67% rename from src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target.php rename to src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php index 72c04012..bff04894 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Target.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php @@ -2,27 +2,28 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor; +namespace ContextDev\Monitors\MonitorListResponse\Data\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, url: string, normalizeWhitespace?: bool|null + * Watch a single web page. + * + * @phpstan-type MonitorsPageTargetShape = array{ + * type: 'page', url: string, normalizeWhitespace?: bool|null * } */ -final class Target implements BaseModel +final class MonitorsPageTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; #[Required] public string $url; @@ -34,17 +35,17 @@ final class Target implements BaseModel public ?bool $normalizeWhitespace; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsPageTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsPageTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsPageTarget)->withURL(...) * ``` */ public function __construct() @@ -56,17 +57,13 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( - Type|string $type, string $url, ?bool $normalizeWhitespace = null ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; @@ -75,9 +72,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'page' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php similarity index 78% rename from src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target.php rename to src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php index 5ced1d18..a207f616 100644 --- a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Target.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php @@ -2,31 +2,32 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor; +namespace ContextDev\Monitors\MonitorListResponse\Data\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a sitemap for URL additions and removals. + * + * @phpstan-type MonitorsSitemapTargetShape = array{ + * type: 'sitemap', * url: string, * exclude?: list|null, * include?: list|null, * maxURLs?: int|null, * } */ -final class Target implements BaseModel +final class MonitorsSitemapTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; /** * Sitemap URL to monitor. @@ -54,17 +55,17 @@ final class Target implements BaseModel public ?int $maxURLs; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsSitemapTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsSitemapTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsSitemapTarget)->withURL(...) * ``` */ public function __construct() @@ -77,12 +78,10 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param list|null $exclude * @param list|null $include */ public static function with( - Type|string $type, string $url, ?array $exclude = null, ?array $include = null, @@ -90,7 +89,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $exclude && $self['exclude'] = $exclude; @@ -101,9 +99,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'sitemap' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Webhook.php b/src/Monitors/MonitorListResponse/Data/Webhook.php similarity index 96% rename from src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Webhook.php rename to src/Monitors/MonitorListResponse/Data/Webhook.php index a4d4b8af..1fcacfbd 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/Webhook.php +++ b/src/Monitors/MonitorListResponse/Data/Webhook.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; +namespace ContextDev\Monitors\MonitorListResponse\Data; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; diff --git a/src/Monitors/MonitorNewResponse.php b/src/Monitors/MonitorNewResponse.php index 83170766..f77442ed 100644 --- a/src/Monitors/MonitorNewResponse.php +++ b/src/Monitors/MonitorNewResponse.php @@ -4,39 +4,336 @@ namespace ContextDev\Monitors; -use ContextDev\Core\Concerns\SdkUnion; -use ContextDev\Core\Conversion\Contracts\Converter; -use ContextDev\Core\Conversion\Contracts\ConverterSource; -use ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor; +use ContextDev\Core\Attributes\Optional; +use ContextDev\Core\Attributes\Required; +use ContextDev\Core\Concerns\SdkModel; +use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorNewResponse\ChangeDetection; +use ContextDev\Monitors\MonitorNewResponse\ChangeDetection\MonitorsExactChangeDetection; +use ContextDev\Monitors\MonitorNewResponse\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorNewResponse\Mode; +use ContextDev\Monitors\MonitorNewResponse\Schedule; +use ContextDev\Monitors\MonitorNewResponse\Status; +use ContextDev\Monitors\MonitorNewResponse\Target; +use ContextDev\Monitors\MonitorNewResponse\Target\MonitorsExtractTarget; +use ContextDev\Monitors\MonitorNewResponse\Target\MonitorsPageTarget; +use ContextDev\Monitors\MonitorNewResponse\Target\MonitorsSitemapTarget; +use ContextDev\Monitors\MonitorNewResponse\Webhook; /** - * Union of monitor response shapes. + * A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic). * - * @phpstan-import-type MonitorsPageExactMonitorShape from \ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor - * @phpstan-import-type MonitorsSitemapExactMonitorShape from \ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor - * @phpstan-import-type MonitorsPageSemanticMonitorShape from \ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor - * @phpstan-import-type MonitorsExtractSemanticMonitorShape from \ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor + * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorNewResponse\ChangeDetection + * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorNewResponse\Target + * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorNewResponse\ChangeDetection + * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorNewResponse\Schedule + * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorNewResponse\Target + * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorNewResponse\Webhook * - * @phpstan-type MonitorNewResponseVariants = MonitorsPageExactMonitor|MonitorsSitemapExactMonitor|MonitorsPageSemanticMonitor|MonitorsExtractSemanticMonitor - * @phpstan-type MonitorNewResponseShape = MonitorNewResponseVariants|MonitorsPageExactMonitorShape|MonitorsSitemapExactMonitorShape|MonitorsPageSemanticMonitorShape|MonitorsExtractSemanticMonitorShape + * @phpstan-type MonitorNewResponseShape = array{ + * id: string, + * changeDetection: ChangeDetectionShape, + * createdAt: \DateTimeInterface, + * mode: Mode|value-of, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } */ -final class MonitorNewResponse implements ConverterSource +final class MonitorNewResponse implements BaseModel { - use SdkUnion; + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorNewResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorNewResponse::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorNewResponse) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } /** - * @return list|array + * @param Status|value-of $status */ - public static function variants(): array + public function withStatus(Status|string $status): self { - return [ - MonitorsPageExactMonitor::class, - MonitorsSitemapExactMonitor::class, - MonitorsPageSemanticMonitor::class, - MonitorsExtractSemanticMonitor::class, - ]; + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; } } diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection.php new file mode 100644 index 00000000..6acbb5c9 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 00000000..9f80a396 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php similarity index 64% rename from src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php rename to src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index a72c366f..21c2a85c 100644 --- a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php +++ b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -2,48 +2,47 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor; +namespace ContextDev\Monitors\MonitorNewResponse\ChangeDetection; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor\ChangeDetection\Type; /** * Detect meaning-level changes that match a natural language query. * - * @phpstan-type ChangeDetectionShape = array{ - * query: string, type: Type|value-of, confidenceThreshold?: float|null + * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ + * query: string, type: 'semantic', confidenceThreshold?: float|null * } */ -final class ChangeDetection implements BaseModel +final class MonitorsSemanticChangeDetection implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; + /** @var 'semantic' $type */ #[Required] - public string $query; + public string $type = 'semantic'; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + #[Required] + public string $query; #[Optional('confidence_threshold')] public ?float $confidenceThreshold; /** - * `new ChangeDetection()` is missing required properties by the API. + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ChangeDetection::with(query: ..., type: ...) + * MonitorsSemanticChangeDetection::with(query: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) + * (new MonitorsSemanticChangeDetection)->withQuery(...) * ``` */ public function __construct() @@ -55,18 +54,14 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( string $query, - Type|string $type, ?float $confidenceThreshold = null ): self { $self = new self; $self['query'] = $query; - $self['type'] = $type; null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; @@ -82,9 +77,9 @@ public function withQuery(string $query): self } /** - * @param Type|value-of $type + * @param 'semantic' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorNewResponse/Mode.php b/src/Monitors/MonitorNewResponse/Mode.php new file mode 100644 index 00000000..668aef6b --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Mode.php @@ -0,0 +1,13 @@ +, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsExtractSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsExtractSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsExtractSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index fd9b8fc3..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php deleted file mode 100644 index e9537d36..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php deleted file mode 100644 index e5a105f0..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php deleted file mode 100644 index 281d9b28..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index bc8b9aed..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index f255088d..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php deleted file mode 100644 index abf1bd86..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsPageSemanticMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php deleted file mode 100644 index 7f08c4ce..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsSitemapExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSitemapExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSitemapExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php deleted file mode 100644 index eacb2f0c..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index 3cd3652c..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php deleted file mode 100644 index 688ed4ea..00000000 --- a/src/Monitors/MonitorNewResponse/MonitorsSitemapExactMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule.php b/src/Monitors/MonitorNewResponse/Schedule.php similarity index 91% rename from src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule.php rename to src/Monitors/MonitorNewResponse/Schedule.php index f734f20e..30222337 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule.php +++ b/src/Monitors/MonitorNewResponse/Schedule.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor; +namespace ContextDev\Monitors\MonitorNewResponse; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor\Schedule\Type; -use ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor\Schedule\Unit; +use ContextDev\Monitors\MonitorNewResponse\Schedule\Type; +use ContextDev\Monitors\MonitorNewResponse\Schedule\Unit; /** * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorNewResponse/Schedule/Type.php similarity index 50% rename from src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Type.php rename to src/Monitors/MonitorNewResponse/Schedule/Type.php index 32451c12..61da9c91 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Type.php +++ b/src/Monitors/MonitorNewResponse/Schedule/Type.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor\Schedule; +namespace ContextDev\Monitors\MonitorNewResponse\Schedule; enum Type: string { diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php b/src/Monitors/MonitorNewResponse/Schedule/Unit.php similarity index 61% rename from src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php rename to src/Monitors/MonitorNewResponse/Schedule/Unit.php index da8886d0..994b9c6b 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule/Unit.php +++ b/src/Monitors/MonitorNewResponse/Schedule/Unit.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor\Schedule; +namespace ContextDev\Monitors\MonitorNewResponse\Schedule; enum Unit: string { diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Status.php b/src/Monitors/MonitorNewResponse/Status.php similarity index 64% rename from src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Status.php rename to src/Monitors/MonitorNewResponse/Status.php index 0f3fdf37..d58f553e 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Status.php +++ b/src/Monitors/MonitorNewResponse/Status.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor; +namespace ContextDev\Monitors\MonitorNewResponse; enum Status: string { diff --git a/src/Monitors/MonitorNewResponse/Target.php b/src/Monitors/MonitorNewResponse/Target.php new file mode 100644 index 00000000..9955d262 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Target.php @@ -0,0 +1,44 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target.php b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php similarity index 84% rename from src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target.php rename to src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php index 9d9faedc..d71e5bb3 100644 --- a/src/Monitors/MonitorListResponse/Data/MonitorsExtractSemanticMonitor/Target.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php @@ -2,17 +2,18 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListResponse\Data\MonitorsExtractSemanticMonitor; +namespace ContextDev\Monitors\MonitorNewResponse\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorListResponse\Data\MonitorsExtractSemanticMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a site's extracted structured data. + * + * @phpstan-type MonitorsExtractTargetShape = array{ + * type: 'extract', * url: string, * followSubdomains?: bool|null, * instructions?: string|null, @@ -21,14 +22,14 @@ * schema?: array|null, * } */ -final class Target implements BaseModel +final class MonitorsExtractTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; /** * Root URL to extract structured data from. @@ -66,17 +67,17 @@ final class Target implements BaseModel public ?array $schema; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsExtractTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsExtractTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsExtractTarget)->withURL(...) * ``` */ public function __construct() @@ -89,11 +90,9 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param array|null $schema */ public static function with( - Type|string $type, string $url, ?bool $followSubdomains = null, ?string $instructions = null, @@ -103,7 +102,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; @@ -116,9 +114,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'extract' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target.php b/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php similarity index 67% rename from src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target.php rename to src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php index 0cb41644..cb684a97 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Target.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php @@ -2,27 +2,28 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor; +namespace ContextDev\Monitors\MonitorNewResponse\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, url: string, normalizeWhitespace?: bool|null + * Watch a single web page. + * + * @phpstan-type MonitorsPageTargetShape = array{ + * type: 'page', url: string, normalizeWhitespace?: bool|null * } */ -final class Target implements BaseModel +final class MonitorsPageTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; #[Required] public string $url; @@ -34,17 +35,17 @@ final class Target implements BaseModel public ?bool $normalizeWhitespace; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsPageTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsPageTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsPageTarget)->withURL(...) * ``` */ public function __construct() @@ -56,17 +57,13 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type */ public static function with( - Type|string $type, string $url, ?bool $normalizeWhitespace = null ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; @@ -75,9 +72,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'page' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target.php b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php similarity index 77% rename from src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target.php rename to src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php index 36828ab4..38cce8d5 100644 --- a/src/Monitors/MonitorListResponse/Data/MonitorsSitemapExactMonitor/Target.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php @@ -2,31 +2,32 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListResponse\Data\MonitorsSitemapExactMonitor; +namespace ContextDev\Monitors\MonitorNewResponse\Target; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorListResponse\Data\MonitorsSitemapExactMonitor\Target\Type; /** - * @phpstan-type TargetShape = array{ - * type: Type|value-of, + * Watch a sitemap for URL additions and removals. + * + * @phpstan-type MonitorsSitemapTargetShape = array{ + * type: 'sitemap', * url: string, * exclude?: list|null, * include?: list|null, * maxURLs?: int|null, * } */ -final class Target implements BaseModel +final class MonitorsSitemapTarget implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; /** * Sitemap URL to monitor. @@ -54,17 +55,17 @@ final class Target implements BaseModel public ?int $maxURLs; /** - * `new Target()` is missing required properties by the API. + * `new MonitorsSitemapTarget()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Target::with(type: ..., url: ...) + * MonitorsSitemapTarget::with(url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Target)->withType(...)->withURL(...) + * (new MonitorsSitemapTarget)->withURL(...) * ``` */ public function __construct() @@ -77,12 +78,10 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Type|value-of $type * @param list|null $exclude * @param list|null $include */ public static function with( - Type|string $type, string $url, ?array $exclude = null, ?array $include = null, @@ -90,7 +89,6 @@ public static function with( ): self { $self = new self; - $self['type'] = $type; $self['url'] = $url; null !== $exclude && $self['exclude'] = $exclude; @@ -101,9 +99,9 @@ public static function with( } /** - * @param Type|value-of $type + * @param 'sitemap' $type */ - public function withType(Type|string $type): self + public function withType(string $type): self { $self = clone $this; $self['type'] = $type; diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Webhook.php b/src/Monitors/MonitorNewResponse/Webhook.php similarity index 96% rename from src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Webhook.php rename to src/Monitors/MonitorNewResponse/Webhook.php index d4ad6c70..8a700917 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Webhook.php +++ b/src/Monitors/MonitorNewResponse/Webhook.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor; +namespace ContextDev\Monitors\MonitorNewResponse; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php index 9dd110b1..61bb6ff7 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php @@ -10,6 +10,8 @@ use ContextDev\Core\Contracts\BaseModel; /** + * Watch a site's extracted structured data. + * * @phpstan-type MonitorsExtractTargetShape = array{ * type: 'extract', * url: string, diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php index 0e8425a0..6e4bf1e4 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php @@ -10,6 +10,8 @@ use ContextDev\Core\Contracts\BaseModel; /** + * Watch a single web page. + * * @phpstan-type MonitorsPageTargetShape = array{ * type: 'page', url: string, normalizeWhitespace?: bool|null * } diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php index 1e18b694..a02b5df7 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php @@ -10,6 +10,8 @@ use ContextDev\Core\Contracts\BaseModel; /** + * Watch a sitemap for URL additions and removals. + * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', * url: string, diff --git a/src/Monitors/MonitorUpdateResponse.php b/src/Monitors/MonitorUpdateResponse.php index 145d8ecd..30635b98 100644 --- a/src/Monitors/MonitorUpdateResponse.php +++ b/src/Monitors/MonitorUpdateResponse.php @@ -4,39 +4,336 @@ namespace ContextDev\Monitors; -use ContextDev\Core\Concerns\SdkUnion; -use ContextDev\Core\Conversion\Contracts\Converter; -use ContextDev\Core\Conversion\Contracts\ConverterSource; -use ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor; -use ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor; -use ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor; -use ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor; +use ContextDev\Core\Attributes\Optional; +use ContextDev\Core\Attributes\Required; +use ContextDev\Core\Concerns\SdkModel; +use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection; +use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection\MonitorsExactChangeDetection; +use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorUpdateResponse\Mode; +use ContextDev\Monitors\MonitorUpdateResponse\Schedule; +use ContextDev\Monitors\MonitorUpdateResponse\Status; +use ContextDev\Monitors\MonitorUpdateResponse\Target; +use ContextDev\Monitors\MonitorUpdateResponse\Target\MonitorsExtractTarget; +use ContextDev\Monitors\MonitorUpdateResponse\Target\MonitorsPageTarget; +use ContextDev\Monitors\MonitorUpdateResponse\Target\MonitorsSitemapTarget; +use ContextDev\Monitors\MonitorUpdateResponse\Webhook; /** - * Union of monitor response shapes. + * A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic). * - * @phpstan-import-type MonitorsPageExactMonitorShape from \ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor - * @phpstan-import-type MonitorsSitemapExactMonitorShape from \ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor - * @phpstan-import-type MonitorsPageSemanticMonitorShape from \ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor - * @phpstan-import-type MonitorsExtractSemanticMonitorShape from \ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor + * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection + * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorUpdateResponse\Target + * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection + * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorUpdateResponse\Schedule + * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorUpdateResponse\Target + * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorUpdateResponse\Webhook * - * @phpstan-type MonitorUpdateResponseVariants = MonitorsPageExactMonitor|MonitorsSitemapExactMonitor|MonitorsPageSemanticMonitor|MonitorsExtractSemanticMonitor - * @phpstan-type MonitorUpdateResponseShape = MonitorUpdateResponseVariants|MonitorsPageExactMonitorShape|MonitorsSitemapExactMonitorShape|MonitorsPageSemanticMonitorShape|MonitorsExtractSemanticMonitorShape + * @phpstan-type MonitorUpdateResponseShape = array{ + * id: string, + * changeDetection: ChangeDetectionShape, + * createdAt: \DateTimeInterface, + * mode: Mode|value-of, + * name: string, + * schedule: Schedule|ScheduleShape, + * status: Status|value-of, + * target: TargetShape, + * updatedAt: \DateTimeInterface, + * lastChangeAt?: \DateTimeInterface|null, + * lastRunAt?: \DateTimeInterface|null, + * tags?: list|null, + * webhook?: null|Webhook|WebhookShape, + * } */ -final class MonitorUpdateResponse implements ConverterSource +final class MonitorUpdateResponse implements BaseModel { - use SdkUnion; + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants $changeDetection + */ + #[Required('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; + + #[Required('created_at')] + public \DateTimeInterface $createdAt; + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + #[Required] + public string $name; + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Required] + public Schedule $schedule; + + /** @var value-of $status */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Discriminated union describing what the monitor watches. + * + * @var TargetVariants $target + */ + #[Required(union: Target::class)] + public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + + #[Required('updated_at')] + public \DateTimeInterface $updatedAt; + + #[Optional('last_change_at', nullable: true)] + public ?\DateTimeInterface $lastChangeAt; + + #[Optional('last_run_at', nullable: true)] + public ?\DateTimeInterface $lastRunAt; + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + #[Optional(nullable: true)] + public ?Webhook $webhook; + + /** + * `new MonitorUpdateResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorUpdateResponse::with( + * id: ..., + * changeDetection: ..., + * createdAt: ..., + * mode: ..., + * name: ..., + * schedule: ..., + * status: ..., + * target: ..., + * updatedAt: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorUpdateResponse) + * ->withID(...) + * ->withChangeDetection(...) + * ->withCreatedAt(...) + * ->withMode(...) + * ->withName(...) + * ->withSchedule(...) + * ->withStatus(...) + * ->withTarget(...) + * ->withUpdatedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param ChangeDetectionShape $changeDetection + * @param Mode|value-of $mode + * @param Schedule|ScheduleShape $schedule + * @param Status|value-of $status + * @param TargetShape $target + * @param list|null $tags + * @param Webhook|WebhookShape|null $webhook + */ + public static function with( + string $id, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + \DateTimeInterface $createdAt, + Mode|string $mode, + string $name, + Schedule|array $schedule, + Status|string $status, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + \DateTimeInterface $updatedAt, + ?\DateTimeInterface $lastChangeAt = null, + ?\DateTimeInterface $lastRunAt = null, + ?array $tags = null, + Webhook|array|null $webhook = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['changeDetection'] = $changeDetection; + $self['createdAt'] = $createdAt; + $self['mode'] = $mode; + $self['name'] = $name; + $self['schedule'] = $schedule; + $self['status'] = $status; + $self['target'] = $target; + $self['updatedAt'] = $updatedAt; + + null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $tags && $self['tags'] = $tags; + null !== $webhook && $self['webhook'] = $webhook; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Discriminated union describing how changes are detected. + * + * @param ChangeDetectionShape $changeDetection + */ + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, + ): self { + $self = clone $this; + $self['changeDetection'] = $changeDetection; + + return $self; + } + + public function withCreatedAt(\DateTimeInterface $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } /** - * @return list|array + * @param Status|value-of $status */ - public static function variants(): array + public function withStatus(Status|string $status): self { - return [ - MonitorsPageExactMonitor::class, - MonitorsSitemapExactMonitor::class, - MonitorsPageSemanticMonitor::class, - MonitorsExtractSemanticMonitor::class, - ]; + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Discriminated union describing what the monitor watches. + * + * @param TargetShape $target + */ + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { + $self = clone $this; + $self['target'] = $target; + + return $self; + } + + public function withUpdatedAt(\DateTimeInterface $updatedAt): self + { + $self = clone $this; + $self['updatedAt'] = $updatedAt; + + return $self; + } + + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self + { + $self = clone $this; + $self['lastChangeAt'] = $lastChangeAt; + + return $self; + } + + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self + { + $self = clone $this; + $self['lastRunAt'] = $lastRunAt; + + return $self; + } + + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * @param Webhook|WebhookShape|null $webhook + */ + public function withWebhook(Webhook|array|null $webhook): self + { + $self = clone $this; + $self['webhook'] = $webhook; + + return $self; } } diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection.php new file mode 100644 index 00000000..31cb75fb --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'exact' => MonitorsExactChangeDetection::class, + 'semantic' => MonitorsSemanticChangeDetection::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsExactChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsExactChangeDetection.php new file mode 100644 index 00000000..4111fc8e --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsExactChangeDetection.php @@ -0,0 +1,50 @@ + */ + use SdkModel; + + /** @var 'exact' $type */ + #[Required] + public string $type = 'exact'; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(): self + { + return new self; + } + + /** + * @param 'exact' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php new file mode 100644 index 00000000..99411714 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -0,0 +1,97 @@ + */ + use SdkModel; + + /** @var 'semantic' $type */ + #[Required] + public string $type = 'semantic'; + + #[Required] + public string $query; + + #[Optional('confidence_threshold')] + public ?float $confidenceThreshold; + + /** + * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSemanticChangeDetection::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSemanticChangeDetection)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $query, + ?float $confidenceThreshold = null + ): self { + $self = new self; + + $self['query'] = $query; + + null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } + + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * @param 'semantic' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withConfidenceThreshold(float $confidenceThreshold): self + { + $self = clone $this; + $self['confidenceThreshold'] = $confidenceThreshold; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Mode.php b/src/Monitors/MonitorUpdateResponse/Mode.php new file mode 100644 index 00000000..4c0a73c3 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Mode.php @@ -0,0 +1,13 @@ +, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsExtractSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsExtractSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsExtractSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsExtractSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php deleted file mode 100644 index cd63925a..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection.php +++ /dev/null @@ -1,102 +0,0 @@ -, confidenceThreshold?: float|null - * } - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $query; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Optional('confidence_threshold')] - public ?float $confidenceThreshold; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(query: ..., type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - string $query, - Type|string $type, - ?float $confidenceThreshold = null - ): self { - $self = new self; - - $self['query'] = $query; - $self['type'] = $type; - - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } - - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withConfidenceThreshold(float $confidenceThreshold): self - { - $self = clone $this; - $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index 73704d8d..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php deleted file mode 100644 index 1642e52e..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsExtractSemanticMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php deleted file mode 100644 index 1b034603..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php deleted file mode 100644 index 9d3a77a4..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index 3b3dd9b3..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php deleted file mode 100644 index 3c3c2400..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, url: string, normalizeWhitespace?: bool|null - * } - */ -final class Target implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Required] - public string $url; - - /** - * Normalize whitespace before comparing or analyzing text. - */ - #[Optional('normalize_whitespace')] - public ?bool $normalizeWhitespace; - - /** - * `new Target()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Target::with(type: ..., url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Target)->withType(...)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - Type|string $type, - string $url, - ?bool $normalizeWhitespace = null - ): self { - $self = new self; - - $self['type'] = $type; - $self['url'] = $url; - - null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Normalize whitespace before comparing or analyzing text. - */ - public function withNormalizeWhitespace(bool $normalizeWhitespace): self - { - $self = clone $this; - $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php deleted file mode 100644 index 55fe5030..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageExactMonitor/Target/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php deleted file mode 100644 index 6d5bb508..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsPageSemanticMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect meaning-level changes that match a natural language query. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsPageSemanticMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsPageSemanticMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsPageSemanticMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect meaning-level changes that match a natural language query. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php deleted file mode 100644 index 21697015..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection.php +++ /dev/null @@ -1,102 +0,0 @@ -, confidenceThreshold?: float|null - * } - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $query; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Optional('confidence_threshold')] - public ?float $confidenceThreshold; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(query: ..., type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withQuery(...)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - string $query, - Type|string $type, - ?float $confidenceThreshold = null - ): self { - $self = new self; - - $self['query'] = $query; - $self['type'] = $type; - - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } - - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withConfidenceThreshold(float $confidenceThreshold): self - { - $self = clone $this; - $self['confidenceThreshold'] = $confidenceThreshold; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php deleted file mode 100644 index 67990408..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php deleted file mode 100644 index 3665f855..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, url: string, normalizeWhitespace?: bool|null - * } - */ -final class Target implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - #[Required] - public string $url; - - /** - * Normalize whitespace before comparing or analyzing text. - */ - #[Optional('normalize_whitespace')] - public ?bool $normalizeWhitespace; - - /** - * `new Target()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Target::with(type: ..., url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Target)->withType(...)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with( - Type|string $type, - string $url, - ?bool $normalizeWhitespace = null - ): self { - $self = new self; - - $self['type'] = $type; - $self['url'] = $url; - - null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Normalize whitespace before comparing or analyzing text. - */ - public function withNormalizeWhitespace(bool $normalizeWhitespace): self - { - $self = clone $this; - $self['normalizeWhitespace'] = $normalizeWhitespace; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php deleted file mode 100644 index 0b6aac26..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsPageSemanticMonitor/Target/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php deleted file mode 100644 index 2cb8a409..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor.php +++ /dev/null @@ -1,294 +0,0 @@ -, - * target: Target|TargetShape, - * updatedAt: \DateTimeInterface, - * lastChangeAt?: \DateTimeInterface|null, - * lastRunAt?: \DateTimeInterface|null, - * tags?: list|null, - * webhook?: null|Webhook|WebhookShape, - * } - */ -final class MonitorsSitemapExactMonitor implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required] - public string $id; - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - */ - #[Required('change_detection')] - public ChangeDetection $changeDetection; - - #[Required('created_at')] - public \DateTimeInterface $createdAt; - - #[Required] - public string $name; - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - - /** @var value-of $status */ - #[Required(enum: Status::class)] - public string $status; - - #[Required] - public Target $target; - - #[Required('updated_at')] - public \DateTimeInterface $updatedAt; - - #[Optional('last_change_at', nullable: true)] - public ?\DateTimeInterface $lastChangeAt; - - #[Optional('last_run_at', nullable: true)] - public ?\DateTimeInterface $lastRunAt; - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - #[Optional(nullable: true)] - public ?Webhook $webhook; - - /** - * `new MonitorsSitemapExactMonitor()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSitemapExactMonitor::with( - * id: ..., - * changeDetection: ..., - * createdAt: ..., - * name: ..., - * schedule: ..., - * status: ..., - * target: ..., - * updatedAt: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSitemapExactMonitor) - * ->withID(...) - * ->withChangeDetection(...) - * ->withCreatedAt(...) - * ->withName(...) - * ->withSchedule(...) - * ->withStatus(...) - * ->withTarget(...) - * ->withUpdatedAt(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule - * @param Status|value-of $status - * @param Target|TargetShape $target - * @param list|null $tags - * @param Webhook|WebhookShape|null $webhook - */ - public static function with( - string $id, - ChangeDetection|array $changeDetection, - \DateTimeInterface $createdAt, - string $name, - Schedule|array $schedule, - Status|string $status, - Target|array $target, - \DateTimeInterface $updatedAt, - ?\DateTimeInterface $lastChangeAt = null, - ?\DateTimeInterface $lastRunAt = null, - ?array $tags = null, - Webhook|array|null $webhook = null, - ): self { - $self = new self; - - $self['id'] = $id; - $self['changeDetection'] = $changeDetection; - $self['createdAt'] = $createdAt; - $self['name'] = $name; - $self['schedule'] = $schedule; - $self['status'] = $status; - $self['target'] = $target; - $self['updatedAt'] = $updatedAt; - - null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; - null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; - null !== $tags && $self['tags'] = $tags; - null !== $webhook && $self['webhook'] = $webhook; - - return $self; - } - - public function withID(string $id): self - { - $self = clone $this; - $self['id'] = $id; - - return $self; - } - - /** - * Detect exact changes. For page targets, this means visible text diffs. For sitemap targets, this means URL additions and removals. - * - * @param ChangeDetection|ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - ChangeDetection|array $changeDetection - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - - public function withCreatedAt(\DateTimeInterface $createdAt): self - { - $self = clone $this; - $self['createdAt'] = $createdAt; - - return $self; - } - - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * - * @param Schedule|ScheduleShape $schedule - */ - public function withSchedule(Schedule|array $schedule): self - { - $self = clone $this; - $self['schedule'] = $schedule; - - return $self; - } - - /** - * @param Status|value-of $status - */ - public function withStatus(Status|string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * @param Target|TargetShape $target - */ - public function withTarget(Target|array $target): self - { - $self = clone $this; - $self['target'] = $target; - - return $self; - } - - public function withUpdatedAt(\DateTimeInterface $updatedAt): self - { - $self = clone $this; - $self['updatedAt'] = $updatedAt; - - return $self; - } - - public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self - { - $self = clone $this; - $self['lastChangeAt'] = $lastChangeAt; - - return $self; - } - - public function withLastRunAt(?\DateTimeInterface $lastRunAt): self - { - $self = clone $this; - $self['lastRunAt'] = $lastRunAt; - - return $self; - } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } - - /** - * @param Webhook|WebhookShape|null $webhook - */ - public function withWebhook(Webhook|array|null $webhook): self - { - $self = clone $this; - $self['webhook'] = $webhook; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php deleted file mode 100644 index 633ed16b..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection.php +++ /dev/null @@ -1,71 +0,0 @@ -} - */ -final class ChangeDetection implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** - * `new ChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * ChangeDetection::with(type: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new ChangeDetection)->withType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - */ - public static function with(Type|string $type): self - { - $self = new self; - - $self['type'] = $type; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php deleted file mode 100644 index 424dbdf6..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/ChangeDetection/Type.php +++ /dev/null @@ -1,10 +0,0 @@ -, unit: Unit|value-of - * } - */ -final class Schedule implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - #[Required] - public int $frequency; - - /** @var value-of $type */ - #[Required(enum: Type::class)] - public string $type; - - /** @var value-of $unit */ - #[Required(enum: Unit::class)] - public string $unit; - - /** - * `new Schedule()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Schedule::with(frequency: ..., type: ..., unit: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Schedule)->withFrequency(...)->withType(...)->withUnit(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of $type - * @param Unit|value-of $unit - */ - public static function with( - int $frequency, - Type|string $type, - Unit|string $unit - ): self { - $self = new self; - - $self['frequency'] = $frequency; - $self['type'] = $type; - $self['unit'] = $unit; - - return $self; - } - - /** - * Number of units between runs. The resulting interval (frequency × unit) must be at least 10 minutes and at most 1 year (e.g. minimum 10 when unit is minutes; maximum 365 when unit is days). - */ - public function withFrequency(int $frequency): self - { - $self = clone $this; - $self['frequency'] = $frequency; - - return $self; - } - - /** - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * @param Unit|value-of $unit - */ - public function withUnit(Unit|string $unit): self - { - $self = clone $this; - $self['unit'] = $unit; - - return $self; - } -} diff --git a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php deleted file mode 100644 index 7ed9445b..00000000 --- a/src/Monitors/MonitorUpdateResponse/MonitorsSitemapExactMonitor/Schedule/Type.php +++ /dev/null @@ -1,10 +0,0 @@ - */ - use SdkModel; - - /** - * Webhook URL called when a change is detected. - */ - #[Required] - public string $url; - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - #[Optional] - public ?string $secret; - - /** - * `new Webhook()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Webhook::with(url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Webhook)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $url, ?string $secret = null): self - { - $self = new self; - - $self['url'] = $url; - - null !== $secret && $self['secret'] = $secret; - - return $self; - } - - /** - * Webhook URL called when a change is detected. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } - - /** - * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. - */ - public function withSecret(string $secret): self - { - $self = clone $this; - $self['secret'] = $secret; - - return $self; - } -} diff --git a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule.php b/src/Monitors/MonitorUpdateResponse/Schedule.php similarity index 91% rename from src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule.php rename to src/Monitors/MonitorUpdateResponse/Schedule.php index 147ef170..9effd286 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsPageSemanticMonitor/Schedule.php +++ b/src/Monitors/MonitorUpdateResponse/Schedule.php @@ -2,13 +2,13 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor; +namespace ContextDev\Monitors\MonitorUpdateResponse; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor\Schedule\Type; -use ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor\Schedule\Unit; +use ContextDev\Monitors\MonitorUpdateResponse\Schedule\Type; +use ContextDev\Monitors\MonitorUpdateResponse\Schedule\Unit; /** * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Type.php b/src/Monitors/MonitorUpdateResponse/Schedule/Type.php similarity index 50% rename from src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Type.php rename to src/Monitors/MonitorUpdateResponse/Schedule/Type.php index 050474a6..43da8d73 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Type.php +++ b/src/Monitors/MonitorUpdateResponse/Schedule/Type.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor\Schedule; +namespace ContextDev\Monitors\MonitorUpdateResponse\Schedule; enum Type: string { diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php b/src/Monitors/MonitorUpdateResponse/Schedule/Unit.php similarity index 61% rename from src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php rename to src/Monitors/MonitorUpdateResponse/Schedule/Unit.php index 40d33368..14a36144 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Schedule/Unit.php +++ b/src/Monitors/MonitorUpdateResponse/Schedule/Unit.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor\Schedule; +namespace ContextDev\Monitors\MonitorUpdateResponse\Schedule; enum Unit: string { diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Status.php b/src/Monitors/MonitorUpdateResponse/Status.php similarity index 64% rename from src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Status.php rename to src/Monitors/MonitorUpdateResponse/Status.php index e9f7e1f6..1ecb242b 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Status.php +++ b/src/Monitors/MonitorUpdateResponse/Status.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor; +namespace ContextDev\Monitors\MonitorUpdateResponse; enum Status: string { diff --git a/src/Monitors/MonitorUpdateResponse/Target.php b/src/Monitors/MonitorUpdateResponse/Target.php new file mode 100644 index 00000000..0c0ff6bf --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Target.php @@ -0,0 +1,44 @@ +|array + */ + public static function variants(): array + { + return [ + 'page' => MonitorsPageTarget::class, + 'sitemap' => MonitorsSitemapTarget::class, + 'extract' => MonitorsExtractTarget::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php new file mode 100644 index 00000000..ce54f243 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php @@ -0,0 +1,191 @@ +|null, + * } + */ +final class MonitorsExtractTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'extract' $type */ + #[Required] + public string $type = 'extract'; + + /** + * Root URL to extract structured data from. + */ + #[Required] + public string $url; + + #[Optional('follow_subdomains')] + public ?bool $followSubdomains; + + /** + * Optional natural-language instructions guiding what to extract. + */ + #[Optional] + public ?string $instructions; + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + #[Optional('max_depth')] + public ?int $maxDepth; + + /** + * Maximum number of pages to analyze during extraction. + */ + #[Optional('max_pages')] + public ?int $maxPages; + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @var array|null $schema + */ + #[Optional(map: 'mixed')] + public ?array $schema; + + /** + * `new MonitorsExtractTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $schema + */ + public static function with( + string $url, + ?bool $followSubdomains = null, + ?string $instructions = null, + ?int $maxDepth = null, + ?int $maxPages = null, + ?array $schema = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $instructions && $self['instructions'] = $instructions; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxPages && $self['maxPages'] = $maxPages; + null !== $schema && $self['schema'] = $schema; + + return $self; + } + + /** + * @param 'extract' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Root URL to extract structured data from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Optional natural-language instructions guiding what to extract. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + + /** + * Optional maximum link depth from the starting URL (0 = only the starting page). + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum number of pages to analyze during extraction. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * + * @param array $schema + */ + public function withSchema(array $schema): self + { + $self = clone $this; + $self['schema'] = $schema; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php new file mode 100644 index 00000000..80d0b6b4 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** @var 'page' $type */ + #[Required] + public string $type = 'page'; + + #[Required] + public string $url; + + /** + * Normalize whitespace before comparing or analyzing text. + */ + #[Optional('normalize_whitespace')] + public ?bool $normalizeWhitespace; + + /** + * `new MonitorsPageTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $url, + ?bool $normalizeWhitespace = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } + + /** + * @param 'page' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Normalize whitespace before comparing or analyzing text. + */ + public function withNormalizeWhitespace(bool $normalizeWhitespace): self + { + $self = clone $this; + $self['normalizeWhitespace'] = $normalizeWhitespace; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php new file mode 100644 index 00000000..333cfb3c --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php @@ -0,0 +1,156 @@ +|null, + * include?: list|null, + * maxURLs?: int|null, + * } + */ +final class MonitorsSitemapTarget implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'sitemap' $type */ + #[Required] + public string $type = 'sitemap'; + + /** + * Sitemap URL to monitor. + */ + #[Required] + public string $url; + + /** + * URL path patterns to exclude. + * + * @var list|null $exclude + */ + #[Optional(list: 'string')] + public ?array $exclude; + + /** + * URL path patterns to include. + * + * @var list|null $include + */ + #[Optional(list: 'string')] + public ?array $include; + + #[Optional('max_urls')] + public ?int $maxURLs; + + /** + * `new MonitorsSitemapTarget()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapTarget::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapTarget)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $exclude + * @param list|null $include + */ + public static function with( + string $url, + ?array $exclude = null, + ?array $include = null, + ?int $maxURLs = null, + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $exclude && $self['exclude'] = $exclude; + null !== $include && $self['include'] = $include; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Sitemap URL to monitor. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * URL path patterns to exclude. + * + * @param list $exclude + */ + public function withExclude(array $exclude): self + { + $self = clone $this; + $self['exclude'] = $exclude; + + return $self; + } + + /** + * URL path patterns to include. + * + * @param list $include + */ + public function withInclude(array $include): self + { + $self = clone $this; + $self['include'] = $include; + + return $self; + } + + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Webhook.php b/src/Monitors/MonitorUpdateResponse/Webhook.php similarity index 96% rename from src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Webhook.php rename to src/Monitors/MonitorUpdateResponse/Webhook.php index 18dae57b..e785fec7 100644 --- a/src/Monitors/MonitorGetResponse/MonitorsSitemapExactMonitor/Webhook.php +++ b/src/Monitors/MonitorUpdateResponse/Webhook.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor; +namespace ContextDev\Monitors\MonitorUpdateResponse; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php index 4fd43d16..1dda23c8 100644 --- a/src/ServiceContracts/MonitorsContract.php +++ b/src/ServiceContracts/MonitorsContract.php @@ -5,33 +5,30 @@ namespace ContextDev\ServiceContracts; use ContextDev\Core\Exceptions\APIException; -use ContextDev\Monitors\MonitorCreateParams\ChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsExactChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\Mode; use ContextDev\Monitors\MonitorCreateParams\Schedule; -use ContextDev\Monitors\MonitorCreateParams\Target; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsExtractTarget; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsPageTarget; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsSitemapTarget; use ContextDev\Monitors\MonitorCreateParams\Webhook; use ContextDev\Monitors\MonitorDeleteResponse; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsExtractSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageExactChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsSitemapExactChange; +use ContextDev\Monitors\MonitorGetChangeResponse; +use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesResponse; use ContextDev\Monitors\MonitorListAccountRunsResponse; use ContextDev\Monitors\MonitorListChangesResponse; use ContextDev\Monitors\MonitorListParams\ChangeDetectionType; +use ContextDev\Monitors\MonitorListParams\SearchBy; +use ContextDev\Monitors\MonitorListParams\SearchType; use ContextDev\Monitors\MonitorListParams\TargetType; use ContextDev\Monitors\MonitorListResponse; use ContextDev\Monitors\MonitorListRunsResponse; -use ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor; +use ContextDev\Monitors\MonitorNewResponse; use ContextDev\Monitors\MonitorRunResponse; -use ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsExactChangeDetection; -use ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsSemanticChangeDetection; use ContextDev\Monitors\MonitorUpdateParams\Status; -use ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsExtractTarget; -use ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsPageTarget; -use ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsSitemapTarget; +use ContextDev\Monitors\MonitorUpdateResponse; use ContextDev\RequestOptions; /** @@ -50,9 +47,10 @@ interface MonitorsContract /** * @api * - * @param ChangeDetection|ChangeDetectionShape $changeDetection detect meaning-level changes that match a natural language query + * @param ChangeDetectionShape $changeDetection discriminated union describing how changes are detected * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * @param Target|TargetShape $target + * @param TargetShape $target discriminated union describing what the monitor watches + * @param Mode|value-of $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. * @param list $tags user-defined tags for grouping and filtering monitors and their changes * @param Webhook|WebhookShape|null $webhook * @param RequestOpts|null $requestOptions @@ -60,14 +58,15 @@ interface MonitorsContract * @throws APIException */ public function create( - ChangeDetection|array $changeDetection, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, string $name, Schedule|array $schedule, - Target|array $target, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + Mode|string|null $mode = null, ?array $tags = null, Webhook|array|null $webhook = null, RequestOptions|array|null $requestOptions = null, - ): MonitorsPageExactMonitor|MonitorsSitemapExactMonitor|MonitorsPageSemanticMonitor|MonitorsExtractSemanticMonitor; + ): MonitorNewResponse; /** * @api @@ -79,7 +78,7 @@ public function create( public function retrieve( string $monitorID, RequestOptions|array|null $requestOptions = null - ): \ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor; + ): MonitorGetResponse; /** * @api @@ -96,22 +95,26 @@ public function retrieve( */ public function update( string $monitorID, - MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, + \ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsExactChangeDetection|array|\ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsSemanticChangeDetection|null $changeDetection = null, ?string $name = null, \ContextDev\Monitors\MonitorUpdateParams\Schedule|array|null $schedule = null, Status|string|null $status = null, ?array $tags = null, - MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget|null $target = null, + \ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsPageTarget|array|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsSitemapTarget|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsExtractTarget|null $target = null, \ContextDev\Monitors\MonitorUpdateParams\Webhook|array|null $webhook = null, RequestOptions|array|null $requestOptions = null, - ): \ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor; + ): MonitorUpdateResponse; /** * @api * * @param ChangeDetectionType|value-of $changeDetectionType + * @param string $q free-text search term, matched against the fields named in `search_by` + * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status * @param string $tag filter to items that have this tag + * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) * @param TargetType|value-of $targetType * @param RequestOpts|null $requestOptions * @@ -121,8 +124,12 @@ public function list( ChangeDetectionType|string|null $changeDetectionType = null, ?string $cursor = null, int $limit = 25, + ?string $q = null, + ?array $searchBy = null, + SearchType|string $searchType = 'prefix', \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, ?string $tag = null, + ?array $tags = null, TargetType|string|null $targetType = null, RequestOptions|array|null $requestOptions = null, ): MonitorListResponse; @@ -220,7 +227,7 @@ public function listRuns( public function retrieveChange( string $changeID, RequestOptions|array|null $requestOptions = null - ): MonitorsPageExactChange|MonitorsSitemapExactChange|MonitorsPageSemanticChange|MonitorsExtractSemanticChange; + ): MonitorGetChangeResponse; /** * @api diff --git a/src/ServiceContracts/MonitorsRawContract.php b/src/ServiceContracts/MonitorsRawContract.php index b61fb391..aad01ad0 100644 --- a/src/ServiceContracts/MonitorsRawContract.php +++ b/src/ServiceContracts/MonitorsRawContract.php @@ -8,10 +8,8 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\Monitors\MonitorCreateParams; use ContextDev\Monitors\MonitorDeleteResponse; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsExtractSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageExactChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsSitemapExactChange; +use ContextDev\Monitors\MonitorGetChangeResponse; +use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesParams; use ContextDev\Monitors\MonitorListAccountChangesResponse; use ContextDev\Monitors\MonitorListAccountRunsParams; @@ -22,12 +20,10 @@ use ContextDev\Monitors\MonitorListResponse; use ContextDev\Monitors\MonitorListRunsParams; use ContextDev\Monitors\MonitorListRunsResponse; -use ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor; +use ContextDev\Monitors\MonitorNewResponse; use ContextDev\Monitors\MonitorRunResponse; use ContextDev\Monitors\MonitorUpdateParams; +use ContextDev\Monitors\MonitorUpdateResponse; use ContextDev\RequestOptions; /** @@ -41,7 +37,7 @@ interface MonitorsRawContract * @param array|MonitorCreateParams $params * @param RequestOpts|null $requestOptions * - * @return BaseResponse + * @return BaseResponse * * @throws APIException */ @@ -55,7 +51,7 @@ public function create( * * @param RequestOpts|null $requestOptions * - * @return BaseResponse<\ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor,> + * @return BaseResponse * * @throws APIException */ @@ -70,7 +66,7 @@ public function retrieve( * @param array|MonitorUpdateParams $params * @param RequestOpts|null $requestOptions * - * @return BaseResponse<\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor,> + * @return BaseResponse * * @throws APIException */ @@ -176,7 +172,7 @@ public function listRuns( * * @param RequestOpts|null $requestOptions * - * @return BaseResponse + * @return BaseResponse * * @throws APIException */ diff --git a/src/Services/MonitorsRawService.php b/src/Services/MonitorsRawService.php index 27498428..a0f78f98 100644 --- a/src/Services/MonitorsRawService.php +++ b/src/Services/MonitorsRawService.php @@ -9,16 +9,11 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\Util; use ContextDev\Monitors\MonitorCreateParams; -use ContextDev\Monitors\MonitorCreateParams\ChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\Mode; use ContextDev\Monitors\MonitorCreateParams\Schedule; -use ContextDev\Monitors\MonitorCreateParams\Target; use ContextDev\Monitors\MonitorCreateParams\Webhook; use ContextDev\Monitors\MonitorDeleteResponse; use ContextDev\Monitors\MonitorGetChangeResponse; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsExtractSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageExactChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsSitemapExactChange; use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesParams; use ContextDev\Monitors\MonitorListAccountChangesResponse; @@ -28,15 +23,13 @@ use ContextDev\Monitors\MonitorListChangesResponse; use ContextDev\Monitors\MonitorListParams; use ContextDev\Monitors\MonitorListParams\ChangeDetectionType; +use ContextDev\Monitors\MonitorListParams\SearchBy; +use ContextDev\Monitors\MonitorListParams\SearchType; use ContextDev\Monitors\MonitorListParams\TargetType; use ContextDev\Monitors\MonitorListResponse; use ContextDev\Monitors\MonitorListRunsParams; use ContextDev\Monitors\MonitorListRunsResponse; use ContextDev\Monitors\MonitorNewResponse; -use ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor; use ContextDev\Monitors\MonitorRunResponse; use ContextDev\Monitors\MonitorUpdateParams; use ContextDev\Monitors\MonitorUpdateParams\Status; @@ -71,16 +64,17 @@ public function __construct(private Client $client) {} * Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline. * * @param array{ - * changeDetection: ChangeDetection|ChangeDetectionShape, + * changeDetection: ChangeDetectionShape, * name: string, * schedule: Schedule|ScheduleShape, - * target: Target|TargetShape, + * target: TargetShape, + * mode?: Mode|value-of, * tags?: list, * webhook?: Webhook|WebhookShape|null, * }|MonitorCreateParams $params * @param RequestOpts|null $requestOptions * - * @return BaseResponse + * @return BaseResponse * * @throws APIException */ @@ -110,7 +104,7 @@ public function create( * * @param RequestOpts|null $requestOptions * - * @return BaseResponse + * @return BaseResponse * * @throws APIException */ @@ -143,7 +137,7 @@ public function retrieve( * }|MonitorUpdateParams $params * @param RequestOpts|null $requestOptions * - * @return BaseResponse + * @return BaseResponse * * @throws APIException */ @@ -170,14 +164,18 @@ public function update( /** * @api * - * List monitors + * Lists monitors for the authenticated organization. Supports free-text search (`q` over `search_by` fields, `prefix` or `exact` via `search_type`) plus status/type/tag filters. Results are paginated via the opaque `cursor`. * * @param array{ * changeDetectionType?: ChangeDetectionType|value-of, * cursor?: string, * limit?: int, + * q?: string, + * searchBy?: list>, + * searchType?: SearchType|value-of, * status?: MonitorListParams\Status|value-of, * tag?: string, + * tags?: list, * targetType?: TargetType|value-of, * }|MonitorListParams $params * @param RequestOpts|null $requestOptions @@ -203,6 +201,8 @@ public function list( $parsed, [ 'changeDetectionType' => 'change_detection_type', + 'searchBy' => 'search_by', + 'searchType' => 'search_type', 'targetType' => 'target_type', ], ), @@ -398,7 +398,7 @@ public function listRuns( * * @param RequestOpts|null $requestOptions * - * @return BaseResponse + * @return BaseResponse * * @throws APIException */ diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php index 8df4453e..4aed25ea 100644 --- a/src/Services/MonitorsService.php +++ b/src/Services/MonitorsService.php @@ -7,33 +7,30 @@ use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\Util; -use ContextDev\Monitors\MonitorCreateParams\ChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsExactChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorCreateParams\Mode; use ContextDev\Monitors\MonitorCreateParams\Schedule; -use ContextDev\Monitors\MonitorCreateParams\Target; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsExtractTarget; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsPageTarget; +use ContextDev\Monitors\MonitorCreateParams\Target\MonitorsSitemapTarget; use ContextDev\Monitors\MonitorCreateParams\Webhook; use ContextDev\Monitors\MonitorDeleteResponse; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsExtractSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageExactChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsPageSemanticChange; -use ContextDev\Monitors\MonitorGetChangeResponse\MonitorsSitemapExactChange; +use ContextDev\Monitors\MonitorGetChangeResponse; +use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesResponse; use ContextDev\Monitors\MonitorListAccountRunsResponse; use ContextDev\Monitors\MonitorListChangesResponse; use ContextDev\Monitors\MonitorListParams\ChangeDetectionType; +use ContextDev\Monitors\MonitorListParams\SearchBy; +use ContextDev\Monitors\MonitorListParams\SearchType; use ContextDev\Monitors\MonitorListParams\TargetType; use ContextDev\Monitors\MonitorListResponse; use ContextDev\Monitors\MonitorListRunsResponse; -use ContextDev\Monitors\MonitorNewResponse\MonitorsExtractSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageExactMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsPageSemanticMonitor; -use ContextDev\Monitors\MonitorNewResponse\MonitorsSitemapExactMonitor; +use ContextDev\Monitors\MonitorNewResponse; use ContextDev\Monitors\MonitorRunResponse; -use ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsExactChangeDetection; -use ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsSemanticChangeDetection; use ContextDev\Monitors\MonitorUpdateParams\Status; -use ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsExtractTarget; -use ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsPageTarget; -use ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsSitemapTarget; +use ContextDev\Monitors\MonitorUpdateResponse; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\MonitorsContract; @@ -70,9 +67,10 @@ public function __construct(private Client $client) * * Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline. * - * @param ChangeDetection|ChangeDetectionShape $changeDetection detect meaning-level changes that match a natural language query + * @param ChangeDetectionShape $changeDetection discriminated union describing how changes are detected * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - * @param Target|TargetShape $target + * @param TargetShape $target discriminated union describing what the monitor watches + * @param Mode|value-of $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. * @param list $tags user-defined tags for grouping and filtering monitors and their changes * @param Webhook|WebhookShape|null $webhook * @param RequestOpts|null $requestOptions @@ -80,20 +78,22 @@ public function __construct(private Client $client) * @throws APIException */ public function create( - ChangeDetection|array $changeDetection, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, string $name, Schedule|array $schedule, - Target|array $target, + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + Mode|string|null $mode = null, ?array $tags = null, Webhook|array|null $webhook = null, RequestOptions|array|null $requestOptions = null, - ): MonitorsPageExactMonitor|MonitorsSitemapExactMonitor|MonitorsPageSemanticMonitor|MonitorsExtractSemanticMonitor { + ): MonitorNewResponse { $params = Util::removeNulls( [ 'changeDetection' => $changeDetection, 'name' => $name, 'schedule' => $schedule, 'target' => $target, + 'mode' => $mode, 'tags' => $tags, 'webhook' => $webhook, ], @@ -117,7 +117,7 @@ public function create( public function retrieve( string $monitorID, RequestOptions|array|null $requestOptions = null - ): \ContextDev\Monitors\MonitorGetResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorGetResponse\MonitorsExtractSemanticMonitor { + ): MonitorGetResponse { // @phpstan-ignore-next-line argument.type $response = $this->raw->retrieve($monitorID, requestOptions: $requestOptions); @@ -141,15 +141,15 @@ public function retrieve( */ public function update( string $monitorID, - MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, + \ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsExactChangeDetection|array|\ContextDev\Monitors\MonitorUpdateParams\ChangeDetection\MonitorsSemanticChangeDetection|null $changeDetection = null, ?string $name = null, \ContextDev\Monitors\MonitorUpdateParams\Schedule|array|null $schedule = null, Status|string|null $status = null, ?array $tags = null, - MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget|null $target = null, + \ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsPageTarget|array|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsSitemapTarget|\ContextDev\Monitors\MonitorUpdateParams\Target\MonitorsExtractTarget|null $target = null, \ContextDev\Monitors\MonitorUpdateParams\Webhook|array|null $webhook = null, RequestOptions|array|null $requestOptions = null, - ): \ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsSitemapExactMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsPageSemanticMonitor|\ContextDev\Monitors\MonitorUpdateResponse\MonitorsExtractSemanticMonitor { + ): MonitorUpdateResponse { $params = Util::removeNulls( [ 'changeDetection' => $changeDetection, @@ -171,11 +171,15 @@ public function update( /** * @api * - * List monitors + * Lists monitors for the authenticated organization. Supports free-text search (`q` over `search_by` fields, `prefix` or `exact` via `search_type`) plus status/type/tag filters. Results are paginated via the opaque `cursor`. * * @param ChangeDetectionType|value-of $changeDetectionType + * @param string $q free-text search term, matched against the fields named in `search_by` + * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status * @param string $tag filter to items that have this tag + * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) * @param TargetType|value-of $targetType * @param RequestOpts|null $requestOptions * @@ -185,8 +189,12 @@ public function list( ChangeDetectionType|string|null $changeDetectionType = null, ?string $cursor = null, int $limit = 25, + ?string $q = null, + ?array $searchBy = null, + SearchType|string $searchType = 'prefix', \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, ?string $tag = null, + ?array $tags = null, TargetType|string|null $targetType = null, RequestOptions|array|null $requestOptions = null, ): MonitorListResponse { @@ -195,8 +203,12 @@ public function list( 'changeDetectionType' => $changeDetectionType, 'cursor' => $cursor, 'limit' => $limit, + 'q' => $q, + 'searchBy' => $searchBy, + 'searchType' => $searchType, 'status' => $status, 'tag' => $tag, + 'tags' => $tags, 'targetType' => $targetType, ], ); @@ -368,7 +380,7 @@ public function listRuns( public function retrieveChange( string $changeID, RequestOptions|array|null $requestOptions = null - ): MonitorsPageExactChange|MonitorsSitemapExactChange|MonitorsPageSemanticChange|MonitorsExtractSemanticChange { + ): MonitorGetChangeResponse { // @phpstan-ignore-next-line argument.type $response = $this->raw->retrieveChange($changeID, requestOptions: $requestOptions); diff --git a/tests/Services/MonitorsTest.php b/tests/Services/MonitorsTest.php index 2e62023c..ede69632 100644 --- a/tests/Services/MonitorsTest.php +++ b/tests/Services/MonitorsTest.php @@ -5,12 +5,16 @@ use ContextDev\Client; use ContextDev\Core\Util; use ContextDev\Monitors\MonitorDeleteResponse; +use ContextDev\Monitors\MonitorGetChangeResponse; +use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesResponse; use ContextDev\Monitors\MonitorListAccountRunsResponse; use ContextDev\Monitors\MonitorListChangesResponse; use ContextDev\Monitors\MonitorListResponse; use ContextDev\Monitors\MonitorListRunsResponse; +use ContextDev\Monitors\MonitorNewResponse; use ContextDev\Monitors\MonitorRunResponse; +use ContextDev\Monitors\MonitorUpdateResponse; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; @@ -42,17 +46,14 @@ public function testCreate(): void } $result = $this->client->monitors->create( - changeDetection: [ - 'query' => 'Tell me when pricing, packaging, plan limits, or discounts change.', - 'type' => 'semantic', - ], - name: 'Acme pricing monitor', + changeDetection: ['type' => 'exact'], + name: 'Acme pricing page', schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], - target: ['type' => 'extract', 'url' => 'https://acme.com'], + target: ['type' => 'page', 'url' => 'https://acme.com/pricing'], ); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertNotNull($result); + $this->assertInstanceOf(MonitorNewResponse::class, $result); } #[Test] @@ -63,28 +64,21 @@ public function testCreateWithOptionalParams(): void } $result = $this->client->monitors->create( - changeDetection: [ - 'query' => 'Tell me when pricing, packaging, plan limits, or discounts change.', - 'type' => 'semantic', - 'confidenceThreshold' => 0, - ], - name: 'Acme pricing monitor', + changeDetection: ['type' => 'exact'], + name: 'Acme pricing page', schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], target: [ - 'type' => 'extract', - 'url' => 'https://acme.com', - 'followSubdomains' => true, - 'instructions' => 'Extract every pricing plan with its monthly price and included limits.', - 'maxDepth' => 0, - 'maxPages' => 1, - 'schema' => ['type' => 'bar', 'properties' => 'bar'], + 'type' => 'page', + 'url' => 'https://acme.com/pricing', + 'normalizeWhitespace' => true, ], + mode: 'web', tags: ['pricing', 'competitor'], webhook: ['url' => 'https://example.com/webhook'], ); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertNotNull($result); + $this->assertInstanceOf(MonitorNewResponse::class, $result); } #[Test] @@ -97,7 +91,7 @@ public function testRetrieve(): void $result = $this->client->monitors->retrieve('mon_123'); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertNotNull($result); + $this->assertInstanceOf(MonitorGetResponse::class, $result); } #[Test] @@ -110,7 +104,7 @@ public function testUpdate(): void $result = $this->client->monitors->update('mon_123'); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertNotNull($result); + $this->assertInstanceOf(MonitorUpdateResponse::class, $result); } #[Test] @@ -201,7 +195,7 @@ public function testRetrieveChange(): void $result = $this->client->monitors->retrieveChange('chg_123'); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertNotNull($result); + $this->assertInstanceOf(MonitorGetChangeResponse::class, $result); } #[Test] From 2ce8b0fcc9fbe7d191911e7950d888a7a9a633cd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 30 Jun 2026 03:55:57 +0000 Subject: [PATCH 017/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 6 ++++++ src/Services/WebRawService.php | 3 +++ src/Services/WebService.php | 9 +++++++++ src/Web/WebWebCrawlMdParams.php | 20 ++++++++++++++++++++ src/Web/WebWebScrapeHTMLParams.php | 20 ++++++++++++++++++++ src/Web/WebWebScrapeMdParams.php | 20 ++++++++++++++++++++ tests/Services/WebTest.php | 3 +++ 8 files changed, 83 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0115b3b5..f52ab5d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-66a3bf68b47ba61c9b61406d36f614a079ff752b8964a8df8062e485391d5598.yml -openapi_spec_hash: b17d6cfe3710dd0605078f3907a1a419 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d71b08e421ccdda9a2754c307e97df0ee7444926306a00624dca2bc7d56548ac.yml +openapi_spec_hash: ebfbed20b5837ccf8db8bb40ab23baac config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index c067c5a5..b8da98db 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -213,6 +213,7 @@ public function search( * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -238,6 +239,7 @@ public function webCrawlMd( \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, int $stopAfterMs = 80000, ?int $timeoutMs = null, @@ -258,6 +260,7 @@ public function webCrawlMd( * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). @@ -276,6 +279,7 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -318,6 +322,7 @@ public function webScrapeImages( * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation @@ -339,6 +344,7 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, ?int $timeoutMs = null, bool $useMainContentOnly = false, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 1464af22..ac2dee79 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -321,6 +321,7 @@ public function search( * maxDepth?: int, * maxPages?: int, * pdf?: WebWebCrawlMdParams\Pdf|PdfShape1, + * settleAnimations?: bool, * shortenBase64Images?: bool, * stopAfterMs?: int, * timeoutMs?: int, @@ -367,6 +368,7 @@ public function webCrawlMd( * includeSelectors?: list, * maxAgeMs?: int, * pdf?: WebWebScrapeHTMLParams\Pdf|PdfShape2, + * settleAnimations?: bool, * timeoutMs?: int, * useMainContentOnly?: bool, * waitForMs?: int, @@ -450,6 +452,7 @@ public function webScrapeImages( * includeSelectors?: list, * maxAgeMs?: int, * pdf?: WebWebScrapeMdParams\Pdf|PdfShape3, + * settleAnimations?: bool, * shortenBase64Images?: bool, * timeoutMs?: int, * useMainContentOnly?: bool, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index c7ad6ad3..58d23590 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -349,6 +349,7 @@ public function search( * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -374,6 +375,7 @@ public function webCrawlMd( \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, int $stopAfterMs = 80000, ?int $timeoutMs = null, @@ -396,6 +398,7 @@ public function webCrawlMd( 'maxDepth' => $maxDepth, 'maxPages' => $maxPages, 'pdf' => $pdf, + 'settleAnimations' => $settleAnimations, 'shortenBase64Images' => $shortenBase64Images, 'stopAfterMs' => $stopAfterMs, 'timeoutMs' => $timeoutMs, @@ -424,6 +427,7 @@ public function webCrawlMd( * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). @@ -442,6 +446,7 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -457,6 +462,7 @@ public function webScrapeHTML( 'includeSelectors' => $includeSelectors, 'maxAgeMs' => $maxAgeMs, 'pdf' => $pdf, + 'settleAnimations' => $settleAnimations, 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, 'waitForMs' => $waitForMs, @@ -525,6 +531,7 @@ public function webScrapeImages( * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation @@ -546,6 +553,7 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, ], + bool $settleAnimations = false, bool $shortenBase64Images = true, ?int $timeoutMs = null, bool $useMainContentOnly = false, @@ -564,6 +572,7 @@ public function webScrapeMd( 'includeSelectors' => $includeSelectors, 'maxAgeMs' => $maxAgeMs, 'pdf' => $pdf, + 'settleAnimations' => $settleAnimations, 'shortenBase64Images' => $shortenBase64Images, 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index d08a8bd2..d89de937 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -32,6 +32,7 @@ * maxDepth?: int|null, * maxPages?: int|null, * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, * shortenBase64Images?: bool|null, * stopAfterMs?: int|null, * timeoutMs?: int|null, @@ -124,6 +125,12 @@ final class WebWebCrawlMdParams implements BaseModel #[Optional] public ?Pdf $pdf; + /** + * When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + #[Optional] + public ?bool $settleAnimations; + /** * Truncate base64-encoded image data in the Markdown output. */ @@ -202,6 +209,7 @@ public static function with( ?int $maxDepth = null, ?int $maxPages = null, Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, ?bool $shortenBase64Images = null, ?int $stopAfterMs = null, ?int $timeoutMs = null, @@ -224,6 +232,7 @@ public static function with( null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; @@ -374,6 +383,17 @@ public function withPdf(Pdf|array $pdf): self return $self; } + /** + * When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + /** * Truncate base64-encoded image data in the Markdown output. */ diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php index 785afc2e..a37ee58c 100644 --- a/src/Web/WebWebScrapeHTMLParams.php +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -28,6 +28,7 @@ * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, * timeoutMs?: int|null, * useMainContentOnly?: bool|null, * waitForMs?: int|null, @@ -95,6 +96,12 @@ final class WebWebScrapeHTMLParams implements BaseModel #[Optional] public ?Pdf $pdf; + /** + * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + #[Optional] + public ?bool $settleAnimations; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -152,6 +159,7 @@ public static function with( ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, ?int $timeoutMs = null, ?bool $useMainContentOnly = null, ?int $waitForMs = null, @@ -167,6 +175,7 @@ public static function with( null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -272,6 +281,17 @@ public function withPdf(Pdf|array $pdf): self return $self; } + /** + * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index 54f2cc79..5b36e1ef 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -30,6 +30,7 @@ * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, * shortenBase64Images?: bool|null, * timeoutMs?: int|null, * useMainContentOnly?: bool|null, @@ -110,6 +111,12 @@ final class WebWebScrapeMdParams implements BaseModel #[Optional] public ?Pdf $pdf; + /** + * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + #[Optional] + public ?bool $settleAnimations; + /** * Shorten base64-encoded image data in the Markdown output. */ @@ -175,6 +182,7 @@ public static function with( ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, ?bool $shortenBase64Images = null, ?int $timeoutMs = null, ?bool $useMainContentOnly = null, @@ -193,6 +201,7 @@ public static function with( null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; @@ -321,6 +330,17 @@ public function withPdf(Pdf|array $pdf): self return $self; } + /** + * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + /** * Shorten base64-encoded image data in the Markdown output. */ diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index 55fa08d3..bb991a64 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -240,6 +240,7 @@ public function testWebCrawlMdWithOptionalParams(): void maxDepth: 0, maxPages: 1, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, shortenBase64Images: true, stopAfterMs: 10000, timeoutMs: 1000, @@ -281,6 +282,7 @@ public function testWebScrapeHTMLWithOptionalParams(): void includeSelectors: ['string'], maxAgeMs: 0, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, timeoutMs: 1000, useMainContentOnly: true, waitForMs: 0, @@ -359,6 +361,7 @@ public function testWebScrapeMdWithOptionalParams(): void includeSelectors: ['string'], maxAgeMs: 0, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, shortenBase64Images: true, timeoutMs: 1000, useMainContentOnly: true, From ffbb3b186021eb7820140ae5fe8475a1dda6036c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2026 01:46:53 +0000 Subject: [PATCH 018/130] feat(api): api update --- .stats.yml | 4 ++-- src/Web/WebExtractResponse/Metadata.php | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f52ab5d2..75582f89 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d71b08e421ccdda9a2754c307e97df0ee7444926306a00624dca2bc7d56548ac.yml -openapi_spec_hash: ebfbed20b5837ccf8db8bb40ab23baac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c7625b4a7beb9e7d9827f3b836e6539cbc5f26b6754891d4352716e38cdecd73.yml +openapi_spec_hash: cbee9cf164cc6704a6febb4d9737e83e config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/Web/WebExtractResponse/Metadata.php b/src/Web/WebExtractResponse/Metadata.php index 36928ce2..35b923d7 100644 --- a/src/Web/WebExtractResponse/Metadata.php +++ b/src/Web/WebExtractResponse/Metadata.php @@ -11,6 +11,7 @@ /** * @phpstan-type MetadataShape = array{ * maxCrawlDepth: int, + * numBlocked: int, * numFailed: int, * numSkipped: int, * numSucceeded: int, @@ -25,6 +26,12 @@ final class Metadata implements BaseModel #[Required] public int $maxCrawlDepth; + /** + * Number of crawled pages excluded because they were anti-bot challenges, error pages, or parked-domain placeholders. + */ + #[Required] + public int $numBlocked; + #[Required] public int $numFailed; @@ -44,6 +51,7 @@ final class Metadata implements BaseModel * ``` * Metadata::with( * maxCrawlDepth: ..., + * numBlocked: ..., * numFailed: ..., * numSkipped: ..., * numSucceeded: ..., @@ -56,6 +64,7 @@ final class Metadata implements BaseModel * ``` * (new Metadata) * ->withMaxCrawlDepth(...) + * ->withNumBlocked(...) * ->withNumFailed(...) * ->withNumSkipped(...) * ->withNumSucceeded(...) @@ -74,6 +83,7 @@ public function __construct() */ public static function with( int $maxCrawlDepth, + int $numBlocked, int $numFailed, int $numSkipped, int $numSucceeded, @@ -82,6 +92,7 @@ public static function with( $self = new self; $self['maxCrawlDepth'] = $maxCrawlDepth; + $self['numBlocked'] = $numBlocked; $self['numFailed'] = $numFailed; $self['numSkipped'] = $numSkipped; $self['numSucceeded'] = $numSucceeded; @@ -98,6 +109,17 @@ public function withMaxCrawlDepth(int $maxCrawlDepth): self return $self; } + /** + * Number of crawled pages excluded because they were anti-bot challenges, error pages, or parked-domain placeholders. + */ + public function withNumBlocked(int $numBlocked): self + { + $self = clone $this; + $self['numBlocked'] = $numBlocked; + + return $self; + } + public function withNumFailed(int $numFailed): self { $self = clone $this; From 8e06d22db07f33983b559e3ed368ad6d9c0e6c7e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 2 Jul 2026 05:14:32 +0000 Subject: [PATCH 019/130] feat(api): api update --- .stats.yml | 4 +- .../Target/MonitorsSitemapTarget.php | 8 +- src/Monitors/MonitorGetChangeResponse.php | 46 ++++++++++- src/Monitors/MonitorGetResponse.php | 53 ++++++++++++- src/Monitors/MonitorGetResponse/LastError.php | 76 +++++++++++++++++++ src/Monitors/MonitorGetResponse/Status.php | 3 + .../Target/MonitorsSitemapTarget.php | 8 +- src/Monitors/MonitorListAccountRunsParams.php | 8 +- .../MonitorListAccountRunsParams/Status.php | 5 ++ .../MonitorListAccountRunsResponse/Data.php | 56 +++++++++++++- .../Data/SkipReason.php | 17 +++++ .../Data/Status.php | 5 ++ src/Monitors/MonitorListParams.php | 8 +- src/Monitors/MonitorListParams/Status.php | 3 + src/Monitors/MonitorListResponse/Data.php | 53 ++++++++++++- .../MonitorListResponse/Data/LastError.php | 76 +++++++++++++++++++ .../MonitorListResponse/Data/Status.php | 3 + .../Data/Target/MonitorsSitemapTarget.php | 8 +- src/Monitors/MonitorListRunsParams.php | 8 +- src/Monitors/MonitorListRunsParams/Status.php | 5 ++ src/Monitors/MonitorListRunsResponse/Data.php | 56 +++++++++++++- .../Data/SkipReason.php | 17 +++++ .../MonitorListRunsResponse/Data/Status.php | 5 ++ src/Monitors/MonitorNewResponse.php | 53 ++++++++++++- src/Monitors/MonitorNewResponse/LastError.php | 76 +++++++++++++++++++ src/Monitors/MonitorNewResponse/Status.php | 3 + .../Target/MonitorsSitemapTarget.php | 8 +- src/Monitors/MonitorRunResponse.php | 33 ++++++-- .../Target/MonitorsSitemapTarget.php | 8 +- src/Monitors/MonitorUpdateResponse.php | 53 ++++++++++++- .../MonitorUpdateResponse/LastError.php | 76 +++++++++++++++++++ src/Monitors/MonitorUpdateResponse/Status.php | 3 + .../Target/MonitorsSitemapTarget.php | 8 +- src/ServiceContracts/MonitorsContract.php | 6 +- src/Services/MonitorsService.php | 6 +- 35 files changed, 833 insertions(+), 31 deletions(-) create mode 100644 src/Monitors/MonitorGetResponse/LastError.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/SkipReason.php create mode 100644 src/Monitors/MonitorListResponse/Data/LastError.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/SkipReason.php create mode 100644 src/Monitors/MonitorNewResponse/LastError.php create mode 100644 src/Monitors/MonitorUpdateResponse/LastError.php diff --git a/.stats.yml b/.stats.yml index 75582f89..3e4f5649 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c7625b4a7beb9e7d9827f3b836e6539cbc5f26b6754891d4352716e38cdecd73.yml -openapi_spec_hash: cbee9cf164cc6704a6febb4d9737e83e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-09b6020939995033719a53b988fb00bdb20c42d87070975a8d6b469fa18128fb.yml +openapi_spec_hash: ba3e471937a679e2c45c0b9a115fca5c config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php index f0bf27e5..92e7c01a 100644 --- a/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', @@ -51,6 +51,9 @@ final class MonitorsSitemapTarget implements BaseModel #[Optional(list: 'string')] public ?array $include; + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ #[Optional('max_urls')] public ?int $maxURLs; @@ -146,6 +149,9 @@ public function withInclude(array $include): self return $self; } + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ public function withMaxURLs(int $maxURLs): self { $self = clone $this; diff --git a/src/Monitors/MonitorGetChangeResponse.php b/src/Monitors/MonitorGetChangeResponse.php index 3008ad3f..44f7b824 100644 --- a/src/Monitors/MonitorGetChangeResponse.php +++ b/src/Monitors/MonitorGetChangeResponse.php @@ -25,6 +25,7 @@ * detectedAt: \DateTimeInterface, * mode: Mode|value-of, * monitorID: string, + * runID: string, * summary: string, * targetType: TargetType|value-of, * title: string, @@ -71,6 +72,12 @@ final class MonitorGetChangeResponse implements BaseModel #[Required('monitor_id')] public string $monitorID; + /** + * The run that detected this change. + */ + #[Required('run_id')] + public string $runID; + #[Required] public string $summary; @@ -87,7 +94,11 @@ final class MonitorGetChangeResponse implements BaseModel #[Optional('added_url_count')] public ?int $addedURLCount; - /** @var list|null $addedURLs */ + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @var list|null $addedURLs + */ #[Optional('added_urls', list: 'string')] public ?array $addedURLs; @@ -117,7 +128,11 @@ final class MonitorGetChangeResponse implements BaseModel #[Optional('matched_url_count')] public ?int $matchedURLCount; - /** @var list|null $matchedURLs */ + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @var list|null $matchedURLs + */ #[Optional('matched_urls', list: 'string')] public ?array $matchedURLs; @@ -127,7 +142,11 @@ final class MonitorGetChangeResponse implements BaseModel #[Optional('removed_url_count')] public ?int $removedURLCount; - /** @var list|null $removedURLs */ + /** + * At most 500 URLs are included; the corresponding count field is always exact. + * + * @var list|null $removedURLs + */ #[Optional('removed_urls', list: 'string')] public ?array $removedURLs; @@ -150,6 +169,7 @@ final class MonitorGetChangeResponse implements BaseModel * detectedAt: ..., * mode: ..., * monitorID: ..., + * runID: ..., * summary: ..., * targetType: ..., * title: ..., @@ -166,6 +186,7 @@ final class MonitorGetChangeResponse implements BaseModel * ->withDetectedAt(...) * ->withMode(...) * ->withMonitorID(...) + * ->withRunID(...) * ->withSummary(...) * ->withTargetType(...) * ->withTitle(...) @@ -198,6 +219,7 @@ public static function with( \DateTimeInterface $detectedAt, Mode|string $mode, string $monitorID, + string $runID, string $summary, TargetType|string $targetType, string $title, @@ -224,6 +246,7 @@ public static function with( $self['detectedAt'] = $detectedAt; $self['mode'] = $mode; $self['monitorID'] = $monitorID; + $self['runID'] = $runID; $self['summary'] = $summary; $self['targetType'] = $targetType; $self['title'] = $title; @@ -296,6 +319,17 @@ public function withMonitorID(string $monitorID): self return $self; } + /** + * The run that detected this change. + */ + public function withRunID(string $runID): self + { + $self = clone $this; + $self['runID'] = $runID; + + return $self; + } + public function withSummary(string $summary): self { $self = clone $this; @@ -340,6 +374,8 @@ public function withAddedURLCount(int $addedURLCount): self } /** + * At most 500 URLs are included; the corresponding count field is always exact. + * * @param list $addedURLs */ public function withAddedURLs(array $addedURLs): self @@ -416,6 +452,8 @@ public function withMatchedURLCount(int $matchedURLCount): self } /** + * At most 500 URLs are included; the corresponding count field is always exact. + * * @param list $matchedURLs */ public function withMatchedURLs(array $matchedURLs): self @@ -443,6 +481,8 @@ public function withRemovedURLCount(int $removedURLCount): self } /** + * At most 500 URLs are included; the corresponding count field is always exact. + * * @param list $removedURLs */ public function withRemovedURLs(array $removedURLs): self diff --git a/src/Monitors/MonitorGetResponse.php b/src/Monitors/MonitorGetResponse.php index 89f9d467..5e0fba53 100644 --- a/src/Monitors/MonitorGetResponse.php +++ b/src/Monitors/MonitorGetResponse.php @@ -11,6 +11,7 @@ use ContextDev\Monitors\MonitorGetResponse\ChangeDetection; use ContextDev\Monitors\MonitorGetResponse\ChangeDetection\MonitorsExactChangeDetection; use ContextDev\Monitors\MonitorGetResponse\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorGetResponse\LastError; use ContextDev\Monitors\MonitorGetResponse\Mode; use ContextDev\Monitors\MonitorGetResponse\Schedule; use ContextDev\Monitors\MonitorGetResponse\Status; @@ -28,6 +29,7 @@ * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorGetResponse\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorGetResponse\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorGetResponse\Target + * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorGetResponse\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorGetResponse\Webhook * * @phpstan-type MonitorGetResponseShape = array{ @@ -41,7 +43,9 @@ * target: TargetShape, * updatedAt: \DateTimeInterface, * lastChangeAt?: \DateTimeInterface|null, + * lastError?: null|LastError|LastErrorShape, * lastRunAt?: \DateTimeInterface|null, + * nextRunAt?: \DateTimeInterface|null, * tags?: list|null, * webhook?: null|Webhook|WebhookShape, * } @@ -82,7 +86,11 @@ final class MonitorGetResponse implements BaseModel #[Required] public Schedule $schedule; - /** @var value-of $status */ + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ #[Required(enum: Status::class)] public string $status; @@ -100,9 +108,21 @@ final class MonitorGetResponse implements BaseModel #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + #[Optional('last_run_at', nullable: true)] public ?\DateTimeInterface $lastRunAt; + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + /** * User-defined tags for grouping and filtering monitors and their changes. * @@ -162,6 +182,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook */ @@ -176,7 +197,9 @@ public static function with( MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, ): self { @@ -193,7 +216,9 @@ public static function with( $self['updatedAt'] = $updatedAt; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; @@ -265,6 +290,8 @@ public function withSchedule(Schedule|array $schedule): self } /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self @@ -305,6 +332,19 @@ public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self return $self; } + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self { $self = clone $this; @@ -313,6 +353,17 @@ public function withLastRunAt(?\DateTimeInterface $lastRunAt): self return $self; } + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + /** * User-defined tags for grouping and filtering monitors and their changes. * diff --git a/src/Monitors/MonitorGetResponse/LastError.php b/src/Monitors/MonitorGetResponse/LastError.php new file mode 100644 index 00000000..815218a7 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Status.php b/src/Monitors/MonitorGetResponse/Status.php index 552dcf83..7d64de72 100644 --- a/src/Monitors/MonitorGetResponse/Status.php +++ b/src/Monitors/MonitorGetResponse/Status.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorGetResponse; +/** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + */ enum Status: string { case ACTIVE = 'active'; diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php index 9ff46192..4ae0fcac 100644 --- a/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', @@ -51,6 +51,9 @@ final class MonitorsSitemapTarget implements BaseModel #[Optional(list: 'string')] public ?array $include; + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ #[Optional('max_urls')] public ?int $maxURLs; @@ -146,6 +149,9 @@ public function withInclude(array $include): self return $self; } + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ public function withMaxURLs(int $maxURLs): self { $self = clone $this; diff --git a/src/Monitors/MonitorListAccountRunsParams.php b/src/Monitors/MonitorListAccountRunsParams.php index 0795f164..474613e6 100644 --- a/src/Monitors/MonitorListAccountRunsParams.php +++ b/src/Monitors/MonitorListAccountRunsParams.php @@ -31,7 +31,11 @@ final class MonitorListAccountRunsParams implements BaseModel #[Optional] public ?int $limit; - /** @var value-of|null $status */ + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of|null $status + */ #[Optional(enum: Status::class)] public ?string $status; @@ -78,6 +82,8 @@ public function withLimit(int $limit): self } /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self diff --git a/src/Monitors/MonitorListAccountRunsParams/Status.php b/src/Monitors/MonitorListAccountRunsParams/Status.php index c768dd7f..585dc956 100644 --- a/src/Monitors/MonitorListAccountRunsParams/Status.php +++ b/src/Monitors/MonitorListAccountRunsParams/Status.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListAccountRunsParams; +/** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + */ enum Status: string { case QUEUED = 'queued'; @@ -13,4 +16,6 @@ enum Status: string case COMPLETED = 'completed'; case FAILED = 'failed'; + + case SKIPPED = 'skipped'; } diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data.php b/src/Monitors/MonitorListAccountRunsResponse/Data.php index 4e8a7c75..21281937 100644 --- a/src/Monitors/MonitorListAccountRunsResponse/Data.php +++ b/src/Monitors/MonitorListAccountRunsResponse/Data.php @@ -11,6 +11,7 @@ use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\ChangeDetectionType; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Error; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\RunType; +use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\SkipReason; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Status; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\TargetType; @@ -22,6 +23,7 @@ * baselineCreated: bool, * changeDetected: bool, * changeDetectionType: ChangeDetectionType|value-of, + * creditsCharged: int, * monitorID: string, * runType: RunType|value-of, * status: Status|value-of, @@ -29,6 +31,7 @@ * changeID?: string|null, * completedAt?: \DateTimeInterface|null, * error?: null|Error|ErrorShape, + * skipReason?: null|SkipReason|value-of, * startedAt?: \DateTimeInterface|null, * } */ @@ -53,6 +56,12 @@ final class Data implements BaseModel #[Required('change_detection_type', enum: ChangeDetectionType::class)] public string $changeDetectionType; + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + #[Required('credits_charged')] + public int $creditsCharged; + #[Required('monitor_id')] public string $monitorID; @@ -64,7 +73,11 @@ final class Data implements BaseModel #[Required('run_type', enum: RunType::class)] public string $runType; - /** @var value-of $status */ + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of $status + */ #[Required(enum: Status::class)] public string $status; @@ -81,6 +94,14 @@ final class Data implements BaseModel #[Optional(nullable: true)] public ?Error $error; + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @var value-of|null $skipReason + */ + #[Optional('skip_reason', enum: SkipReason::class, nullable: true)] + public ?string $skipReason; + #[Optional('started_at', nullable: true)] public ?\DateTimeInterface $startedAt; @@ -94,6 +115,7 @@ final class Data implements BaseModel * baselineCreated: ..., * changeDetected: ..., * changeDetectionType: ..., + * creditsCharged: ..., * monitorID: ..., * runType: ..., * status: ..., @@ -109,6 +131,7 @@ final class Data implements BaseModel * ->withBaselineCreated(...) * ->withChangeDetected(...) * ->withChangeDetectionType(...) + * ->withCreditsCharged(...) * ->withMonitorID(...) * ->withRunType(...) * ->withStatus(...) @@ -130,12 +153,14 @@ public function __construct() * @param Status|value-of $status * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error + * @param SkipReason|value-of|null $skipReason */ public static function with( string $id, bool $baselineCreated, bool $changeDetected, ChangeDetectionType|string $changeDetectionType, + int $creditsCharged, string $monitorID, RunType|string $runType, Status|string $status, @@ -143,6 +168,7 @@ public static function with( ?string $changeID = null, ?\DateTimeInterface $completedAt = null, Error|array|null $error = null, + SkipReason|string|null $skipReason = null, ?\DateTimeInterface $startedAt = null, ): self { $self = new self; @@ -151,6 +177,7 @@ public static function with( $self['baselineCreated'] = $baselineCreated; $self['changeDetected'] = $changeDetected; $self['changeDetectionType'] = $changeDetectionType; + $self['creditsCharged'] = $creditsCharged; $self['monitorID'] = $monitorID; $self['runType'] = $runType; $self['status'] = $status; @@ -159,6 +186,7 @@ public static function with( null !== $changeID && $self['changeID'] = $changeID; null !== $completedAt && $self['completedAt'] = $completedAt; null !== $error && $self['error'] = $error; + null !== $skipReason && $self['skipReason'] = $skipReason; null !== $startedAt && $self['startedAt'] = $startedAt; return $self; @@ -203,6 +231,17 @@ public function withChangeDetectionType( return $self; } + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + public function withCreditsCharged(int $creditsCharged): self + { + $self = clone $this; + $self['creditsCharged'] = $creditsCharged; + + return $self; + } + public function withMonitorID(string $monitorID): self { $self = clone $this; @@ -225,6 +264,8 @@ public function withRunType(RunType|string $runType): self } /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self @@ -273,6 +314,19 @@ public function withError(Error|array|null $error): self return $self; } + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @param SkipReason|value-of|null $skipReason + */ + public function withSkipReason(SkipReason|string|null $skipReason): self + { + $self = clone $this; + $self['skipReason'] = $skipReason; + + return $self; + } + public function withStartedAt(?\DateTimeInterface $startedAt): self { $self = clone $this; diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/SkipReason.php b/src/Monitors/MonitorListAccountRunsResponse/Data/SkipReason.php new file mode 100644 index 00000000..82009e1e --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/SkipReason.php @@ -0,0 +1,17 @@ +|null $status */ + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of|null $status + */ #[Optional(enum: Status::class)] public ?string $status; @@ -203,6 +207,8 @@ public function withSearchType(SearchType|string $searchType): self } /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self diff --git a/src/Monitors/MonitorListParams/Status.php b/src/Monitors/MonitorListParams/Status.php index cbd92c1e..84537bd5 100644 --- a/src/Monitors/MonitorListParams/Status.php +++ b/src/Monitors/MonitorListParams/Status.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListParams; +/** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + */ enum Status: string { case ACTIVE = 'active'; diff --git a/src/Monitors/MonitorListResponse/Data.php b/src/Monitors/MonitorListResponse/Data.php index e7335e95..95526640 100644 --- a/src/Monitors/MonitorListResponse/Data.php +++ b/src/Monitors/MonitorListResponse/Data.php @@ -11,6 +11,7 @@ use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection; use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection\MonitorsExactChangeDetection; use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorListResponse\Data\LastError; use ContextDev\Monitors\MonitorListResponse\Data\Mode; use ContextDev\Monitors\MonitorListResponse\Data\Schedule; use ContextDev\Monitors\MonitorListResponse\Data\Status; @@ -28,6 +29,7 @@ * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorListResponse\Data\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorListResponse\Data\Target + * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorListResponse\Data\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorListResponse\Data\Webhook * * @phpstan-type DataShape = array{ @@ -41,7 +43,9 @@ * target: TargetShape, * updatedAt: \DateTimeInterface, * lastChangeAt?: \DateTimeInterface|null, + * lastError?: null|LastError|LastErrorShape, * lastRunAt?: \DateTimeInterface|null, + * nextRunAt?: \DateTimeInterface|null, * tags?: list|null, * webhook?: null|Webhook|WebhookShape, * } @@ -82,7 +86,11 @@ final class Data implements BaseModel #[Required] public Schedule $schedule; - /** @var value-of $status */ + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ #[Required(enum: Status::class)] public string $status; @@ -100,9 +108,21 @@ final class Data implements BaseModel #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + #[Optional('last_run_at', nullable: true)] public ?\DateTimeInterface $lastRunAt; + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + /** * User-defined tags for grouping and filtering monitors and their changes. * @@ -162,6 +182,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook */ @@ -176,7 +197,9 @@ public static function with( MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, ): self { @@ -193,7 +216,9 @@ public static function with( $self['updatedAt'] = $updatedAt; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; @@ -265,6 +290,8 @@ public function withSchedule(Schedule|array $schedule): self } /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self @@ -305,6 +332,19 @@ public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self return $self; } + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self { $self = clone $this; @@ -313,6 +353,17 @@ public function withLastRunAt(?\DateTimeInterface $lastRunAt): self return $self; } + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + /** * User-defined tags for grouping and filtering monitors and their changes. * diff --git a/src/Monitors/MonitorListResponse/Data/LastError.php b/src/Monitors/MonitorListResponse/Data/LastError.php new file mode 100644 index 00000000..4cf4df7f --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Status.php b/src/Monitors/MonitorListResponse/Data/Status.php index bdc7bce7..1eabecdf 100644 --- a/src/Monitors/MonitorListResponse/Data/Status.php +++ b/src/Monitors/MonitorListResponse/Data/Status.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListResponse\Data; +/** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + */ enum Status: string { case ACTIVE = 'active'; diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php index a207f616..04a020f5 100644 --- a/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', @@ -51,6 +51,9 @@ final class MonitorsSitemapTarget implements BaseModel #[Optional(list: 'string')] public ?array $include; + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ #[Optional('max_urls')] public ?int $maxURLs; @@ -146,6 +149,9 @@ public function withInclude(array $include): self return $self; } + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ public function withMaxURLs(int $maxURLs): self { $self = clone $this; diff --git a/src/Monitors/MonitorListRunsParams.php b/src/Monitors/MonitorListRunsParams.php index 477023ef..8b87f69f 100644 --- a/src/Monitors/MonitorListRunsParams.php +++ b/src/Monitors/MonitorListRunsParams.php @@ -31,7 +31,11 @@ final class MonitorListRunsParams implements BaseModel #[Optional] public ?int $limit; - /** @var value-of|null $status */ + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of|null $status + */ #[Optional(enum: Status::class)] public ?string $status; @@ -78,6 +82,8 @@ public function withLimit(int $limit): self } /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self diff --git a/src/Monitors/MonitorListRunsParams/Status.php b/src/Monitors/MonitorListRunsParams/Status.php index a65b54a5..765a444e 100644 --- a/src/Monitors/MonitorListRunsParams/Status.php +++ b/src/Monitors/MonitorListRunsParams/Status.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListRunsParams; +/** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + */ enum Status: string { case QUEUED = 'queued'; @@ -13,4 +16,6 @@ enum Status: string case COMPLETED = 'completed'; case FAILED = 'failed'; + + case SKIPPED = 'skipped'; } diff --git a/src/Monitors/MonitorListRunsResponse/Data.php b/src/Monitors/MonitorListRunsResponse/Data.php index b779d323..882d163d 100644 --- a/src/Monitors/MonitorListRunsResponse/Data.php +++ b/src/Monitors/MonitorListRunsResponse/Data.php @@ -11,6 +11,7 @@ use ContextDev\Monitors\MonitorListRunsResponse\Data\ChangeDetectionType; use ContextDev\Monitors\MonitorListRunsResponse\Data\Error; use ContextDev\Monitors\MonitorListRunsResponse\Data\RunType; +use ContextDev\Monitors\MonitorListRunsResponse\Data\SkipReason; use ContextDev\Monitors\MonitorListRunsResponse\Data\Status; use ContextDev\Monitors\MonitorListRunsResponse\Data\TargetType; @@ -22,6 +23,7 @@ * baselineCreated: bool, * changeDetected: bool, * changeDetectionType: ChangeDetectionType|value-of, + * creditsCharged: int, * monitorID: string, * runType: RunType|value-of, * status: Status|value-of, @@ -29,6 +31,7 @@ * changeID?: string|null, * completedAt?: \DateTimeInterface|null, * error?: null|Error|ErrorShape, + * skipReason?: null|SkipReason|value-of, * startedAt?: \DateTimeInterface|null, * } */ @@ -53,6 +56,12 @@ final class Data implements BaseModel #[Required('change_detection_type', enum: ChangeDetectionType::class)] public string $changeDetectionType; + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + #[Required('credits_charged')] + public int $creditsCharged; + #[Required('monitor_id')] public string $monitorID; @@ -64,7 +73,11 @@ final class Data implements BaseModel #[Required('run_type', enum: RunType::class)] public string $runType; - /** @var value-of $status */ + /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * + * @var value-of $status + */ #[Required(enum: Status::class)] public string $status; @@ -81,6 +94,14 @@ final class Data implements BaseModel #[Optional(nullable: true)] public ?Error $error; + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @var value-of|null $skipReason + */ + #[Optional('skip_reason', enum: SkipReason::class, nullable: true)] + public ?string $skipReason; + #[Optional('started_at', nullable: true)] public ?\DateTimeInterface $startedAt; @@ -94,6 +115,7 @@ final class Data implements BaseModel * baselineCreated: ..., * changeDetected: ..., * changeDetectionType: ..., + * creditsCharged: ..., * monitorID: ..., * runType: ..., * status: ..., @@ -109,6 +131,7 @@ final class Data implements BaseModel * ->withBaselineCreated(...) * ->withChangeDetected(...) * ->withChangeDetectionType(...) + * ->withCreditsCharged(...) * ->withMonitorID(...) * ->withRunType(...) * ->withStatus(...) @@ -130,12 +153,14 @@ public function __construct() * @param Status|value-of $status * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error + * @param SkipReason|value-of|null $skipReason */ public static function with( string $id, bool $baselineCreated, bool $changeDetected, ChangeDetectionType|string $changeDetectionType, + int $creditsCharged, string $monitorID, RunType|string $runType, Status|string $status, @@ -143,6 +168,7 @@ public static function with( ?string $changeID = null, ?\DateTimeInterface $completedAt = null, Error|array|null $error = null, + SkipReason|string|null $skipReason = null, ?\DateTimeInterface $startedAt = null, ): self { $self = new self; @@ -151,6 +177,7 @@ public static function with( $self['baselineCreated'] = $baselineCreated; $self['changeDetected'] = $changeDetected; $self['changeDetectionType'] = $changeDetectionType; + $self['creditsCharged'] = $creditsCharged; $self['monitorID'] = $monitorID; $self['runType'] = $runType; $self['status'] = $status; @@ -159,6 +186,7 @@ public static function with( null !== $changeID && $self['changeID'] = $changeID; null !== $completedAt && $self['completedAt'] = $completedAt; null !== $error && $self['error'] = $error; + null !== $skipReason && $self['skipReason'] = $skipReason; null !== $startedAt && $self['startedAt'] = $startedAt; return $self; @@ -203,6 +231,17 @@ public function withChangeDetectionType( return $self; } + /** + * Credits charged for this run (0 for skipped/failed runs). + */ + public function withCreditsCharged(int $creditsCharged): self + { + $self = clone $this; + $self['creditsCharged'] = $creditsCharged; + + return $self; + } + public function withMonitorID(string $monitorID): self { $self = clone $this; @@ -225,6 +264,8 @@ public function withRunType(RunType|string $runType): self } /** + * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self @@ -273,6 +314,19 @@ public function withError(Error|array|null $error): self return $self; } + /** + * Why a skipped run never executed; null unless status is `skipped`. + * + * @param SkipReason|value-of|null $skipReason + */ + public function withSkipReason(SkipReason|string|null $skipReason): self + { + $self = clone $this; + $self['skipReason'] = $skipReason; + + return $self; + } + public function withStartedAt(?\DateTimeInterface $startedAt): self { $self = clone $this; diff --git a/src/Monitors/MonitorListRunsResponse/Data/SkipReason.php b/src/Monitors/MonitorListRunsResponse/Data/SkipReason.php new file mode 100644 index 00000000..c37f9b4c --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/SkipReason.php @@ -0,0 +1,17 @@ +|null, * webhook?: null|Webhook|WebhookShape, * } @@ -82,7 +86,11 @@ final class MonitorNewResponse implements BaseModel #[Required] public Schedule $schedule; - /** @var value-of $status */ + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ #[Required(enum: Status::class)] public string $status; @@ -100,9 +108,21 @@ final class MonitorNewResponse implements BaseModel #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + #[Optional('last_run_at', nullable: true)] public ?\DateTimeInterface $lastRunAt; + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + /** * User-defined tags for grouping and filtering monitors and their changes. * @@ -162,6 +182,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook */ @@ -176,7 +197,9 @@ public static function with( MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, ): self { @@ -193,7 +216,9 @@ public static function with( $self['updatedAt'] = $updatedAt; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; @@ -265,6 +290,8 @@ public function withSchedule(Schedule|array $schedule): self } /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self @@ -305,6 +332,19 @@ public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self return $self; } + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self { $self = clone $this; @@ -313,6 +353,17 @@ public function withLastRunAt(?\DateTimeInterface $lastRunAt): self return $self; } + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + /** * User-defined tags for grouping and filtering monitors and their changes. * diff --git a/src/Monitors/MonitorNewResponse/LastError.php b/src/Monitors/MonitorNewResponse/LastError.php new file mode 100644 index 00000000..894d68c8 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Status.php b/src/Monitors/MonitorNewResponse/Status.php index d58f553e..1c0155e5 100644 --- a/src/Monitors/MonitorNewResponse/Status.php +++ b/src/Monitors/MonitorNewResponse/Status.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorNewResponse; +/** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + */ enum Status: string { case ACTIVE = 'active'; diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php index 38cce8d5..bef89b16 100644 --- a/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', @@ -51,6 +51,9 @@ final class MonitorsSitemapTarget implements BaseModel #[Optional(list: 'string')] public ?array $include; + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ #[Optional('max_urls')] public ?int $maxURLs; @@ -146,6 +149,9 @@ public function withInclude(array $include): self return $self; } + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ public function withMaxURLs(int $maxURLs): self { $self = clone $this; diff --git a/src/Monitors/MonitorRunResponse.php b/src/Monitors/MonitorRunResponse.php index c9a5f074..e90007bf 100644 --- a/src/Monitors/MonitorRunResponse.php +++ b/src/Monitors/MonitorRunResponse.php @@ -9,7 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-type MonitorRunResponseShape = array{monitorID: string, queued: bool} + * @phpstan-type MonitorRunResponseShape = array{ + * monitorID: string, queued: bool, runID: string + * } */ final class MonitorRunResponse implements BaseModel { @@ -22,18 +24,24 @@ final class MonitorRunResponse implements BaseModel #[Required] public bool $queued; + /** + * The queued run. Poll GET /monitors/{monitor_id}/runs or use it to correlate results. + */ + #[Required('run_id')] + public string $runID; + /** * `new MonitorRunResponse()` is missing required properties by the API. * * To enforce required parameters use * ``` - * MonitorRunResponse::with(monitorID: ..., queued: ...) + * MonitorRunResponse::with(monitorID: ..., queued: ..., runID: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorRunResponse)->withMonitorID(...)->withQueued(...) + * (new MonitorRunResponse)->withMonitorID(...)->withQueued(...)->withRunID(...) * ``` */ public function __construct() @@ -46,12 +54,16 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(string $monitorID, bool $queued): self - { + public static function with( + string $monitorID, + bool $queued, + string $runID + ): self { $self = new self; $self['monitorID'] = $monitorID; $self['queued'] = $queued; + $self['runID'] = $runID; return $self; } @@ -71,4 +83,15 @@ public function withQueued(bool $queued): self return $self; } + + /** + * The queued run. Poll GET /monitors/{monitor_id}/runs or use it to correlate results. + */ + public function withRunID(string $runID): self + { + $self = clone $this; + $self['runID'] = $runID; + + return $self; + } } diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php index a02b5df7..d2e5441d 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', @@ -51,6 +51,9 @@ final class MonitorsSitemapTarget implements BaseModel #[Optional(list: 'string')] public ?array $include; + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ #[Optional('max_urls')] public ?int $maxURLs; @@ -146,6 +149,9 @@ public function withInclude(array $include): self return $self; } + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ public function withMaxURLs(int $maxURLs): self { $self = clone $this; diff --git a/src/Monitors/MonitorUpdateResponse.php b/src/Monitors/MonitorUpdateResponse.php index 30635b98..0100ff26 100644 --- a/src/Monitors/MonitorUpdateResponse.php +++ b/src/Monitors/MonitorUpdateResponse.php @@ -11,6 +11,7 @@ use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection; use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection\MonitorsExactChangeDetection; use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection\MonitorsSemanticChangeDetection; +use ContextDev\Monitors\MonitorUpdateResponse\LastError; use ContextDev\Monitors\MonitorUpdateResponse\Mode; use ContextDev\Monitors\MonitorUpdateResponse\Schedule; use ContextDev\Monitors\MonitorUpdateResponse\Status; @@ -28,6 +29,7 @@ * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorUpdateResponse\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorUpdateResponse\Target + * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorUpdateResponse\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorUpdateResponse\Webhook * * @phpstan-type MonitorUpdateResponseShape = array{ @@ -41,7 +43,9 @@ * target: TargetShape, * updatedAt: \DateTimeInterface, * lastChangeAt?: \DateTimeInterface|null, + * lastError?: null|LastError|LastErrorShape, * lastRunAt?: \DateTimeInterface|null, + * nextRunAt?: \DateTimeInterface|null, * tags?: list|null, * webhook?: null|Webhook|WebhookShape, * } @@ -82,7 +86,11 @@ final class MonitorUpdateResponse implements BaseModel #[Required] public Schedule $schedule; - /** @var value-of $status */ + /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * + * @var value-of $status + */ #[Required(enum: Status::class)] public string $status; @@ -100,9 +108,21 @@ final class MonitorUpdateResponse implements BaseModel #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; + /** + * Error from the most recent failed run; null when the last run succeeded. + */ + #[Optional('last_error', nullable: true)] + public ?LastError $lastError; + #[Optional('last_run_at', nullable: true)] public ?\DateTimeInterface $lastRunAt; + /** + * When the next scheduled run is due. + */ + #[Optional('next_run_at', nullable: true)] + public ?\DateTimeInterface $nextRunAt; + /** * User-defined tags for grouping and filtering monitors and their changes. * @@ -162,6 +182,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook */ @@ -176,7 +197,9 @@ public static function with( MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, ?\DateTimeInterface $lastChangeAt = null, + LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, + ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, ): self { @@ -193,7 +216,9 @@ public static function with( $self['updatedAt'] = $updatedAt; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; + null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; + null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; @@ -265,6 +290,8 @@ public function withSchedule(Schedule|array $schedule): self } /** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * * @param Status|value-of $status */ public function withStatus(Status|string $status): self @@ -305,6 +332,19 @@ public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self return $self; } + /** + * Error from the most recent failed run; null when the last run succeeded. + * + * @param LastError|LastErrorShape|null $lastError + */ + public function withLastError(LastError|array|null $lastError): self + { + $self = clone $this; + $self['lastError'] = $lastError; + + return $self; + } + public function withLastRunAt(?\DateTimeInterface $lastRunAt): self { $self = clone $this; @@ -313,6 +353,17 @@ public function withLastRunAt(?\DateTimeInterface $lastRunAt): self return $self; } + /** + * When the next scheduled run is due. + */ + public function withNextRunAt(?\DateTimeInterface $nextRunAt): self + { + $self = clone $this; + $self['nextRunAt'] = $nextRunAt; + + return $self; + } + /** * User-defined tags for grouping and filtering monitors and their changes. * diff --git a/src/Monitors/MonitorUpdateResponse/LastError.php b/src/Monitors/MonitorUpdateResponse/LastError.php new file mode 100644 index 00000000..430044e8 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/LastError.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new LastError()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * LastError::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new LastError)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Status.php b/src/Monitors/MonitorUpdateResponse/Status.php index 1ecb242b..037af96f 100644 --- a/src/Monitors/MonitorUpdateResponse/Status.php +++ b/src/Monitors/MonitorUpdateResponse/Status.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorUpdateResponse; +/** + * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + */ enum Status: string { case ACTIVE = 'active'; diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php index 333cfb3c..a02ae7f9 100644 --- a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', @@ -51,6 +51,9 @@ final class MonitorsSitemapTarget implements BaseModel #[Optional(list: 'string')] public ?array $include; + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ #[Optional('max_urls')] public ?int $maxURLs; @@ -146,6 +149,9 @@ public function withInclude(array $include): self return $self; } + /** + * Maximum number of sitemap URLs to track (capped at 10,000). + */ public function withMaxURLs(int $maxURLs): self { $self = clone $this; diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php index 1dda23c8..516d8e3c 100644 --- a/src/ServiceContracts/MonitorsContract.php +++ b/src/ServiceContracts/MonitorsContract.php @@ -112,7 +112,7 @@ public function update( * @param string $q free-text search term, matched against the fields named in `search_by` * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching - * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. * @param string $tag filter to items that have this tag * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) * @param TargetType|value-of $targetType @@ -171,7 +171,7 @@ public function listAccountChanges( /** * @api * - * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). * @param RequestOpts|null $requestOptions * * @throws APIException @@ -204,7 +204,7 @@ public function listChanges( /** * @api * - * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). * @param RequestOpts|null $requestOptions * * @throws APIException diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php index 4aed25ea..571f0cb5 100644 --- a/src/Services/MonitorsService.php +++ b/src/Services/MonitorsService.php @@ -177,7 +177,7 @@ public function update( * @param string $q free-text search term, matched against the fields named in `search_by` * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching - * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. * @param string $tag filter to items that have this tag * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) * @param TargetType|value-of $targetType @@ -285,7 +285,7 @@ public function listAccountChanges( * * Returns an account-wide feed of monitor runs across all monitors. * - * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). * @param RequestOpts|null $requestOptions * * @throws APIException @@ -346,7 +346,7 @@ public function listChanges( * * List monitor runs * - * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). * @param RequestOpts|null $requestOptions * * @throws APIException From 176972dd6139efebc01b96bea6d9ed4c4c0d9150 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 3 Jul 2026 05:13:17 +0000 Subject: [PATCH 020/130] feat(api): api update --- .stats.yml | 4 ++-- src/Web/WebWebScrapeHTMLResponse.php | 4 ++-- src/Web/WebWebScrapeHTMLResponse/Type.php | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3e4f5649..7e518326 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-09b6020939995033719a53b988fb00bdb20c42d87070975a8d6b469fa18128fb.yml -openapi_spec_hash: ba3e471937a679e2c45c0b9a115fca5c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6320934d3b42a03cc52429218247595c7119e91a615db570070f71849aaa74de.yml +openapi_spec_hash: c63aeaa0fdcc422e8ad59c9fb30d2476 config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/Web/WebWebScrapeHTMLResponse.php b/src/Web/WebWebScrapeHTMLResponse.php index cb950aae..f18826d3 100644 --- a/src/Web/WebWebScrapeHTMLResponse.php +++ b/src/Web/WebWebScrapeHTMLResponse.php @@ -49,7 +49,7 @@ final class WebWebScrapeHTMLResponse implements BaseModel public bool $success; /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables. * * @var value-of $type */ @@ -160,7 +160,7 @@ public function withSuccess(bool $success): self } /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables. * * @param Type|value-of $type */ diff --git a/src/Web/WebWebScrapeHTMLResponse/Type.php b/src/Web/WebWebScrapeHTMLResponse/Type.php index fab93ab2..1747205d 100644 --- a/src/Web/WebWebScrapeHTMLResponse/Type.php +++ b/src/Web/WebWebScrapeHTMLResponse/Type.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeHTMLResponse; /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables. */ enum Type: string { @@ -28,4 +28,8 @@ enum Type: string case DOCX = 'docx'; case DOC = 'doc'; + + case XLSX = 'xlsx'; + + case XLS = 'xls'; } From c23f4b048521a45fbfa8da8d8d53666bb9cea34e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 4 Jul 2026 18:58:53 +0000 Subject: [PATCH 021/130] feat(api): api update --- .stats.yml | 4 ++-- src/Web/WebWebScrapeHTMLResponse.php | 4 ++-- src/Web/WebWebScrapeHTMLResponse/Type.php | 6 +++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7e518326..3840f484 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6320934d3b42a03cc52429218247595c7119e91a615db570070f71849aaa74de.yml -openapi_spec_hash: c63aeaa0fdcc422e8ad59c9fb30d2476 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-171b4c39eb26210aad8afd74d63d620bf45f7e0b7f2de3938c7239741ea3f2f4.yml +openapi_spec_hash: 752c05fc817dc766061bd4357bd327ba config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/Web/WebWebScrapeHTMLResponse.php b/src/Web/WebWebScrapeHTMLResponse.php index f18826d3..12aab0e8 100644 --- a/src/Web/WebWebScrapeHTMLResponse.php +++ b/src/Web/WebWebScrapeHTMLResponse.php @@ -49,7 +49,7 @@ final class WebWebScrapeHTMLResponse implements BaseModel public bool $success; /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations are surfaced as `pptx`/`ppt` with the extracted slides as HTML. * * @var value-of $type */ @@ -160,7 +160,7 @@ public function withSuccess(bool $success): self } /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations are surfaced as `pptx`/`ppt` with the extracted slides as HTML. * * @param Type|value-of $type */ diff --git a/src/Web/WebWebScrapeHTMLResponse/Type.php b/src/Web/WebWebScrapeHTMLResponse/Type.php index 1747205d..84a4f8bf 100644 --- a/src/Web/WebWebScrapeHTMLResponse/Type.php +++ b/src/Web/WebWebScrapeHTMLResponse/Type.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeHTMLResponse; /** - * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables. + * Detected content type of the returned `html` field. Sitemaps and feeds are surfaced as `xml`; ordinary pages are `html`. Excel workbooks are surfaced as `xlsx`/`xls` with the extracted sheets as HTML tables; PowerPoint presentations are surfaced as `pptx`/`ppt` with the extracted slides as HTML. */ enum Type: string { @@ -32,4 +32,8 @@ enum Type: string case XLSX = 'xlsx'; case XLS = 'xls'; + + case PPTX = 'pptx'; + + case PPT = 'ppt'; } From 4940f428afe3382888f1bc1934349eb1fd4cf022 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 4 Jul 2026 21:59:03 +0000 Subject: [PATCH 022/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 2 ++ src/Services/WebRawService.php | 1 + src/Services/WebService.php | 3 +++ src/Web/WebWebScrapeImagesParams.php | 20 ++++++++++++++++++++ tests/Services/WebTest.php | 1 + 6 files changed, 29 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3840f484..e7ac9695 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-171b4c39eb26210aad8afd74d63d620bf45f7e0b7f2de3938c7239741ea3f2f4.yml -openapi_spec_hash: 752c05fc817dc766061bd4357bd327ba +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-633097a61ae4e029434e5af07efa3017301fe8b391c27ada3eb68b61d798ef33.yml +openapi_spec_hash: 051b08a4c6530546d520aa7ec18f8123 config_hash: 7ec4851ee8d93177947e95df5ae897b5 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index b8da98db..a0afdcd9 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -290,6 +290,7 @@ public function webScrapeHTML( * @api * * @param string $url Page URL to inspect. Must include http:// or https://. + * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). @@ -301,6 +302,7 @@ public function webScrapeHTML( */ public function webScrapeImages( string $url, + bool $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, int $maxAgeMs = 86400000, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index ac2dee79..94f84b7f 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -405,6 +405,7 @@ public function webScrapeHTML( * * @param array{ * url: string, + * dedupe?: bool, * enrichment?: Enrichment|EnrichmentShape, * headers?: array, * maxAgeMs?: int, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 58d23590..0ac922ce 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -481,6 +481,7 @@ public function webScrapeHTML( * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. * * @param string $url Page URL to inspect. Must include http:// or https://. + * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). @@ -492,6 +493,7 @@ public function webScrapeHTML( */ public function webScrapeImages( string $url, + bool $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, int $maxAgeMs = 86400000, @@ -502,6 +504,7 @@ public function webScrapeImages( $params = Util::removeNulls( [ 'url' => $url, + 'dedupe' => $dedupe, 'enrichment' => $enrichment, 'headers' => $headers, 'maxAgeMs' => $maxAgeMs, diff --git a/src/Web/WebWebScrapeImagesParams.php b/src/Web/WebWebScrapeImagesParams.php index eb4932cb..92c8710d 100644 --- a/src/Web/WebWebScrapeImagesParams.php +++ b/src/Web/WebWebScrapeImagesParams.php @@ -20,6 +20,7 @@ * * @phpstan-type WebWebScrapeImagesParamsShape = array{ * url: string, + * dedupe?: bool|null, * enrichment?: null|Enrichment|EnrichmentShape, * headers?: array|null, * maxAgeMs?: int|null, @@ -39,6 +40,12 @@ final class WebWebScrapeImagesParams implements BaseModel #[Required] public string $url; + /** + * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + */ + #[Optional] + public ?bool $dedupe; + /** * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. */ @@ -100,6 +107,7 @@ public function __construct() */ public static function with( string $url, + ?bool $dedupe = null, Enrichment|array|null $enrichment = null, ?array $headers = null, ?int $maxAgeMs = null, @@ -110,6 +118,7 @@ public static function with( $self['url'] = $url; + null !== $dedupe && $self['dedupe'] = $dedupe; null !== $enrichment && $self['enrichment'] = $enrichment; null !== $headers && $self['headers'] = $headers; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; @@ -130,6 +139,17 @@ public function withURL(string $url): self return $self; } + /** + * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + */ + public function withDedupe(bool $dedupe): self + { + $self = clone $this; + $self['dedupe'] = $dedupe; + + return $self; + } + /** * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. * diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index bb991a64..6c2ca761 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -314,6 +314,7 @@ public function testWebScrapeImagesWithOptionalParams(): void $result = $this->client->web->webScrapeImages( url: 'https://example.com', + dedupe: true, enrichment: [ 'classification' => true, 'hostedURL' => true, From 362f41bc96b0f8cece90051337621f4fda20fa46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 01:39:01 +0000 Subject: [PATCH 023/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index e7ac9695..ea3b8aea 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-633097a61ae4e029434e5af07efa3017301fe8b391c27ada3eb68b61d798ef33.yml -openapi_spec_hash: 051b08a4c6530546d520aa7ec18f8123 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-3bbf1a39f32a13c350bdbc1e8a98ebd3753ec54f70d75cd4656c1773b2d2ecad.yml +openapi_spec_hash: 69beb23616fa92b1c1f6a2a4f7a36390 config_hash: 7ec4851ee8d93177947e95df5ae897b5 From 6314d405130b6d426b1711fee842c8b034b7b71e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 03:17:39 +0000 Subject: [PATCH 024/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ea3b8aea..77807bac 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-3bbf1a39f32a13c350bdbc1e8a98ebd3753ec54f70d75cd4656c1773b2d2ecad.yml -openapi_spec_hash: 69beb23616fa92b1c1f6a2a4f7a36390 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4b24bfbe3d1371e5ce175d71f9074b6f6aec35d4c3438013af2a54b776f8f126.yml +openapi_spec_hash: d3b67756889b03f77efaf8571bb09d59 config_hash: 7ec4851ee8d93177947e95df5ae897b5 From 586b9da3873c495375f0c758ebf2c78cc1d3c19a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 04:28:01 +0000 Subject: [PATCH 025/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 77807bac..cb8d47f2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4b24bfbe3d1371e5ce175d71f9074b6f6aec35d4c3438013af2a54b776f8f126.yml -openapi_spec_hash: d3b67756889b03f77efaf8571bb09d59 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-77005ca6ad90dc48689fe056a1dbd63f8eefb0224dc88530dd921a784a7b0185.yml +openapi_spec_hash: 8f3189c550a36de0ca5e1b032298acfd config_hash: 7ec4851ee8d93177947e95df5ae897b5 From 34b21e03837fb43109d4ff67e213df3fa11c870a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 05:12:26 +0000 Subject: [PATCH 026/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index cb8d47f2..a272343b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-77005ca6ad90dc48689fe056a1dbd63f8eefb0224dc88530dd921a784a7b0185.yml -openapi_spec_hash: 8f3189c550a36de0ca5e1b032298acfd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-654e47d50a02e8b12f4f035b1a8ec6e864557fed57b744c909ca85127739cc30.yml +openapi_spec_hash: a44b7d4172c8c7cd395237738867d5cb config_hash: 7ec4851ee8d93177947e95df5ae897b5 From 00dd4c7b14599dc288b3434c190d5f2e78fd6946 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 05:30:57 +0000 Subject: [PATCH 027/130] feat(api): manual updates --- .stats.yml | 6 +- README.md | 13 +- src/AI/AIAIQueryParams.php | 153 ------ src/AI/AIAIQueryParams/DataToExtract.php | 203 -------- .../DataToExtract/DatapointListType.php | 27 - .../DataToExtract/DatapointObjectSchema.php | 16 - .../DataToExtract/DatapointType.php | 23 - src/AI/AIAIQueryParams/SpecificPages.php | 219 -------- src/AI/AIAIQueryResponse.php | 156 ------ src/AI/AIAIQueryResponse/DataExtracted.php | 87 ---- .../DataExtracted/DatapointValue.php | 36 -- src/AI/AIAIQueryResponse/KeyMetadata.php | 92 ---- src/Brand/BrandGetByEmailResponse.php | 129 ----- src/Brand/BrandGetByEmailResponse/Brand.php | 416 --------------- .../BrandGetByEmailResponse/Brand/Address.php | 179 ------- .../Brand/Backdrop.php | 113 ---- .../Brand/Backdrop/Color.php | 72 --- .../Brand/Backdrop/Resolution.php | 97 ---- .../BrandGetByEmailResponse/Brand/Color.php | 72 --- .../Brand/Industries.php | 65 --- .../Brand/Industries/Eic.php | 104 ---- .../Brand/Industries/Eic/Industry.php | 59 --- .../Brand/Industries/Eic/Subindustry.php | 451 ---------------- .../BrandGetByEmailResponse/Brand/Links.php | 159 ------ .../BrandGetByEmailResponse/Brand/Logo.php | 165 ------ .../Brand/Logo/Color.php | 72 --- .../Brand/Logo/Mode.php | 17 - .../Brand/Logo/Resolution.php | 97 ---- .../Brand/Logo/Type.php | 15 - .../Brand/PrimaryLanguage.php | 251 --------- .../BrandGetByEmailResponse/Brand/Social.php | 83 --- .../Brand/Social/Type.php | 73 --- .../BrandGetByEmailResponse/Brand/Stock.php | 76 --- .../BrandGetByEmailResponse/KeyMetadata.php | 92 ---- src/Brand/BrandGetByIsinResponse.php | 129 ----- src/Brand/BrandGetByIsinResponse/Brand.php | 416 --------------- .../BrandGetByIsinResponse/Brand/Address.php | 179 ------- .../BrandGetByIsinResponse/Brand/Backdrop.php | 113 ---- .../Brand/Backdrop/Color.php | 72 --- .../Brand/Backdrop/Resolution.php | 97 ---- .../BrandGetByIsinResponse/Brand/Color.php | 72 --- .../Brand/Industries.php | 65 --- .../Brand/Industries/Eic.php | 104 ---- .../Brand/Industries/Eic/Industry.php | 59 --- .../Brand/Industries/Eic/Subindustry.php | 451 ---------------- .../BrandGetByIsinResponse/Brand/Links.php | 159 ------ .../BrandGetByIsinResponse/Brand/Logo.php | 165 ------ .../Brand/Logo/Color.php | 72 --- .../Brand/Logo/Mode.php | 17 - .../Brand/Logo/Resolution.php | 97 ---- .../Brand/Logo/Type.php | 15 - .../Brand/PrimaryLanguage.php | 251 --------- .../BrandGetByIsinResponse/Brand/Social.php | 83 --- .../Brand/Social/Type.php | 73 --- .../BrandGetByIsinResponse/Brand/Stock.php | 76 --- .../BrandGetByIsinResponse/KeyMetadata.php | 92 ---- src/Brand/BrandGetByNameResponse.php | 129 ----- src/Brand/BrandGetByNameResponse/Brand.php | 416 --------------- .../BrandGetByNameResponse/Brand/Address.php | 179 ------- .../BrandGetByNameResponse/Brand/Backdrop.php | 113 ---- .../Brand/Backdrop/Color.php | 72 --- .../Brand/Backdrop/Resolution.php | 97 ---- .../BrandGetByNameResponse/Brand/Color.php | 72 --- .../Brand/Industries.php | 65 --- .../Brand/Industries/Eic.php | 104 ---- .../Brand/Industries/Eic/Industry.php | 59 --- .../Brand/Industries/Eic/Subindustry.php | 451 ---------------- .../BrandGetByNameResponse/Brand/Links.php | 159 ------ .../BrandGetByNameResponse/Brand/Logo.php | 165 ------ .../Brand/Logo/Color.php | 72 --- .../Brand/Logo/Mode.php | 17 - .../Brand/Logo/Resolution.php | 97 ---- .../Brand/Logo/Type.php | 15 - .../Brand/PrimaryLanguage.php | 251 --------- .../BrandGetByNameResponse/Brand/Social.php | 83 --- .../Brand/Social/Type.php | 73 --- .../BrandGetByNameResponse/Brand/Stock.php | 76 --- .../BrandGetByNameResponse/KeyMetadata.php | 92 ---- src/Brand/BrandGetByTickerResponse.php | 129 ----- src/Brand/BrandGetByTickerResponse/Brand.php | 416 --------------- .../Brand/Address.php | 179 ------- .../Brand/Backdrop.php | 113 ---- .../Brand/Backdrop/Color.php | 72 --- .../Brand/Backdrop/Resolution.php | 97 ---- .../BrandGetByTickerResponse/Brand/Color.php | 72 --- .../Brand/Industries.php | 65 --- .../Brand/Industries/Eic.php | 104 ---- .../Brand/Industries/Eic/Industry.php | 59 --- .../Brand/Industries/Eic/Subindustry.php | 451 ---------------- .../BrandGetByTickerResponse/Brand/Links.php | 159 ------ .../BrandGetByTickerResponse/Brand/Logo.php | 165 ------ .../Brand/Logo/Color.php | 72 --- .../Brand/Logo/Mode.php | 17 - .../Brand/Logo/Resolution.php | 97 ---- .../Brand/Logo/Type.php | 15 - .../Brand/PrimaryLanguage.php | 251 --------- .../BrandGetByTickerResponse/Brand/Social.php | 83 --- .../Brand/Social/Type.php | 73 --- .../BrandGetByTickerResponse/Brand/Stock.php | 76 --- .../BrandGetByTickerResponse/KeyMetadata.php | 92 ---- .../BrandIdentifyFromTransactionParams.php | 252 --------- .../CountryGl.php | 489 ------------------ .../ForceLanguage.php | 251 --------- .../BrandIdentifyFromTransactionResponse.php | 129 ----- .../Brand.php | 416 --------------- .../Brand/Address.php | 179 ------- .../Brand/Backdrop.php | 113 ---- .../Brand/Backdrop/Color.php | 72 --- .../Brand/Backdrop/Resolution.php | 97 ---- .../Brand/Color.php | 72 --- .../Brand/Industries.php | 65 --- .../Brand/Industries/Eic.php | 104 ---- .../Brand/Industries/Eic/Industry.php | 59 --- .../Brand/Industries/Eic/Subindustry.php | 451 ---------------- .../Brand/Links.php | 159 ------ .../Brand/Logo.php | 165 ------ .../Brand/Logo/Color.php | 72 --- .../Brand/Logo/Mode.php | 17 - .../Brand/Logo/Resolution.php | 97 ---- .../Brand/Logo/Type.php | 15 - .../Brand/PrimaryLanguage.php | 251 --------- .../Brand/Social.php | 83 --- .../Brand/Social/Type.php | 73 --- .../Brand/Stock.php | 76 --- .../KeyMetadata.php | 92 ---- src/Brand/BrandRetrieveByEmailParams.php | 166 ------ .../ForceLanguage.php | 251 --------- src/Brand/BrandRetrieveByIsinParams.php | 166 ------ .../ForceLanguage.php | 251 --------- src/Brand/BrandRetrieveByNameParams.php | 192 ------- .../BrandRetrieveByNameParams/CountryGl.php | 489 ------------------ .../ForceLanguage.php | 251 --------- src/Brand/BrandRetrieveByTickerParams.php | 193 ------- .../ForceLanguage.php | 251 --------- .../TickerExchange.php | 155 ------ src/Brand/BrandRetrieveParams.php | 233 ++++++++- .../BrandRetrieveParams/ForceLanguage.php | 3 - src/ServiceContracts/AIContract.php | 24 - src/ServiceContracts/AIRawContract.php | 17 - src/ServiceContracts/BrandContract.php | 150 +----- src/ServiceContracts/BrandRawContract.php | 85 --- src/ServiceContracts/UtilityContract.php | 25 +- src/ServiceContracts/UtilityRawContract.php | 17 - src/Services/AIRawService.php | 42 -- src/Services/AIService.php | 40 -- src/Services/BrandRawService.php | 251 +-------- src/Services/BrandService.php | 247 ++------- src/Services/UtilityRawService.php | 48 +- src/Services/UtilityService.php | 38 +- src/Utility/UtilityPrefetchByEmailParams.php | 96 ---- .../UtilityPrefetchByEmailResponse.php | 124 ----- .../KeyMetadata.php | 92 ---- src/Utility/UtilityPrefetchParams.php | 60 ++- .../UtilityPrefetchParams/Identifier.php | 76 +++ src/Utility/UtilityPrefetchParams/Type.php | 13 + src/Utility/UtilityPrefetchResponse.php | 26 + src/Utility/UtilityPrefetchResponse/Type.php | 13 + tests/ClientTest.php | 10 +- tests/Services/AITest.php | 63 --- tests/Services/BrandTest.php | 195 +------ tests/Services/UtilityTest.php | 39 +- 161 files changed, 523 insertions(+), 20177 deletions(-) delete mode 100644 src/AI/AIAIQueryParams.php delete mode 100644 src/AI/AIAIQueryParams/DataToExtract.php delete mode 100644 src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php delete mode 100644 src/AI/AIAIQueryParams/DataToExtract/DatapointObjectSchema.php delete mode 100644 src/AI/AIAIQueryParams/DataToExtract/DatapointType.php delete mode 100644 src/AI/AIAIQueryParams/SpecificPages.php delete mode 100644 src/AI/AIAIQueryResponse.php delete mode 100644 src/AI/AIAIQueryResponse/DataExtracted.php delete mode 100644 src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php delete mode 100644 src/AI/AIAIQueryResponse/KeyMetadata.php delete mode 100644 src/Brand/BrandGetByEmailResponse.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Address.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Color.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Subindustry.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Links.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Resolution.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/PrimaryLanguage.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Social.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php delete mode 100644 src/Brand/BrandGetByEmailResponse/Brand/Stock.php delete mode 100644 src/Brand/BrandGetByEmailResponse/KeyMetadata.php delete mode 100644 src/Brand/BrandGetByIsinResponse.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Address.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Color.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Subindustry.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Links.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Resolution.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/PrimaryLanguage.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Social.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php delete mode 100644 src/Brand/BrandGetByIsinResponse/Brand/Stock.php delete mode 100644 src/Brand/BrandGetByIsinResponse/KeyMetadata.php delete mode 100644 src/Brand/BrandGetByNameResponse.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Address.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Backdrop.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Color.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Subindustry.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Links.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Resolution.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/PrimaryLanguage.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Social.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Social/Type.php delete mode 100644 src/Brand/BrandGetByNameResponse/Brand/Stock.php delete mode 100644 src/Brand/BrandGetByNameResponse/KeyMetadata.php delete mode 100644 src/Brand/BrandGetByTickerResponse.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Address.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Color.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Subindustry.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Links.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Resolution.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/PrimaryLanguage.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Social.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php delete mode 100644 src/Brand/BrandGetByTickerResponse/Brand/Stock.php delete mode 100644 src/Brand/BrandGetByTickerResponse/KeyMetadata.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionParams.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionParams/ForceLanguage.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Subindustry.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Links.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Resolution.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/PrimaryLanguage.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/Brand/Stock.php delete mode 100644 src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php delete mode 100644 src/Brand/BrandRetrieveByEmailParams.php delete mode 100644 src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php delete mode 100644 src/Brand/BrandRetrieveByIsinParams.php delete mode 100644 src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php delete mode 100644 src/Brand/BrandRetrieveByNameParams.php delete mode 100644 src/Brand/BrandRetrieveByNameParams/CountryGl.php delete mode 100644 src/Brand/BrandRetrieveByNameParams/ForceLanguage.php delete mode 100644 src/Brand/BrandRetrieveByTickerParams.php delete mode 100644 src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php delete mode 100644 src/Brand/BrandRetrieveByTickerParams/TickerExchange.php delete mode 100644 src/Utility/UtilityPrefetchByEmailParams.php delete mode 100644 src/Utility/UtilityPrefetchByEmailResponse.php delete mode 100644 src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php create mode 100644 src/Utility/UtilityPrefetchParams/Identifier.php create mode 100644 src/Utility/UtilityPrefetchParams/Type.php create mode 100644 src/Utility/UtilityPrefetchResponse/Type.php diff --git a/.stats.yml b/.stats.yml index a272343b..151723e6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-654e47d50a02e8b12f4f035b1a8ec6e864557fed57b744c909ca85127739cc30.yml +configured_endpoints: 29 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2e40370ce4d7d019b30d43020674bb02aaaf2a67a8916772084815c874f99950.yml openapi_spec_hash: a44b7d4172c8c7cd395237738867d5cb -config_hash: 7ec4851ee8d93177947e95df5ae897b5 +config_hash: 472cc1adb51663e5b3d8dce16f6d29d9 diff --git a/README.md b/README.md index bf4e14c7..0410e2e3 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ use ContextDev\Client; $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key'); -$brand = $client->brand->retrieve(domain: 'REPLACE_ME'); +$response = $client->web->extract(); -var_dump($brand->brand); +var_dump($response->data); ``` ### Value Objects @@ -54,7 +54,7 @@ use ContextDev\Core\Exceptions\RateLimitException; use ContextDev\Core\Exceptions\APIStatusException; try { - $brand = $client->brand->retrieve(domain: 'REPLACE_ME'); + $response = $client->web->extract(); } catch (APIConnectionException $e) { echo "The server could not be reached", PHP_EOL; var_dump($e->getPrevious()); @@ -99,9 +99,7 @@ use ContextDev\Client; $client = new Client(requestOptions: ['maxRetries' => 0]); // Or, configure per-request: -$result = $client->brand->retrieve( - domain: 'REPLACE_ME', requestOptions: ['maxRetries' => 5] -); +$result = $client->web->extract(requestOptions: ['maxRetries' => 5]); ``` ## Advanced concepts @@ -117,8 +115,7 @@ Note: the `extra*` parameters of the same name overrides the documented paramete ```php brand->retrieve( - domain: 'REPLACE_ME', +$response = $client->web->extract( requestOptions: [ 'extraQueryParams' => ['my_query_parameter' => 'value'], 'extraBodyParams' => ['my_body_parameter' => 'value'], diff --git a/src/AI/AIAIQueryParams.php b/src/AI/AIAIQueryParams.php deleted file mode 100644 index 16a3684a..00000000 --- a/src/AI/AIAIQueryParams.php +++ /dev/null @@ -1,153 +0,0 @@ -, - * domain: string, - * specificPages?: null|SpecificPages|SpecificPagesShape, - * timeoutMs?: int|null, - * } - */ -final class AIAIQueryParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Array of data points to extract from the website. - * - * @var list $dataToExtract - */ - #[Required('data_to_extract', list: DataToExtract::class)] - public array $dataToExtract; - - /** - * The domain name to analyze. - */ - #[Required] - public string $domain; - - /** - * Optional object specifying which pages to analyze. - */ - #[Optional('specific_pages')] - public ?SpecificPages $specificPages; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional('timeoutMS')] - public ?int $timeoutMs; - - /** - * `new AIAIQueryParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * AIAIQueryParams::with(dataToExtract: ..., domain: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new AIAIQueryParams)->withDataToExtract(...)->withDomain(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list $dataToExtract - * @param SpecificPages|SpecificPagesShape|null $specificPages - */ - public static function with( - array $dataToExtract, - string $domain, - SpecificPages|array|null $specificPages = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['dataToExtract'] = $dataToExtract; - $self['domain'] = $domain; - - null !== $specificPages && $self['specificPages'] = $specificPages; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Array of data points to extract from the website. - * - * @param list $dataToExtract - */ - public function withDataToExtract(array $dataToExtract): self - { - $self = clone $this; - $self['dataToExtract'] = $dataToExtract; - - return $self; - } - - /** - * The domain name to analyze. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Optional object specifying which pages to analyze. - * - * @param SpecificPages|SpecificPagesShape $specificPages - */ - public function withSpecificPages(SpecificPages|array $specificPages): self - { - $self = clone $this; - $self['specificPages'] = $specificPages; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/AI/AIAIQueryParams/DataToExtract.php b/src/AI/AIAIQueryParams/DataToExtract.php deleted file mode 100644 index 1678796f..00000000 --- a/src/AI/AIAIQueryParams/DataToExtract.php +++ /dev/null @@ -1,203 +0,0 @@ -, - * datapointListType?: null|DatapointListType|value-of, - * datapointObjectSchema?: array>|null, - * } - */ -final class DataToExtract implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Description of what to extract. - */ - #[Required('datapoint_description')] - public string $datapointDescription; - - /** - * Example of the expected value. - */ - #[Required('datapoint_example')] - public string $datapointExample; - - /** - * Name of the data point to extract. - */ - #[Required('datapoint_name')] - public string $datapointName; - - /** - * Type of the data point. - * - * @var value-of $datapointType - */ - #[Required('datapoint_type', enum: DatapointType::class)] - public string $datapointType; - - /** - * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. Use 'object' to extract an array of objects matching a schema. - * - * @var value-of|null $datapointListType - */ - #[Optional('datapoint_list_type', enum: DatapointListType::class)] - public ?string $datapointListType; - - /** - * Schema definition for objects when datapoint_list_type is 'object'. Provide a map of field names to their scalar types. - * - * @var array>|null $datapointObjectSchema - */ - #[Optional('datapoint_object_schema', map: DatapointObjectSchema::class)] - public ?array $datapointObjectSchema; - - /** - * `new DataToExtract()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * DataToExtract::with( - * datapointDescription: ..., - * datapointExample: ..., - * datapointName: ..., - * datapointType: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new DataToExtract) - * ->withDatapointDescription(...) - * ->withDatapointExample(...) - * ->withDatapointName(...) - * ->withDatapointType(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param DatapointType|value-of $datapointType - * @param DatapointListType|value-of|null $datapointListType - * @param array>|null $datapointObjectSchema - */ - public static function with( - string $datapointDescription, - string $datapointExample, - string $datapointName, - DatapointType|string $datapointType, - DatapointListType|string|null $datapointListType = null, - ?array $datapointObjectSchema = null, - ): self { - $self = new self; - - $self['datapointDescription'] = $datapointDescription; - $self['datapointExample'] = $datapointExample; - $self['datapointName'] = $datapointName; - $self['datapointType'] = $datapointType; - - null !== $datapointListType && $self['datapointListType'] = $datapointListType; - null !== $datapointObjectSchema && $self['datapointObjectSchema'] = $datapointObjectSchema; - - return $self; - } - - /** - * Description of what to extract. - */ - public function withDatapointDescription(string $datapointDescription): self - { - $self = clone $this; - $self['datapointDescription'] = $datapointDescription; - - return $self; - } - - /** - * Example of the expected value. - */ - public function withDatapointExample(string $datapointExample): self - { - $self = clone $this; - $self['datapointExample'] = $datapointExample; - - return $self; - } - - /** - * Name of the data point to extract. - */ - public function withDatapointName(string $datapointName): self - { - $self = clone $this; - $self['datapointName'] = $datapointName; - - return $self; - } - - /** - * Type of the data point. - * - * @param DatapointType|value-of $datapointType - */ - public function withDatapointType(DatapointType|string $datapointType): self - { - $self = clone $this; - $self['datapointType'] = $datapointType; - - return $self; - } - - /** - * Type of items in the list when datapoint_type is 'list'. Defaults to 'string'. Use 'object' to extract an array of objects matching a schema. - * - * @param DatapointListType|value-of $datapointListType - */ - public function withDatapointListType( - DatapointListType|string $datapointListType - ): self { - $self = clone $this; - $self['datapointListType'] = $datapointListType; - - return $self; - } - - /** - * Schema definition for objects when datapoint_list_type is 'object'. Provide a map of field names to their scalar types. - * - * @param array> $datapointObjectSchema - */ - public function withDatapointObjectSchema( - array $datapointObjectSchema - ): self { - $self = clone $this; - $self['datapointObjectSchema'] = $datapointObjectSchema; - - return $self; - } -} diff --git a/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php b/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php deleted file mode 100644 index 940605fb..00000000 --- a/src/AI/AIAIQueryParams/DataToExtract/DatapointListType.php +++ /dev/null @@ -1,27 +0,0 @@ - */ - use SdkModel; - - /** - * Whether to analyze the about us page. - */ - #[Optional('about_us')] - public ?bool $aboutUs; - - /** - * Whether to analyze the blog. - */ - #[Optional] - public ?bool $blog; - - /** - * Whether to analyze the careers page. - */ - #[Optional] - public ?bool $careers; - - /** - * Whether to analyze the contact us page. - */ - #[Optional('contact_us')] - public ?bool $contactUs; - - /** - * Whether to analyze the FAQ page. - */ - #[Optional] - public ?bool $faq; - - /** - * Whether to analyze the home page. - */ - #[Optional('home_page')] - public ?bool $homePage; - - /** - * Whether to analyze the pricing page. - */ - #[Optional] - public ?bool $pricing; - - /** - * Whether to analyze the privacy policy page. - */ - #[Optional('privacy_policy')] - public ?bool $privacyPolicy; - - /** - * Whether to analyze the terms and conditions page. - */ - #[Optional('terms_and_conditions')] - public ?bool $termsAndConditions; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?bool $aboutUs = null, - ?bool $blog = null, - ?bool $careers = null, - ?bool $contactUs = null, - ?bool $faq = null, - ?bool $homePage = null, - ?bool $pricing = null, - ?bool $privacyPolicy = null, - ?bool $termsAndConditions = null, - ): self { - $self = new self; - - null !== $aboutUs && $self['aboutUs'] = $aboutUs; - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contactUs && $self['contactUs'] = $contactUs; - null !== $faq && $self['faq'] = $faq; - null !== $homePage && $self['homePage'] = $homePage; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacyPolicy && $self['privacyPolicy'] = $privacyPolicy; - null !== $termsAndConditions && $self['termsAndConditions'] = $termsAndConditions; - - return $self; - } - - /** - * Whether to analyze the about us page. - */ - public function withAboutUs(bool $aboutUs): self - { - $self = clone $this; - $self['aboutUs'] = $aboutUs; - - return $self; - } - - /** - * Whether to analyze the blog. - */ - public function withBlog(bool $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * Whether to analyze the careers page. - */ - public function withCareers(bool $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * Whether to analyze the contact us page. - */ - public function withContactUs(bool $contactUs): self - { - $self = clone $this; - $self['contactUs'] = $contactUs; - - return $self; - } - - /** - * Whether to analyze the FAQ page. - */ - public function withFaq(bool $faq): self - { - $self = clone $this; - $self['faq'] = $faq; - - return $self; - } - - /** - * Whether to analyze the home page. - */ - public function withHomePage(bool $homePage): self - { - $self = clone $this; - $self['homePage'] = $homePage; - - return $self; - } - - /** - * Whether to analyze the pricing page. - */ - public function withPricing(bool $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * Whether to analyze the privacy policy page. - */ - public function withPrivacyPolicy(bool $privacyPolicy): self - { - $self = clone $this; - $self['privacyPolicy'] = $privacyPolicy; - - return $self; - } - - /** - * Whether to analyze the terms and conditions page. - */ - public function withTermsAndConditions(bool $termsAndConditions): self - { - $self = clone $this; - $self['termsAndConditions'] = $termsAndConditions; - - return $self; - } -} diff --git a/src/AI/AIAIQueryResponse.php b/src/AI/AIAIQueryResponse.php deleted file mode 100644 index 0ef34b18..00000000 --- a/src/AI/AIAIQueryResponse.php +++ /dev/null @@ -1,156 +0,0 @@ -|null, - * domain?: string|null, - * keyMetadata?: null|KeyMetadata|KeyMetadataShape, - * status?: string|null, - * urlsAnalyzed?: list|null, - * } - */ -final class AIAIQueryResponse implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of extracted data points. - * - * @var list|null $dataExtracted - */ - #[Optional('data_extracted', list: DataExtracted::class)] - public ?array $dataExtracted; - - /** - * The domain that was analyzed. - */ - #[Optional] - public ?string $domain; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - /** - * List of URLs that were analyzed. - * - * @var list|null $urlsAnalyzed - */ - #[Optional('urls_analyzed', list: 'string')] - public ?array $urlsAnalyzed; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $dataExtracted - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - * @param list|null $urlsAnalyzed - */ - public static function with( - ?array $dataExtracted = null, - ?string $domain = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ?array $urlsAnalyzed = null, - ): self { - $self = new self; - - null !== $dataExtracted && $self['dataExtracted'] = $dataExtracted; - null !== $domain && $self['domain'] = $domain; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - null !== $urlsAnalyzed && $self['urlsAnalyzed'] = $urlsAnalyzed; - - return $self; - } - - /** - * Array of extracted data points. - * - * @param list $dataExtracted - */ - public function withDataExtracted(array $dataExtracted): self - { - $self = clone $this; - $self['dataExtracted'] = $dataExtracted; - - return $self; - } - - /** - * The domain that was analyzed. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } - - /** - * List of URLs that were analyzed. - * - * @param list $urlsAnalyzed - */ - public function withURLsAnalyzed(array $urlsAnalyzed): self - { - $self = clone $this; - $self['urlsAnalyzed'] = $urlsAnalyzed; - - return $self; - } -} diff --git a/src/AI/AIAIQueryResponse/DataExtracted.php b/src/AI/AIAIQueryResponse/DataExtracted.php deleted file mode 100644 index f99ac9af..00000000 --- a/src/AI/AIAIQueryResponse/DataExtracted.php +++ /dev/null @@ -1,87 +0,0 @@ - */ - use SdkModel; - - /** - * Name of the extracted data point. - */ - #[Optional('datapoint_name')] - public ?string $datapointName; - - /** - * Value of the extracted data point. Can be a primitive type, an array of primitives, or an array of objects when datapoint_list_type is 'object'. - * - * @var DatapointValueVariants|null $datapointValue - */ - #[Optional('datapoint_value', union: DatapointValue::class)] - public string|float|bool|array|null $datapointValue; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param DatapointValueShape|null $datapointValue - */ - public static function with( - ?string $datapointName = null, - string|float|bool|array|null $datapointValue = null - ): self { - $self = new self; - - null !== $datapointName && $self['datapointName'] = $datapointName; - null !== $datapointValue && $self['datapointValue'] = $datapointValue; - - return $self; - } - - /** - * Name of the extracted data point. - */ - public function withDatapointName(string $datapointName): self - { - $self = clone $this; - $self['datapointName'] = $datapointName; - - return $self; - } - - /** - * Value of the extracted data point. Can be a primitive type, an array of primitives, or an array of objects when datapoint_list_type is 'object'. - * - * @param DatapointValueShape $datapointValue - */ - public function withDatapointValue( - string|float|bool|array $datapointValue - ): self { - $self = clone $this; - $self['datapointValue'] = $datapointValue; - - return $self; - } -} diff --git a/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php b/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php deleted file mode 100644 index e312347e..00000000 --- a/src/AI/AIAIQueryResponse/DataExtracted/DatapointValue.php +++ /dev/null @@ -1,36 +0,0 @@ -|list|list - * @phpstan-type DatapointValueShape = DatapointValueVariants - */ -final class DatapointValue implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return [ - 'string', - 'float', - 'bool', - new ListOf('string'), - new ListOf('float'), - new ListOf('mixed'), - ]; - } -} diff --git a/src/AI/AIAIQueryResponse/KeyMetadata.php b/src/AI/AIAIQueryResponse/KeyMetadata.php deleted file mode 100644 index e4568c26..00000000 --- a/src/AI/AIAIQueryResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse.php b/src/Brand/BrandGetByEmailResponse.php deleted file mode 100644 index 4169cab3..00000000 --- a/src/Brand/BrandGetByEmailResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand.php b/src/Brand/BrandGetByEmailResponse/Brand.php deleted file mode 100644 index 3d952722..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Address.php b/src/Brand/BrandGetByEmailResponse/Brand/Address.php deleted file mode 100644 index 4d2134e4..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php deleted file mode 100644 index 1d48570c..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php deleted file mode 100644 index c958a53f..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 002ac653..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Color.php deleted file mode 100644 index 9a5543cb..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries.php deleted file mode 100644 index a0dd9d3c..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php deleted file mode 100644 index 9718fbdf..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index 6f4810de..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo.php deleted file mode 100644 index 5247070a..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php deleted file mode 100644 index 1d224b05..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php deleted file mode 100644 index a46d7d56..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php deleted file mode 100644 index 255db91c..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php b/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php deleted file mode 100644 index bd6c1e43..00000000 --- a/src/Brand/BrandGetByEmailResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByEmailResponse/KeyMetadata.php b/src/Brand/BrandGetByEmailResponse/KeyMetadata.php deleted file mode 100644 index 88c559b6..00000000 --- a/src/Brand/BrandGetByEmailResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse.php b/src/Brand/BrandGetByIsinResponse.php deleted file mode 100644 index d1d1c379..00000000 --- a/src/Brand/BrandGetByIsinResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand.php b/src/Brand/BrandGetByIsinResponse/Brand.php deleted file mode 100644 index 75c7a32e..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Address.php b/src/Brand/BrandGetByIsinResponse/Brand/Address.php deleted file mode 100644 index a580c485..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php deleted file mode 100644 index 37197346..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php deleted file mode 100644 index 26128b40..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 02c7875d..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Color.php deleted file mode 100644 index e97ab2ff..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries.php deleted file mode 100644 index 27c08ef7..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php deleted file mode 100644 index 76030ba5..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index 9b037e75..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo.php deleted file mode 100644 index fcfd7d51..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php deleted file mode 100644 index f8833561..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php deleted file mode 100644 index 27ca4f93..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php deleted file mode 100644 index 00fea71f..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php b/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php deleted file mode 100644 index 3f648bed..00000000 --- a/src/Brand/BrandGetByIsinResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByIsinResponse/KeyMetadata.php b/src/Brand/BrandGetByIsinResponse/KeyMetadata.php deleted file mode 100644 index bcb2029b..00000000 --- a/src/Brand/BrandGetByIsinResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse.php b/src/Brand/BrandGetByNameResponse.php deleted file mode 100644 index 59671393..00000000 --- a/src/Brand/BrandGetByNameResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand.php b/src/Brand/BrandGetByNameResponse/Brand.php deleted file mode 100644 index 1a6700bf..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Address.php b/src/Brand/BrandGetByNameResponse/Brand/Address.php deleted file mode 100644 index f8064df9..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php deleted file mode 100644 index 8bedea8b..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php deleted file mode 100644 index 1932047f..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 95cc16c5..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Color.php deleted file mode 100644 index 56b5adc4..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries.php b/src/Brand/BrandGetByNameResponse/Brand/Industries.php deleted file mode 100644 index af0cb0be..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php deleted file mode 100644 index 54d6c9d2..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index df8802ba..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo.php b/src/Brand/BrandGetByNameResponse/Brand/Logo.php deleted file mode 100644 index 56d3855c..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php deleted file mode 100644 index e99a36e6..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php deleted file mode 100644 index 5371498e..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php deleted file mode 100644 index 8161b3cc..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php b/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php deleted file mode 100644 index f3498814..00000000 --- a/src/Brand/BrandGetByNameResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByNameResponse/KeyMetadata.php b/src/Brand/BrandGetByNameResponse/KeyMetadata.php deleted file mode 100644 index caf12baa..00000000 --- a/src/Brand/BrandGetByNameResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse.php b/src/Brand/BrandGetByTickerResponse.php deleted file mode 100644 index afe72bfa..00000000 --- a/src/Brand/BrandGetByTickerResponse.php +++ /dev/null @@ -1,129 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand.php b/src/Brand/BrandGetByTickerResponse/Brand.php deleted file mode 100644 index b121f019..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Address.php b/src/Brand/BrandGetByTickerResponse/Brand/Address.php deleted file mode 100644 index 325d1c38..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php deleted file mode 100644 index 2be87f33..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php deleted file mode 100644 index efc62277..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index faeac3d2..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Color.php deleted file mode 100644 index dcef6d94..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries.php deleted file mode 100644 index 3fe79fe3..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php deleted file mode 100644 index dcc42aa4..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index 6a96999a..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo.php deleted file mode 100644 index d28ac0df..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php deleted file mode 100644 index 71377134..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php deleted file mode 100644 index a7d34ade..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php b/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php deleted file mode 100644 index 1a0a4142..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php b/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php deleted file mode 100644 index cb308fd4..00000000 --- a/src/Brand/BrandGetByTickerResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandGetByTickerResponse/KeyMetadata.php b/src/Brand/BrandGetByTickerResponse/KeyMetadata.php deleted file mode 100644 index f3396e95..00000000 --- a/src/Brand/BrandGetByTickerResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionParams.php b/src/Brand/BrandIdentifyFromTransactionParams.php deleted file mode 100644 index 5de9c697..00000000 --- a/src/Brand/BrandIdentifyFromTransactionParams.php +++ /dev/null @@ -1,252 +0,0 @@ -, - * forceLanguage?: null|ForceLanguage|value-of, - * highConfidenceOnly?: bool|null, - * maxSpeed?: bool|null, - * mcc?: string|null, - * phone?: float|null, - * timeoutMs?: int|null, - * } - */ -final class BrandIdentifyFromTransactionParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Transaction information to identify the brand. - */ - #[Required] - public string $transactionInfo; - - /** - * Optional city name to prioritize when searching for the brand. - */ - #[Optional] - public ?string $city; - - /** - * Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * - * @var value-of|null $countryGl - */ - #[Optional(enum: CountryGl::class)] - public ?string $countryGl; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * When set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence. - */ - #[Optional] - public ?bool $highConfidenceOnly; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional Merchant Category Code (MCC) to help identify the business category/industry. - */ - #[Optional] - public ?string $mcc; - - /** - * Optional phone number from the transaction to help verify brand match. - */ - #[Optional] - public ?float $phone; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandIdentifyFromTransactionParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandIdentifyFromTransactionParams::with(transactionInfo: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandIdentifyFromTransactionParams)->withTransactionInfo(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param CountryGl|value-of|null $countryGl - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $transactionInfo, - ?string $city = null, - CountryGl|string|null $countryGl = null, - ForceLanguage|string|null $forceLanguage = null, - ?bool $highConfidenceOnly = null, - ?bool $maxSpeed = null, - ?string $mcc = null, - ?float $phone = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['transactionInfo'] = $transactionInfo; - - null !== $city && $self['city'] = $city; - null !== $countryGl && $self['countryGl'] = $countryGl; - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $highConfidenceOnly && $self['highConfidenceOnly'] = $highConfidenceOnly; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $mcc && $self['mcc'] = $mcc; - null !== $phone && $self['phone'] = $phone; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Transaction information to identify the brand. - */ - public function withTransactionInfo(string $transactionInfo): self - { - $self = clone $this; - $self['transactionInfo'] = $transactionInfo; - - return $self; - } - - /** - * Optional city name to prioritize when searching for the brand. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * - * @param CountryGl|value-of $countryGl - */ - public function withCountryGl(CountryGl|string $countryGl): self - { - $self = clone $this; - $self['countryGl'] = $countryGl; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * When set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence. - */ - public function withHighConfidenceOnly(bool $highConfidenceOnly): self - { - $self = clone $this; - $self['highConfidenceOnly'] = $highConfidenceOnly; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional Merchant Category Code (MCC) to help identify the business category/industry. - */ - public function withMcc(string $mcc): self - { - $self = clone $this; - $self['mcc'] = $mcc; - - return $self; - } - - /** - * Optional phone number from the transaction to help verify brand match. - */ - public function withPhone(float $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php b/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php deleted file mode 100644 index 9fdec22b..00000000 --- a/src/Brand/BrandIdentifyFromTransactionParams/CountryGl.php +++ /dev/null @@ -1,489 +0,0 @@ - */ - use SdkModel; - - /** - * Detailed brand information. - */ - #[Optional] - public ?Brand $brand; - - /** - * HTTP status code. - */ - #[Optional] - public ?int $code; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Brand|BrandShape|null $brand - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - Brand|array|null $brand = null, - ?int $code = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $brand && $self['brand'] = $brand; - null !== $code && $self['code'] = $code; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * Detailed brand information. - * - * @param Brand|BrandShape $brand - */ - public function withBrand(Brand|array $brand): self - { - $self = clone $this; - $self['brand'] = $brand; - - return $self; - } - - /** - * HTTP status code. - */ - public function withCode(int $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php deleted file mode 100644 index 6110e28b..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand.php +++ /dev/null @@ -1,416 +0,0 @@ -|null, - * colors?: list|null, - * description?: string|null, - * domain?: string|null, - * email?: string|null, - * industries?: null|Industries|IndustriesShape, - * isNsfw?: bool|null, - * links?: null|Links|LinksShape, - * logos?: list|null, - * phone?: string|null, - * primaryLanguage?: null|PrimaryLanguage|value-of, - * slogan?: string|null, - * socials?: list|null, - * stock?: null|Stock|StockShape, - * title?: string|null, - * } - */ -final class Brand implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Physical address of the brand. - */ - #[Optional] - public ?Address $address; - - /** - * An array of backdrop images for the brand. - * - * @var list|null $backdrops - */ - #[Optional(list: Backdrop::class)] - public ?array $backdrops; - - /** - * An array of brand colors. - * - * @var list|null $colors - */ - #[Optional(list: Color::class)] - public ?array $colors; - - /** - * A brief description of the brand. - */ - #[Optional] - public ?string $description; - - /** - * The domain name of the brand. - */ - #[Optional] - public ?string $domain; - - /** - * Company email address. - */ - #[Optional] - public ?string $email; - - /** - * Industry classification information for the brand. - */ - #[Optional] - public ?Industries $industries; - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - #[Optional('is_nsfw')] - public ?bool $isNsfw; - - /** - * Important website links for the brand. - */ - #[Optional] - public ?Links $links; - - /** - * An array of logos associated with the brand. - * - * @var list|null $logos - */ - #[Optional(list: Logo::class)] - public ?array $logos; - - /** - * Company phone number. - */ - #[Optional] - public ?string $phone; - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @var value-of|null $primaryLanguage - */ - #[Optional('primary_language', enum: PrimaryLanguage::class, nullable: true)] - public ?string $primaryLanguage; - - /** - * The brand's slogan. - */ - #[Optional] - public ?string $slogan; - - /** - * An array of social media links for the brand. - * - * @var list|null $socials - */ - #[Optional(list: Social::class)] - public ?array $socials; - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - */ - #[Optional] - public ?Stock $stock; - - /** - * The title or name of the brand. - */ - #[Optional] - public ?string $title; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Address|AddressShape|null $address - * @param list|null $backdrops - * @param list|null $colors - * @param Industries|IndustriesShape|null $industries - * @param Links|LinksShape|null $links - * @param list|null $logos - * @param PrimaryLanguage|value-of|null $primaryLanguage - * @param list|null $socials - * @param Stock|StockShape|null $stock - */ - public static function with( - Address|array|null $address = null, - ?array $backdrops = null, - ?array $colors = null, - ?string $description = null, - ?string $domain = null, - ?string $email = null, - Industries|array|null $industries = null, - ?bool $isNsfw = null, - Links|array|null $links = null, - ?array $logos = null, - ?string $phone = null, - PrimaryLanguage|string|null $primaryLanguage = null, - ?string $slogan = null, - ?array $socials = null, - Stock|array|null $stock = null, - ?string $title = null, - ): self { - $self = new self; - - null !== $address && $self['address'] = $address; - null !== $backdrops && $self['backdrops'] = $backdrops; - null !== $colors && $self['colors'] = $colors; - null !== $description && $self['description'] = $description; - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - null !== $industries && $self['industries'] = $industries; - null !== $isNsfw && $self['isNsfw'] = $isNsfw; - null !== $links && $self['links'] = $links; - null !== $logos && $self['logos'] = $logos; - null !== $phone && $self['phone'] = $phone; - null !== $primaryLanguage && $self['primaryLanguage'] = $primaryLanguage; - null !== $slogan && $self['slogan'] = $slogan; - null !== $socials && $self['socials'] = $socials; - null !== $stock && $self['stock'] = $stock; - null !== $title && $self['title'] = $title; - - return $self; - } - - /** - * Physical address of the brand. - * - * @param Address|AddressShape $address - */ - public function withAddress(Address|array $address): self - { - $self = clone $this; - $self['address'] = $address; - - return $self; - } - - /** - * An array of backdrop images for the brand. - * - * @param list $backdrops - */ - public function withBackdrops(array $backdrops): self - { - $self = clone $this; - $self['backdrops'] = $backdrops; - - return $self; - } - - /** - * An array of brand colors. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * A brief description of the brand. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } - - /** - * The domain name of the brand. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Company email address. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Industry classification information for the brand. - * - * @param Industries|IndustriesShape $industries - */ - public function withIndustries(Industries|array $industries): self - { - $self = clone $this; - $self['industries'] = $industries; - - return $self; - } - - /** - * Indicates whether the brand content is not safe for work (NSFW). - */ - public function withIsNsfw(bool $isNsfw): self - { - $self = clone $this; - $self['isNsfw'] = $isNsfw; - - return $self; - } - - /** - * Important website links for the brand. - * - * @param Links|LinksShape $links - */ - public function withLinks(Links|array $links): self - { - $self = clone $this; - $self['links'] = $links; - - return $self; - } - - /** - * An array of logos associated with the brand. - * - * @param list $logos - */ - public function withLogos(array $logos): self - { - $self = clone $this; - $self['logos'] = $logos; - - return $self; - } - - /** - * Company phone number. - */ - public function withPhone(string $phone): self - { - $self = clone $this; - $self['phone'] = $phone; - - return $self; - } - - /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. - * - * @param PrimaryLanguage|value-of|null $primaryLanguage - */ - public function withPrimaryLanguage( - PrimaryLanguage|string|null $primaryLanguage - ): self { - $self = clone $this; - $self['primaryLanguage'] = $primaryLanguage; - - return $self; - } - - /** - * The brand's slogan. - */ - public function withSlogan(string $slogan): self - { - $self = clone $this; - $self['slogan'] = $slogan; - - return $self; - } - - /** - * An array of social media links for the brand. - * - * @param list $socials - */ - public function withSocials(array $socials): self - { - $self = clone $this; - $self['socials'] = $socials; - - return $self; - } - - /** - * Stock market information for this brand (will be null if not a publicly traded company). - * - * @param Stock|StockShape $stock - */ - public function withStock(Stock|array $stock): self - { - $self = clone $this; - $self['stock'] = $stock; - - return $self; - } - - /** - * The title or name of the brand. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php deleted file mode 100644 index bc937d0c..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Address.php +++ /dev/null @@ -1,179 +0,0 @@ - */ - use SdkModel; - - /** - * City name. - */ - #[Optional] - public ?string $city; - - /** - * Country name. - */ - #[Optional] - public ?string $country; - - /** - * Country code. - */ - #[Optional('country_code')] - public ?string $countryCode; - - /** - * Postal or ZIP code. - */ - #[Optional('postal_code')] - public ?string $postalCode; - - /** - * State or province code. - */ - #[Optional('state_code')] - public ?string $stateCode; - - /** - * State or province name. - */ - #[Optional('state_province')] - public ?string $stateProvince; - - /** - * Street address. - */ - #[Optional] - public ?string $street; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $city = null, - ?string $country = null, - ?string $countryCode = null, - ?string $postalCode = null, - ?string $stateCode = null, - ?string $stateProvince = null, - ?string $street = null, - ): self { - $self = new self; - - null !== $city && $self['city'] = $city; - null !== $country && $self['country'] = $country; - null !== $countryCode && $self['countryCode'] = $countryCode; - null !== $postalCode && $self['postalCode'] = $postalCode; - null !== $stateCode && $self['stateCode'] = $stateCode; - null !== $stateProvince && $self['stateProvince'] = $stateProvince; - null !== $street && $self['street'] = $street; - - return $self; - } - - /** - * City name. - */ - public function withCity(string $city): self - { - $self = clone $this; - $self['city'] = $city; - - return $self; - } - - /** - * Country name. - */ - public function withCountry(string $country): self - { - $self = clone $this; - $self['country'] = $country; - - return $self; - } - - /** - * Country code. - */ - public function withCountryCode(string $countryCode): self - { - $self = clone $this; - $self['countryCode'] = $countryCode; - - return $self; - } - - /** - * Postal or ZIP code. - */ - public function withPostalCode(string $postalCode): self - { - $self = clone $this; - $self['postalCode'] = $postalCode; - - return $self; - } - - /** - * State or province code. - */ - public function withStateCode(string $stateCode): self - { - $self = clone $this; - $self['stateCode'] = $stateCode; - - return $self; - } - - /** - * State or province name. - */ - public function withStateProvince(string $stateProvince): self - { - $self = clone $this; - $self['stateProvince'] = $stateProvince; - - return $self; - } - - /** - * Street address. - */ - public function withStreet(string $street): self - { - $self = clone $this; - $self['street'] = $street; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php deleted file mode 100644 index 46c8abb2..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop.php +++ /dev/null @@ -1,113 +0,0 @@ -|null, - * resolution?: null|Resolution|ResolutionShape, - * url?: string|null, - * } - */ -final class Backdrop implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the backdrop image. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class, - )] - public ?array $colors; - - /** - * Resolution of the backdrop image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * URL of the backdrop image. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Resolution|ResolutionShape|null $resolution - */ - public static function with( - ?array $colors = null, - Resolution|array|null $resolution = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $resolution && $self['resolution'] = $resolution; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the backdrop image. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Resolution of the backdrop image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * URL of the backdrop image. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php deleted file mode 100644 index c0c8f828..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php deleted file mode 100644 index 311b6d39..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Backdrop/Resolution.php +++ /dev/null @@ -1,97 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php deleted file mode 100644 index 249a4148..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php deleted file mode 100644 index b0519ada..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries.php +++ /dev/null @@ -1,65 +0,0 @@ -|null} - */ -final class Industries implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @var list|null $eic - */ - #[Optional(list: Eic::class)] - public ?array $eic; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $eic - */ - public static function with(?array $eic = null): self - { - $self = new self; - - null !== $eic && $self['eic'] = $eic; - - return $self; - } - - /** - * Easy Industry Classification - array of industry and subindustry pairs. - * - * @param list $eic - */ - public function withEic(array $eic): self - { - $self = clone $this; - $self['eic'] = $eic; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php deleted file mode 100644 index cb9dd0db..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic.php +++ /dev/null @@ -1,104 +0,0 @@ -, - * subindustry: Subindustry|value-of, - * } - */ -final class Eic implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Industry classification enum. - * - * @var value-of $industry - */ - #[Required(enum: Industry::class)] - public string $industry; - - /** - * Subindustry classification enum. - * - * @var value-of $subindustry - */ - #[Required(enum: Subindustry::class)] - public string $subindustry; - - /** - * `new Eic()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Eic::with(industry: ..., subindustry: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Eic)->withIndustry(...)->withSubindustry(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Industry|value-of $industry - * @param Subindustry|value-of $subindustry - */ - public static function with( - Industry|string $industry, - Subindustry|string $subindustry - ): self { - $self = new self; - - $self['industry'] = $industry; - $self['subindustry'] = $subindustry; - - return $self; - } - - /** - * Industry classification enum. - * - * @param Industry|value-of $industry - */ - public function withIndustry(Industry|string $industry): self - { - $self = clone $this; - $self['industry'] = $industry; - - return $self; - } - - /** - * Subindustry classification enum. - * - * @param Subindustry|value-of $subindustry - */ - public function withSubindustry(Subindustry|string $subindustry): self - { - $self = clone $this; - $self['subindustry'] = $subindustry; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php deleted file mode 100644 index fd1a8391..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Industries/Eic/Industry.php +++ /dev/null @@ -1,59 +0,0 @@ - */ - use SdkModel; - - /** - * URL to the brand's blog or news page. - */ - #[Optional(nullable: true)] - public ?string $blog; - - /** - * URL to the brand's careers or job opportunities page. - */ - #[Optional(nullable: true)] - public ?string $careers; - - /** - * URL to the brand's contact or contact us page. - */ - #[Optional(nullable: true)] - public ?string $contact; - - /** - * URL to the brand's pricing or plans page. - */ - #[Optional(nullable: true)] - public ?string $pricing; - - /** - * URL to the brand's privacy policy page. - */ - #[Optional(nullable: true)] - public ?string $privacy; - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - #[Optional(nullable: true)] - public ?string $terms; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $blog = null, - ?string $careers = null, - ?string $contact = null, - ?string $pricing = null, - ?string $privacy = null, - ?string $terms = null, - ): self { - $self = new self; - - null !== $blog && $self['blog'] = $blog; - null !== $careers && $self['careers'] = $careers; - null !== $contact && $self['contact'] = $contact; - null !== $pricing && $self['pricing'] = $pricing; - null !== $privacy && $self['privacy'] = $privacy; - null !== $terms && $self['terms'] = $terms; - - return $self; - } - - /** - * URL to the brand's blog or news page. - */ - public function withBlog(?string $blog): self - { - $self = clone $this; - $self['blog'] = $blog; - - return $self; - } - - /** - * URL to the brand's careers or job opportunities page. - */ - public function withCareers(?string $careers): self - { - $self = clone $this; - $self['careers'] = $careers; - - return $self; - } - - /** - * URL to the brand's contact or contact us page. - */ - public function withContact(?string $contact): self - { - $self = clone $this; - $self['contact'] = $contact; - - return $self; - } - - /** - * URL to the brand's pricing or plans page. - */ - public function withPricing(?string $pricing): self - { - $self = clone $this; - $self['pricing'] = $pricing; - - return $self; - } - - /** - * URL to the brand's privacy policy page. - */ - public function withPrivacy(?string $privacy): self - { - $self = clone $this; - $self['privacy'] = $privacy; - - return $self; - } - - /** - * URL to the brand's terms of service or terms and conditions page. - */ - public function withTerms(?string $terms): self - { - $self = clone $this; - $self['terms'] = $terms; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php deleted file mode 100644 index 3ad972b7..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo.php +++ /dev/null @@ -1,165 +0,0 @@ -|null, - * mode?: null|Mode|value-of, - * resolution?: null|Resolution|ResolutionShape, - * type?: null|Type|value-of, - * url?: string|null, - * } - */ -final class Logo implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Array of colors in the logo. - * - * @var list|null $colors - */ - #[Optional( - list: Color::class, - )] - public ?array $colors; - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @var value-of|null $mode - */ - #[Optional(enum: Mode::class)] - public ?string $mode; - - /** - * Resolution of the logo image. - */ - #[Optional] - public ?Resolution $resolution; - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * CDN hosted url of the logo (ready for display). - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $colors - * @param Mode|value-of|null $mode - * @param Resolution|ResolutionShape|null $resolution - * @param Type|value-of|null $type - */ - public static function with( - ?array $colors = null, - Mode|string|null $mode = null, - Resolution|array|null $resolution = null, - Type|string|null $type = null, - ?string $url = null, - ): self { - $self = new self; - - null !== $colors && $self['colors'] = $colors; - null !== $mode && $self['mode'] = $mode; - null !== $resolution && $self['resolution'] = $resolution; - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Array of colors in the logo. - * - * @param list $colors - */ - public function withColors(array $colors): self - { - $self = clone $this; - $self['colors'] = $colors; - - return $self; - } - - /** - * Indicates when this logo is best used: 'light' = best for light mode, 'dark' = best for dark mode, 'has_opaque_background' = can be used for either as image has its own background. - * - * @param Mode|value-of $mode - */ - public function withMode(Mode|string $mode): self - { - $self = clone $this; - $self['mode'] = $mode; - - return $self; - } - - /** - * Resolution of the logo image. - * - * @param Resolution|ResolutionShape $resolution - */ - public function withResolution(Resolution|array $resolution): self - { - $self = clone $this; - $self['resolution'] = $resolution; - - return $self; - } - - /** - * Type of the logo based on resolution (e.g., 'icon', 'logo'). - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * CDN hosted url of the logo (ready for display). - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php deleted file mode 100644 index d998e680..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Color.php +++ /dev/null @@ -1,72 +0,0 @@ - */ - use SdkModel; - - /** - * Color in hexadecimal format. - */ - #[Optional] - public ?string $hex; - - /** - * Name of the color. - */ - #[Optional] - public ?string $name; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $hex = null, ?string $name = null): self - { - $self = new self; - - null !== $hex && $self['hex'] = $hex; - null !== $name && $self['name'] = $name; - - return $self; - } - - /** - * Color in hexadecimal format. - */ - public function withHex(string $hex): self - { - $self = clone $this; - $self['hex'] = $hex; - - return $self; - } - - /** - * Name of the color. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php deleted file mode 100644 index 27574670..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Mode.php +++ /dev/null @@ -1,17 +0,0 @@ - */ - use SdkModel; - - /** - * Aspect ratio of the image (width/height). - */ - #[Optional('aspect_ratio')] - public ?float $aspectRatio; - - /** - * Height of the image in pixels. - */ - #[Optional] - public ?int $height; - - /** - * Width of the image in pixels. - */ - #[Optional] - public ?int $width; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?float $aspectRatio = null, - ?int $height = null, - ?int $width = null - ): self { - $self = new self; - - null !== $aspectRatio && $self['aspectRatio'] = $aspectRatio; - null !== $height && $self['height'] = $height; - null !== $width && $self['width'] = $width; - - return $self; - } - - /** - * Aspect ratio of the image (width/height). - */ - public function withAspectRatio(float $aspectRatio): self - { - $self = clone $this; - $self['aspectRatio'] = $aspectRatio; - - return $self; - } - - /** - * Height of the image in pixels. - */ - public function withHeight(int $height): self - { - $self = clone $this; - $self['height'] = $height; - - return $self; - } - - /** - * Width of the image in pixels. - */ - public function withWidth(int $width): self - { - $self = clone $this; - $self['width'] = $width; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php deleted file mode 100644 index 8aa9e3c6..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Logo/Type.php +++ /dev/null @@ -1,15 +0,0 @@ -, url?: string|null - * } - */ -final class Social implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Type of social media platform. - * - * @var value-of|null $type - */ - #[Optional(enum: Type::class)] - public ?string $type; - - /** - * URL of the social media page. - */ - #[Optional] - public ?string $url; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Type|value-of|null $type - */ - public static function with( - Type|string|null $type = null, - ?string $url = null - ): self { - $self = new self; - - null !== $type && $self['type'] = $type; - null !== $url && $self['url'] = $url; - - return $self; - } - - /** - * Type of social media platform. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - - /** - * URL of the social media page. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php b/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php deleted file mode 100644 index 9ca63322..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/Brand/Social/Type.php +++ /dev/null @@ -1,73 +0,0 @@ - */ - use SdkModel; - - /** - * Stock exchange name. - */ - #[Optional] - public ?string $exchange; - - /** - * Stock ticker symbol. - */ - #[Optional] - public ?string $ticker; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $exchange = null, - ?string $ticker = null - ): self { - $self = new self; - - null !== $exchange && $self['exchange'] = $exchange; - null !== $ticker && $self['ticker'] = $ticker; - - return $self; - } - - /** - * Stock exchange name. - */ - public function withExchange(string $exchange): self - { - $self = clone $this; - $self['exchange'] = $exchange; - - return $self; - } - - /** - * Stock ticker symbol. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } -} diff --git a/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php b/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php deleted file mode 100644 index f1edefc6..00000000 --- a/src/Brand/BrandIdentifyFromTransactionResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByEmailParams.php b/src/Brand/BrandRetrieveByEmailParams.php deleted file mode 100644 index 23e596fa..00000000 --- a/src/Brand/BrandRetrieveByEmailParams.php +++ /dev/null @@ -1,166 +0,0 @@ -, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByEmailParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - #[Required] - public string $email; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByEmailParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByEmailParams::with(email: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByEmailParams)->withEmail(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $email, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['email'] = $email; - - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php b/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php deleted file mode 100644 index 6ebc1511..00000000 --- a/src/Brand/BrandRetrieveByEmailParams/ForceLanguage.php +++ /dev/null @@ -1,251 +0,0 @@ -, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByIsinParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - */ - #[Required] - public string $isin; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByIsinParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByIsinParams::with(isin: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByIsinParams)->withIsin(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $isin, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['isin'] = $isin; - - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - */ - public function withIsin(string $isin): self - { - $self = clone $this; - $self['isin'] = $isin; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php b/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php deleted file mode 100644 index 59bbdf53..00000000 --- a/src/Brand/BrandRetrieveByIsinParams/ForceLanguage.php +++ /dev/null @@ -1,251 +0,0 @@ -, - * forceLanguage?: null|ForceLanguage|value-of, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByNameParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - */ - #[Required] - public string $name; - - /** - * Optional country code hint (GL parameter) to specify the country for the company name. - * - * @var value-of|null $countryGl - */ - #[Optional(enum: CountryGl::class)] - public ?string $countryGl; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByNameParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByNameParams::with(name: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByNameParams)->withName(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param CountryGl|value-of|null $countryGl - * @param ForceLanguage|value-of|null $forceLanguage - */ - public static function with( - string $name, - CountryGl|string|null $countryGl = null, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['name'] = $name; - - null !== $countryGl && $self['countryGl'] = $countryGl; - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Optional country code hint (GL parameter) to specify the country for the company name. - * - * @param CountryGl|value-of $countryGl - */ - public function withCountryGl(CountryGl|string $countryGl): self - { - $self = clone $this; - $self['countryGl'] = $countryGl; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByNameParams/CountryGl.php b/src/Brand/BrandRetrieveByNameParams/CountryGl.php deleted file mode 100644 index 290fad48..00000000 --- a/src/Brand/BrandRetrieveByNameParams/CountryGl.php +++ /dev/null @@ -1,489 +0,0 @@ -, - * maxAgeMs?: int|null, - * maxSpeed?: bool|null, - * tickerExchange?: null|TickerExchange|value-of, - * timeoutMs?: int|null, - * } - */ -final class BrandRetrieveByTickerParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - */ - #[Required] - public string $ticker; - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @var value-of|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] - public ?string $forceLanguage; - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - #[Optional] - public ?int $maxAgeMs; - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - #[Optional] - public ?bool $maxSpeed; - - /** - * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * - * @var value-of|null $tickerExchange - */ - #[Optional(enum: TickerExchange::class)] - public ?string $tickerExchange; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional] - public ?int $timeoutMs; - - /** - * `new BrandRetrieveByTickerParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * BrandRetrieveByTickerParams::with(ticker: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new BrandRetrieveByTickerParams)->withTicker(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param ForceLanguage|value-of|null $forceLanguage - * @param TickerExchange|value-of|null $tickerExchange - */ - public static function with( - string $ticker, - ForceLanguage|string|null $forceLanguage = null, - ?int $maxAgeMs = null, - ?bool $maxSpeed = null, - TickerExchange|string|null $tickerExchange = null, - ?int $timeoutMs = null, - ): self { - $self = new self; - - $self['ticker'] = $ticker; - - null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; - null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; - null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; - null !== $tickerExchange && $self['tickerExchange'] = $tickerExchange; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - */ - public function withTicker(string $ticker): self - { - $self = clone $this; - $self['ticker'] = $ticker; - - return $self; - } - - /** - * Optional parameter to force the language of the retrieved brand data. - * - * @param ForceLanguage|value-of $forceLanguage - */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { - $self = clone $this; - $self['forceLanguage'] = $forceLanguage; - - return $self; - } - - /** - * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - */ - public function withMaxAgeMs(int $maxAgeMs): self - { - $self = clone $this; - $self['maxAgeMs'] = $maxAgeMs; - - return $self; - } - - /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - */ - public function withMaxSpeed(bool $maxSpeed): self - { - $self = clone $this; - $self['maxSpeed'] = $maxSpeed; - - return $self; - } - - /** - * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * - * @param TickerExchange|value-of $tickerExchange - */ - public function withTickerExchange( - TickerExchange|string $tickerExchange - ): self { - $self = clone $this; - $self['tickerExchange'] = $tickerExchange; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php b/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php deleted file mode 100644 index 7449533c..00000000 --- a/src/Brand/BrandRetrieveByTickerParams/ForceLanguage.php +++ /dev/null @@ -1,251 +0,0 @@ -|null $forceLanguage - */ - #[Optional(enum: ForceLanguage::class)] + /** @var value-of|null $forceLanguage */ + #[Optional('force_language', enum: ForceLanguage::class)] public ?string $forceLanguage; /** @@ -51,7 +57,7 @@ final class BrandRetrieveParams implements BaseModel public ?int $maxAgeMs; /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. */ #[Optional] public ?bool $maxSpeed; @@ -59,21 +65,88 @@ final class BrandRetrieveParams implements BaseModel /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ - #[Optional] + #[Optional('timeoutMS')] public ?int $timeoutMs; + /** + * Company name to retrieve brand data for (e.g., 'Apple Inc'). + */ + #[Required] + public string $name; + + /** + * Optional country code hint (GL parameter) to specify the country when identifying a transaction. + */ + #[Optional('country_gl')] + public ?string $countryGl; + + /** + * Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + */ + #[Required] + public string $email; + + /** + * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + */ + #[Required] + public string $ticker; + + /** + * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + */ + #[Optional('ticker_exchange')] + public ?string $tickerExchange; + + /** + * Transaction information to identify the brand. + */ + #[Required('transaction_info')] + public string $transactionInfo; + + /** + * Optional city name to prioritize when searching for the brand. + */ + #[Optional] + public ?string $city; + + /** + * When set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence. + */ + #[Optional('high_confidence_only')] + public ?bool $highConfidenceOnly; + + /** + * Optional Merchant Category Code (MCC) to help identify the business category or industry. + */ + #[Optional] + public ?int $mcc; + + /** + * Optional phone number from the transaction to help verify brand match. + */ + #[Optional] + public ?float $phone; + /** * `new BrandRetrieveParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * BrandRetrieveParams::with(domain: ...) + * BrandRetrieveParams::with( + * domain: ..., name: ..., email: ..., ticker: ..., transactionInfo: ... + * ) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new BrandRetrieveParams)->withDomain(...) + * (new BrandRetrieveParams) + * ->withDomain(...) + * ->withName(...) + * ->withEmail(...) + * ->withTicker(...) + * ->withTransactionInfo(...) * ``` */ public function __construct() @@ -90,25 +163,45 @@ public function __construct() */ public static function with( string $domain, + string $name, + string $email, + string $ticker, + string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, ?bool $maxSpeed = null, ?int $timeoutMs = null, + ?string $countryGl = null, + ?string $tickerExchange = null, + ?string $city = null, + ?bool $highConfidenceOnly = null, + ?int $mcc = null, + ?float $phone = null, ): self { $self = new self; $self['domain'] = $domain; + $self['name'] = $name; + $self['email'] = $email; + $self['ticker'] = $ticker; + $self['transactionInfo'] = $transactionInfo; null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $countryGl && $self['countryGl'] = $countryGl; + null !== $tickerExchange && $self['tickerExchange'] = $tickerExchange; + null !== $city && $self['city'] = $city; + null !== $highConfidenceOnly && $self['highConfidenceOnly'] = $highConfidenceOnly; + null !== $mcc && $self['mcc'] = $mcc; + null !== $phone && $self['phone'] = $phone; return $self; } /** - * Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. + * Domain name to retrieve brand data for (e.g., 'stripe.com'). */ public function withDomain(string $domain): self { @@ -119,8 +212,6 @@ public function withDomain(string $domain): self } /** - * Optional parameter to force the language of the retrieved brand data. - * * @param ForceLanguage|value-of $forceLanguage */ public function withForceLanguage(ForceLanguage|string $forceLanguage): self @@ -143,7 +234,7 @@ public function withMaxAgeMs(int $maxAgeMs): self } /** - * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. */ public function withMaxSpeed(bool $maxSpeed): self { @@ -163,4 +254,114 @@ public function withTimeoutMs(int $timeoutMs): self return $self; } + + /** + * Company name to retrieve brand data for (e.g., 'Apple Inc'). + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Optional country code hint (GL parameter) to specify the country when identifying a transaction. + */ + public function withCountryGl(string $countryGl): self + { + $self = clone $this; + $self['countryGl'] = $countryGl; + + return $self; + } + + /** + * Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } + + /** + * Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + */ + public function withTickerExchange(string $tickerExchange): self + { + $self = clone $this; + $self['tickerExchange'] = $tickerExchange; + + return $self; + } + + /** + * Transaction information to identify the brand. + */ + public function withTransactionInfo(string $transactionInfo): self + { + $self = clone $this; + $self['transactionInfo'] = $transactionInfo; + + return $self; + } + + /** + * Optional city name to prioritize when searching for the brand. + */ + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + /** + * When set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence. + */ + public function withHighConfidenceOnly(bool $highConfidenceOnly): self + { + $self = clone $this; + $self['highConfidenceOnly'] = $highConfidenceOnly; + + return $self; + } + + /** + * Optional Merchant Category Code (MCC) to help identify the business category or industry. + */ + public function withMcc(int $mcc): self + { + $self = clone $this; + $self['mcc'] = $mcc; + + return $self; + } + + /** + * Optional phone number from the transaction to help verify brand match. + */ + public function withPhone(float $phone): self + { + $self = clone $this; + $self['phone'] = $phone; + + return $self; + } } diff --git a/src/Brand/BrandRetrieveParams/ForceLanguage.php b/src/Brand/BrandRetrieveParams/ForceLanguage.php index 41a3aee3..82478ee8 100644 --- a/src/Brand/BrandRetrieveParams/ForceLanguage.php +++ b/src/Brand/BrandRetrieveParams/ForceLanguage.php @@ -4,9 +4,6 @@ namespace ContextDev\Brand\BrandRetrieveParams; -/** - * Optional parameter to force the language of the retrieved brand data. - */ enum ForceLanguage: string { case AFRIKAANS = 'afrikaans'; diff --git a/src/ServiceContracts/AIContract.php b/src/ServiceContracts/AIContract.php index ecd7de9b..87465152 100644 --- a/src/ServiceContracts/AIContract.php +++ b/src/ServiceContracts/AIContract.php @@ -4,40 +4,16 @@ namespace ContextDev\ServiceContracts; -use ContextDev\AI\AIAIQueryParams\DataToExtract; -use ContextDev\AI\AIAIQueryParams\SpecificPages; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; /** - * @phpstan-import-type DataToExtractShape from \ContextDev\AI\AIAIQueryParams\DataToExtract - * @phpstan-import-type SpecificPagesShape from \ContextDev\AI\AIAIQueryParams\SpecificPages * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface AIContract { - /** - * @api - * - * @param list $dataToExtract Array of data points to extract from the website - * @param string $domain The domain name to analyze - * @param SpecificPages|SpecificPagesShape $specificPages Optional object specifying which pages to analyze - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function aiQuery( - array $dataToExtract, - string $domain, - SpecificPages|array|null $specificPages = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): AIAIQueryResponse; - /** * @api * diff --git a/src/ServiceContracts/AIRawContract.php b/src/ServiceContracts/AIRawContract.php index dc6e6011..783850ba 100644 --- a/src/ServiceContracts/AIRawContract.php +++ b/src/ServiceContracts/AIRawContract.php @@ -4,8 +4,6 @@ namespace ContextDev\ServiceContracts; -use ContextDev\AI\AIAIQueryParams; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductParams; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsParams; @@ -19,21 +17,6 @@ */ interface AIRawContract { - /** - * @api - * - * @param array|AIAIQueryParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function aiQuery( - array|AIAIQueryParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - /** * @api * diff --git a/src/ServiceContracts/BrandContract.php b/src/ServiceContracts/BrandContract.php index 342ac582..8e5d93da 100644 --- a/src/ServiceContracts/BrandContract.php +++ b/src/ServiceContracts/BrandContract.php @@ -4,15 +4,8 @@ namespace ContextDev\ServiceContracts; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams\CountryGl; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByTickerParams\TickerExchange; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; @@ -25,140 +18,43 @@ interface BrandContract /** * @api * - * @param string $domain Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. - * @param ForceLanguage|value-of $forceLanguage optional parameter to force the language of the retrieved brand data + * @param string $domain Domain name to retrieve brand data for (e.g., 'stripe.com'). + * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). + * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + * @param string $transactionInfo transaction information to identify the brand + * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction + * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * @param string $city optional city name to prioritize when searching for the brand + * @param bool $highConfidenceOnly when set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence + * @param int $mcc optional Merchant Category Code (MCC) to help identify the business category or industry + * @param float $phone optional phone number from the transaction to help verify brand match * @param RequestOpts|null $requestOptions * * @throws APIException */ public function retrieve( string $domain, + string $name, + string $email, + string $ticker, + string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = null, ?bool $maxSpeed = null, ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetResponse; - - /** - * @api - * - * @param string $transactionInfo Transaction information to identify the brand - * @param string $city optional city name to prioritize when searching for the brand - * @param CountryGl|value-of $countryGl Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * @param \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|value-of<\ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param bool $highConfidenceOnly when set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param string $mcc optional Merchant Category Code (MCC) to help identify the business category/industry - * @param float $phone optional phone number from the transaction to help verify brand match - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function identifyFromTransaction( - string $transactionInfo, + ?string $countryGl = null, + ?string $tickerExchange = null, ?string $city = null, - CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|string|null $forceLanguage = null, - bool $highConfidenceOnly = false, - ?bool $maxSpeed = null, - ?string $mcc = null, + ?bool $highConfidenceOnly = null, + ?int $mcc = null, ?float $phone = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandIdentifyFromTransactionResponse; - - /** - * @api - * - * @param string $email Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByEmail( - string $email, - \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, - ): BrandGetByEmailResponse; - - /** - * @api - * - * @param string $isin ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - * @param \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByIsin( - string $isin, - \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByIsinResponse; - - /** - * @api - * - * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - * @param \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\CountryGl> $countryGl optional country code hint (GL parameter) to specify the country for the company name - * @param \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByName( - string $name, - \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByNameResponse; - - /** - * @api - * - * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - * @param \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param TickerExchange|value-of $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByTicker( - string $ticker, - \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - TickerExchange|string|null $tickerExchange = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByTickerResponse; + ): BrandGetResponse; /** * @api diff --git a/src/ServiceContracts/BrandRawContract.php b/src/ServiceContracts/BrandRawContract.php index 42adeb47..784eff79 100644 --- a/src/ServiceContracts/BrandRawContract.php +++ b/src/ServiceContracts/BrandRawContract.php @@ -4,18 +4,8 @@ namespace ContextDev\ServiceContracts; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByEmailParams; -use ContextDev\Brand\BrandRetrieveByIsinParams; -use ContextDev\Brand\BrandRetrieveByNameParams; -use ContextDev\Brand\BrandRetrieveByTickerParams; use ContextDev\Brand\BrandRetrieveParams; use ContextDev\Brand\BrandRetrieveSimplifiedParams; use ContextDev\Core\Contracts\BaseResponse; @@ -42,81 +32,6 @@ public function retrieve( RequestOptions|array|null $requestOptions = null, ): BaseResponse; - /** - * @api - * - * @param array|BrandIdentifyFromTransactionParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function identifyFromTransaction( - array|BrandIdentifyFromTransactionParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByEmail( - array|BrandRetrieveByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByIsinParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByIsin( - array|BrandRetrieveByIsinParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByNameParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByName( - array|BrandRetrieveByNameParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - - /** - * @api - * - * @param array|BrandRetrieveByTickerParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByTicker( - array|BrandRetrieveByTickerParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; - /** * @api * diff --git a/src/ServiceContracts/UtilityContract.php b/src/ServiceContracts/UtilityContract.php index 7ffb24df..73094d29 100644 --- a/src/ServiceContracts/UtilityContract.php +++ b/src/ServiceContracts/UtilityContract.php @@ -6,10 +6,12 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; +use ContextDev\Utility\UtilityPrefetchParams\Identifier; +use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; /** + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface UtilityContract @@ -17,30 +19,17 @@ interface UtilityContract /** * @api * - * @param string $domain Domain name to prefetch brand data for + * @param Identifier|IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. + * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function prefetch( - string $domain, + Identifier|array $identifier, + Type|string $type, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): UtilityPrefetchResponse; - - /** - * @api - * - * @param string $email Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function prefetchByEmail( - string $email, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): UtilityPrefetchByEmailResponse; } diff --git a/src/ServiceContracts/UtilityRawContract.php b/src/ServiceContracts/UtilityRawContract.php index 463ac4c0..5297c888 100644 --- a/src/ServiceContracts/UtilityRawContract.php +++ b/src/ServiceContracts/UtilityRawContract.php @@ -7,8 +7,6 @@ use ContextDev\Core\Contracts\BaseResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; -use ContextDev\Utility\UtilityPrefetchByEmailParams; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; use ContextDev\Utility\UtilityPrefetchParams; use ContextDev\Utility\UtilityPrefetchResponse; @@ -31,19 +29,4 @@ public function prefetch( array|UtilityPrefetchParams $params, RequestOptions|array|null $requestOptions = null, ): BaseResponse; - - /** - * @api - * - * @param array|UtilityPrefetchByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function prefetchByEmail( - array|UtilityPrefetchByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse; } diff --git a/src/Services/AIRawService.php b/src/Services/AIRawService.php index 0b6e140f..cb6349ea 100644 --- a/src/Services/AIRawService.php +++ b/src/Services/AIRawService.php @@ -4,10 +4,6 @@ namespace ContextDev\Services; -use ContextDev\AI\AIAIQueryParams; -use ContextDev\AI\AIAIQueryParams\DataToExtract; -use ContextDev\AI\AIAIQueryParams\SpecificPages; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductParams; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsParams; @@ -19,8 +15,6 @@ use ContextDev\ServiceContracts\AIRawContract; /** - * @phpstan-import-type DataToExtractShape from \ContextDev\AI\AIAIQueryParams\DataToExtract - * @phpstan-import-type SpecificPagesShape from \ContextDev\AI\AIAIQueryParams\SpecificPages * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class AIRawService implements AIRawContract @@ -31,42 +25,6 @@ final class AIRawService implements AIRawContract */ public function __construct(private Client $client) {} - /** - * @api - * - * Use AI to extract specific data points from a brand's website. The AI will crawl the website and extract the requested information based on the provided data points. - * - * @param array{ - * dataToExtract: list, - * domain: string, - * specificPages?: SpecificPages|SpecificPagesShape, - * timeoutMs?: int, - * }|AIAIQueryParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function aiQuery( - array|AIAIQueryParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = AIAIQueryParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'post', - path: 'brand/ai/query', - body: (object) $parsed, - options: $options, - convert: AIAIQueryResponse::class, - ); - } - /** * @api * diff --git a/src/Services/AIService.php b/src/Services/AIService.php index 187e24a7..62949acc 100644 --- a/src/Services/AIService.php +++ b/src/Services/AIService.php @@ -4,9 +4,6 @@ namespace ContextDev\Services; -use ContextDev\AI\AIAIQueryParams\DataToExtract; -use ContextDev\AI\AIAIQueryParams\SpecificPages; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsResponse; use ContextDev\Client; @@ -16,8 +13,6 @@ use ContextDev\ServiceContracts\AIContract; /** - * @phpstan-import-type DataToExtractShape from \ContextDev\AI\AIAIQueryParams\DataToExtract - * @phpstan-import-type SpecificPagesShape from \ContextDev\AI\AIAIQueryParams\SpecificPages * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class AIService implements AIContract @@ -35,41 +30,6 @@ public function __construct(private Client $client) $this->raw = new AIRawService($client); } - /** - * @api - * - * Use AI to extract specific data points from a brand's website. The AI will crawl the website and extract the requested information based on the provided data points. - * - * @param list $dataToExtract Array of data points to extract from the website - * @param string $domain The domain name to analyze - * @param SpecificPages|SpecificPagesShape $specificPages Optional object specifying which pages to analyze - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function aiQuery( - array $dataToExtract, - string $domain, - SpecificPages|array|null $specificPages = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): AIAIQueryResponse { - $params = Util::removeNulls( - [ - 'dataToExtract' => $dataToExtract, - 'domain' => $domain, - 'specificPages' => $specificPages, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->aiQuery(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - /** * @api * diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index a2aabbb7..e2d0217a 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -4,20 +4,8 @@ namespace ContextDev\Services; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams; -use ContextDev\Brand\BrandIdentifyFromTransactionParams\CountryGl; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByEmailParams; -use ContextDev\Brand\BrandRetrieveByIsinParams; -use ContextDev\Brand\BrandRetrieveByNameParams; -use ContextDev\Brand\BrandRetrieveByTickerParams; -use ContextDev\Brand\BrandRetrieveByTickerParams\TickerExchange; use ContextDev\Brand\BrandRetrieveParams; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Brand\BrandRetrieveSimplifiedParams; @@ -42,7 +30,7 @@ public function __construct(private Client $client) {} /** * @api * - * Retrieve logos, backdrops, colors, industry, description, and more from any domain + * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. * * @param array{ * domain: string, @@ -50,6 +38,16 @@ public function __construct(private Client $client) {} * maxAgeMs?: int, * maxSpeed?: bool, * timeoutMs?: int, + * name: string, + * countryGl?: string, + * email: string, + * ticker: string, + * tickerExchange?: string, + * transactionInfo: string, + * city?: string, + * highConfidenceOnly?: bool, + * mcc?: int, + * phone?: float, * }|BrandRetrieveParams $params * @param RequestOpts|null $requestOptions * @@ -68,237 +66,14 @@ public function retrieve( // @phpstan-ignore-next-line return.type return $this->client->request( - method: 'get', + method: 'post', path: 'brand/retrieve', - query: Util::array_transform_keys( - $parsed, - ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], - ), + body: (object) $parsed, options: $options, convert: BrandGetResponse::class, ); } - /** - * @api - * - * Endpoint specially designed for platforms that want to identify transaction data by the transaction title. - * - * @param array{ - * transactionInfo: string, - * city?: string, - * countryGl?: value-of, - * forceLanguage?: value-of, - * highConfidenceOnly?: bool, - * maxSpeed?: bool, - * mcc?: string, - * phone?: float, - * timeoutMs?: int, - * }|BrandIdentifyFromTransactionParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function identifyFromTransaction( - array|BrandIdentifyFromTransactionParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandIdentifyFromTransactionParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/transaction_identifier', - query: Util::array_transform_keys( - $parsed, - [ - 'transactionInfo' => 'transaction_info', - 'countryGl' => 'country_gl', - 'forceLanguage' => 'force_language', - 'highConfidenceOnly' => 'high_confidence_only', - 'timeoutMs' => 'timeoutMS', - ], - ), - options: $options, - convert: BrandIdentifyFromTransactionResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using an email address while detecting disposable and free email addresses. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. - * - * @param array{ - * email: string, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * timeoutMs?: int, - * }|BrandRetrieveByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByEmail( - array|BrandRetrieveByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByEmailParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-email', - query: Util::array_transform_keys( - $parsed, - ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], - ), - options: $options, - convert: BrandGetByEmailResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using an ISIN (International Securities Identification Number). - * - * @param array{ - * isin: string, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * timeoutMs?: int, - * }|BrandRetrieveByIsinParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByIsin( - array|BrandRetrieveByIsinParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByIsinParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-isin', - query: Util::array_transform_keys( - $parsed, - ['forceLanguage' => 'force_language', 'timeoutMs' => 'timeoutMS'], - ), - options: $options, - convert: BrandGetByIsinResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using a company name. - * - * @param array{ - * name: string, - * countryGl?: value-of, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * timeoutMs?: int, - * }|BrandRetrieveByNameParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByName( - array|BrandRetrieveByNameParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByNameParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-name', - query: Util::array_transform_keys( - $parsed, - [ - 'countryGl' => 'country_gl', - 'forceLanguage' => 'force_language', - 'timeoutMs' => 'timeoutMS', - ], - ), - options: $options, - convert: BrandGetByNameResponse::class, - ); - } - - /** - * @api - * - * Retrieve brand information using a stock ticker symbol. - * - * @param array{ - * ticker: string, - * forceLanguage?: value-of, - * maxAgeMs?: int, - * maxSpeed?: bool, - * tickerExchange?: value-of, - * timeoutMs?: int, - * }|BrandRetrieveByTickerParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function retrieveByTicker( - array|BrandRetrieveByTickerParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = BrandRetrieveByTickerParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'get', - path: 'brand/retrieve-by-ticker', - query: Util::array_transform_keys( - $parsed, - [ - 'forceLanguage' => 'force_language', - 'tickerExchange' => 'ticker_exchange', - 'timeoutMs' => 'timeoutMS', - ], - ), - options: $options, - convert: BrandGetByTickerResponse::class, - ); - } - /** * @api * diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index f5f2944a..fa42323a 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -4,15 +4,8 @@ namespace ContextDev\Services; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionParams\CountryGl; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; -use ContextDev\Brand\BrandRetrieveByTickerParams\TickerExchange; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; @@ -41,23 +34,43 @@ public function __construct(private Client $client) /** * @api * - * Retrieve logos, backdrops, colors, industry, description, and more from any domain + * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. * - * @param string $domain Domain name to retrieve brand data for (e.g., 'example.com', 'google.com'). Cannot be used with name or ticker parameters. - * @param ForceLanguage|value-of $forceLanguage optional parameter to force the language of the retrieved brand data + * @param string $domain Domain name to retrieve brand data for (e.g., 'stripe.com'). + * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). + * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). + * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + * @param string $transactionInfo transaction information to identify the brand + * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. Works with all three lookup methods. + * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction + * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. + * @param string $city optional city name to prioritize when searching for the brand + * @param bool $highConfidenceOnly when set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence + * @param int $mcc optional Merchant Category Code (MCC) to help identify the business category or industry + * @param float $phone optional phone number from the transaction to help verify brand match * @param RequestOpts|null $requestOptions * * @throws APIException */ public function retrieve( string $domain, + string $name, + string $email, + string $ticker, + string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = null, ?bool $maxSpeed = null, ?int $timeoutMs = null, + ?string $countryGl = null, + ?string $tickerExchange = null, + ?string $city = null, + ?bool $highConfidenceOnly = null, + ?int $mcc = null, + ?float $phone = null, RequestOptions|array|null $requestOptions = null, ): BrandGetResponse { $params = Util::removeNulls( @@ -67,219 +80,21 @@ public function retrieve( 'maxAgeMs' => $maxAgeMs, 'maxSpeed' => $maxSpeed, 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieve(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Endpoint specially designed for platforms that want to identify transaction data by the transaction title. - * - * @param string $transactionInfo Transaction information to identify the brand - * @param string $city optional city name to prioritize when searching for the brand - * @param CountryGl|value-of $countryGl Optional country code (GL parameter) to specify the country. This affects the geographic location used for search queries. - * @param \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|value-of<\ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param bool $highConfidenceOnly when set to true, the API will perform an additional verification steps to ensure the identified brand matches the transaction with high confidence - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param string $mcc optional Merchant Category Code (MCC) to help identify the business category/industry - * @param float $phone optional phone number from the transaction to help verify brand match - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function identifyFromTransaction( - string $transactionInfo, - ?string $city = null, - CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandIdentifyFromTransactionParams\ForceLanguage|string|null $forceLanguage = null, - bool $highConfidenceOnly = false, - ?bool $maxSpeed = null, - ?string $mcc = null, - ?float $phone = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandIdentifyFromTransactionResponse { - $params = Util::removeNulls( - [ + 'name' => $name, + 'countryGl' => $countryGl, + 'email' => $email, + 'ticker' => $ticker, + 'tickerExchange' => $tickerExchange, 'transactionInfo' => $transactionInfo, 'city' => $city, - 'countryGl' => $countryGl, - 'forceLanguage' => $forceLanguage, 'highConfidenceOnly' => $highConfidenceOnly, - 'maxSpeed' => $maxSpeed, 'mcc' => $mcc, 'phone' => $phone, - 'timeoutMs' => $timeoutMs, ], ); // @phpstan-ignore-next-line argument.type - $response = $this->raw->identifyFromTransaction(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using an email address while detecting disposable and free email addresses. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. - * - * @param string $email Email address to retrieve brand data for (e.g., 'contact@example.com'). The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByEmail( - string $email, - \ContextDev\Brand\BrandRetrieveByEmailParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByEmailResponse { - $params = Util::removeNulls( - [ - 'email' => $email, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByEmail(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using an ISIN (International Securities Identification Number). - * - * @param string $isin ISIN (International Securities Identification Number) to retrieve brand data for (e.g., 'AU000000IMD5', 'US0378331005'). Must be exactly 12 characters: 2 letters followed by 9 alphanumeric characters and ending with a digit. - * @param \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByIsin( - string $isin, - \ContextDev\Brand\BrandRetrieveByIsinParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByIsinResponse { - $params = Util::removeNulls( - [ - 'isin' => $isin, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByIsin(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using a company name. - * - * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc', 'Microsoft Corporation'). Must be 3-30 characters. - * @param \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\CountryGl> $countryGl optional country code hint (GL parameter) to specify the country for the company name - * @param \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByName( - string $name, - \ContextDev\Brand\BrandRetrieveByNameParams\CountryGl|string|null $countryGl = null, - \ContextDev\Brand\BrandRetrieveByNameParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByNameResponse { - $params = Util::removeNulls( - [ - 'name' => $name, - 'countryGl' => $countryGl, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByName(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } - - /** - * @api - * - * Retrieve brand information using a stock ticker symbol. - * - * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL', 'GOOGL', 'BRK.A'). Must be 1-15 characters, letters/numbers/dots only. - * @param \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|value-of<\ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage> $forceLanguage optional parameter to force the language of the retrieved brand data - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. - * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param TickerExchange|value-of $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function retrieveByTicker( - string $ticker, - \ContextDev\Brand\BrandRetrieveByTickerParams\ForceLanguage|string|null $forceLanguage = null, - int $maxAgeMs = 7776000000, - ?bool $maxSpeed = null, - TickerExchange|string|null $tickerExchange = null, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): BrandGetByTickerResponse { - $params = Util::removeNulls( - [ - 'ticker' => $ticker, - 'forceLanguage' => $forceLanguage, - 'maxAgeMs' => $maxAgeMs, - 'maxSpeed' => $maxSpeed, - 'tickerExchange' => $tickerExchange, - 'timeoutMs' => $timeoutMs, - ], - ); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieveByTicker(params: $params, requestOptions: $requestOptions); + $response = $this->raw->retrieve(params: $params, requestOptions: $requestOptions); return $response->parse(); } diff --git a/src/Services/UtilityRawService.php b/src/Services/UtilityRawService.php index fb7fc71f..0168902a 100644 --- a/src/Services/UtilityRawService.php +++ b/src/Services/UtilityRawService.php @@ -9,12 +9,13 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\UtilityRawContract; -use ContextDev\Utility\UtilityPrefetchByEmailParams; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; use ContextDev\Utility\UtilityPrefetchParams; +use ContextDev\Utility\UtilityPrefetchParams\Identifier; +use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; /** + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class UtilityRawService implements UtilityRawContract @@ -28,9 +29,13 @@ public function __construct(private Client $client) {} /** * @api * - * Signal that you may fetch brand data for a particular domain soon to improve latency. + * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * - * @param array{domain: string, timeoutMs?: int}|UtilityPrefetchParams $params + * @param array{ + * identifier: Identifier|IdentifierShape, + * type: Type|value-of, + * timeoutMs?: int, + * }|UtilityPrefetchParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse @@ -49,43 +54,10 @@ public function prefetch( // @phpstan-ignore-next-line return.type return $this->client->request( method: 'post', - path: 'brand/prefetch', + path: 'utility/prefetch', body: (object) $parsed, options: $options, convert: UtilityPrefetchResponse::class, ); } - - /** - * @api - * - * Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint accepts an email address, extracts the domain from it, validates that it's not a disposable or free email provider, and queues the domain for prefetching. - * - * @param array{ - * email: string, timeoutMs?: int - * }|UtilityPrefetchByEmailParams $params - * @param RequestOpts|null $requestOptions - * - * @return BaseResponse - * - * @throws APIException - */ - public function prefetchByEmail( - array|UtilityPrefetchByEmailParams $params, - RequestOptions|array|null $requestOptions = null, - ): BaseResponse { - [$parsed, $options] = UtilityPrefetchByEmailParams::parseRequest( - $params, - $requestOptions, - ); - - // @phpstan-ignore-next-line return.type - return $this->client->request( - method: 'post', - path: 'brand/prefetch-by-email', - body: (object) $parsed, - options: $options, - convert: UtilityPrefetchByEmailResponse::class, - ); - } } diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php index ff11a921..ea7635e5 100644 --- a/src/Services/UtilityService.php +++ b/src/Services/UtilityService.php @@ -9,10 +9,12 @@ use ContextDev\Core\Util; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\UtilityContract; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; +use ContextDev\Utility\UtilityPrefetchParams\Identifier; +use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; /** + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class UtilityService implements UtilityContract @@ -33,21 +35,23 @@ public function __construct(private Client $client) /** * @api * - * Signal that you may fetch brand data for a particular domain soon to improve latency. + * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * - * @param string $domain Domain name to prefetch brand data for + * @param Identifier|IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. + * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function prefetch( - string $domain, + Identifier|array $identifier, + Type|string $type, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): UtilityPrefetchResponse { $params = Util::removeNulls( - ['domain' => $domain, 'timeoutMs' => $timeoutMs] + ['identifier' => $identifier, 'type' => $type, 'timeoutMs' => $timeoutMs] ); // @phpstan-ignore-next-line argument.type @@ -55,28 +59,4 @@ public function prefetch( return $response->parse(); } - - /** - * @api - * - * Signal that you may fetch brand data for a particular domain soon to improve latency. This endpoint accepts an email address, extracts the domain from it, validates that it's not a disposable or free email provider, and queues the domain for prefetching. - * - * @param string $email Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param RequestOpts|null $requestOptions - * - * @throws APIException - */ - public function prefetchByEmail( - string $email, - ?int $timeoutMs = null, - RequestOptions|array|null $requestOptions = null, - ): UtilityPrefetchByEmailResponse { - $params = Util::removeNulls(['email' => $email, 'timeoutMs' => $timeoutMs]); - - // @phpstan-ignore-next-line argument.type - $response = $this->raw->prefetchByEmail(params: $params, requestOptions: $requestOptions); - - return $response->parse(); - } } diff --git a/src/Utility/UtilityPrefetchByEmailParams.php b/src/Utility/UtilityPrefetchByEmailParams.php deleted file mode 100644 index 60fc4dcb..00000000 --- a/src/Utility/UtilityPrefetchByEmailParams.php +++ /dev/null @@ -1,96 +0,0 @@ - */ - use SdkModel; - use SdkParams; - - /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - #[Required] - public string $email; - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - #[Optional('timeoutMS')] - public ?int $timeoutMs; - - /** - * `new UtilityPrefetchByEmailParams()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * UtilityPrefetchByEmailParams::with(email: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new UtilityPrefetchByEmailParams)->withEmail(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $email, ?int $timeoutMs = null): self - { - $self = new self; - - $self['email'] = $email; - - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; - - return $self; - } - - /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; - } - - /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - */ - public function withTimeoutMs(int $timeoutMs): self - { - $self = clone $this; - $self['timeoutMs'] = $timeoutMs; - - return $self; - } -} diff --git a/src/Utility/UtilityPrefetchByEmailResponse.php b/src/Utility/UtilityPrefetchByEmailResponse.php deleted file mode 100644 index cc7f237a..00000000 --- a/src/Utility/UtilityPrefetchByEmailResponse.php +++ /dev/null @@ -1,124 +0,0 @@ - */ - use SdkModel; - - /** - * The domain that was queued for prefetching. - */ - #[Optional] - public ?string $domain; - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - */ - #[Optional('key_metadata')] - public ?KeyMetadata $keyMetadata; - - /** - * Success message. - */ - #[Optional] - public ?string $message; - - /** - * Status of the response, e.g., 'ok'. - */ - #[Optional] - public ?string $status; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param KeyMetadata|KeyMetadataShape|null $keyMetadata - */ - public static function with( - ?string $domain = null, - KeyMetadata|array|null $keyMetadata = null, - ?string $message = null, - ?string $status = null, - ): self { - $self = new self; - - null !== $domain && $self['domain'] = $domain; - null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $message && $self['message'] = $message; - null !== $status && $self['status'] = $status; - - return $self; - } - - /** - * The domain that was queued for prefetching. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. - * - * @param KeyMetadata|KeyMetadataShape $keyMetadata - */ - public function withKeyMetadata(KeyMetadata|array $keyMetadata): self - { - $self = clone $this; - $self['keyMetadata'] = $keyMetadata; - - return $self; - } - - /** - * Success message. - */ - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } - - /** - * Status of the response, e.g., 'ok'. - */ - public function withStatus(string $status): self - { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php b/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php deleted file mode 100644 index 9966c76e..00000000 --- a/src/Utility/UtilityPrefetchByEmailResponse/KeyMetadata.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * The number of credits consumed by this request. - */ - #[Required('credits_consumed')] - public int $creditsConsumed; - - /** - * The number of credits remaining for your organization after this request. - */ - #[Required('credits_remaining')] - public int $creditsRemaining; - - /** - * `new KeyMetadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $creditsConsumed, - int $creditsRemaining - ): self { - $self = new self; - - $self['creditsConsumed'] = $creditsConsumed; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } - - /** - * The number of credits consumed by this request. - */ - public function withCreditsConsumed(int $creditsConsumed): self - { - $self = clone $this; - $self['creditsConsumed'] = $creditsConsumed; - - return $self; - } - - /** - * The number of credits remaining for your organization after this request. - */ - public function withCreditsRemaining(int $creditsRemaining): self - { - $self = clone $this; - $self['creditsRemaining'] = $creditsRemaining; - - return $self; - } -} diff --git a/src/Utility/UtilityPrefetchParams.php b/src/Utility/UtilityPrefetchParams.php index 80ccac24..de2dda47 100644 --- a/src/Utility/UtilityPrefetchParams.php +++ b/src/Utility/UtilityPrefetchParams.php @@ -9,14 +9,20 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Utility\UtilityPrefetchParams\Identifier; +use ContextDev\Utility\UtilityPrefetchParams\Type; /** - * Signal that you may fetch brand data for a particular domain soon to improve latency. + * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * * @see ContextDev\Services\UtilityService::prefetch() * + * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier + * * @phpstan-type UtilityPrefetchParamsShape = array{ - * domain: string, timeoutMs?: int|null + * identifier: Identifier|IdentifierShape, + * type: Type|value-of, + * timeoutMs?: int|null, * } */ final class UtilityPrefetchParams implements BaseModel @@ -26,10 +32,18 @@ final class UtilityPrefetchParams implements BaseModel use SdkParams; /** - * Domain name to prefetch brand data for. + * Identifier of the brand to prefetch. Provide exactly one of domain or email. */ #[Required] - public string $domain; + public Identifier $identifier; + + /** + * What to prefetch. Currently only 'brand' is supported. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -42,13 +56,13 @@ final class UtilityPrefetchParams implements BaseModel * * To enforce required parameters use * ``` - * UtilityPrefetchParams::with(domain: ...) + * UtilityPrefetchParams::with(identifier: ..., type: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new UtilityPrefetchParams)->withDomain(...) + * (new UtilityPrefetchParams)->withIdentifier(...)->withType(...) * ``` */ public function __construct() @@ -60,12 +74,19 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param Identifier|IdentifierShape $identifier + * @param Type|value-of $type */ - public static function with(string $domain, ?int $timeoutMs = null): self - { + public static function with( + Identifier|array $identifier, + Type|string $type, + ?int $timeoutMs = null + ): self { $self = new self; - $self['domain'] = $domain; + $self['identifier'] = $identifier; + $self['type'] = $type; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; @@ -73,12 +94,27 @@ public static function with(string $domain, ?int $timeoutMs = null): self } /** - * Domain name to prefetch brand data for. + * Identifier of the brand to prefetch. Provide exactly one of domain or email. + * + * @param Identifier|IdentifierShape $identifier + */ + public function withIdentifier(Identifier|array $identifier): self + { + $self = clone $this; + $self['identifier'] = $identifier; + + return $self; + } + + /** + * What to prefetch. Currently only 'brand' is supported. + * + * @param Type|value-of $type */ - public function withDomain(string $domain): self + public function withType(Type|string $type): self { $self = clone $this; - $self['domain'] = $domain; + $self['type'] = $type; return $self; } diff --git a/src/Utility/UtilityPrefetchParams/Identifier.php b/src/Utility/UtilityPrefetchParams/Identifier.php new file mode 100644 index 00000000..286d6af6 --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Identifier.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + /** + * Domain name to prefetch brand data for. + */ + #[Optional] + public ?string $domain; + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + #[Optional] + public ?string $email; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $domain = null, + ?string $email = null + ): self { + $self = new self; + + null !== $domain && $self['domain'] = $domain; + null !== $email && $self['email'] = $email; + + return $self; + } + + /** + * Domain name to prefetch brand data for. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchParams/Type.php b/src/Utility/UtilityPrefetchParams/Type.php new file mode 100644 index 00000000..79bdffa2 --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Type.php @@ -0,0 +1,13 @@ +, * } */ final class UtilityPrefetchResponse implements BaseModel @@ -48,6 +50,14 @@ final class UtilityPrefetchResponse implements BaseModel #[Optional] public ?string $status; + /** + * The type of prefetch that was queued, echoed from the request (currently always 'brand'). + * + * @var value-of|null $type + */ + #[Optional(enum: Type::class)] + public ?string $type; + public function __construct() { $this->initialize(); @@ -59,12 +69,14 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + * @param Type|value-of|null $type */ public static function with( ?string $domain = null, KeyMetadata|array|null $keyMetadata = null, ?string $message = null, ?string $status = null, + Type|string|null $type = null, ): self { $self = new self; @@ -72,6 +84,7 @@ public static function with( null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; null !== $message && $self['message'] = $message; null !== $status && $self['status'] = $status; + null !== $type && $self['type'] = $type; return $self; } @@ -121,4 +134,17 @@ public function withStatus(string $status): self return $self; } + + /** + * The type of prefetch that was queued, echoed from the request (currently always 'brand'). + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } } diff --git a/src/Utility/UtilityPrefetchResponse/Type.php b/src/Utility/UtilityPrefetchResponse/Type.php new file mode 100644 index 00000000..b1270556 --- /dev/null +++ b/src/Utility/UtilityPrefetchResponse/Type.php @@ -0,0 +1,13 @@ + $transporter], ); - $client->brand->retrieve(domain: 'domain'); + $client->web->extract( + schema: [ + 'type' => 'bar', + 'properties' => 'bar', + 'required' => 'bar', + 'additionalProperties' => 'bar', + ], + url: 'https://example.com', + ); $this->assertNotFalse($requested = $transporter->getRequests()[0] ?? false); diff --git a/tests/Services/AITest.php b/tests/Services/AITest.php index 9295e6c7..eff078e4 100644 --- a/tests/Services/AITest.php +++ b/tests/Services/AITest.php @@ -2,7 +2,6 @@ namespace Tests\Services; -use ContextDev\AI\AIAIQueryResponse; use ContextDev\AI\AIExtractProductResponse; use ContextDev\AI\AIExtractProductsResponse; use ContextDev\Client; @@ -30,68 +29,6 @@ protected function setUp(): void $this->client = $client; } - #[Test] - public function testAIQuery(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->ai->aiQuery( - dataToExtract: [ - [ - 'datapointDescription' => 'datapoint_description', - 'datapointExample' => 'datapoint_example', - 'datapointName' => 'datapoint_name', - 'datapointType' => 'text', - ], - ], - domain: 'domain', - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(AIAIQueryResponse::class, $result); - } - - #[Test] - public function testAIQueryWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->ai->aiQuery( - dataToExtract: [ - [ - 'datapointDescription' => 'datapoint_description', - 'datapointExample' => 'datapoint_example', - 'datapointName' => 'datapoint_name', - 'datapointType' => 'text', - 'datapointListType' => 'string', - 'datapointObjectSchema' => [ - 'testimonial_text' => 'string', 'testimonial_author' => 'string', - ], - ], - ], - domain: 'domain', - specificPages: [ - 'aboutUs' => true, - 'blog' => true, - 'careers' => true, - 'contactUs' => true, - 'faq' => true, - 'homePage' => true, - 'pricing' => true, - 'privacyPolicy' => true, - 'termsAndConditions' => true, - ], - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(AIAIQueryResponse::class, $result); - } - #[Test] public function testExtractProduct(): void { diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index 8f0dadbd..5f1392a6 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -2,13 +2,8 @@ namespace Tests\Services; -use ContextDev\Brand\BrandGetByEmailResponse; -use ContextDev\Brand\BrandGetByIsinResponse; -use ContextDev\Brand\BrandGetByNameResponse; -use ContextDev\Brand\BrandGetByTickerResponse; use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; -use ContextDev\Brand\BrandIdentifyFromTransactionResponse; use ContextDev\Client; use ContextDev\Core\Util; use PHPUnit\Framework\Attributes\CoversNothing; @@ -41,7 +36,13 @@ public function testRetrieve(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->brand->retrieve(domain: 'domain'); + $result = $this->client->brand->retrieve( + domain: 'domain', + name: 'xxx', + email: 'dev@stainless.com', + ticker: 'ticker', + transactionInfo: 'xxx', + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(BrandGetResponse::class, $result); @@ -57,187 +58,23 @@ public function testRetrieveWithOptionalParams(): void $result = $this->client->brand->retrieve( domain: 'domain', forceLanguage: 'afrikaans', - maxAgeMs: 86400000, + maxAgeMs: 0, maxSpeed: true, timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetResponse::class, $result); - } - - #[Test] - public function testIdentifyFromTransaction(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->identifyFromTransaction( - transactionInfo: 'transaction_info' - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf( - BrandIdentifyFromTransactionResponse::class, - $result - ); - } - - #[Test] - public function testIdentifyFromTransactionWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->identifyFromTransaction( - transactionInfo: 'transaction_info', + name: 'xxx', + countryGl: 'country_gl', + email: 'dev@stainless.com', + ticker: 'ticker', + tickerExchange: 'ticker_exchange', + transactionInfo: 'xxx', city: 'city', - countryGl: 'ad', - forceLanguage: 'afrikaans', highConfidenceOnly: true, - maxSpeed: true, - mcc: 'mcc', + mcc: 0, phone: 0, - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf( - BrandIdentifyFromTransactionResponse::class, - $result - ); - } - - #[Test] - public function testRetrieveByEmail(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByEmail(email: 'dev@stainless.com'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByEmailResponse::class, $result); - } - - #[Test] - public function testRetrieveByEmailWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByEmail( - email: 'dev@stainless.com', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByEmailResponse::class, $result); - } - - #[Test] - public function testRetrieveByIsin(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByIsin(isin: 'SE60513A9993'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByIsinResponse::class, $result); - } - - #[Test] - public function testRetrieveByIsinWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByIsin( - isin: 'SE60513A9993', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByIsinResponse::class, $result); - } - - #[Test] - public function testRetrieveByName(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByName(name: 'xxx'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByNameResponse::class, $result); - } - - #[Test] - public function testRetrieveByNameWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByName( - name: 'xxx', - countryGl: 'ad', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByNameResponse::class, $result); - } - - #[Test] - public function testRetrieveByTicker(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByTicker(ticker: 'ticker'); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByTickerResponse::class, $result); - } - - #[Test] - public function testRetrieveByTickerWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->brand->retrieveByTicker( - ticker: 'ticker', - forceLanguage: 'afrikaans', - maxAgeMs: 86400000, - maxSpeed: true, - tickerExchange: 'AMEX', - timeoutMs: 1000, - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(BrandGetByTickerResponse::class, $result); + $this->assertInstanceOf(BrandGetResponse::class, $result); } #[Test] diff --git a/tests/Services/UtilityTest.php b/tests/Services/UtilityTest.php index 8f236c57..de2e549a 100644 --- a/tests/Services/UtilityTest.php +++ b/tests/Services/UtilityTest.php @@ -4,7 +4,6 @@ use ContextDev\Client; use ContextDev\Core\Util; -use ContextDev\Utility\UtilityPrefetchByEmailResponse; use ContextDev\Utility\UtilityPrefetchResponse; use PHPUnit\Framework\Attributes\CoversNothing; use PHPUnit\Framework\Attributes\Test; @@ -36,7 +35,7 @@ public function testPrefetch(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->utility->prefetch(domain: 'domain'); + $result = $this->client->utility->prefetch(identifier: [], type: 'brand'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UtilityPrefetchResponse::class, $result); @@ -50,42 +49,12 @@ public function testPrefetchWithOptionalParams(): void } $result = $this->client->utility->prefetch( - domain: 'domain', - timeoutMs: 1000 + identifier: ['domain' => 'domain', 'email' => 'dev@stainless.com'], + type: 'brand', + timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UtilityPrefetchResponse::class, $result); } - - #[Test] - public function testPrefetchByEmail(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->utility->prefetchByEmail( - email: 'dev@stainless.com' - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(UtilityPrefetchByEmailResponse::class, $result); - } - - #[Test] - public function testPrefetchByEmailWithOptionalParams(): void - { - if (UnsupportedMockTests::$skip) { - $this->markTestSkipped('Mock server tests are disabled'); - } - - $result = $this->client->utility->prefetchByEmail( - email: 'dev@stainless.com', - timeoutMs: 1000 - ); - - // @phpstan-ignore-next-line method.alreadyNarrowedType - $this->assertInstanceOf(UtilityPrefetchByEmailResponse::class, $result); - } } From f8dc6abe110efef8ca78dab3065e0a95a17b4128 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 05:33:18 +0000 Subject: [PATCH 028/130] feat(api): manual updates --- .stats.yml | 4 ++-- README.md | 13 ++++++++----- tests/ClientTest.php | 14 ++++++-------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.stats.yml b/.stats.yml index 151723e6..0ae96ead 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2e40370ce4d7d019b30d43020674bb02aaaf2a67a8916772084815c874f99950.yml +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9de98d1d4d2c9a431961599cb54716212c06200a919e09adedd42244038ec07b.yml openapi_spec_hash: a44b7d4172c8c7cd395237738867d5cb -config_hash: 472cc1adb51663e5b3d8dce16f6d29d9 +config_hash: ff35e224e809656528c44163aa41bebd diff --git a/README.md b/README.md index 0410e2e3..bf4e14c7 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ use ContextDev\Client; $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key'); -$response = $client->web->extract(); +$brand = $client->brand->retrieve(domain: 'REPLACE_ME'); -var_dump($response->data); +var_dump($brand->brand); ``` ### Value Objects @@ -54,7 +54,7 @@ use ContextDev\Core\Exceptions\RateLimitException; use ContextDev\Core\Exceptions\APIStatusException; try { - $response = $client->web->extract(); + $brand = $client->brand->retrieve(domain: 'REPLACE_ME'); } catch (APIConnectionException $e) { echo "The server could not be reached", PHP_EOL; var_dump($e->getPrevious()); @@ -99,7 +99,9 @@ use ContextDev\Client; $client = new Client(requestOptions: ['maxRetries' => 0]); // Or, configure per-request: -$result = $client->web->extract(requestOptions: ['maxRetries' => 5]); +$result = $client->brand->retrieve( + domain: 'REPLACE_ME', requestOptions: ['maxRetries' => 5] +); ``` ## Advanced concepts @@ -115,7 +117,8 @@ Note: the `extra*` parameters of the same name overrides the documented paramete ```php web->extract( +$brand = $client->brand->retrieve( + domain: 'REPLACE_ME', requestOptions: [ 'extraQueryParams' => ['my_query_parameter' => 'value'], 'extraBodyParams' => ['my_body_parameter' => 'value'], diff --git a/tests/ClientTest.php b/tests/ClientTest.php index e0e7672e..d316cfd5 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -32,14 +32,12 @@ public function testDefaultHeaders(): void requestOptions: ['transporter' => $transporter], ); - $client->web->extract( - schema: [ - 'type' => 'bar', - 'properties' => 'bar', - 'required' => 'bar', - 'additionalProperties' => 'bar', - ], - url: 'https://example.com', + $client->brand->retrieve( + domain: 'domain', + name: 'xxx', + email: 'dev@stainless.com', + ticker: 'ticker', + transactionInfo: 'xxx', ); $this->assertNotFalse($requested = $transporter->getRequests()[0] ?? false); From cc181831235309ceab9b967eaf0979fb4f4ea2da Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 05:45:06 +0000 Subject: [PATCH 029/130] feat(api): api update --- .stats.yml | 4 +- src/ServiceContracts/UtilityContract.php | 7 +- src/Services/UtilityRawService.php | 5 +- src/Services/UtilityService.php | 7 +- src/Utility/UtilityPrefetchParams.php | 25 +++--- .../UtilityPrefetchParams/Identifier.php | 76 +++++-------------- .../UtilityPrefetchDomainIdentifier.php | 70 +++++++++++++++++ .../UtilityPrefetchEmailIdentifier.php | 70 +++++++++++++++++ tests/Services/UtilityTest.php | 9 ++- 9 files changed, 189 insertions(+), 84 deletions(-) create mode 100644 src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php create mode 100644 src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php diff --git a/.stats.yml b/.stats.yml index 0ae96ead..c36fec26 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9de98d1d4d2c9a431961599cb54716212c06200a919e09adedd42244038ec07b.yml -openapi_spec_hash: a44b7d4172c8c7cd395237738867d5cb +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5280c0f42603633a06d2404b120b98d0d9aa43256d13680bbdead7579a90452a.yml +openapi_spec_hash: 34869d638c12bf076949bb7e050dd634 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/ServiceContracts/UtilityContract.php b/src/ServiceContracts/UtilityContract.php index 73094d29..64ca1adc 100644 --- a/src/ServiceContracts/UtilityContract.php +++ b/src/ServiceContracts/UtilityContract.php @@ -6,7 +6,8 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; -use ContextDev\Utility\UtilityPrefetchParams\Identifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; @@ -19,7 +20,7 @@ interface UtilityContract /** * @api * - * @param Identifier|IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. + * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -27,7 +28,7 @@ interface UtilityContract * @throws APIException */ public function prefetch( - Identifier|array $identifier, + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, Type|string $type, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, diff --git a/src/Services/UtilityRawService.php b/src/Services/UtilityRawService.php index 0168902a..7030cadf 100644 --- a/src/Services/UtilityRawService.php +++ b/src/Services/UtilityRawService.php @@ -10,7 +10,6 @@ use ContextDev\RequestOptions; use ContextDev\ServiceContracts\UtilityRawContract; use ContextDev\Utility\UtilityPrefetchParams; -use ContextDev\Utility\UtilityPrefetchParams\Identifier; use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; @@ -32,9 +31,7 @@ public function __construct(private Client $client) {} * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * * @param array{ - * identifier: Identifier|IdentifierShape, - * type: Type|value-of, - * timeoutMs?: int, + * identifier: IdentifierShape, type: Type|value-of, timeoutMs?: int * }|UtilityPrefetchParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php index ea7635e5..8ea4db95 100644 --- a/src/Services/UtilityService.php +++ b/src/Services/UtilityService.php @@ -9,7 +9,8 @@ use ContextDev\Core\Util; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\UtilityContract; -use ContextDev\Utility\UtilityPrefetchParams\Identifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; use ContextDev\Utility\UtilityPrefetchParams\Type; use ContextDev\Utility\UtilityPrefetchResponse; @@ -37,7 +38,7 @@ public function __construct(private Client $client) * * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * - * @param Identifier|IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. + * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -45,7 +46,7 @@ public function __construct(private Client $client) * @throws APIException */ public function prefetch( - Identifier|array $identifier, + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, Type|string $type, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, diff --git a/src/Utility/UtilityPrefetchParams.php b/src/Utility/UtilityPrefetchParams.php index de2dda47..0082269d 100644 --- a/src/Utility/UtilityPrefetchParams.php +++ b/src/Utility/UtilityPrefetchParams.php @@ -9,7 +9,8 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Utility\UtilityPrefetchParams\Identifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; use ContextDev\Utility\UtilityPrefetchParams\Type; /** @@ -17,12 +18,11 @@ * * @see ContextDev\Services\UtilityService::prefetch() * + * @phpstan-import-type IdentifierVariants from \ContextDev\Utility\UtilityPrefetchParams\Identifier * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * * @phpstan-type UtilityPrefetchParamsShape = array{ - * identifier: Identifier|IdentifierShape, - * type: Type|value-of, - * timeoutMs?: int|null, + * identifier: IdentifierShape, type: Type|value-of, timeoutMs?: int|null * } */ final class UtilityPrefetchParams implements BaseModel @@ -33,9 +33,11 @@ final class UtilityPrefetchParams implements BaseModel /** * Identifier of the brand to prefetch. Provide exactly one of domain or email. + * + * @var IdentifierVariants $identifier */ #[Required] - public Identifier $identifier; + public UtilityPrefetchDomainIdentifier|UtilityPrefetchEmailIdentifier $identifier; /** * What to prefetch. Currently only 'brand' is supported. @@ -75,13 +77,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Identifier|IdentifierShape $identifier + * @param IdentifierShape $identifier * @param Type|value-of $type */ public static function with( - Identifier|array $identifier, + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, Type|string $type, - ?int $timeoutMs = null + ?int $timeoutMs = null, ): self { $self = new self; @@ -96,10 +98,11 @@ public static function with( /** * Identifier of the brand to prefetch. Provide exactly one of domain or email. * - * @param Identifier|IdentifierShape $identifier + * @param IdentifierShape $identifier */ - public function withIdentifier(Identifier|array $identifier): self - { + public function withIdentifier( + UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, + ): self { $self = clone $this; $self['identifier'] = $identifier; diff --git a/src/Utility/UtilityPrefetchParams/Identifier.php b/src/Utility/UtilityPrefetchParams/Identifier.php index 286d6af6..1fdb5ab1 100644 --- a/src/Utility/UtilityPrefetchParams/Identifier.php +++ b/src/Utility/UtilityPrefetchParams/Identifier.php @@ -4,73 +4,33 @@ namespace ContextDev\Utility\UtilityPrefetchParams; -use ContextDev\Core\Attributes\Optional; -use ContextDev\Core\Concerns\SdkModel; -use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Core\Concerns\SdkUnion; +use ContextDev\Core\Conversion\Contracts\Converter; +use ContextDev\Core\Conversion\Contracts\ConverterSource; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier; +use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; /** * Identifier of the brand to prefetch. Provide exactly one of domain or email. * - * @phpstan-type IdentifierShape = array{domain?: string|null, email?: string|null} + * @phpstan-import-type UtilityPrefetchDomainIdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier + * @phpstan-import-type UtilityPrefetchEmailIdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier + * + * @phpstan-type IdentifierVariants = UtilityPrefetchDomainIdentifier|UtilityPrefetchEmailIdentifier + * @phpstan-type IdentifierShape = IdentifierVariants|UtilityPrefetchDomainIdentifierShape|UtilityPrefetchEmailIdentifierShape */ -final class Identifier implements BaseModel +final class Identifier implements ConverterSource { - /** @use SdkModel */ - use SdkModel; - - /** - * Domain name to prefetch brand data for. - */ - #[Optional] - public ?string $domain; + use SdkUnion; /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + * @return list|array */ - #[Optional] - public ?string $email; - - public function __construct() + public static function variants(): array { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $domain = null, - ?string $email = null - ): self { - $self = new self; - - null !== $domain && $self['domain'] = $domain; - null !== $email && $self['email'] = $email; - - return $self; - } - - /** - * Domain name to prefetch brand data for. - */ - public function withDomain(string $domain): self - { - $self = clone $this; - $self['domain'] = $domain; - - return $self; - } - - /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. - */ - public function withEmail(string $email): self - { - $self = clone $this; - $self['email'] = $email; - - return $self; + return [ + UtilityPrefetchDomainIdentifier::class, + UtilityPrefetchEmailIdentifier::class, + ]; } } diff --git a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php new file mode 100644 index 00000000..615f897b --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + /** + * Domain name to prefetch brand data for. + */ + #[Required] + public string $domain; + + /** + * `new UtilityPrefetchDomainIdentifier()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UtilityPrefetchDomainIdentifier::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UtilityPrefetchDomainIdentifier)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $domain): self + { + $self = new self; + + $self['domain'] = $domain; + + return $self; + } + + /** + * Domain name to prefetch brand data for. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } +} diff --git a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php new file mode 100644 index 00000000..44142c31 --- /dev/null +++ b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php @@ -0,0 +1,70 @@ + */ + use SdkModel; + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + #[Required] + public string $email; + + /** + * `new UtilityPrefetchEmailIdentifier()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UtilityPrefetchEmailIdentifier::with(email: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UtilityPrefetchEmailIdentifier)->withEmail(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $email): self + { + $self = new self; + + $self['email'] = $email; + + return $self; + } + + /** + * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + */ + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } +} diff --git a/tests/Services/UtilityTest.php b/tests/Services/UtilityTest.php index de2e549a..f59410a4 100644 --- a/tests/Services/UtilityTest.php +++ b/tests/Services/UtilityTest.php @@ -35,7 +35,10 @@ public function testPrefetch(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->utility->prefetch(identifier: [], type: 'brand'); + $result = $this->client->utility->prefetch( + identifier: ['domain' => 'domain'], + type: 'brand' + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(UtilityPrefetchResponse::class, $result); @@ -49,9 +52,9 @@ public function testPrefetchWithOptionalParams(): void } $result = $this->client->utility->prefetch( - identifier: ['domain' => 'domain', 'email' => 'dev@stainless.com'], + identifier: ['domain' => 'domain'], type: 'brand', - timeoutMs: 1000, + timeoutMs: 1000 ); // @phpstan-ignore-next-line method.alreadyNarrowedType From 1ad89041287492a4025ec04827e9a6ea2feb1148 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 07:05:29 +0000 Subject: [PATCH 030/130] feat(api): api update --- .stats.yml | 4 +-- README.md | 7 +++--- src/Brand/BrandRetrieveParams.php | 34 +++++++++++++++++++++++++- src/Brand/BrandRetrieveParams/Type.php | 13 ++++++++++ src/ServiceContracts/BrandContract.php | 3 +++ src/Services/BrandRawService.php | 2 ++ src/Services/BrandService.php | 4 +++ tests/ClientTest.php | 1 + tests/Services/BrandTest.php | 2 ++ 9 files changed, 64 insertions(+), 6 deletions(-) create mode 100644 src/Brand/BrandRetrieveParams/Type.php diff --git a/.stats.yml b/.stats.yml index c36fec26..f52f4302 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5280c0f42603633a06d2404b120b98d0d9aa43256d13680bbdead7579a90452a.yml -openapi_spec_hash: 34869d638c12bf076949bb7e050dd634 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7dbd739a81e6aaf7fc7ef1858606e7d572d309af55082a66431d9292e655e66f.yml +openapi_spec_hash: a6374d5d718a7bd9d3d54fb657e2bd9d config_hash: ff35e224e809656528c44163aa41bebd diff --git a/README.md b/README.md index bf4e14c7..bb8741f7 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ use ContextDev\Client; $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key'); -$brand = $client->brand->retrieve(domain: 'REPLACE_ME'); +$brand = $client->brand->retrieve(domain: 'REPLACE_ME', type: 'by_domain'); var_dump($brand->brand); ``` @@ -54,7 +54,7 @@ use ContextDev\Core\Exceptions\RateLimitException; use ContextDev\Core\Exceptions\APIStatusException; try { - $brand = $client->brand->retrieve(domain: 'REPLACE_ME'); + $brand = $client->brand->retrieve(domain: 'REPLACE_ME', type: 'by_domain'); } catch (APIConnectionException $e) { echo "The server could not be reached", PHP_EOL; var_dump($e->getPrevious()); @@ -100,7 +100,7 @@ $client = new Client(requestOptions: ['maxRetries' => 0]); // Or, configure per-request: $result = $client->brand->retrieve( - domain: 'REPLACE_ME', requestOptions: ['maxRetries' => 5] + domain: 'REPLACE_ME', type: 'by_domain', requestOptions: ['maxRetries' => 5] ); ``` @@ -119,6 +119,7 @@ Note: the `extra*` parameters of the same name overrides the documented paramete $brand = $client->brand->retrieve( domain: 'REPLACE_ME', + type: 'by_domain', requestOptions: [ 'extraQueryParams' => ['my_query_parameter' => 'value'], 'extraBodyParams' => ['my_body_parameter' => 'value'], diff --git a/src/Brand/BrandRetrieveParams.php b/src/Brand/BrandRetrieveParams.php index c5280ffe..e32f18d9 100644 --- a/src/Brand/BrandRetrieveParams.php +++ b/src/Brand/BrandRetrieveParams.php @@ -5,6 +5,7 @@ namespace ContextDev\Brand; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; +use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; @@ -18,6 +19,7 @@ * * @phpstan-type BrandRetrieveParamsShape = array{ * domain: string, + * type: Type|value-of, * forceLanguage?: null|ForceLanguage|value-of, * maxAgeMs?: int|null, * maxSpeed?: bool|null, @@ -46,6 +48,14 @@ final class BrandRetrieveParams implements BaseModel #[Required] public string $domain; + /** + * Discriminator for transaction-based brand retrieval. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + /** @var value-of|null $forceLanguage */ #[Optional('force_language', enum: ForceLanguage::class)] public ?string $forceLanguage; @@ -134,7 +144,12 @@ final class BrandRetrieveParams implements BaseModel * To enforce required parameters use * ``` * BrandRetrieveParams::with( - * domain: ..., name: ..., email: ..., ticker: ..., transactionInfo: ... + * domain: ..., + * type: ..., + * name: ..., + * email: ..., + * ticker: ..., + * transactionInfo: ..., * ) * ``` * @@ -143,6 +158,7 @@ final class BrandRetrieveParams implements BaseModel * ``` * (new BrandRetrieveParams) * ->withDomain(...) + * ->withType(...) * ->withName(...) * ->withEmail(...) * ->withTicker(...) @@ -159,10 +175,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param Type|value-of $type * @param ForceLanguage|value-of|null $forceLanguage */ public static function with( string $domain, + Type|string $type, string $name, string $email, string $ticker, @@ -181,6 +199,7 @@ public static function with( $self = new self; $self['domain'] = $domain; + $self['type'] = $type; $self['name'] = $name; $self['email'] = $email; $self['ticker'] = $ticker; @@ -211,6 +230,19 @@ public function withDomain(string $domain): self return $self; } + /** + * Discriminator for transaction-based brand retrieval. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + /** * @param ForceLanguage|value-of $forceLanguage */ diff --git a/src/Brand/BrandRetrieveParams/Type.php b/src/Brand/BrandRetrieveParams/Type.php new file mode 100644 index 00000000..00a6ff93 --- /dev/null +++ b/src/Brand/BrandRetrieveParams/Type.php @@ -0,0 +1,13 @@ + $type discriminator for transaction-based brand retrieval * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). @@ -39,6 +41,7 @@ interface BrandContract */ public function retrieve( string $domain, + Type|string $type, string $name, string $email, string $ticker, diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index e2d0217a..c6d80b75 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -8,6 +8,7 @@ use ContextDev\Brand\BrandGetSimplifiedResponse; use ContextDev\Brand\BrandRetrieveParams; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; +use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Brand\BrandRetrieveSimplifiedParams; use ContextDev\Client; use ContextDev\Core\Contracts\BaseResponse; @@ -34,6 +35,7 @@ public function __construct(private Client $client) {} * * @param array{ * domain: string, + * type: Type|value-of, * forceLanguage?: value-of, * maxAgeMs?: int, * maxSpeed?: bool, diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index fa42323a..58fa3da3 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -7,6 +7,7 @@ use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; +use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\Util; @@ -37,6 +38,7 @@ public function __construct(private Client $client) * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. * * @param string $domain Domain name to retrieve brand data for (e.g., 'stripe.com'). + * @param Type|value-of $type discriminator for transaction-based brand retrieval * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). @@ -57,6 +59,7 @@ public function __construct(private Client $client) */ public function retrieve( string $domain, + Type|string $type, string $name, string $email, string $ticker, @@ -76,6 +79,7 @@ public function retrieve( $params = Util::removeNulls( [ 'domain' => $domain, + 'type' => $type, 'forceLanguage' => $forceLanguage, 'maxAgeMs' => $maxAgeMs, 'maxSpeed' => $maxSpeed, diff --git a/tests/ClientTest.php b/tests/ClientTest.php index d316cfd5..d854fd54 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -34,6 +34,7 @@ public function testDefaultHeaders(): void $client->brand->retrieve( domain: 'domain', + type: 'by_transaction', name: 'xxx', email: 'dev@stainless.com', ticker: 'ticker', diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index 5f1392a6..fdb0f1e8 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -38,6 +38,7 @@ public function testRetrieve(): void $result = $this->client->brand->retrieve( domain: 'domain', + type: 'by_transaction', name: 'xxx', email: 'dev@stainless.com', ticker: 'ticker', @@ -57,6 +58,7 @@ public function testRetrieveWithOptionalParams(): void $result = $this->client->brand->retrieve( domain: 'domain', + type: 'by_transaction', forceLanguage: 'afrikaans', maxAgeMs: 0, maxSpeed: true, From 9e538544c6cc77b4f0494dd52b355452afab5a70 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 6 Jul 2026 07:13:50 +0000 Subject: [PATCH 031/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 2a8f4ffd..65f558e7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "1.3.0" + ".": "2.0.0" } \ No newline at end of file diff --git a/README.md b/README.md index bb8741f7..817bc6bf 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 1.3.0" +composer require "context-dev/context-dev-php 2.0.0" ``` diff --git a/src/Client.php b/src/Client.php index 63da523e..1757c445 100644 --- a/src/Client.php +++ b/src/Client.php @@ -89,7 +89,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '1.3.0', + 'X-Stainless-Package-Version' => '2.0.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 348143f2..7f441e39 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '1.3.0'; +const VERSION = '2.0.0'; // x-release-please-end From 72e2a0ed1111163ba8280a3a28a40921f05dd6c0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 7 Jul 2026 04:22:49 +0000 Subject: [PATCH 032/130] feat(api): api update --- .stats.yml | 4 +- src/Monitors/MonitorGetResponse.php | 31 +++++ src/Monitors/MonitorGetResponse/Baseline.php | 39 ++++++ .../Baseline/MonitorsExtractBaseline.php | 120 ++++++++++++++++++ .../Baseline/MonitorsPageBaseline.php | 92 ++++++++++++++ .../Baseline/MonitorsSitemapBaseline.php | 120 ++++++++++++++++++ src/Monitors/MonitorListResponse/Data.php | 31 +++++ .../MonitorListResponse/Data/Baseline.php | 39 ++++++ .../Data/Baseline/MonitorsExtractBaseline.php | 120 ++++++++++++++++++ .../Data/Baseline/MonitorsPageBaseline.php | 92 ++++++++++++++ .../Data/Baseline/MonitorsSitemapBaseline.php | 120 ++++++++++++++++++ src/Monitors/MonitorNewResponse.php | 31 +++++ src/Monitors/MonitorNewResponse/Baseline.php | 39 ++++++ .../Baseline/MonitorsExtractBaseline.php | 120 ++++++++++++++++++ .../Baseline/MonitorsPageBaseline.php | 92 ++++++++++++++ .../Baseline/MonitorsSitemapBaseline.php | 120 ++++++++++++++++++ src/Monitors/MonitorUpdateResponse.php | 31 +++++ .../MonitorUpdateResponse/Baseline.php | 39 ++++++ .../Baseline/MonitorsExtractBaseline.php | 120 ++++++++++++++++++ .../Baseline/MonitorsPageBaseline.php | 92 ++++++++++++++ .../Baseline/MonitorsSitemapBaseline.php | 120 ++++++++++++++++++ 21 files changed, 1610 insertions(+), 2 deletions(-) create mode 100644 src/Monitors/MonitorGetResponse/Baseline.php create mode 100644 src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php create mode 100644 src/Monitors/MonitorGetResponse/Baseline/MonitorsPageBaseline.php create mode 100644 src/Monitors/MonitorGetResponse/Baseline/MonitorsSitemapBaseline.php create mode 100644 src/Monitors/MonitorListResponse/Data/Baseline.php create mode 100644 src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php create mode 100644 src/Monitors/MonitorListResponse/Data/Baseline/MonitorsPageBaseline.php create mode 100644 src/Monitors/MonitorListResponse/Data/Baseline/MonitorsSitemapBaseline.php create mode 100644 src/Monitors/MonitorNewResponse/Baseline.php create mode 100644 src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php create mode 100644 src/Monitors/MonitorNewResponse/Baseline/MonitorsPageBaseline.php create mode 100644 src/Monitors/MonitorNewResponse/Baseline/MonitorsSitemapBaseline.php create mode 100644 src/Monitors/MonitorUpdateResponse/Baseline.php create mode 100644 src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php create mode 100644 src/Monitors/MonitorUpdateResponse/Baseline/MonitorsPageBaseline.php create mode 100644 src/Monitors/MonitorUpdateResponse/Baseline/MonitorsSitemapBaseline.php diff --git a/.stats.yml b/.stats.yml index f52f4302..df5918bb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7dbd739a81e6aaf7fc7ef1858606e7d572d309af55082a66431d9292e655e66f.yml -openapi_spec_hash: a6374d5d718a7bd9d3d54fb657e2bd9d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6fd8cb15c904d1befd41a85ef8ffa3dfda11e60d560e466857e331e177e0c1e1.yml +openapi_spec_hash: 0f969f518e16e4fc41d00a5229705f5f config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorGetResponse.php b/src/Monitors/MonitorGetResponse.php index 5e0fba53..c0a3e511 100644 --- a/src/Monitors/MonitorGetResponse.php +++ b/src/Monitors/MonitorGetResponse.php @@ -8,6 +8,9 @@ use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorGetResponse\Baseline\MonitorsExtractBaseline; +use ContextDev\Monitors\MonitorGetResponse\Baseline\MonitorsPageBaseline; +use ContextDev\Monitors\MonitorGetResponse\Baseline\MonitorsSitemapBaseline; use ContextDev\Monitors\MonitorGetResponse\ChangeDetection; use ContextDev\Monitors\MonitorGetResponse\ChangeDetection\MonitorsExactChangeDetection; use ContextDev\Monitors\MonitorGetResponse\ChangeDetection\MonitorsSemanticChangeDetection; @@ -26,9 +29,11 @@ * * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorGetResponse\ChangeDetection * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorGetResponse\Target + * @phpstan-import-type BaselineVariants from \ContextDev\Monitors\MonitorGetResponse\Baseline * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorGetResponse\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorGetResponse\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorGetResponse\Target + * @phpstan-import-type BaselineShape from \ContextDev\Monitors\MonitorGetResponse\Baseline * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorGetResponse\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorGetResponse\Webhook * @@ -42,6 +47,7 @@ * status: Status|value-of, * target: TargetShape, * updatedAt: \DateTimeInterface, + * baseline?: BaselineShape|null, * lastChangeAt?: \DateTimeInterface|null, * lastError?: null|LastError|LastErrorShape, * lastRunAt?: \DateTimeInterface|null, @@ -105,6 +111,14 @@ final class MonitorGetResponse implements BaseModel #[Required('updated_at')] public \DateTimeInterface $updatedAt; + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @var BaselineVariants|null $baseline + */ + #[Optional(nullable: true)] + public MonitorsPageBaseline|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline; + #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; @@ -182,6 +196,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param BaselineShape|null $baseline * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook @@ -196,6 +211,7 @@ public static function with( Status|string $status, MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline = null, ?\DateTimeInterface $lastChangeAt = null, LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, @@ -215,6 +231,7 @@ public static function with( $self['target'] = $target; $self['updatedAt'] = $updatedAt; + null !== $baseline && $self['baseline'] = $baseline; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; @@ -324,6 +341,20 @@ public function withUpdatedAt(\DateTimeInterface $updatedAt): self return $self; } + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @param BaselineShape|null $baseline + */ + public function withBaseline( + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline, + ): self { + $self = clone $this; + $self['baseline'] = $baseline; + + return $self; + } + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self { $self = clone $this; diff --git a/src/Monitors/MonitorGetResponse/Baseline.php b/src/Monitors/MonitorGetResponse/Baseline.php new file mode 100644 index 00000000..f5e08b9a --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Baseline.php @@ -0,0 +1,39 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageBaseline::class, + MonitorsSitemapBaseline::class, + MonitorsExtractBaseline::class, + ]; + } +} diff --git a/src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php new file mode 100644 index 00000000..c2a156f9 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsExtractBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + #[Required] + public mixed $data; + + /** + * URLs that were analyzed to produce the extracted data. + * + * @var list $urlsAnalyzed + */ + #[Required('urls_analyzed', list: 'string')] + public array $urlsAnalyzed; + + /** + * `new MonitorsExtractBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractBaseline::with(capturedAt: ..., data: ..., urlsAnalyzed: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractBaseline) + * ->withCapturedAt(...) + * ->withData(...) + * ->withURLsAnalyzed(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urlsAnalyzed + */ + public static function with( + \DateTimeInterface $capturedAt, + mixed $data, + array $urlsAnalyzed + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['data'] = $data; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + public function withData(mixed $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * URLs that were analyzed to produce the extracted data. + * + * @param list $urlsAnalyzed + */ + public function withURLsAnalyzed(array $urlsAnalyzed): self + { + $self = clone $this; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Baseline/MonitorsPageBaseline.php b/src/Monitors/MonitorGetResponse/Baseline/MonitorsPageBaseline.php new file mode 100644 index 00000000..dddacea7 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Baseline/MonitorsPageBaseline.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The page's visible text as last observed. + */ + #[Required] + public string $text; + + /** + * `new MonitorsPageBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageBaseline::with(capturedAt: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageBaseline)->withCapturedAt(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + \DateTimeInterface $capturedAt, + string $text + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['text'] = $text; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The page's visible text as last observed. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/Baseline/MonitorsSitemapBaseline.php b/src/Monitors/MonitorGetResponse/Baseline/MonitorsSitemapBaseline.php new file mode 100644 index 00000000..aca23554 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Baseline/MonitorsSitemapBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsSitemapBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * Number of URLs in the baseline. + */ + #[Required('url_count')] + public int $urlCount; + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @var list $urls + */ + #[Required(list: 'string')] + public array $urls; + + /** + * `new MonitorsSitemapBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapBaseline::with(capturedAt: ..., urlCount: ..., urls: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapBaseline) + * ->withCapturedAt(...) + * ->withURLCount(...) + * ->withURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urls + */ + public static function with( + \DateTimeInterface $capturedAt, + int $urlCount, + array $urls + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['urlCount'] = $urlCount; + $self['urls'] = $urls; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * Number of URLs in the baseline. + */ + public function withURLCount(int $urlCount): self + { + $self = clone $this; + $self['urlCount'] = $urlCount; + + return $self; + } + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @param list $urls + */ + public function withURLs(array $urls): self + { + $self = clone $this; + $self['urls'] = $urls; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data.php b/src/Monitors/MonitorListResponse/Data.php index 95526640..ce057b7a 100644 --- a/src/Monitors/MonitorListResponse/Data.php +++ b/src/Monitors/MonitorListResponse/Data.php @@ -8,6 +8,9 @@ use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorListResponse\Data\Baseline\MonitorsExtractBaseline; +use ContextDev\Monitors\MonitorListResponse\Data\Baseline\MonitorsPageBaseline; +use ContextDev\Monitors\MonitorListResponse\Data\Baseline\MonitorsSitemapBaseline; use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection; use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection\MonitorsExactChangeDetection; use ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection\MonitorsSemanticChangeDetection; @@ -26,9 +29,11 @@ * * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorListResponse\Data\Target + * @phpstan-import-type BaselineVariants from \ContextDev\Monitors\MonitorListResponse\Data\Baseline * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorListResponse\Data\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorListResponse\Data\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorListResponse\Data\Target + * @phpstan-import-type BaselineShape from \ContextDev\Monitors\MonitorListResponse\Data\Baseline * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorListResponse\Data\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorListResponse\Data\Webhook * @@ -42,6 +47,7 @@ * status: Status|value-of, * target: TargetShape, * updatedAt: \DateTimeInterface, + * baseline?: BaselineShape|null, * lastChangeAt?: \DateTimeInterface|null, * lastError?: null|LastError|LastErrorShape, * lastRunAt?: \DateTimeInterface|null, @@ -105,6 +111,14 @@ final class Data implements BaseModel #[Required('updated_at')] public \DateTimeInterface $updatedAt; + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @var BaselineVariants|null $baseline + */ + #[Optional(nullable: true)] + public MonitorsPageBaseline|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline; + #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; @@ -182,6 +196,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param BaselineShape|null $baseline * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook @@ -196,6 +211,7 @@ public static function with( Status|string $status, MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline = null, ?\DateTimeInterface $lastChangeAt = null, LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, @@ -215,6 +231,7 @@ public static function with( $self['target'] = $target; $self['updatedAt'] = $updatedAt; + null !== $baseline && $self['baseline'] = $baseline; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; @@ -324,6 +341,20 @@ public function withUpdatedAt(\DateTimeInterface $updatedAt): self return $self; } + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @param BaselineShape|null $baseline + */ + public function withBaseline( + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline, + ): self { + $self = clone $this; + $self['baseline'] = $baseline; + + return $self; + } + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self { $self = clone $this; diff --git a/src/Monitors/MonitorListResponse/Data/Baseline.php b/src/Monitors/MonitorListResponse/Data/Baseline.php new file mode 100644 index 00000000..d586497a --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Baseline.php @@ -0,0 +1,39 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageBaseline::class, + MonitorsSitemapBaseline::class, + MonitorsExtractBaseline::class, + ]; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php new file mode 100644 index 00000000..2fe3f414 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsExtractBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + #[Required] + public mixed $data; + + /** + * URLs that were analyzed to produce the extracted data. + * + * @var list $urlsAnalyzed + */ + #[Required('urls_analyzed', list: 'string')] + public array $urlsAnalyzed; + + /** + * `new MonitorsExtractBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractBaseline::with(capturedAt: ..., data: ..., urlsAnalyzed: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractBaseline) + * ->withCapturedAt(...) + * ->withData(...) + * ->withURLsAnalyzed(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urlsAnalyzed + */ + public static function with( + \DateTimeInterface $capturedAt, + mixed $data, + array $urlsAnalyzed + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['data'] = $data; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + public function withData(mixed $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * URLs that were analyzed to produce the extracted data. + * + * @param list $urlsAnalyzed + */ + public function withURLsAnalyzed(array $urlsAnalyzed): self + { + $self = clone $this; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsPageBaseline.php b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsPageBaseline.php new file mode 100644 index 00000000..17ad7502 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsPageBaseline.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The page's visible text as last observed. + */ + #[Required] + public string $text; + + /** + * `new MonitorsPageBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageBaseline::with(capturedAt: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageBaseline)->withCapturedAt(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + \DateTimeInterface $capturedAt, + string $text + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['text'] = $text; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The page's visible text as last observed. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsSitemapBaseline.php b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsSitemapBaseline.php new file mode 100644 index 00000000..e319c532 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsSitemapBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsSitemapBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * Number of URLs in the baseline. + */ + #[Required('url_count')] + public int $urlCount; + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @var list $urls + */ + #[Required(list: 'string')] + public array $urls; + + /** + * `new MonitorsSitemapBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapBaseline::with(capturedAt: ..., urlCount: ..., urls: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapBaseline) + * ->withCapturedAt(...) + * ->withURLCount(...) + * ->withURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urls + */ + public static function with( + \DateTimeInterface $capturedAt, + int $urlCount, + array $urls + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['urlCount'] = $urlCount; + $self['urls'] = $urls; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * Number of URLs in the baseline. + */ + public function withURLCount(int $urlCount): self + { + $self = clone $this; + $self['urlCount'] = $urlCount; + + return $self; + } + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @param list $urls + */ + public function withURLs(array $urls): self + { + $self = clone $this; + $self['urls'] = $urls; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse.php b/src/Monitors/MonitorNewResponse.php index 1f400759..c61def59 100644 --- a/src/Monitors/MonitorNewResponse.php +++ b/src/Monitors/MonitorNewResponse.php @@ -8,6 +8,9 @@ use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorNewResponse\Baseline\MonitorsExtractBaseline; +use ContextDev\Monitors\MonitorNewResponse\Baseline\MonitorsPageBaseline; +use ContextDev\Monitors\MonitorNewResponse\Baseline\MonitorsSitemapBaseline; use ContextDev\Monitors\MonitorNewResponse\ChangeDetection; use ContextDev\Monitors\MonitorNewResponse\ChangeDetection\MonitorsExactChangeDetection; use ContextDev\Monitors\MonitorNewResponse\ChangeDetection\MonitorsSemanticChangeDetection; @@ -26,9 +29,11 @@ * * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorNewResponse\ChangeDetection * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorNewResponse\Target + * @phpstan-import-type BaselineVariants from \ContextDev\Monitors\MonitorNewResponse\Baseline * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorNewResponse\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorNewResponse\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorNewResponse\Target + * @phpstan-import-type BaselineShape from \ContextDev\Monitors\MonitorNewResponse\Baseline * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorNewResponse\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorNewResponse\Webhook * @@ -42,6 +47,7 @@ * status: Status|value-of, * target: TargetShape, * updatedAt: \DateTimeInterface, + * baseline?: BaselineShape|null, * lastChangeAt?: \DateTimeInterface|null, * lastError?: null|LastError|LastErrorShape, * lastRunAt?: \DateTimeInterface|null, @@ -105,6 +111,14 @@ final class MonitorNewResponse implements BaseModel #[Required('updated_at')] public \DateTimeInterface $updatedAt; + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @var BaselineVariants|null $baseline + */ + #[Optional(nullable: true)] + public MonitorsPageBaseline|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline; + #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; @@ -182,6 +196,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param BaselineShape|null $baseline * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook @@ -196,6 +211,7 @@ public static function with( Status|string $status, MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline = null, ?\DateTimeInterface $lastChangeAt = null, LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, @@ -215,6 +231,7 @@ public static function with( $self['target'] = $target; $self['updatedAt'] = $updatedAt; + null !== $baseline && $self['baseline'] = $baseline; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; @@ -324,6 +341,20 @@ public function withUpdatedAt(\DateTimeInterface $updatedAt): self return $self; } + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @param BaselineShape|null $baseline + */ + public function withBaseline( + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline, + ): self { + $self = clone $this; + $self['baseline'] = $baseline; + + return $self; + } + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self { $self = clone $this; diff --git a/src/Monitors/MonitorNewResponse/Baseline.php b/src/Monitors/MonitorNewResponse/Baseline.php new file mode 100644 index 00000000..5b4f99af --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Baseline.php @@ -0,0 +1,39 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageBaseline::class, + MonitorsSitemapBaseline::class, + MonitorsExtractBaseline::class, + ]; + } +} diff --git a/src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php new file mode 100644 index 00000000..5e2e8b79 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsExtractBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + #[Required] + public mixed $data; + + /** + * URLs that were analyzed to produce the extracted data. + * + * @var list $urlsAnalyzed + */ + #[Required('urls_analyzed', list: 'string')] + public array $urlsAnalyzed; + + /** + * `new MonitorsExtractBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractBaseline::with(capturedAt: ..., data: ..., urlsAnalyzed: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractBaseline) + * ->withCapturedAt(...) + * ->withData(...) + * ->withURLsAnalyzed(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urlsAnalyzed + */ + public static function with( + \DateTimeInterface $capturedAt, + mixed $data, + array $urlsAnalyzed + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['data'] = $data; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + public function withData(mixed $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * URLs that were analyzed to produce the extracted data. + * + * @param list $urlsAnalyzed + */ + public function withURLsAnalyzed(array $urlsAnalyzed): self + { + $self = clone $this; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Baseline/MonitorsPageBaseline.php b/src/Monitors/MonitorNewResponse/Baseline/MonitorsPageBaseline.php new file mode 100644 index 00000000..1dd9f40c --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Baseline/MonitorsPageBaseline.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The page's visible text as last observed. + */ + #[Required] + public string $text; + + /** + * `new MonitorsPageBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageBaseline::with(capturedAt: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageBaseline)->withCapturedAt(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + \DateTimeInterface $capturedAt, + string $text + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['text'] = $text; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The page's visible text as last observed. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/Baseline/MonitorsSitemapBaseline.php b/src/Monitors/MonitorNewResponse/Baseline/MonitorsSitemapBaseline.php new file mode 100644 index 00000000..a988c1f4 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Baseline/MonitorsSitemapBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsSitemapBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * Number of URLs in the baseline. + */ + #[Required('url_count')] + public int $urlCount; + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @var list $urls + */ + #[Required(list: 'string')] + public array $urls; + + /** + * `new MonitorsSitemapBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapBaseline::with(capturedAt: ..., urlCount: ..., urls: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapBaseline) + * ->withCapturedAt(...) + * ->withURLCount(...) + * ->withURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urls + */ + public static function with( + \DateTimeInterface $capturedAt, + int $urlCount, + array $urls + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['urlCount'] = $urlCount; + $self['urls'] = $urls; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * Number of URLs in the baseline. + */ + public function withURLCount(int $urlCount): self + { + $self = clone $this; + $self['urlCount'] = $urlCount; + + return $self; + } + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @param list $urls + */ + public function withURLs(array $urls): self + { + $self = clone $this; + $self['urls'] = $urls; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse.php b/src/Monitors/MonitorUpdateResponse.php index 0100ff26..fe792684 100644 --- a/src/Monitors/MonitorUpdateResponse.php +++ b/src/Monitors/MonitorUpdateResponse.php @@ -8,6 +8,9 @@ use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorUpdateResponse\Baseline\MonitorsExtractBaseline; +use ContextDev\Monitors\MonitorUpdateResponse\Baseline\MonitorsPageBaseline; +use ContextDev\Monitors\MonitorUpdateResponse\Baseline\MonitorsSitemapBaseline; use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection; use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection\MonitorsExactChangeDetection; use ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection\MonitorsSemanticChangeDetection; @@ -26,9 +29,11 @@ * * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorUpdateResponse\Target + * @phpstan-import-type BaselineVariants from \ContextDev\Monitors\MonitorUpdateResponse\Baseline * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorUpdateResponse\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorUpdateResponse\Schedule * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorUpdateResponse\Target + * @phpstan-import-type BaselineShape from \ContextDev\Monitors\MonitorUpdateResponse\Baseline * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorUpdateResponse\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorUpdateResponse\Webhook * @@ -42,6 +47,7 @@ * status: Status|value-of, * target: TargetShape, * updatedAt: \DateTimeInterface, + * baseline?: BaselineShape|null, * lastChangeAt?: \DateTimeInterface|null, * lastError?: null|LastError|LastErrorShape, * lastRunAt?: \DateTimeInterface|null, @@ -105,6 +111,14 @@ final class MonitorUpdateResponse implements BaseModel #[Required('updated_at')] public \DateTimeInterface $updatedAt; + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @var BaselineVariants|null $baseline + */ + #[Optional(nullable: true)] + public MonitorsPageBaseline|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline; + #[Optional('last_change_at', nullable: true)] public ?\DateTimeInterface $lastChangeAt; @@ -182,6 +196,7 @@ public function __construct() * @param Schedule|ScheduleShape $schedule * @param Status|value-of $status * @param TargetShape $target + * @param BaselineShape|null $baseline * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook @@ -196,6 +211,7 @@ public static function with( Status|string $status, MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, \DateTimeInterface $updatedAt, + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline = null, ?\DateTimeInterface $lastChangeAt = null, LastError|array|null $lastError = null, ?\DateTimeInterface $lastRunAt = null, @@ -215,6 +231,7 @@ public static function with( $self['target'] = $target; $self['updatedAt'] = $updatedAt; + null !== $baseline && $self['baseline'] = $baseline; null !== $lastChangeAt && $self['lastChangeAt'] = $lastChangeAt; null !== $lastError && $self['lastError'] = $lastError; null !== $lastRunAt && $self['lastRunAt'] = $lastRunAt; @@ -324,6 +341,20 @@ public function withUpdatedAt(\DateTimeInterface $updatedAt): self return $self; } + /** + * Current baseline: the last observed value the monitor compares new snapshots against. Its shape follows `target.type` (page/sitemap/extract). Only populated on GET /monitors/{monitor_id}; null until the first baseline run completes (and after a target or change_detection update, which resets the baseline). + * + * @param BaselineShape|null $baseline + */ + public function withBaseline( + MonitorsPageBaseline|array|MonitorsSitemapBaseline|MonitorsExtractBaseline|null $baseline, + ): self { + $self = clone $this; + $self['baseline'] = $baseline; + + return $self; + } + public function withLastChangeAt(?\DateTimeInterface $lastChangeAt): self { $self = clone $this; diff --git a/src/Monitors/MonitorUpdateResponse/Baseline.php b/src/Monitors/MonitorUpdateResponse/Baseline.php new file mode 100644 index 00000000..4478f02a --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Baseline.php @@ -0,0 +1,39 @@ +|array + */ + public static function variants(): array + { + return [ + MonitorsPageBaseline::class, + MonitorsSitemapBaseline::class, + MonitorsExtractBaseline::class, + ]; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php new file mode 100644 index 00000000..86ae3084 --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsExtractBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + #[Required] + public mixed $data; + + /** + * URLs that were analyzed to produce the extracted data. + * + * @var list $urlsAnalyzed + */ + #[Required('urls_analyzed', list: 'string')] + public array $urlsAnalyzed; + + /** + * `new MonitorsExtractBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsExtractBaseline::with(capturedAt: ..., data: ..., urlsAnalyzed: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsExtractBaseline) + * ->withCapturedAt(...) + * ->withData(...) + * ->withURLsAnalyzed(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urlsAnalyzed + */ + public static function with( + \DateTimeInterface $capturedAt, + mixed $data, + array $urlsAnalyzed + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['data'] = $data; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + */ + public function withData(mixed $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * URLs that were analyzed to produce the extracted data. + * + * @param list $urlsAnalyzed + */ + public function withURLsAnalyzed(array $urlsAnalyzed): self + { + $self = clone $this; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsPageBaseline.php b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsPageBaseline.php new file mode 100644 index 00000000..36681a1c --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsPageBaseline.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * The page's visible text as last observed. + */ + #[Required] + public string $text; + + /** + * `new MonitorsPageBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsPageBaseline::with(capturedAt: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsPageBaseline)->withCapturedAt(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + \DateTimeInterface $capturedAt, + string $text + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['text'] = $text; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * The page's visible text as last observed. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsSitemapBaseline.php b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsSitemapBaseline.php new file mode 100644 index 00000000..5f6e865d --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsSitemapBaseline.php @@ -0,0 +1,120 @@ + + * } + */ +final class MonitorsSitemapBaseline implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When this baseline was last captured or replaced. + */ + #[Required('captured_at')] + public \DateTimeInterface $capturedAt; + + /** + * Number of URLs in the baseline. + */ + #[Required('url_count')] + public int $urlCount; + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @var list $urls + */ + #[Required(list: 'string')] + public array $urls; + + /** + * `new MonitorsSitemapBaseline()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorsSitemapBaseline::with(capturedAt: ..., urlCount: ..., urls: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorsSitemapBaseline) + * ->withCapturedAt(...) + * ->withURLCount(...) + * ->withURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urls + */ + public static function with( + \DateTimeInterface $capturedAt, + int $urlCount, + array $urls + ): self { + $self = new self; + + $self['capturedAt'] = $capturedAt; + $self['urlCount'] = $urlCount; + $self['urls'] = $urls; + + return $self; + } + + /** + * When this baseline was last captured or replaced. + */ + public function withCapturedAt(\DateTimeInterface $capturedAt): self + { + $self = clone $this; + $self['capturedAt'] = $capturedAt; + + return $self; + } + + /** + * Number of URLs in the baseline. + */ + public function withURLCount(int $urlCount): self + { + $self = clone $this; + $self['urlCount'] = $urlCount; + + return $self; + } + + /** + * The sitemap URLs as last observed (sorted, normalized). + * + * @param list $urls + */ + public function withURLs(array $urls): self + { + $self = clone $this; + $self['urls'] = $urls; + + return $self; + } +} From 43bebbc1f4a922b3d2dfd1a7a29dba2bdc404f9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 00:09:55 +0000 Subject: [PATCH 033/130] feat(api): api update --- .stats.yml | 4 ++-- src/Brand/BrandRetrieveParams.php | 24 +++++++++++++++++++++++- src/ServiceContracts/BrandContract.php | 2 ++ src/Services/BrandRawService.php | 3 ++- src/Services/BrandService.php | 5 ++++- tests/ClientTest.php | 1 + tests/Services/BrandTest.php | 2 ++ 7 files changed, 36 insertions(+), 5 deletions(-) diff --git a/.stats.yml b/.stats.yml index df5918bb..5321a028 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6fd8cb15c904d1befd41a85ef8ffa3dfda11e60d560e466857e331e177e0c1e1.yml -openapi_spec_hash: 0f969f518e16e4fc41d00a5229705f5f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-fa5c7cd62da1c7cb2eddf8c6bb1f32ca7f958be5c3c315ade6ca0a669814d75a.yml +openapi_spec_hash: 8358c1a467ab971afd59d615d1e731ee config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Brand/BrandRetrieveParams.php b/src/Brand/BrandRetrieveParams.php index e32f18d9..4d98ff97 100644 --- a/src/Brand/BrandRetrieveParams.php +++ b/src/Brand/BrandRetrieveParams.php @@ -13,7 +13,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. + * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, transaction descriptor, or direct URL. Note: `by_direct_url` fetches brand data only from the provided URL — not from the entire internet. * * @see ContextDev\Services\BrandService::retrieve() * @@ -29,6 +29,7 @@ * email: string, * ticker: string, * tickerExchange?: string|null, + * directURL: string, * transactionInfo: string, * city?: string|null, * highConfidenceOnly?: bool|null, @@ -108,6 +109,12 @@ final class BrandRetrieveParams implements BaseModel #[Optional('ticker_exchange')] public ?string $tickerExchange; + /** + * Full http(s) URL to fetch brand data from (e.g., 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire internet. + */ + #[Required('direct_url')] + public string $directURL; + /** * Transaction information to identify the brand. */ @@ -149,6 +156,7 @@ final class BrandRetrieveParams implements BaseModel * name: ..., * email: ..., * ticker: ..., + * directURL: ..., * transactionInfo: ..., * ) * ``` @@ -162,6 +170,7 @@ final class BrandRetrieveParams implements BaseModel * ->withName(...) * ->withEmail(...) * ->withTicker(...) + * ->withDirectURL(...) * ->withTransactionInfo(...) * ``` */ @@ -184,6 +193,7 @@ public static function with( string $name, string $email, string $ticker, + string $directURL, string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, @@ -203,6 +213,7 @@ public static function with( $self['name'] = $name; $self['email'] = $email; $self['ticker'] = $ticker; + $self['directURL'] = $directURL; $self['transactionInfo'] = $transactionInfo; null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; @@ -342,6 +353,17 @@ public function withTickerExchange(string $tickerExchange): self return $self; } + /** + * Full http(s) URL to fetch brand data from (e.g., 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire internet. + */ + public function withDirectURL(string $directURL): self + { + $self = clone $this; + $self['directURL'] = $directURL; + + return $self; + } + /** * Transaction information to identify the brand. */ diff --git a/src/ServiceContracts/BrandContract.php b/src/ServiceContracts/BrandContract.php index b68e7c32..ca83c911 100644 --- a/src/ServiceContracts/BrandContract.php +++ b/src/ServiceContracts/BrandContract.php @@ -24,6 +24,7 @@ interface BrandContract * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + * @param string $directURL Full http(s) URL to fetch brand data from (e.g., 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire internet. * @param string $transactionInfo transaction information to identify the brand * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. @@ -45,6 +46,7 @@ public function retrieve( string $name, string $email, string $ticker, + string $directURL, string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index c6d80b75..b0f6c263 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -31,7 +31,7 @@ public function __construct(private Client $client) {} /** * @api * - * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. + * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, transaction descriptor, or direct URL. Note: `by_direct_url` fetches brand data only from the provided URL — not from the entire internet. * * @param array{ * domain: string, @@ -45,6 +45,7 @@ public function __construct(private Client $client) {} * email: string, * ticker: string, * tickerExchange?: string, + * directURL: string, * transactionInfo: string, * city?: string, * highConfidenceOnly?: bool, diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index 58fa3da3..63e08abc 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -35,13 +35,14 @@ public function __construct(private Client $client) /** * @api * - * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, or transaction descriptor. + * Retrieve logos, backdrops, colors, industry, description, and more. Provide exactly one lookup identifier in the request body: a domain, company name, email address, stock ticker, transaction descriptor, or direct URL. Note: `by_direct_url` fetches brand data only from the provided URL — not from the entire internet. * * @param string $domain Domain name to retrieve brand data for (e.g., 'stripe.com'). * @param Type|value-of $type discriminator for transaction-based brand retrieval * @param string $name Company name to retrieve brand data for (e.g., 'Apple Inc'). * @param string $email Email address to retrieve brand data for (e.g., 'jane@stripe.com'). * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). + * @param string $directURL Full http(s) URL to fetch brand data from (e.g., 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire internet. * @param string $transactionInfo transaction information to identify the brand * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. @@ -63,6 +64,7 @@ public function retrieve( string $name, string $email, string $ticker, + string $directURL, string $transactionInfo, ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, @@ -89,6 +91,7 @@ public function retrieve( 'email' => $email, 'ticker' => $ticker, 'tickerExchange' => $tickerExchange, + 'directURL' => $directURL, 'transactionInfo' => $transactionInfo, 'city' => $city, 'highConfidenceOnly' => $highConfidenceOnly, diff --git a/tests/ClientTest.php b/tests/ClientTest.php index d854fd54..07473e5f 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -38,6 +38,7 @@ public function testDefaultHeaders(): void name: 'xxx', email: 'dev@stainless.com', ticker: 'ticker', + directURL: 'https://example.com', transactionInfo: 'xxx', ); diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index fdb0f1e8..7a91ba75 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -42,6 +42,7 @@ public function testRetrieve(): void name: 'xxx', email: 'dev@stainless.com', ticker: 'ticker', + directURL: 'https://example.com', transactionInfo: 'xxx', ); @@ -68,6 +69,7 @@ public function testRetrieveWithOptionalParams(): void email: 'dev@stainless.com', ticker: 'ticker', tickerExchange: 'ticker_exchange', + directURL: 'https://example.com', transactionInfo: 'xxx', city: 'city', highConfidenceOnly: true, From 3f4e1415dc6100ff21f9f34cd46c28c61c887f88 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 00:36:06 +0000 Subject: [PATCH 034/130] feat(api): api update --- .stats.yml | 4 +- .../MonitorsSemanticChangeDetection.php | 37 ++-------------- .../Target/MonitorsExtractTarget.php | 44 +++++++++---------- src/Monitors/MonitorGetChangeResponse.php | 14 ------ .../MonitorsSemanticChangeDetection.php | 37 ++-------------- .../Target/MonitorsExtractTarget.php | 44 +++++++++---------- src/Monitors/MonitorListParams.php | 4 +- src/Monitors/MonitorListParams/SearchBy.php | 2 +- .../MonitorsSemanticChangeDetection.php | 37 ++-------------- .../Data/Target/MonitorsExtractTarget.php | 44 +++++++++---------- .../MonitorsSemanticChangeDetection.php | 37 ++-------------- .../Target/MonitorsExtractTarget.php | 44 +++++++++---------- .../MonitorsSemanticChangeDetection.php | 37 ++-------------- .../Target/MonitorsExtractTarget.php | 44 +++++++++---------- .../MonitorsSemanticChangeDetection.php | 37 ++-------------- .../Target/MonitorsExtractTarget.php | 44 +++++++++---------- src/ServiceContracts/MonitorsContract.php | 2 +- src/Services/MonitorsService.php | 2 +- 18 files changed, 163 insertions(+), 351 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5321a028..085d46dd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-fa5c7cd62da1c7cb2eddf8c6bb1f32ca7f958be5c3c315ade6ca0a669814d75a.yml -openapi_spec_hash: 8358c1a467ab971afd59d615d1e731ee +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b075e5704110b3c03bd81b41f62b836d7624eceed7feb0ac63720dec9a4cbba4.yml +openapi_spec_hash: 5efb926e6e99163e3e42a98986da8335 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php index 8297408e..27eaf065 100644 --- a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,10 +10,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes that match a natural language query. + * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ - * query: string, type: 'semantic', confidenceThreshold?: float|null + * type: 'semantic', confidenceThreshold?: float|null * } */ final class MonitorsSemanticChangeDetection implements BaseModel @@ -25,26 +25,9 @@ final class MonitorsSemanticChangeDetection implements BaseModel #[Required] public string $type = 'semantic'; - #[Required] - public string $query; - #[Optional('confidence_threshold')] public ?float $confidenceThreshold; - /** - * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSemanticChangeDetection::with(query: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSemanticChangeDetection)->withQuery(...) - * ``` - */ public function __construct() { $this->initialize(); @@ -55,27 +38,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - string $query, - ?float $confidenceThreshold = null - ): self { + public static function with(?float $confidenceThreshold = null): self + { $self = new self; - $self['query'] = $query; - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; return $self; } - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - /** * @param 'semantic' $type */ diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php index 05903625..19771d30 100644 --- a/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php @@ -13,10 +13,10 @@ * Watch a site's extracted structured data. * * @phpstan-type MonitorsExtractTargetShape = array{ + * instructions: string, * type: 'extract', * url: string, * followSubdomains?: bool|null, - * instructions?: string|null, * maxDepth?: int|null, * maxPages?: int|null, * schema?: array|null, @@ -31,6 +31,12 @@ final class MonitorsExtractTarget implements BaseModel #[Required] public string $type = 'extract'; + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + #[Required] + public string $instructions; + /** * Root URL to extract structured data from. */ @@ -40,12 +46,6 @@ final class MonitorsExtractTarget implements BaseModel #[Optional('follow_subdomains')] public ?bool $followSubdomains; - /** - * Optional natural-language instructions guiding what to extract. - */ - #[Optional] - public ?string $instructions; - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ @@ -71,13 +71,13 @@ final class MonitorsExtractTarget implements BaseModel * * To enforce required parameters use * ``` - * MonitorsExtractTarget::with(url: ...) + * MonitorsExtractTarget::with(instructions: ..., url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorsExtractTarget)->withURL(...) + * (new MonitorsExtractTarget)->withInstructions(...)->withURL(...) * ``` */ public function __construct() @@ -93,19 +93,19 @@ public function __construct() * @param array|null $schema */ public static function with( + string $instructions, string $url, ?bool $followSubdomains = null, - ?string $instructions = null, ?int $maxDepth = null, ?int $maxPages = null, ?array $schema = null, ): self { $self = new self; + $self['instructions'] = $instructions; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; - null !== $instructions && $self['instructions'] = $instructions; null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $schema && $self['schema'] = $schema; @@ -113,6 +113,17 @@ public static function with( return $self; } + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * @param 'extract' $type */ @@ -143,17 +154,6 @@ public function withFollowSubdomains(bool $followSubdomains): self return $self; } - /** - * Optional natural-language instructions guiding what to extract. - */ - public function withInstructions(string $instructions): self - { - $self = clone $this; - $self['instructions'] = $instructions; - - return $self; - } - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ diff --git a/src/Monitors/MonitorGetChangeResponse.php b/src/Monitors/MonitorGetChangeResponse.php index 44f7b824..bc39e1a0 100644 --- a/src/Monitors/MonitorGetChangeResponse.php +++ b/src/Monitors/MonitorGetChangeResponse.php @@ -40,7 +40,6 @@ * importance?: null|Importance|value-of, * matchedURLCount?: int|null, * matchedURLs?: list|null, - * query?: string|null, * removedURLCount?: int|null, * removedURLs?: list|null, * tags?: list|null, @@ -136,9 +135,6 @@ final class MonitorGetChangeResponse implements BaseModel #[Optional('matched_urls', list: 'string')] public ?array $matchedURLs; - #[Optional] - public ?string $query; - #[Optional('removed_url_count')] public ?int $removedURLCount; @@ -234,7 +230,6 @@ public static function with( Importance|string|null $importance = null, ?int $matchedURLCount = null, ?array $matchedURLs = null, - ?string $query = null, ?int $removedURLCount = null, ?array $removedURLs = null, ?array $tags = null, @@ -262,7 +257,6 @@ public static function with( null !== $importance && $self['importance'] = $importance; null !== $matchedURLCount && $self['matchedURLCount'] = $matchedURLCount; null !== $matchedURLs && $self['matchedURLs'] = $matchedURLs; - null !== $query && $self['query'] = $query; null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; null !== $removedURLs && $self['removedURLs'] = $removedURLs; null !== $tags && $self['tags'] = $tags; @@ -464,14 +458,6 @@ public function withMatchedURLs(array $matchedURLs): self return $self; } - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - public function withRemovedURLCount(int $removedURLCount): self { $self = clone $this; diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index c7046049..e4ead61c 100644 --- a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,10 +10,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes that match a natural language query. + * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ - * query: string, type: 'semantic', confidenceThreshold?: float|null + * type: 'semantic', confidenceThreshold?: float|null * } */ final class MonitorsSemanticChangeDetection implements BaseModel @@ -25,26 +25,9 @@ final class MonitorsSemanticChangeDetection implements BaseModel #[Required] public string $type = 'semantic'; - #[Required] - public string $query; - #[Optional('confidence_threshold')] public ?float $confidenceThreshold; - /** - * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSemanticChangeDetection::with(query: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSemanticChangeDetection)->withQuery(...) - * ``` - */ public function __construct() { $this->initialize(); @@ -55,27 +38,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - string $query, - ?float $confidenceThreshold = null - ): self { + public static function with(?float $confidenceThreshold = null): self + { $self = new self; - $self['query'] = $query; - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; return $self; } - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - /** * @param 'semantic' $type */ diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php index c5d50b5d..7d07f5f9 100644 --- a/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php @@ -13,10 +13,10 @@ * Watch a site's extracted structured data. * * @phpstan-type MonitorsExtractTargetShape = array{ + * instructions: string, * type: 'extract', * url: string, * followSubdomains?: bool|null, - * instructions?: string|null, * maxDepth?: int|null, * maxPages?: int|null, * schema?: array|null, @@ -31,6 +31,12 @@ final class MonitorsExtractTarget implements BaseModel #[Required] public string $type = 'extract'; + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + #[Required] + public string $instructions; + /** * Root URL to extract structured data from. */ @@ -40,12 +46,6 @@ final class MonitorsExtractTarget implements BaseModel #[Optional('follow_subdomains')] public ?bool $followSubdomains; - /** - * Optional natural-language instructions guiding what to extract. - */ - #[Optional] - public ?string $instructions; - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ @@ -71,13 +71,13 @@ final class MonitorsExtractTarget implements BaseModel * * To enforce required parameters use * ``` - * MonitorsExtractTarget::with(url: ...) + * MonitorsExtractTarget::with(instructions: ..., url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorsExtractTarget)->withURL(...) + * (new MonitorsExtractTarget)->withInstructions(...)->withURL(...) * ``` */ public function __construct() @@ -93,19 +93,19 @@ public function __construct() * @param array|null $schema */ public static function with( + string $instructions, string $url, ?bool $followSubdomains = null, - ?string $instructions = null, ?int $maxDepth = null, ?int $maxPages = null, ?array $schema = null, ): self { $self = new self; + $self['instructions'] = $instructions; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; - null !== $instructions && $self['instructions'] = $instructions; null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $schema && $self['schema'] = $schema; @@ -113,6 +113,17 @@ public static function with( return $self; } + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * @param 'extract' $type */ @@ -143,17 +154,6 @@ public function withFollowSubdomains(bool $followSubdomains): self return $self; } - /** - * Optional natural-language instructions guiding what to extract. - */ - public function withInstructions(string $instructions): self - { - $self = clone $this; - $self['instructions'] = $instructions; - - return $self; - } - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ diff --git a/src/Monitors/MonitorListParams.php b/src/Monitors/MonitorListParams.php index 9f167e48..2119e051 100644 --- a/src/Monitors/MonitorListParams.php +++ b/src/Monitors/MonitorListParams.php @@ -55,7 +55,7 @@ final class MonitorListParams implements BaseModel public ?string $q; /** - * Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. * * @var list>|null $searchBy */ @@ -181,7 +181,7 @@ public function withQ(string $q): self } /** - * Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. * * @param list> $searchBy */ diff --git a/src/Monitors/MonitorListParams/SearchBy.php b/src/Monitors/MonitorListParams/SearchBy.php index e35ffc6e..c9c728b4 100644 --- a/src/Monitors/MonitorListParams/SearchBy.php +++ b/src/Monitors/MonitorListParams/SearchBy.php @@ -10,7 +10,7 @@ enum SearchBy: string case URL = 'url'; - case QUERY = 'query'; + case INSTRUCTIONS = 'instructions'; case TAGS = 'tags'; } diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php index 9a6a4689..6859c141 100644 --- a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,10 +10,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes that match a natural language query. + * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ - * query: string, type: 'semantic', confidenceThreshold?: float|null + * type: 'semantic', confidenceThreshold?: float|null * } */ final class MonitorsSemanticChangeDetection implements BaseModel @@ -25,26 +25,9 @@ final class MonitorsSemanticChangeDetection implements BaseModel #[Required] public string $type = 'semantic'; - #[Required] - public string $query; - #[Optional('confidence_threshold')] public ?float $confidenceThreshold; - /** - * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSemanticChangeDetection::with(query: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSemanticChangeDetection)->withQuery(...) - * ``` - */ public function __construct() { $this->initialize(); @@ -55,27 +38,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - string $query, - ?float $confidenceThreshold = null - ): self { + public static function with(?float $confidenceThreshold = null): self + { $self = new self; - $self['query'] = $query; - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; return $self; } - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - /** * @param 'semantic' $type */ diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php index c092e11d..b85aec47 100644 --- a/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php @@ -13,10 +13,10 @@ * Watch a site's extracted structured data. * * @phpstan-type MonitorsExtractTargetShape = array{ + * instructions: string, * type: 'extract', * url: string, * followSubdomains?: bool|null, - * instructions?: string|null, * maxDepth?: int|null, * maxPages?: int|null, * schema?: array|null, @@ -31,6 +31,12 @@ final class MonitorsExtractTarget implements BaseModel #[Required] public string $type = 'extract'; + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + #[Required] + public string $instructions; + /** * Root URL to extract structured data from. */ @@ -40,12 +46,6 @@ final class MonitorsExtractTarget implements BaseModel #[Optional('follow_subdomains')] public ?bool $followSubdomains; - /** - * Optional natural-language instructions guiding what to extract. - */ - #[Optional] - public ?string $instructions; - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ @@ -71,13 +71,13 @@ final class MonitorsExtractTarget implements BaseModel * * To enforce required parameters use * ``` - * MonitorsExtractTarget::with(url: ...) + * MonitorsExtractTarget::with(instructions: ..., url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorsExtractTarget)->withURL(...) + * (new MonitorsExtractTarget)->withInstructions(...)->withURL(...) * ``` */ public function __construct() @@ -93,19 +93,19 @@ public function __construct() * @param array|null $schema */ public static function with( + string $instructions, string $url, ?bool $followSubdomains = null, - ?string $instructions = null, ?int $maxDepth = null, ?int $maxPages = null, ?array $schema = null, ): self { $self = new self; + $self['instructions'] = $instructions; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; - null !== $instructions && $self['instructions'] = $instructions; null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $schema && $self['schema'] = $schema; @@ -113,6 +113,17 @@ public static function with( return $self; } + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * @param 'extract' $type */ @@ -143,17 +154,6 @@ public function withFollowSubdomains(bool $followSubdomains): self return $self; } - /** - * Optional natural-language instructions guiding what to extract. - */ - public function withInstructions(string $instructions): self - { - $self = clone $this; - $self['instructions'] = $instructions; - - return $self; - } - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index 21c2a85c..9b35b993 100644 --- a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,10 +10,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes that match a natural language query. + * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ - * query: string, type: 'semantic', confidenceThreshold?: float|null + * type: 'semantic', confidenceThreshold?: float|null * } */ final class MonitorsSemanticChangeDetection implements BaseModel @@ -25,26 +25,9 @@ final class MonitorsSemanticChangeDetection implements BaseModel #[Required] public string $type = 'semantic'; - #[Required] - public string $query; - #[Optional('confidence_threshold')] public ?float $confidenceThreshold; - /** - * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSemanticChangeDetection::with(query: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSemanticChangeDetection)->withQuery(...) - * ``` - */ public function __construct() { $this->initialize(); @@ -55,27 +38,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - string $query, - ?float $confidenceThreshold = null - ): self { + public static function with(?float $confidenceThreshold = null): self + { $self = new self; - $self['query'] = $query; - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; return $self; } - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - /** * @param 'semantic' $type */ diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php index d71e5bb3..41d41bcc 100644 --- a/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php @@ -13,10 +13,10 @@ * Watch a site's extracted structured data. * * @phpstan-type MonitorsExtractTargetShape = array{ + * instructions: string, * type: 'extract', * url: string, * followSubdomains?: bool|null, - * instructions?: string|null, * maxDepth?: int|null, * maxPages?: int|null, * schema?: array|null, @@ -31,6 +31,12 @@ final class MonitorsExtractTarget implements BaseModel #[Required] public string $type = 'extract'; + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + #[Required] + public string $instructions; + /** * Root URL to extract structured data from. */ @@ -40,12 +46,6 @@ final class MonitorsExtractTarget implements BaseModel #[Optional('follow_subdomains')] public ?bool $followSubdomains; - /** - * Optional natural-language instructions guiding what to extract. - */ - #[Optional] - public ?string $instructions; - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ @@ -71,13 +71,13 @@ final class MonitorsExtractTarget implements BaseModel * * To enforce required parameters use * ``` - * MonitorsExtractTarget::with(url: ...) + * MonitorsExtractTarget::with(instructions: ..., url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorsExtractTarget)->withURL(...) + * (new MonitorsExtractTarget)->withInstructions(...)->withURL(...) * ``` */ public function __construct() @@ -93,19 +93,19 @@ public function __construct() * @param array|null $schema */ public static function with( + string $instructions, string $url, ?bool $followSubdomains = null, - ?string $instructions = null, ?int $maxDepth = null, ?int $maxPages = null, ?array $schema = null, ): self { $self = new self; + $self['instructions'] = $instructions; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; - null !== $instructions && $self['instructions'] = $instructions; null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $schema && $self['schema'] = $schema; @@ -113,6 +113,17 @@ public static function with( return $self; } + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * @param 'extract' $type */ @@ -143,17 +154,6 @@ public function withFollowSubdomains(bool $followSubdomains): self return $self; } - /** - * Optional natural-language instructions guiding what to extract. - */ - public function withInstructions(string $instructions): self - { - $self = clone $this; - $self['instructions'] = $instructions; - - return $self; - } - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php index e97261cb..a39d9153 100644 --- a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,10 +10,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes that match a natural language query. + * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ - * query: string, type: 'semantic', confidenceThreshold?: float|null + * type: 'semantic', confidenceThreshold?: float|null * } */ final class MonitorsSemanticChangeDetection implements BaseModel @@ -25,26 +25,9 @@ final class MonitorsSemanticChangeDetection implements BaseModel #[Required] public string $type = 'semantic'; - #[Required] - public string $query; - #[Optional('confidence_threshold')] public ?float $confidenceThreshold; - /** - * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSemanticChangeDetection::with(query: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSemanticChangeDetection)->withQuery(...) - * ``` - */ public function __construct() { $this->initialize(); @@ -55,27 +38,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - string $query, - ?float $confidenceThreshold = null - ): self { + public static function with(?float $confidenceThreshold = null): self + { $self = new self; - $self['query'] = $query; - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; return $self; } - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - /** * @param 'semantic' $type */ diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php index 61bb6ff7..29470c82 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php @@ -13,10 +13,10 @@ * Watch a site's extracted structured data. * * @phpstan-type MonitorsExtractTargetShape = array{ + * instructions: string, * type: 'extract', * url: string, * followSubdomains?: bool|null, - * instructions?: string|null, * maxDepth?: int|null, * maxPages?: int|null, * schema?: array|null, @@ -31,6 +31,12 @@ final class MonitorsExtractTarget implements BaseModel #[Required] public string $type = 'extract'; + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + #[Required] + public string $instructions; + /** * Root URL to extract structured data from. */ @@ -40,12 +46,6 @@ final class MonitorsExtractTarget implements BaseModel #[Optional('follow_subdomains')] public ?bool $followSubdomains; - /** - * Optional natural-language instructions guiding what to extract. - */ - #[Optional] - public ?string $instructions; - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ @@ -71,13 +71,13 @@ final class MonitorsExtractTarget implements BaseModel * * To enforce required parameters use * ``` - * MonitorsExtractTarget::with(url: ...) + * MonitorsExtractTarget::with(instructions: ..., url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorsExtractTarget)->withURL(...) + * (new MonitorsExtractTarget)->withInstructions(...)->withURL(...) * ``` */ public function __construct() @@ -93,19 +93,19 @@ public function __construct() * @param array|null $schema */ public static function with( + string $instructions, string $url, ?bool $followSubdomains = null, - ?string $instructions = null, ?int $maxDepth = null, ?int $maxPages = null, ?array $schema = null, ): self { $self = new self; + $self['instructions'] = $instructions; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; - null !== $instructions && $self['instructions'] = $instructions; null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $schema && $self['schema'] = $schema; @@ -113,6 +113,17 @@ public static function with( return $self; } + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * @param 'extract' $type */ @@ -143,17 +154,6 @@ public function withFollowSubdomains(bool $followSubdomains): self return $self; } - /** - * Optional natural-language instructions guiding what to extract. - */ - public function withInstructions(string $instructions): self - { - $self = clone $this; - $self['instructions'] = $instructions; - - return $self; - } - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index 99411714..bf2c5e8c 100644 --- a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,10 +10,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes that match a natural language query. + * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ - * query: string, type: 'semantic', confidenceThreshold?: float|null + * type: 'semantic', confidenceThreshold?: float|null * } */ final class MonitorsSemanticChangeDetection implements BaseModel @@ -25,26 +25,9 @@ final class MonitorsSemanticChangeDetection implements BaseModel #[Required] public string $type = 'semantic'; - #[Required] - public string $query; - #[Optional('confidence_threshold')] public ?float $confidenceThreshold; - /** - * `new MonitorsSemanticChangeDetection()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * MonitorsSemanticChangeDetection::with(query: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new MonitorsSemanticChangeDetection)->withQuery(...) - * ``` - */ public function __construct() { $this->initialize(); @@ -55,27 +38,15 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - string $query, - ?float $confidenceThreshold = null - ): self { + public static function with(?float $confidenceThreshold = null): self + { $self = new self; - $self['query'] = $query; - null !== $confidenceThreshold && $self['confidenceThreshold'] = $confidenceThreshold; return $self; } - public function withQuery(string $query): self - { - $self = clone $this; - $self['query'] = $query; - - return $self; - } - /** * @param 'semantic' $type */ diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php index ce54f243..81f3dce1 100644 --- a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php @@ -13,10 +13,10 @@ * Watch a site's extracted structured data. * * @phpstan-type MonitorsExtractTargetShape = array{ + * instructions: string, * type: 'extract', * url: string, * followSubdomains?: bool|null, - * instructions?: string|null, * maxDepth?: int|null, * maxPages?: int|null, * schema?: array|null, @@ -31,6 +31,12 @@ final class MonitorsExtractTarget implements BaseModel #[Required] public string $type = 'extract'; + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + #[Required] + public string $instructions; + /** * Root URL to extract structured data from. */ @@ -40,12 +46,6 @@ final class MonitorsExtractTarget implements BaseModel #[Optional('follow_subdomains')] public ?bool $followSubdomains; - /** - * Optional natural-language instructions guiding what to extract. - */ - #[Optional] - public ?string $instructions; - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ @@ -71,13 +71,13 @@ final class MonitorsExtractTarget implements BaseModel * * To enforce required parameters use * ``` - * MonitorsExtractTarget::with(url: ...) + * MonitorsExtractTarget::with(instructions: ..., url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorsExtractTarget)->withURL(...) + * (new MonitorsExtractTarget)->withInstructions(...)->withURL(...) * ``` */ public function __construct() @@ -93,19 +93,19 @@ public function __construct() * @param array|null $schema */ public static function with( + string $instructions, string $url, ?bool $followSubdomains = null, - ?string $instructions = null, ?int $maxDepth = null, ?int $maxPages = null, ?array $schema = null, ): self { $self = new self; + $self['instructions'] = $instructions; $self['url'] = $url; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; - null !== $instructions && $self['instructions'] = $instructions; null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $schema && $self['schema'] = $schema; @@ -113,6 +113,17 @@ public static function with( return $self; } + /** + * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * @param 'extract' $type */ @@ -143,17 +154,6 @@ public function withFollowSubdomains(bool $followSubdomains): self return $self; } - /** - * Optional natural-language instructions guiding what to extract. - */ - public function withInstructions(string $instructions): self - { - $self = clone $this; - $self['instructions'] = $instructions; - - return $self; - } - /** * Optional maximum link depth from the starting URL (0 = only the starting page). */ diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php index 516d8e3c..d18f9e9f 100644 --- a/src/ServiceContracts/MonitorsContract.php +++ b/src/ServiceContracts/MonitorsContract.php @@ -110,7 +110,7 @@ public function update( * * @param ChangeDetectionType|value-of $changeDetectionType * @param string $q free-text search term, matched against the fields named in `search_by` - * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. * @param string $tag filter to items that have this tag diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php index 571f0cb5..98cfc619 100644 --- a/src/Services/MonitorsService.php +++ b/src/Services/MonitorsService.php @@ -175,7 +175,7 @@ public function update( * * @param ChangeDetectionType|value-of $changeDetectionType * @param string $q free-text search term, matched against the fields named in `search_by` - * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `query` only exists on semantic monitors. + * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. * @param string $tag filter to items that have this tag From 9af4bdfe5ae6c773c12321e7c9eefeb0c4e5ef60 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 8 Jul 2026 01:35:23 +0000 Subject: [PATCH 035/130] feat(api): api update --- .stats.yml | 4 ++-- .../Target/MonitorsExtractTarget.php | 14 +++++++------- .../Target/MonitorsSitemapTarget.php | 2 +- .../Baseline/MonitorsExtractBaseline.php | 10 +++++----- .../Target/MonitorsExtractTarget.php | 14 +++++++------- .../Target/MonitorsSitemapTarget.php | 2 +- .../Data/Baseline/MonitorsExtractBaseline.php | 10 +++++----- .../Data/Target/MonitorsExtractTarget.php | 14 +++++++------- .../Data/Target/MonitorsSitemapTarget.php | 2 +- .../Baseline/MonitorsExtractBaseline.php | 10 +++++----- .../Target/MonitorsExtractTarget.php | 14 +++++++------- .../Target/MonitorsSitemapTarget.php | 2 +- .../Target/MonitorsExtractTarget.php | 14 +++++++------- .../Target/MonitorsSitemapTarget.php | 2 +- .../Baseline/MonitorsExtractBaseline.php | 10 +++++----- .../Target/MonitorsExtractTarget.php | 14 +++++++------- .../Target/MonitorsSitemapTarget.php | 2 +- 17 files changed, 70 insertions(+), 70 deletions(-) diff --git a/.stats.yml b/.stats.yml index 085d46dd..6b4e1c45 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b075e5704110b3c03bd81b41f62b836d7624eceed7feb0ac63720dec9a4cbba4.yml -openapi_spec_hash: 5efb926e6e99163e3e42a98986da8335 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-51ebe668b198157ccb18984017dd2fe35f7675220e8b933b03325b3c459ef2a6.yml +openapi_spec_hash: b3ed94bd6b59d4e32fc2c5aa8187d6b2 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php index 19771d30..15ded69f 100644 --- a/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a site's extracted structured data. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -32,7 +32,7 @@ final class MonitorsExtractTarget implements BaseModel public string $type = 'extract'; /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ #[Required] public string $instructions; @@ -53,13 +53,13 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxDepth; /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ #[Optional('max_pages')] public ?int $maxPages; /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -114,7 +114,7 @@ public static function with( } /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ public function withInstructions(string $instructions): self { @@ -166,7 +166,7 @@ public function withMaxDepth(int $maxDepth): self } /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ public function withMaxPages(int $maxPages): self { @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php index 92e7c01a..a16f4183 100644 --- a/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', diff --git a/src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php index c2a156f9..26fc8066 100644 --- a/src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php +++ b/src/Monitors/MonitorGetResponse/Baseline/MonitorsExtractBaseline.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current baseline of an `extract` monitor: the structured data as last extracted. + * Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. * * @phpstan-type MonitorsExtractBaselineShape = array{ * capturedAt: \DateTimeInterface, data: mixed, urlsAnalyzed: list @@ -27,13 +27,13 @@ final class MonitorsExtractBaseline implements BaseModel public \DateTimeInterface $capturedAt; /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ #[Required] public mixed $data; /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @var list $urlsAnalyzed */ @@ -95,7 +95,7 @@ public function withCapturedAt(\DateTimeInterface $capturedAt): self } /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ public function withData(mixed $data): self { @@ -106,7 +106,7 @@ public function withData(mixed $data): self } /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @param list $urlsAnalyzed */ diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php index 7d07f5f9..609f9c4a 100644 --- a/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a site's extracted structured data. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -32,7 +32,7 @@ final class MonitorsExtractTarget implements BaseModel public string $type = 'extract'; /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ #[Required] public string $instructions; @@ -53,13 +53,13 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxDepth; /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ #[Optional('max_pages')] public ?int $maxPages; /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -114,7 +114,7 @@ public static function with( } /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ public function withInstructions(string $instructions): self { @@ -166,7 +166,7 @@ public function withMaxDepth(int $maxDepth): self } /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ public function withMaxPages(int $maxPages): self { @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php index 4ae0fcac..28ee9ec6 100644 --- a/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', diff --git a/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php index 2fe3f414..4fd75ef0 100644 --- a/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php +++ b/src/Monitors/MonitorListResponse/Data/Baseline/MonitorsExtractBaseline.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current baseline of an `extract` monitor: the structured data as last extracted. + * Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. * * @phpstan-type MonitorsExtractBaselineShape = array{ * capturedAt: \DateTimeInterface, data: mixed, urlsAnalyzed: list @@ -27,13 +27,13 @@ final class MonitorsExtractBaseline implements BaseModel public \DateTimeInterface $capturedAt; /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ #[Required] public mixed $data; /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @var list $urlsAnalyzed */ @@ -95,7 +95,7 @@ public function withCapturedAt(\DateTimeInterface $capturedAt): self } /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ public function withData(mixed $data): self { @@ -106,7 +106,7 @@ public function withData(mixed $data): self } /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @param list $urlsAnalyzed */ diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php index b85aec47..a88be1a0 100644 --- a/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a site's extracted structured data. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -32,7 +32,7 @@ final class MonitorsExtractTarget implements BaseModel public string $type = 'extract'; /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ #[Required] public string $instructions; @@ -53,13 +53,13 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxDepth; /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ #[Optional('max_pages')] public ?int $maxPages; /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -114,7 +114,7 @@ public static function with( } /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ public function withInstructions(string $instructions): self { @@ -166,7 +166,7 @@ public function withMaxDepth(int $maxDepth): self } /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ public function withMaxPages(int $maxPages): self { @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php index 04a020f5..b16de60d 100644 --- a/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', diff --git a/src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php index 5e2e8b79..9ef584b2 100644 --- a/src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php +++ b/src/Monitors/MonitorNewResponse/Baseline/MonitorsExtractBaseline.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current baseline of an `extract` monitor: the structured data as last extracted. + * Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. * * @phpstan-type MonitorsExtractBaselineShape = array{ * capturedAt: \DateTimeInterface, data: mixed, urlsAnalyzed: list @@ -27,13 +27,13 @@ final class MonitorsExtractBaseline implements BaseModel public \DateTimeInterface $capturedAt; /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ #[Required] public mixed $data; /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @var list $urlsAnalyzed */ @@ -95,7 +95,7 @@ public function withCapturedAt(\DateTimeInterface $capturedAt): self } /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ public function withData(mixed $data): self { @@ -106,7 +106,7 @@ public function withData(mixed $data): self } /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @param list $urlsAnalyzed */ diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php index 41d41bcc..70d297c0 100644 --- a/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a site's extracted structured data. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -32,7 +32,7 @@ final class MonitorsExtractTarget implements BaseModel public string $type = 'extract'; /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ #[Required] public string $instructions; @@ -53,13 +53,13 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxDepth; /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ #[Optional('max_pages')] public ?int $maxPages; /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -114,7 +114,7 @@ public static function with( } /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ public function withInstructions(string $instructions): self { @@ -166,7 +166,7 @@ public function withMaxDepth(int $maxDepth): self } /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ public function withMaxPages(int $maxPages): self { @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php index bef89b16..f01e31ba 100644 --- a/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php index 29470c82..84e8ce21 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a site's extracted structured data. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -32,7 +32,7 @@ final class MonitorsExtractTarget implements BaseModel public string $type = 'extract'; /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ #[Required] public string $instructions; @@ -53,13 +53,13 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxDepth; /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ #[Optional('max_pages')] public ?int $maxPages; /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -114,7 +114,7 @@ public static function with( } /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ public function withInstructions(string $instructions): self { @@ -166,7 +166,7 @@ public function withMaxDepth(int $maxDepth): self } /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ public function withMaxPages(int $maxPages): self { @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php index d2e5441d..5da0cb21 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', diff --git a/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php index 86ae3084..ecc2c53b 100644 --- a/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php +++ b/src/Monitors/MonitorUpdateResponse/Baseline/MonitorsExtractBaseline.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current baseline of an `extract` monitor: the structured data as last extracted. + * Current baseline of an `extract` monitor: the pages it tracks and the structured data as last extracted. * * @phpstan-type MonitorsExtractBaselineShape = array{ * capturedAt: \DateTimeInterface, data: mixed, urlsAnalyzed: list @@ -27,13 +27,13 @@ final class MonitorsExtractBaseline implements BaseModel public \DateTimeInterface $capturedAt; /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ #[Required] public mixed $data; /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @var list $urlsAnalyzed */ @@ -95,7 +95,7 @@ public function withCapturedAt(\DateTimeInterface $capturedAt): self } /** - * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). + * The extracted structured data, matching the monitor's extraction schema (same shape as the /web/extract endpoint's `data`). Refreshed when the monitor re-discovers its page set (at most about once a day); `null` when no extraction has been captured yet. */ public function withData(mixed $data): self { @@ -106,7 +106,7 @@ public function withData(mixed $data): self } /** - * URLs that were analyzed to produce the extracted data. + * The page URLs the monitor tracks and analyzes for changes. * * @param list $urlsAnalyzed */ diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php index 81f3dce1..444d63d4 100644 --- a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a site's extracted structured data. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -32,7 +32,7 @@ final class MonitorsExtractTarget implements BaseModel public string $type = 'extract'; /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ #[Required] public string $instructions; @@ -53,13 +53,13 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxDepth; /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ #[Optional('max_pages')] public ?int $maxPages; /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -114,7 +114,7 @@ public static function with( } /** - * Natural-language instructions describing what to extract and watch. This single prompt scopes both the extraction and what changes get reported: only data captured by the schema and these instructions is compared between runs. + * Natural-language instructions guiding which pages and facts to track and which changes to report. */ public function withInstructions(string $instructions): self { @@ -166,7 +166,7 @@ public function withMaxDepth(int $maxDepth): self } /** - * Maximum number of pages to analyze during extraction. + * Maximum number of pages to track. */ public function withMaxPages(int $maxPages): self { @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the structured data to extract and watch for changes. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php index a02ae7f9..28a9b2f9 100644 --- a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. A new URL set must be observed on two consecutive runs before a change is reported, suppressing one-run crawl flaps. + * Watch a sitemap for URL additions and removals. Crawled URLs are normalized (lowercased host, no trailing slash/fragment) and scoped to the monitored site and its subdomains before comparison. On a detected difference the sitemap is re-fetched within the same run and only URLs both observations agree on are reported, suppressing transient crawl flaps. * * @phpstan-type MonitorsSitemapTargetShape = array{ * type: 'sitemap', From 488eb4c5d4a0e3442ffc9234cc68704e7a898200 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 00:33:23 +0000 Subject: [PATCH 036/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 65f558e7..656a2ef1 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.0.0" + ".": "2.1.0" } \ No newline at end of file diff --git a/README.md b/README.md index 817bc6bf..270911f1 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.0.0" +composer require "context-dev/context-dev-php 2.1.0" ``` diff --git a/src/Client.php b/src/Client.php index 1757c445..a8a0cc5d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -89,7 +89,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.0.0', + 'X-Stainless-Package-Version' => '2.1.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 7f441e39..e53c1a9a 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.0.0'; +const VERSION = '2.1.0'; // x-release-please-end From b54d40512023ff0a52838f3e36a4eda190468bd5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 16:48:02 +0000 Subject: [PATCH 037/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6b4e1c45..9768c4bd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-51ebe668b198157ccb18984017dd2fe35f7675220e8b933b03325b3c459ef2a6.yml -openapi_spec_hash: b3ed94bd6b59d4e32fc2c5aa8187d6b2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ea4f36d262d32250c0626d46b9df01e15fd17dec54928c712284693c8be487d2.yml +openapi_spec_hash: 33fe53c36120b880472d3743ba2bd898 config_hash: ff35e224e809656528c44163aa41bebd From e6f2b887f22dcf4aa717b1a01f3c25274a562462 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 9 Jul 2026 20:15:48 +0000 Subject: [PATCH 038/130] feat(api): api update --- .stats.yml | 4 ++-- .../ChangeDetection/MonitorsSemanticChangeDetection.php | 2 +- .../MonitorCreateParams/Target/MonitorsExtractTarget.php | 6 +++--- .../ChangeDetection/MonitorsSemanticChangeDetection.php | 2 +- .../MonitorGetResponse/Target/MonitorsExtractTarget.php | 6 +++--- .../ChangeDetection/MonitorsSemanticChangeDetection.php | 2 +- .../Data/Target/MonitorsExtractTarget.php | 6 +++--- .../ChangeDetection/MonitorsSemanticChangeDetection.php | 2 +- .../MonitorNewResponse/Target/MonitorsExtractTarget.php | 6 +++--- .../ChangeDetection/MonitorsSemanticChangeDetection.php | 2 +- .../MonitorUpdateParams/Target/MonitorsExtractTarget.php | 6 +++--- .../ChangeDetection/MonitorsSemanticChangeDetection.php | 2 +- .../MonitorUpdateResponse/Target/MonitorsExtractTarget.php | 6 +++--- 13 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9768c4bd..6343a8a8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ea4f36d262d32250c0626d46b9df01e15fd17dec54928c712284693c8be487d2.yml -openapi_spec_hash: 33fe53c36120b880472d3743ba2bd898 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-190c8939f11afec54c1c0303cb21e7164a350fb66c5fe8fb5ae970e809dfb066.yml +openapi_spec_hash: 65e3c8513e047a95bcf276b6f88045a6 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php index 27eaf065..2f32c230 100644 --- a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. + * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php index 15ded69f..5af2fceb 100644 --- a/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -59,7 +59,7 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxPages; /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index e4ead61c..1fe50cb2 100644 --- a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. + * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php index 609f9c4a..06cccd36 100644 --- a/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -59,7 +59,7 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxPages; /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php index 6859c141..bf1868d6 100644 --- a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. + * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php index a88be1a0..a7f6758a 100644 --- a/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -59,7 +59,7 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxPages; /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index 9b35b993..9ca859f0 100644 --- a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. + * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php index 70d297c0..7823afd9 100644 --- a/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -59,7 +59,7 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxPages; /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php index a39d9153..b25c4520 100644 --- a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. + * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php index 84e8ce21..1ba504a7 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -59,7 +59,7 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxPages; /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @param array $schema */ diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index bf2c5e8c..c1ccfc6c 100644 --- a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to the extracted data, ignoring cosmetic or paraphrase-only differences. What is watched is determined by the extract target's `schema` and `instructions`. + * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php index 444d63d4..3a5f52dc 100644 --- a/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsExtractTarget.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged against the monitor's instructions. The tracked page set is refreshed by a periodic re-discovery crawl. + * Watch the monitor-relevant pages of a site for meaningful changes. A crawl guided by `schema`/`instructions` selects up to `max_pages` relevant pages to track; each run re-checks exactly those pages, and confirmed content changes are judged for relevance against the monitor's `instructions` (and `schema`, when provided). The tracked page set is refreshed by a periodic re-discovery crawl. * * @phpstan-type MonitorsExtractTargetShape = array{ * instructions: string, @@ -59,7 +59,7 @@ final class MonitorsExtractTarget implements BaseModel public ?int $maxPages; /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @var array|null $schema */ @@ -177,7 +177,7 @@ public function withMaxPages(int $maxPages): self } /** - * JSON Schema describing the data you care about. It guides which pages are selected for tracking and gives the change judge context on what matters. If omitted, a default summary + key-points schema is used. + * JSON Schema describing the data you care about. It is used three ways: it guides which pages are selected for tracking, it gives the change judge extra context on which changes matter (alongside `instructions`), and it defines the shape of the baseline `data` snapshot on GET /monitors/{monitor_id} (refreshed at most about once a day). It is not a response format for changes: change events and webhook payloads always contain diffs, summaries, and evidence excerpts — never data in this schema's shape. If omitted, a default summary + key-points schema is used. * * @param array $schema */ From 7e12b6a130e1bfc153add196f098e43cae75d997 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 00:56:28 +0000 Subject: [PATCH 039/130] feat(api): api update --- .stats.yml | 4 +- .../MonitorListAccountRunsResponse/Data.php | 26 +++ .../Data/WebhookDelivery.php | 166 ++++++++++++++++++ .../Data/WebhookDelivery/Error.php | 74 ++++++++ .../Data/WebhookDelivery/Status.php | 19 ++ src/Monitors/MonitorListRunsResponse/Data.php | 26 +++ .../Data/WebhookDelivery.php | 166 ++++++++++++++++++ .../Data/WebhookDelivery/Error.php | 74 ++++++++ .../Data/WebhookDelivery/Status.php | 19 ++ 9 files changed, 572 insertions(+), 2 deletions(-) create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Status.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php diff --git a/.stats.yml b/.stats.yml index 6343a8a8..c2cc39a5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-190c8939f11afec54c1c0303cb21e7164a350fb66c5fe8fb5ae970e809dfb066.yml -openapi_spec_hash: 65e3c8513e047a95bcf276b6f88045a6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecb277557634e2f0838ea196e2b21f11924f65e133c7977e8c2e1a603b8df466.yml +openapi_spec_hash: 798ce4cb042389a1179bf9af6fc1173d config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data.php b/src/Monitors/MonitorListAccountRunsResponse/Data.php index 21281937..d363b543 100644 --- a/src/Monitors/MonitorListAccountRunsResponse/Data.php +++ b/src/Monitors/MonitorListAccountRunsResponse/Data.php @@ -14,9 +14,11 @@ use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\SkipReason; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Status; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\TargetType; +use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery; /** * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Error + * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery * * @phpstan-type DataShape = array{ * id: string, @@ -33,6 +35,7 @@ * error?: null|Error|ErrorShape, * skipReason?: null|SkipReason|value-of, * startedAt?: \DateTimeInterface|null, + * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ final class Data implements BaseModel @@ -105,6 +108,12 @@ final class Data implements BaseModel #[Optional('started_at', nullable: true)] public ?\DateTimeInterface $startedAt; + /** + * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + */ + #[Optional('webhook_delivery')] + public ?WebhookDelivery $webhookDelivery; + /** * `new Data()` is missing required properties by the API. * @@ -154,6 +163,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason + * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( string $id, @@ -170,6 +180,7 @@ public static function with( Error|array|null $error = null, SkipReason|string|null $skipReason = null, ?\DateTimeInterface $startedAt = null, + WebhookDelivery|array|null $webhookDelivery = null, ): self { $self = new self; @@ -188,6 +199,7 @@ public static function with( null !== $error && $self['error'] = $error; null !== $skipReason && $self['skipReason'] = $skipReason; null !== $startedAt && $self['startedAt'] = $startedAt; + null !== $webhookDelivery && $self['webhookDelivery'] = $webhookDelivery; return $self; } @@ -334,4 +346,18 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self return $self; } + + /** + * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * + * @param WebhookDelivery|WebhookDeliveryShape $webhookDelivery + */ + public function withWebhookDelivery( + WebhookDelivery|array $webhookDelivery + ): self { + $self = clone $this; + $self['webhookDelivery'] = $webhookDelivery; + + return $self; + } } diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php new file mode 100644 index 00000000..1d9ef109 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php @@ -0,0 +1,166 @@ +, + * } + */ +final class WebhookDelivery implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required('attempted_at')] + public \DateTimeInterface $attemptedAt; + + #[Required] + public ?Error $error; + + /** + * Identifier sent in the X-Context-Id header. + */ + #[Required('event_id')] + public string $eventID; + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $status + */ + #[Required( + enum: Status::class, + )] + public string $status; + + /** + * `new WebhookDelivery()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookDelivery::with( + * attemptedAt: ..., error: ..., eventID: ..., httpStatus: ..., status: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookDelivery) + * ->withAttemptedAt(...) + * ->withError(...) + * ->withEventID(...) + * ->withHTTPStatus(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Error|ErrorShape|null $error + * @param Status|value-of $status + */ + public static function with( + \DateTimeInterface $attemptedAt, + Error|array|null $error, + string $eventID, + ?int $httpStatus, + Status|string $status, + ): self { + $self = new self; + + $self['attemptedAt'] = $attemptedAt; + $self['error'] = $error; + $self['eventID'] = $eventID; + $self['httpStatus'] = $httpStatus; + $self['status'] = $status; + + return $self; + } + + public function withAttemptedAt(\DateTimeInterface $attemptedAt): self + { + $self = clone $this; + $self['attemptedAt'] = $attemptedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError( + Error|array|null $error, + ): self { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * Identifier sent in the X-Context-Id header. + */ + public function withEventID(string $eventID): self + { + $self = clone $this; + $self['eventID'] = $eventID; + + return $self; + } + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status, + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php new file mode 100644 index 00000000..951e5b2c --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Status.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Status.php new file mode 100644 index 00000000..a456d903 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Status.php @@ -0,0 +1,19 @@ +, * startedAt?: \DateTimeInterface|null, + * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ final class Data implements BaseModel @@ -105,6 +108,12 @@ final class Data implements BaseModel #[Optional('started_at', nullable: true)] public ?\DateTimeInterface $startedAt; + /** + * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + */ + #[Optional('webhook_delivery')] + public ?WebhookDelivery $webhookDelivery; + /** * `new Data()` is missing required properties by the API. * @@ -154,6 +163,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason + * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( string $id, @@ -170,6 +180,7 @@ public static function with( Error|array|null $error = null, SkipReason|string|null $skipReason = null, ?\DateTimeInterface $startedAt = null, + WebhookDelivery|array|null $webhookDelivery = null, ): self { $self = new self; @@ -188,6 +199,7 @@ public static function with( null !== $error && $self['error'] = $error; null !== $skipReason && $self['skipReason'] = $skipReason; null !== $startedAt && $self['startedAt'] = $startedAt; + null !== $webhookDelivery && $self['webhookDelivery'] = $webhookDelivery; return $self; } @@ -334,4 +346,18 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self return $self; } + + /** + * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * + * @param WebhookDelivery|WebhookDeliveryShape $webhookDelivery + */ + public function withWebhookDelivery( + WebhookDelivery|array $webhookDelivery + ): self { + $self = clone $this; + $self['webhookDelivery'] = $webhookDelivery; + + return $self; + } } diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php new file mode 100644 index 00000000..61c99886 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php @@ -0,0 +1,166 @@ +, + * } + */ +final class WebhookDelivery implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required('attempted_at')] + public \DateTimeInterface $attemptedAt; + + #[Required] + public ?Error $error; + + /** + * Identifier sent in the X-Context-Id header. + */ + #[Required('event_id')] + public string $eventID; + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $status + */ + #[Required( + enum: Status::class, + )] + public string $status; + + /** + * `new WebhookDelivery()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookDelivery::with( + * attemptedAt: ..., error: ..., eventID: ..., httpStatus: ..., status: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookDelivery) + * ->withAttemptedAt(...) + * ->withError(...) + * ->withEventID(...) + * ->withHTTPStatus(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Error|ErrorShape|null $error + * @param Status|value-of $status + */ + public static function with( + \DateTimeInterface $attemptedAt, + Error|array|null $error, + string $eventID, + ?int $httpStatus, + Status|string $status, + ): self { + $self = new self; + + $self['attemptedAt'] = $attemptedAt; + $self['error'] = $error; + $self['eventID'] = $eventID; + $self['httpStatus'] = $httpStatus; + $self['status'] = $status; + + return $self; + } + + public function withAttemptedAt(\DateTimeInterface $attemptedAt): self + { + $self = clone $this; + $self['attemptedAt'] = $attemptedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError( + Error|array|null $error, + ): self { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * Identifier sent in the X-Context-Id header. + */ + public function withEventID(string $eventID): self + { + $self = clone $this; + $self['eventID'] = $eventID; + + return $self; + } + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status, + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php new file mode 100644 index 00000000..16f73bed --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php new file mode 100644 index 00000000..af5edb34 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php @@ -0,0 +1,19 @@ + Date: Fri, 10 Jul 2026 01:02:12 +0000 Subject: [PATCH 040/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 656a2ef1..bfc26f9c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.1.0" + ".": "2.2.0" } \ No newline at end of file diff --git a/README.md b/README.md index 270911f1..a58ebc2e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.1.0" +composer require "context-dev/context-dev-php 2.2.0" ``` diff --git a/src/Client.php b/src/Client.php index a8a0cc5d..338af118 100644 --- a/src/Client.php +++ b/src/Client.php @@ -89,7 +89,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.1.0', + 'X-Stainless-Package-Version' => '2.2.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index e53c1a9a..d5e2aac8 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.1.0'; +const VERSION = '2.2.0'; // x-release-please-end From 9ade046cc5c455812daeab02a85db37ab8fe7e12 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 03:45:41 +0000 Subject: [PATCH 041/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index c2cc39a5..6f63fc82 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecb277557634e2f0838ea196e2b21f11924f65e133c7977e8c2e1a603b8df466.yml -openapi_spec_hash: 798ce4cb042389a1179bf9af6fc1173d +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-de547897d4a30447212ce36430a932cf186efd91844bd8ea0757a1cde4ce40e1.yml +openapi_spec_hash: efa1b29865560c7817495b20c1b62fad config_hash: ff35e224e809656528c44163aa41bebd From faf56e91507ef13bbe93588e8c483fc8e39cb9d0 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 10 Jul 2026 23:21:57 +0000 Subject: [PATCH 042/130] feat(api): api update --- .stats.yml | 4 +- src/Monitors/MonitorGetChangeResponse.php | 54 ++++++++++++----------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6f63fc82..a9bd7b9c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-de547897d4a30447212ce36430a932cf186efd91844bd8ea0757a1cde4ce40e1.yml -openapi_spec_hash: efa1b29865560c7817495b20c1b62fad +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e3b1fd2a6aecb6cac87a0a2f4f811dedc261ae162cceced0841b5184ba609308.yml +openapi_spec_hash: 28e4c0d0599e1f7153838a465f9cf5b5 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorGetChangeResponse.php b/src/Monitors/MonitorGetChangeResponse.php index bc39e1a0..a73cf033 100644 --- a/src/Monitors/MonitorGetChangeResponse.php +++ b/src/Monitors/MonitorGetChangeResponse.php @@ -15,7 +15,7 @@ use ContextDev\Monitors\MonitorGetChangeResponse\TargetType; /** - * A detected change. `mode` is the constant `web`; `target_type` and `change_detection_type` describe the change, and which optional fields are present depends on them (page: `diff` + excerpts; sitemap: `added_urls`/`removed_urls`; semantic: `query`/`confidence`/`importance`/`evidence`/`matched_urls`). + * A detected change. `mode` is the constant `web`; `target_type` and `change_detection_type` describe the change, and which optional fields are present depends on them (page: `diff` + excerpts; sitemap: `added_urls`/`removed_urls`; semantic: `confidence`/`importance`/`evidence`/`matched_urls`). * * @phpstan-import-type EvidenceShape from \ContextDev\Monitors\MonitorGetChangeResponse\Evidence * @@ -27,6 +27,7 @@ * monitorID: string, * runID: string, * summary: string, + * tags: list, * targetType: TargetType|value-of, * title: string, * url: string, @@ -42,7 +43,6 @@ * matchedURLs?: list|null, * removedURLCount?: int|null, * removedURLs?: list|null, - * tags?: list|null, * } */ final class MonitorGetChangeResponse implements BaseModel @@ -80,6 +80,14 @@ final class MonitorGetChangeResponse implements BaseModel #[Required] public string $summary; + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @var list $tags + */ + #[Required(list: 'string')] + public array $tags; + /** @var value-of $targetType */ #[Required('target_type', enum: TargetType::class)] public string $targetType; @@ -146,14 +154,6 @@ final class MonitorGetChangeResponse implements BaseModel #[Optional('removed_urls', list: 'string')] public ?array $removedURLs; - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - /** * `new MonitorGetChangeResponse()` is missing required properties by the API. * @@ -167,6 +167,7 @@ final class MonitorGetChangeResponse implements BaseModel * monitorID: ..., * runID: ..., * summary: ..., + * tags: ..., * targetType: ..., * title: ..., * url: ..., @@ -184,6 +185,7 @@ final class MonitorGetChangeResponse implements BaseModel * ->withMonitorID(...) * ->withRunID(...) * ->withSummary(...) + * ->withTags(...) * ->withTargetType(...) * ->withTitle(...) * ->withURL(...) @@ -201,13 +203,13 @@ public function __construct() * * @param ChangeDetectionType|value-of $changeDetectionType * @param Mode|value-of $mode + * @param list $tags * @param TargetType|value-of $targetType * @param list|null $addedURLs * @param list|null $evidence * @param Importance|value-of|null $importance * @param list|null $matchedURLs * @param list|null $removedURLs - * @param list|null $tags */ public static function with( string $id, @@ -217,6 +219,7 @@ public static function with( string $monitorID, string $runID, string $summary, + array $tags, TargetType|string $targetType, string $title, string $url, @@ -232,7 +235,6 @@ public static function with( ?array $matchedURLs = null, ?int $removedURLCount = null, ?array $removedURLs = null, - ?array $tags = null, ): self { $self = new self; @@ -243,6 +245,7 @@ public static function with( $self['monitorID'] = $monitorID; $self['runID'] = $runID; $self['summary'] = $summary; + $self['tags'] = $tags; $self['targetType'] = $targetType; $self['title'] = $title; $self['url'] = $url; @@ -259,7 +262,6 @@ public static function with( null !== $matchedURLs && $self['matchedURLs'] = $matchedURLs; null !== $removedURLCount && $self['removedURLCount'] = $removedURLCount; null !== $removedURLs && $self['removedURLs'] = $removedURLs; - null !== $tags && $self['tags'] = $tags; return $self; } @@ -332,6 +334,19 @@ public function withSummary(string $summary): self return $self; } + /** + * User-defined tags for grouping and filtering monitors and their changes. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * @param TargetType|value-of $targetType */ @@ -478,17 +493,4 @@ public function withRemovedURLs(array $removedURLs): self return $self; } - - /** - * User-defined tags for grouping and filtering monitors and their changes. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } } From c57c3afb2a1d3df03c96262ff6ea9a127a2bdb55 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 02:22:27 +0000 Subject: [PATCH 043/130] feat(api): api update --- .stats.yml | 4 +- src/Monitors/MonitorGetResponse.php | 26 ++++ .../MonitorGetResponse/WebhookFailure.php | 140 ++++++++++++++++++ .../WebhookFailure/LastStatus.php | 17 +++ src/Monitors/MonitorListResponse/Data.php | 26 ++++ .../Data/WebhookFailure.php | 140 ++++++++++++++++++ .../Data/WebhookFailure/LastStatus.php | 17 +++ src/Monitors/MonitorNewResponse.php | 26 ++++ .../MonitorNewResponse/WebhookFailure.php | 140 ++++++++++++++++++ .../WebhookFailure/LastStatus.php | 17 +++ src/Monitors/MonitorUpdateResponse.php | 26 ++++ .../MonitorUpdateResponse/WebhookFailure.php | 140 ++++++++++++++++++ .../WebhookFailure/LastStatus.php | 17 +++ 13 files changed, 734 insertions(+), 2 deletions(-) create mode 100644 src/Monitors/MonitorGetResponse/WebhookFailure.php create mode 100644 src/Monitors/MonitorGetResponse/WebhookFailure/LastStatus.php create mode 100644 src/Monitors/MonitorListResponse/Data/WebhookFailure.php create mode 100644 src/Monitors/MonitorListResponse/Data/WebhookFailure/LastStatus.php create mode 100644 src/Monitors/MonitorNewResponse/WebhookFailure.php create mode 100644 src/Monitors/MonitorNewResponse/WebhookFailure/LastStatus.php create mode 100644 src/Monitors/MonitorUpdateResponse/WebhookFailure.php create mode 100644 src/Monitors/MonitorUpdateResponse/WebhookFailure/LastStatus.php diff --git a/.stats.yml b/.stats.yml index a9bd7b9c..c1de7fe8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e3b1fd2a6aecb6cac87a0a2f4f811dedc261ae162cceced0841b5184ba609308.yml -openapi_spec_hash: 28e4c0d0599e1f7153838a465f9cf5b5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d60fed3d26479d1ee76b77df8415390504542522e7188792a23bf77b9f37ed63.yml +openapi_spec_hash: 263672c59d9b01c50f7d2307fbd82ec0 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorGetResponse.php b/src/Monitors/MonitorGetResponse.php index c0a3e511..63221624 100644 --- a/src/Monitors/MonitorGetResponse.php +++ b/src/Monitors/MonitorGetResponse.php @@ -23,6 +23,7 @@ use ContextDev\Monitors\MonitorGetResponse\Target\MonitorsPageTarget; use ContextDev\Monitors\MonitorGetResponse\Target\MonitorsSitemapTarget; use ContextDev\Monitors\MonitorGetResponse\Webhook; +use ContextDev\Monitors\MonitorGetResponse\WebhookFailure; /** * A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic). @@ -36,6 +37,7 @@ * @phpstan-import-type BaselineShape from \ContextDev\Monitors\MonitorGetResponse\Baseline * @phpstan-import-type LastErrorShape from \ContextDev\Monitors\MonitorGetResponse\LastError * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorGetResponse\Webhook + * @phpstan-import-type WebhookFailureShape from \ContextDev\Monitors\MonitorGetResponse\WebhookFailure * * @phpstan-type MonitorGetResponseShape = array{ * id: string, @@ -54,6 +56,7 @@ * nextRunAt?: \DateTimeInterface|null, * tags?: list|null, * webhook?: null|Webhook|WebhookShape, + * webhookFailure?: null|WebhookFailure|WebhookFailureShape, * } */ final class MonitorGetResponse implements BaseModel @@ -148,6 +151,12 @@ final class MonitorGetResponse implements BaseModel #[Optional(nullable: true)] public ?Webhook $webhook; + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + */ + #[Optional('webhook_failure', nullable: true)] + public ?WebhookFailure $webhookFailure; + /** * `new MonitorGetResponse()` is missing required properties by the API. * @@ -200,6 +209,7 @@ public function __construct() * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure */ public static function with( string $id, @@ -218,6 +228,7 @@ public static function with( ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, + WebhookFailure|array|null $webhookFailure = null, ): self { $self = new self; @@ -238,6 +249,7 @@ public static function with( null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; + null !== $webhookFailure && $self['webhookFailure'] = $webhookFailure; return $self; } @@ -418,4 +430,18 @@ public function withWebhook(Webhook|array|null $webhook): self return $self; } + + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + * + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure + */ + public function withWebhookFailure( + WebhookFailure|array|null $webhookFailure + ): self { + $self = clone $this; + $self['webhookFailure'] = $webhookFailure; + + return $self; + } } diff --git a/src/Monitors/MonitorGetResponse/WebhookFailure.php b/src/Monitors/MonitorGetResponse/WebhookFailure.php new file mode 100644 index 00000000..8813cf3b --- /dev/null +++ b/src/Monitors/MonitorGetResponse/WebhookFailure.php @@ -0,0 +1,140 @@ +, + * } + */ +final class WebhookFailure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + #[Required('consecutive_failures')] + public int $consecutiveFailures; + + #[Required('last_failed_at')] + public \DateTimeInterface $lastFailedAt; + + /** + * Human-readable description of the most recent failure. + */ + #[Required('last_message')] + public string $lastMessage; + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $lastStatus + */ + #[Required('last_status', enum: LastStatus::class)] + public string $lastStatus; + + /** + * `new WebhookFailure()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookFailure::with( + * consecutiveFailures: ..., lastFailedAt: ..., lastMessage: ..., lastStatus: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookFailure) + * ->withConsecutiveFailures(...) + * ->withLastFailedAt(...) + * ->withLastMessage(...) + * ->withLastStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param LastStatus|value-of $lastStatus + */ + public static function with( + int $consecutiveFailures, + \DateTimeInterface $lastFailedAt, + string $lastMessage, + LastStatus|string $lastStatus, + ): self { + $self = new self; + + $self['consecutiveFailures'] = $consecutiveFailures; + $self['lastFailedAt'] = $lastFailedAt; + $self['lastMessage'] = $lastMessage; + $self['lastStatus'] = $lastStatus; + + return $self; + } + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + public function withConsecutiveFailures(int $consecutiveFailures): self + { + $self = clone $this; + $self['consecutiveFailures'] = $consecutiveFailures; + + return $self; + } + + public function withLastFailedAt(\DateTimeInterface $lastFailedAt): self + { + $self = clone $this; + $self['lastFailedAt'] = $lastFailedAt; + + return $self; + } + + /** + * Human-readable description of the most recent failure. + */ + public function withLastMessage(string $lastMessage): self + { + $self = clone $this; + $self['lastMessage'] = $lastMessage; + + return $self; + } + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param LastStatus|value-of $lastStatus + */ + public function withLastStatus(LastStatus|string $lastStatus): self + { + $self = clone $this; + $self['lastStatus'] = $lastStatus; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetResponse/WebhookFailure/LastStatus.php b/src/Monitors/MonitorGetResponse/WebhookFailure/LastStatus.php new file mode 100644 index 00000000..174e083e --- /dev/null +++ b/src/Monitors/MonitorGetResponse/WebhookFailure/LastStatus.php @@ -0,0 +1,17 @@ +|null, * webhook?: null|Webhook|WebhookShape, + * webhookFailure?: null|WebhookFailure|WebhookFailureShape, * } */ final class Data implements BaseModel @@ -148,6 +151,12 @@ final class Data implements BaseModel #[Optional(nullable: true)] public ?Webhook $webhook; + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + */ + #[Optional('webhook_failure', nullable: true)] + public ?WebhookFailure $webhookFailure; + /** * `new Data()` is missing required properties by the API. * @@ -200,6 +209,7 @@ public function __construct() * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure */ public static function with( string $id, @@ -218,6 +228,7 @@ public static function with( ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, + WebhookFailure|array|null $webhookFailure = null, ): self { $self = new self; @@ -238,6 +249,7 @@ public static function with( null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; + null !== $webhookFailure && $self['webhookFailure'] = $webhookFailure; return $self; } @@ -418,4 +430,18 @@ public function withWebhook(Webhook|array|null $webhook): self return $self; } + + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + * + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure + */ + public function withWebhookFailure( + WebhookFailure|array|null $webhookFailure + ): self { + $self = clone $this; + $self['webhookFailure'] = $webhookFailure; + + return $self; + } } diff --git a/src/Monitors/MonitorListResponse/Data/WebhookFailure.php b/src/Monitors/MonitorListResponse/Data/WebhookFailure.php new file mode 100644 index 00000000..13683823 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/WebhookFailure.php @@ -0,0 +1,140 @@ +, + * } + */ +final class WebhookFailure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + #[Required('consecutive_failures')] + public int $consecutiveFailures; + + #[Required('last_failed_at')] + public \DateTimeInterface $lastFailedAt; + + /** + * Human-readable description of the most recent failure. + */ + #[Required('last_message')] + public string $lastMessage; + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $lastStatus + */ + #[Required('last_status', enum: LastStatus::class)] + public string $lastStatus; + + /** + * `new WebhookFailure()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookFailure::with( + * consecutiveFailures: ..., lastFailedAt: ..., lastMessage: ..., lastStatus: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookFailure) + * ->withConsecutiveFailures(...) + * ->withLastFailedAt(...) + * ->withLastMessage(...) + * ->withLastStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param LastStatus|value-of $lastStatus + */ + public static function with( + int $consecutiveFailures, + \DateTimeInterface $lastFailedAt, + string $lastMessage, + LastStatus|string $lastStatus, + ): self { + $self = new self; + + $self['consecutiveFailures'] = $consecutiveFailures; + $self['lastFailedAt'] = $lastFailedAt; + $self['lastMessage'] = $lastMessage; + $self['lastStatus'] = $lastStatus; + + return $self; + } + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + public function withConsecutiveFailures(int $consecutiveFailures): self + { + $self = clone $this; + $self['consecutiveFailures'] = $consecutiveFailures; + + return $self; + } + + public function withLastFailedAt(\DateTimeInterface $lastFailedAt): self + { + $self = clone $this; + $self['lastFailedAt'] = $lastFailedAt; + + return $self; + } + + /** + * Human-readable description of the most recent failure. + */ + public function withLastMessage(string $lastMessage): self + { + $self = clone $this; + $self['lastMessage'] = $lastMessage; + + return $self; + } + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param LastStatus|value-of $lastStatus + */ + public function withLastStatus(LastStatus|string $lastStatus): self + { + $self = clone $this; + $self['lastStatus'] = $lastStatus; + + return $self; + } +} diff --git a/src/Monitors/MonitorListResponse/Data/WebhookFailure/LastStatus.php b/src/Monitors/MonitorListResponse/Data/WebhookFailure/LastStatus.php new file mode 100644 index 00000000..d8bccf18 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/WebhookFailure/LastStatus.php @@ -0,0 +1,17 @@ +|null, * webhook?: null|Webhook|WebhookShape, + * webhookFailure?: null|WebhookFailure|WebhookFailureShape, * } */ final class MonitorNewResponse implements BaseModel @@ -148,6 +151,12 @@ final class MonitorNewResponse implements BaseModel #[Optional(nullable: true)] public ?Webhook $webhook; + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + */ + #[Optional('webhook_failure', nullable: true)] + public ?WebhookFailure $webhookFailure; + /** * `new MonitorNewResponse()` is missing required properties by the API. * @@ -200,6 +209,7 @@ public function __construct() * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure */ public static function with( string $id, @@ -218,6 +228,7 @@ public static function with( ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, + WebhookFailure|array|null $webhookFailure = null, ): self { $self = new self; @@ -238,6 +249,7 @@ public static function with( null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; + null !== $webhookFailure && $self['webhookFailure'] = $webhookFailure; return $self; } @@ -418,4 +430,18 @@ public function withWebhook(Webhook|array|null $webhook): self return $self; } + + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + * + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure + */ + public function withWebhookFailure( + WebhookFailure|array|null $webhookFailure + ): self { + $self = clone $this; + $self['webhookFailure'] = $webhookFailure; + + return $self; + } } diff --git a/src/Monitors/MonitorNewResponse/WebhookFailure.php b/src/Monitors/MonitorNewResponse/WebhookFailure.php new file mode 100644 index 00000000..279e0998 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/WebhookFailure.php @@ -0,0 +1,140 @@ +, + * } + */ +final class WebhookFailure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + #[Required('consecutive_failures')] + public int $consecutiveFailures; + + #[Required('last_failed_at')] + public \DateTimeInterface $lastFailedAt; + + /** + * Human-readable description of the most recent failure. + */ + #[Required('last_message')] + public string $lastMessage; + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $lastStatus + */ + #[Required('last_status', enum: LastStatus::class)] + public string $lastStatus; + + /** + * `new WebhookFailure()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookFailure::with( + * consecutiveFailures: ..., lastFailedAt: ..., lastMessage: ..., lastStatus: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookFailure) + * ->withConsecutiveFailures(...) + * ->withLastFailedAt(...) + * ->withLastMessage(...) + * ->withLastStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param LastStatus|value-of $lastStatus + */ + public static function with( + int $consecutiveFailures, + \DateTimeInterface $lastFailedAt, + string $lastMessage, + LastStatus|string $lastStatus, + ): self { + $self = new self; + + $self['consecutiveFailures'] = $consecutiveFailures; + $self['lastFailedAt'] = $lastFailedAt; + $self['lastMessage'] = $lastMessage; + $self['lastStatus'] = $lastStatus; + + return $self; + } + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + public function withConsecutiveFailures(int $consecutiveFailures): self + { + $self = clone $this; + $self['consecutiveFailures'] = $consecutiveFailures; + + return $self; + } + + public function withLastFailedAt(\DateTimeInterface $lastFailedAt): self + { + $self = clone $this; + $self['lastFailedAt'] = $lastFailedAt; + + return $self; + } + + /** + * Human-readable description of the most recent failure. + */ + public function withLastMessage(string $lastMessage): self + { + $self = clone $this; + $self['lastMessage'] = $lastMessage; + + return $self; + } + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param LastStatus|value-of $lastStatus + */ + public function withLastStatus(LastStatus|string $lastStatus): self + { + $self = clone $this; + $self['lastStatus'] = $lastStatus; + + return $self; + } +} diff --git a/src/Monitors/MonitorNewResponse/WebhookFailure/LastStatus.php b/src/Monitors/MonitorNewResponse/WebhookFailure/LastStatus.php new file mode 100644 index 00000000..94eab094 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/WebhookFailure/LastStatus.php @@ -0,0 +1,17 @@ +|null, * webhook?: null|Webhook|WebhookShape, + * webhookFailure?: null|WebhookFailure|WebhookFailureShape, * } */ final class MonitorUpdateResponse implements BaseModel @@ -148,6 +151,12 @@ final class MonitorUpdateResponse implements BaseModel #[Optional(nullable: true)] public ?Webhook $webhook; + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + */ + #[Optional('webhook_failure', nullable: true)] + public ?WebhookFailure $webhookFailure; + /** * `new MonitorUpdateResponse()` is missing required properties by the API. * @@ -200,6 +209,7 @@ public function __construct() * @param LastError|LastErrorShape|null $lastError * @param list|null $tags * @param Webhook|WebhookShape|null $webhook + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure */ public static function with( string $id, @@ -218,6 +228,7 @@ public static function with( ?\DateTimeInterface $nextRunAt = null, ?array $tags = null, Webhook|array|null $webhook = null, + WebhookFailure|array|null $webhookFailure = null, ): self { $self = new self; @@ -238,6 +249,7 @@ public static function with( null !== $nextRunAt && $self['nextRunAt'] = $nextRunAt; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; + null !== $webhookFailure && $self['webhookFailure'] = $webhookFailure; return $self; } @@ -418,4 +430,18 @@ public function withWebhook(Webhook|array|null $webhook): self return $self; } + + /** + * Present while webhook deliveries are failing consecutively; null when deliveries are healthy or no webhook is configured. Cleared on the next successful delivery and when the webhook URL changes. + * + * @param WebhookFailure|WebhookFailureShape|null $webhookFailure + */ + public function withWebhookFailure( + WebhookFailure|array|null $webhookFailure + ): self { + $self = clone $this; + $self['webhookFailure'] = $webhookFailure; + + return $self; + } } diff --git a/src/Monitors/MonitorUpdateResponse/WebhookFailure.php b/src/Monitors/MonitorUpdateResponse/WebhookFailure.php new file mode 100644 index 00000000..9506353d --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/WebhookFailure.php @@ -0,0 +1,140 @@ +, + * } + */ +final class WebhookFailure implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + #[Required('consecutive_failures')] + public int $consecutiveFailures; + + #[Required('last_failed_at')] + public \DateTimeInterface $lastFailedAt; + + /** + * Human-readable description of the most recent failure. + */ + #[Required('last_message')] + public string $lastMessage; + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $lastStatus + */ + #[Required('last_status', enum: LastStatus::class)] + public string $lastStatus; + + /** + * `new WebhookFailure()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookFailure::with( + * consecutiveFailures: ..., lastFailedAt: ..., lastMessage: ..., lastStatus: ... + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookFailure) + * ->withConsecutiveFailures(...) + * ->withLastFailedAt(...) + * ->withLastMessage(...) + * ->withLastStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param LastStatus|value-of $lastStatus + */ + public static function with( + int $consecutiveFailures, + \DateTimeInterface $lastFailedAt, + string $lastMessage, + LastStatus|string $lastStatus, + ): self { + $self = new self; + + $self['consecutiveFailures'] = $consecutiveFailures; + $self['lastFailedAt'] = $lastFailedAt; + $self['lastMessage'] = $lastMessage; + $self['lastStatus'] = $lastStatus; + + return $self; + } + + /** + * Number of consecutive delivery attempts that did not succeed. + */ + public function withConsecutiveFailures(int $consecutiveFailures): self + { + $self = clone $this; + $self['consecutiveFailures'] = $consecutiveFailures; + + return $self; + } + + public function withLastFailedAt(\DateTimeInterface $lastFailedAt): self + { + $self = clone $this; + $self['lastFailedAt'] = $lastFailedAt; + + return $self; + } + + /** + * Human-readable description of the most recent failure. + */ + public function withLastMessage(string $lastMessage): self + { + $self = clone $this; + $self['lastMessage'] = $lastMessage; + + return $self; + } + + /** + * Outcome of the most recent failed delivery. rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param LastStatus|value-of $lastStatus + */ + public function withLastStatus(LastStatus|string $lastStatus): self + { + $self = clone $this; + $self['lastStatus'] = $lastStatus; + + return $self; + } +} diff --git a/src/Monitors/MonitorUpdateResponse/WebhookFailure/LastStatus.php b/src/Monitors/MonitorUpdateResponse/WebhookFailure/LastStatus.php new file mode 100644 index 00000000..ae1ad1fb --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/WebhookFailure/LastStatus.php @@ -0,0 +1,17 @@ + Date: Sat, 11 Jul 2026 22:00:32 +0000 Subject: [PATCH 044/130] feat(api): api update --- .stats.yml | 4 ++-- src/Services/WebRawService.php | 15 ++++++++++++++- src/Services/WebService.php | 15 ++++++++++++++- src/Web/WebWebScrapeMdParams.php | 15 ++++++++++++++- src/Web/WebWebScrapeMdResponse.php | 23 ++++++++++++++++++++++- 5 files changed, 66 insertions(+), 6 deletions(-) diff --git a/.stats.yml b/.stats.yml index c1de7fe8..a5e78070 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d60fed3d26479d1ee76b77df8415390504542522e7188792a23bf77b9f37ed63.yml -openapi_spec_hash: 263672c59d9b01c50f7d2307fbd82ec0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-adab8df19dce27396e4a0e698287f083e1f932e63b85fd8dd4d54f80f0e0b5a8.yml +openapi_spec_hash: 717fea46f446ff97bad627f200963fd7 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 94f84b7f..a7eec12a 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -440,7 +440,20 @@ public function webScrapeImages( /** * @api * - * Scrapes the given URL into LLM usable Markdown. + * Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON responses from a recognized API key; use error_code to distinguish stable failure categories. + * + * ### Billing & errors + * + * | HTTP status | Billed? | Meaning | + * | --- | --- | --- | + * | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing | + * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | + * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | + * | 404 | No | Target page returned or fingerprinted as not found | + * | 408 | No | Request timed out | + * | 415 | No | Unsupported content type | + * | 429 | No | Per-minute rate limit exceeded; honor Retry-After | + * | 500 | No | Internal error | * * @param array{ * url: string, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 0ac922ce..269de97d 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -522,7 +522,20 @@ public function webScrapeImages( /** * @api * - * Scrapes the given URL into LLM usable Markdown. + * Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON responses from a recognized API key; use error_code to distinguish stable failure categories. + * + * ### Billing & errors + * + * | HTTP status | Billed? | Meaning | + * | --- | --- | --- | + * | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing | + * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | + * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | + * | 404 | No | Target page returned or fingerprinted as not found | + * | 408 | No | Request timed out | + * | 415 | No | Unsupported content type | + * | 429 | No | Per-minute rate limit exceeded; honor Retry-After | + * | 500 | No | Internal error | * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index 5b36e1ef..c1e95632 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -13,7 +13,20 @@ use ContextDev\Web\WebWebScrapeMdParams\Pdf; /** - * Scrapes the given URL into LLM usable Markdown. + * Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON responses from a recognized API key; use error_code to distinguish stable failure categories. + * + * ### Billing & errors + * + * | HTTP status | Billed? | Meaning | + * | --- | --- | --- | + * | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing | + * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | + * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | + * | 404 | No | Target page returned or fingerprinted as not found | + * | 408 | No | Request timed out | + * | 415 | No | Unsupported content type | + * | 429 | No | Per-minute rate limit exceeded; honor Retry-After | + * | 500 | No | Internal error | * * @see ContextDev\Services\WebService::webScrapeMd() * diff --git a/src/Web/WebWebScrapeMdResponse.php b/src/Web/WebWebScrapeMdResponse.php index 89e65b9c..b9b975cf 100644 --- a/src/Web/WebWebScrapeMdResponse.php +++ b/src/Web/WebWebScrapeMdResponse.php @@ -16,6 +16,7 @@ * @phpstan-import-type KeyMetadataShape from \ContextDev\Web\WebWebScrapeMdResponse\KeyMetadata * * @phpstan-type WebWebScrapeMdResponseShape = array{ + * contentLength: int, * markdown: string, * metadata: Metadata|MetadataShape, * success: bool, @@ -28,6 +29,12 @@ final class WebWebScrapeMdResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result and compare small values against your workload's minimum useful-content threshold. + */ + #[Required] + public int $contentLength; + /** * Page content converted to GitHub Flavored Markdown. */ @@ -64,7 +71,7 @@ final class WebWebScrapeMdResponse implements BaseModel * To enforce required parameters use * ``` * WebWebScrapeMdResponse::with( - * markdown: ..., metadata: ..., success: ..., url: ... + * contentLength: ..., markdown: ..., metadata: ..., success: ..., url: ... * ) * ``` * @@ -72,6 +79,7 @@ final class WebWebScrapeMdResponse implements BaseModel * * ``` * (new WebWebScrapeMdResponse) + * ->withContentLength(...) * ->withMarkdown(...) * ->withMetadata(...) * ->withSuccess(...) @@ -92,6 +100,7 @@ public function __construct() * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + int $contentLength, string $markdown, Metadata|array $metadata, bool $success, @@ -100,6 +109,7 @@ public static function with( ): self { $self = new self; + $self['contentLength'] = $contentLength; $self['markdown'] = $markdown; $self['metadata'] = $metadata; $self['success'] = $success; @@ -110,6 +120,17 @@ public static function with( return $self; } + /** + * UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result and compare small values against your workload's minimum useful-content threshold. + */ + public function withContentLength(int $contentLength): self + { + $self = clone $this; + $self['contentLength'] = $contentLength; + + return $self; + } + /** * Page content converted to GitHub Flavored Markdown. */ From 2bb5eee05e6f972bcb086ccc80fa5e3884f2c155 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 22:21:26 +0000 Subject: [PATCH 045/130] feat(api): api update --- .stats.yml | 4 +- src/Monitors/MonitorCreateParams/Webhook.php | 40 +++- .../MonitorCreateParams/Webhook/Event.php | 12 ++ src/Monitors/MonitorGetResponse/Webhook.php | 40 +++- .../MonitorGetResponse/Webhook/Event.php | 12 ++ .../MonitorListAccountRunsResponse/Data.php | 33 ++- .../Data/WebhookDelivery.php | 38 +++- .../Data/WebhookDelivery/Event.php | 15 ++ .../Data/WebhookDelivery1.php | 196 ++++++++++++++++++ .../Data/WebhookDelivery1/Error.php | 74 +++++++ .../Data/WebhookDelivery1/Event.php | 15 ++ .../Data/WebhookDelivery1/Status.php | 19 ++ .../MonitorListResponse/Data/Webhook.php | 40 +++- .../Data/Webhook/Event.php | 12 ++ src/Monitors/MonitorListRunsResponse/Data.php | 33 ++- .../Data/WebhookDelivery.php | 38 +++- .../Data/WebhookDelivery/Event.php | 15 ++ .../Data/WebhookDelivery1.php | 196 ++++++++++++++++++ .../Data/WebhookDelivery1/Error.php | 74 +++++++ .../Data/WebhookDelivery1/Event.php | 15 ++ .../Data/WebhookDelivery1/Status.php | 19 ++ src/Monitors/MonitorNewResponse/Webhook.php | 40 +++- .../MonitorNewResponse/Webhook/Event.php | 12 ++ src/Monitors/MonitorUpdateParams/Webhook.php | 40 +++- .../MonitorUpdateParams/Webhook/Event.php | 12 ++ .../MonitorUpdateResponse/Webhook.php | 40 +++- .../MonitorUpdateResponse/Webhook/Event.php | 12 ++ src/Services/MonitorsRawService.php | 2 +- src/Services/MonitorsService.php | 2 +- tests/Services/MonitorsTest.php | 5 +- 30 files changed, 1062 insertions(+), 43 deletions(-) create mode 100644 src/Monitors/MonitorCreateParams/Webhook/Event.php create mode 100644 src/Monitors/MonitorGetResponse/Webhook/Event.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Status.php create mode 100644 src/Monitors/MonitorListResponse/Data/Webhook/Event.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Status.php create mode 100644 src/Monitors/MonitorNewResponse/Webhook/Event.php create mode 100644 src/Monitors/MonitorUpdateParams/Webhook/Event.php create mode 100644 src/Monitors/MonitorUpdateResponse/Webhook/Event.php diff --git a/.stats.yml b/.stats.yml index a5e78070..951a04e0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-adab8df19dce27396e4a0e698287f083e1f932e63b85fd8dd4d54f80f0e0b5a8.yml -openapi_spec_hash: 717fea46f446ff97bad627f200963fd7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecf38e27f0c2544a8965f6cee827927343a926e1ab511aa7b34e8aa7d1866c8e.yml +openapi_spec_hash: c5767791a19b95c52ef073902fa5da77 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorCreateParams/Webhook.php b/src/Monitors/MonitorCreateParams/Webhook.php index 93cd9ffc..696997ed 100644 --- a/src/Monitors/MonitorCreateParams/Webhook.php +++ b/src/Monitors/MonitorCreateParams/Webhook.php @@ -8,9 +8,12 @@ use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Monitors\MonitorCreateParams\Webhook\Event; /** - * @phpstan-type WebhookShape = array{url: string, secret?: string|null} + * @phpstan-type WebhookShape = array{ + * url: string, events?: list>|null, secret?: string|null + * } */ final class Webhook implements BaseModel { @@ -18,11 +21,19 @@ final class Webhook implements BaseModel use SdkModel; /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ #[Required] public string $url; + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @var list>|null $events + */ + #[Optional(list: Event::class)] + public ?array $events; + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ @@ -52,20 +63,26 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list>|null $events */ - public static function with(string $url, ?string $secret = null): self - { + public static function with( + string $url, + ?array $events = null, + ?string $secret = null + ): self { $self = new self; $self['url'] = $url; + null !== $events && $self['events'] = $events; null !== $secret && $self['secret'] = $secret; return $self; } /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ public function withURL(string $url): self { @@ -75,6 +92,19 @@ public function withURL(string $url): self return $self; } + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @param list> $events + */ + public function withEvents(array $events): self + { + $self = clone $this; + $self['events'] = $events; + + return $self; + } + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ diff --git a/src/Monitors/MonitorCreateParams/Webhook/Event.php b/src/Monitors/MonitorCreateParams/Webhook/Event.php new file mode 100644 index 00000000..7734513a --- /dev/null +++ b/src/Monitors/MonitorCreateParams/Webhook/Event.php @@ -0,0 +1,12 @@ +>|null, secret?: string|null + * } */ final class Webhook implements BaseModel { @@ -18,11 +21,19 @@ final class Webhook implements BaseModel use SdkModel; /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ #[Required] public string $url; + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @var list>|null $events + */ + #[Optional(list: Event::class)] + public ?array $events; + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ @@ -52,20 +63,26 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list>|null $events */ - public static function with(string $url, ?string $secret = null): self - { + public static function with( + string $url, + ?array $events = null, + ?string $secret = null + ): self { $self = new self; $self['url'] = $url; + null !== $events && $self['events'] = $events; null !== $secret && $self['secret'] = $secret; return $self; } /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ public function withURL(string $url): self { @@ -75,6 +92,19 @@ public function withURL(string $url): self return $self; } + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @param list> $events + */ + public function withEvents(array $events): self + { + $self = clone $this; + $self['events'] = $events; + + return $self; + } + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ diff --git a/src/Monitors/MonitorGetResponse/Webhook/Event.php b/src/Monitors/MonitorGetResponse/Webhook/Event.php new file mode 100644 index 00000000..c93543e9 --- /dev/null +++ b/src/Monitors/MonitorGetResponse/Webhook/Event.php @@ -0,0 +1,12 @@ +, * startedAt?: \DateTimeInterface|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -109,7 +112,17 @@ final class Data implements BaseModel public ?\DateTimeInterface $startedAt; /** - * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. + * + * @var list|null $webhookDeliveries + */ + #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] + public ?array $webhookDeliveries; + + /** + * @deprecated + * + * Deprecated: use `webhook_deliveries`, which records every attempt now that a run can deliver multiple events. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. */ #[Optional('webhook_delivery')] public ?WebhookDelivery $webhookDelivery; @@ -163,6 +176,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -180,6 +194,7 @@ public static function with( Error|array|null $error = null, SkipReason|string|null $skipReason = null, ?\DateTimeInterface $startedAt = null, + ?array $webhookDeliveries = null, WebhookDelivery|array|null $webhookDelivery = null, ): self { $self = new self; @@ -199,6 +214,7 @@ public static function with( null !== $error && $self['error'] = $error; null !== $skipReason && $self['skipReason'] = $skipReason; null !== $startedAt && $self['startedAt'] = $startedAt; + null !== $webhookDeliveries && $self['webhookDeliveries'] = $webhookDeliveries; null !== $webhookDelivery && $self['webhookDelivery'] = $webhookDelivery; return $self; @@ -348,7 +364,20 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self } /** - * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. + * + * @param list $webhookDeliveries + */ + public function withWebhookDeliveries(array $webhookDeliveries): self + { + $self = clone $this; + $self['webhookDeliveries'] = $webhookDeliveries; + + return $self; + } + + /** + * Deprecated: use `webhook_deliveries`, which records every attempt now that a run can deliver multiple events. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. * * @param WebhookDelivery|WebhookDeliveryShape $webhookDelivery */ diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php index 1d9ef109..77fd214b 100644 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php @@ -8,16 +8,20 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Error; +use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Event; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status; /** - * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * Deprecated: use `webhook_deliveries`, which records every attempt now that a run can deliver multiple events. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * + * @deprecated * * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Error * * @phpstan-type WebhookDeliveryShape = array{ * attemptedAt: \DateTimeInterface, * error: null|\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Error|ErrorShape, + * event: Event|value-of, * eventID: string, * httpStatus: int|null, * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status>, @@ -34,6 +38,14 @@ final class WebhookDelivery implements BaseModel #[Required] public ?Error $error; + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @var value-of $event + */ + #[Required(enum: Event::class)] + public string $event; + /** * Identifier sent in the X-Context-Id header. */ @@ -62,7 +74,12 @@ enum: Status::class, * To enforce required parameters use * ``` * WebhookDelivery::with( - * attemptedAt: ..., error: ..., eventID: ..., httpStatus: ..., status: ... + * attemptedAt: ..., + * error: ..., + * event: ..., + * eventID: ..., + * httpStatus: ..., + * status: ..., * ) * ``` * @@ -72,6 +89,7 @@ enum: Status::class, * (new WebhookDelivery) * ->withAttemptedAt(...) * ->withError(...) + * ->withEvent(...) * ->withEventID(...) * ->withHTTPStatus(...) * ->withStatus(...) @@ -88,11 +106,13 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param Error|ErrorShape|null $error + * @param Event|value-of $event * @param Status|value-of $status */ public static function with( \DateTimeInterface $attemptedAt, Error|array|null $error, + Event|string $event, string $eventID, ?int $httpStatus, Status|string $status, @@ -101,6 +121,7 @@ public static function with( $self['attemptedAt'] = $attemptedAt; $self['error'] = $error; + $self['event'] = $event; $self['eventID'] = $eventID; $self['httpStatus'] = $httpStatus; $self['status'] = $status; @@ -128,6 +149,19 @@ public function withError( return $self; } + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @param Event|value-of $event + */ + public function withEvent(Event|string $event): self + { + $self = clone $this; + $self['event'] = $event; + + return $self; + } + /** * Identifier sent in the X-Context-Id header. */ diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php new file mode 100644 index 00000000..dab594a2 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php @@ -0,0 +1,15 @@ +, + * eventID: string, + * httpStatus: int|null, + * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status>, + * } + */ +final class WebhookDelivery1 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required('attempted_at')] + public \DateTimeInterface $attemptedAt; + + #[Required] + public ?Error $error; + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @var value-of $event + */ + #[Required(enum: Event::class)] + public string $event; + + /** + * Identifier sent in the X-Context-Id header. + */ + #[Required('event_id')] + public string $eventID; + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $status + */ + #[Required( + enum: Status::class, + )] + public string $status; + + /** + * `new WebhookDelivery1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookDelivery1::with( + * attemptedAt: ..., + * error: ..., + * event: ..., + * eventID: ..., + * httpStatus: ..., + * status: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookDelivery1) + * ->withAttemptedAt(...) + * ->withError(...) + * ->withEvent(...) + * ->withEventID(...) + * ->withHTTPStatus(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Error|ErrorShape|null $error + * @param Event|value-of $event + * @param Status|value-of $status + */ + public static function with( + \DateTimeInterface $attemptedAt, + Error|array|null $error, + Event|string $event, + string $eventID, + ?int $httpStatus, + Status|string $status, + ): self { + $self = new self; + + $self['attemptedAt'] = $attemptedAt; + $self['error'] = $error; + $self['event'] = $event; + $self['eventID'] = $eventID; + $self['httpStatus'] = $httpStatus; + $self['status'] = $status; + + return $self; + } + + public function withAttemptedAt(\DateTimeInterface $attemptedAt): self + { + $self = clone $this; + $self['attemptedAt'] = $attemptedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError( + Error|array|null $error, + ): self { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @param Event|value-of $event + */ + public function withEvent(Event|string $event): self + { + $self = clone $this; + $self['event'] = $event; + + return $self; + } + + /** + * Identifier sent in the X-Context-Id header. + */ + public function withEventID(string $eventID): self + { + $self = clone $this; + $self['eventID'] = $eventID; + + return $self; + } + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status, + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php new file mode 100644 index 00000000..96919d87 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php new file mode 100644 index 00000000..b7971845 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php @@ -0,0 +1,15 @@ +>|null, secret?: string|null + * } */ final class Webhook implements BaseModel { @@ -18,11 +21,19 @@ final class Webhook implements BaseModel use SdkModel; /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ #[Required] public string $url; + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @var list>|null $events + */ + #[Optional(list: Event::class)] + public ?array $events; + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ @@ -52,20 +63,26 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list>|null $events */ - public static function with(string $url, ?string $secret = null): self - { + public static function with( + string $url, + ?array $events = null, + ?string $secret = null + ): self { $self = new self; $self['url'] = $url; + null !== $events && $self['events'] = $events; null !== $secret && $self['secret'] = $secret; return $self; } /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ public function withURL(string $url): self { @@ -75,6 +92,19 @@ public function withURL(string $url): self return $self; } + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @param list> $events + */ + public function withEvents(array $events): self + { + $self = clone $this; + $self['events'] = $events; + + return $self; + } + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ diff --git a/src/Monitors/MonitorListResponse/Data/Webhook/Event.php b/src/Monitors/MonitorListResponse/Data/Webhook/Event.php new file mode 100644 index 00000000..0ff8b877 --- /dev/null +++ b/src/Monitors/MonitorListResponse/Data/Webhook/Event.php @@ -0,0 +1,12 @@ +, * startedAt?: \DateTimeInterface|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -109,7 +112,17 @@ final class Data implements BaseModel public ?\DateTimeInterface $startedAt; /** - * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. + * + * @var list|null $webhookDeliveries + */ + #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] + public ?array $webhookDeliveries; + + /** + * @deprecated + * + * Deprecated: use `webhook_deliveries`, which records every attempt now that a run can deliver multiple events. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. */ #[Optional('webhook_delivery')] public ?WebhookDelivery $webhookDelivery; @@ -163,6 +176,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -180,6 +194,7 @@ public static function with( Error|array|null $error = null, SkipReason|string|null $skipReason = null, ?\DateTimeInterface $startedAt = null, + ?array $webhookDeliveries = null, WebhookDelivery|array|null $webhookDelivery = null, ): self { $self = new self; @@ -199,6 +214,7 @@ public static function with( null !== $error && $self['error'] = $error; null !== $skipReason && $self['skipReason'] = $skipReason; null !== $startedAt && $self['startedAt'] = $startedAt; + null !== $webhookDeliveries && $self['webhookDeliveries'] = $webhookDeliveries; null !== $webhookDelivery && $self['webhookDelivery'] = $webhookDelivery; return $self; @@ -348,7 +364,20 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self } /** - * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. + * + * @param list $webhookDeliveries + */ + public function withWebhookDeliveries(array $webhookDeliveries): self + { + $self = clone $this; + $self['webhookDeliveries'] = $webhookDeliveries; + + return $self; + } + + /** + * Deprecated: use `webhook_deliveries`, which records every attempt now that a run can deliver multiple events. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. * * @param WebhookDelivery|WebhookDeliveryShape $webhookDelivery */ diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php index 61c99886..bea65e0f 100644 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php @@ -8,16 +8,20 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Error; +use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Event; use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status; /** - * The webhook delivery attempted for a change detected by this run. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * Deprecated: use `webhook_deliveries`, which records every attempt now that a run can deliver multiple events. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * + * @deprecated * * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Error * * @phpstan-type WebhookDeliveryShape = array{ * attemptedAt: \DateTimeInterface, * error: null|\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Error|ErrorShape, + * event: Event|value-of, * eventID: string, * httpStatus: int|null, * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status>, @@ -34,6 +38,14 @@ final class WebhookDelivery implements BaseModel #[Required] public ?Error $error; + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @var value-of $event + */ + #[Required(enum: Event::class)] + public string $event; + /** * Identifier sent in the X-Context-Id header. */ @@ -62,7 +74,12 @@ enum: Status::class, * To enforce required parameters use * ``` * WebhookDelivery::with( - * attemptedAt: ..., error: ..., eventID: ..., httpStatus: ..., status: ... + * attemptedAt: ..., + * error: ..., + * event: ..., + * eventID: ..., + * httpStatus: ..., + * status: ..., * ) * ``` * @@ -72,6 +89,7 @@ enum: Status::class, * (new WebhookDelivery) * ->withAttemptedAt(...) * ->withError(...) + * ->withEvent(...) * ->withEventID(...) * ->withHTTPStatus(...) * ->withStatus(...) @@ -88,11 +106,13 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param Error|ErrorShape|null $error + * @param Event|value-of $event * @param Status|value-of $status */ public static function with( \DateTimeInterface $attemptedAt, Error|array|null $error, + Event|string $event, string $eventID, ?int $httpStatus, Status|string $status, @@ -101,6 +121,7 @@ public static function with( $self['attemptedAt'] = $attemptedAt; $self['error'] = $error; + $self['event'] = $event; $self['eventID'] = $eventID; $self['httpStatus'] = $httpStatus; $self['status'] = $status; @@ -128,6 +149,19 @@ public function withError( return $self; } + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @param Event|value-of $event + */ + public function withEvent(Event|string $event): self + { + $self = clone $this; + $self['event'] = $event; + + return $self; + } + /** * Identifier sent in the X-Context-Id header. */ diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php new file mode 100644 index 00000000..b387c981 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php @@ -0,0 +1,15 @@ +, + * eventID: string, + * httpStatus: int|null, + * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status>, + * } + */ +final class WebhookDelivery1 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required('attempted_at')] + public \DateTimeInterface $attemptedAt; + + #[Required] + public ?Error $error; + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @var value-of $event + */ + #[Required(enum: Event::class)] + public string $event; + + /** + * Identifier sent in the X-Context-Id header. + */ + #[Required('event_id')] + public string $eventID; + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $status + */ + #[Required( + enum: Status::class, + )] + public string $status; + + /** + * `new WebhookDelivery1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookDelivery1::with( + * attemptedAt: ..., + * error: ..., + * event: ..., + * eventID: ..., + * httpStatus: ..., + * status: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookDelivery1) + * ->withAttemptedAt(...) + * ->withError(...) + * ->withEvent(...) + * ->withEventID(...) + * ->withHTTPStatus(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Error|ErrorShape|null $error + * @param Event|value-of $event + * @param Status|value-of $status + */ + public static function with( + \DateTimeInterface $attemptedAt, + Error|array|null $error, + Event|string $event, + string $eventID, + ?int $httpStatus, + Status|string $status, + ): self { + $self = new self; + + $self['attemptedAt'] = $attemptedAt; + $self['error'] = $error; + $self['event'] = $event; + $self['eventID'] = $eventID; + $self['httpStatus'] = $httpStatus; + $self['status'] = $status; + + return $self; + } + + public function withAttemptedAt(\DateTimeInterface $attemptedAt): self + { + $self = clone $this; + $self['attemptedAt'] = $attemptedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError( + Error|array|null $error, + ): self { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @param Event|value-of $event + */ + public function withEvent(Event|string $event): self + { + $self = clone $this; + $self['event'] = $event; + + return $self; + } + + /** + * Identifier sent in the X-Context-Id header. + */ + public function withEventID(string $eventID): self + { + $self = clone $this; + $self['eventID'] = $eventID; + + return $self; + } + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status, + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php new file mode 100644 index 00000000..94b8d20a --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php new file mode 100644 index 00000000..fe9094a5 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php @@ -0,0 +1,15 @@ +>|null, secret?: string|null + * } */ final class Webhook implements BaseModel { @@ -18,11 +21,19 @@ final class Webhook implements BaseModel use SdkModel; /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ #[Required] public string $url; + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @var list>|null $events + */ + #[Optional(list: Event::class)] + public ?array $events; + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ @@ -52,20 +63,26 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list>|null $events */ - public static function with(string $url, ?string $secret = null): self - { + public static function with( + string $url, + ?array $events = null, + ?string $secret = null + ): self { $self = new self; $self['url'] = $url; + null !== $events && $self['events'] = $events; null !== $secret && $self['secret'] = $secret; return $self; } /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ public function withURL(string $url): self { @@ -75,6 +92,19 @@ public function withURL(string $url): self return $self; } + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @param list> $events + */ + public function withEvents(array $events): self + { + $self = clone $this; + $self['events'] = $events; + + return $self; + } + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ diff --git a/src/Monitors/MonitorNewResponse/Webhook/Event.php b/src/Monitors/MonitorNewResponse/Webhook/Event.php new file mode 100644 index 00000000..94203f86 --- /dev/null +++ b/src/Monitors/MonitorNewResponse/Webhook/Event.php @@ -0,0 +1,12 @@ +>|null, secret?: string|null + * } */ final class Webhook implements BaseModel { @@ -20,11 +23,19 @@ final class Webhook implements BaseModel use SdkModel; /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ #[Required] public string $url; + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @var list>|null $events + */ + #[Optional(list: Event::class)] + public ?array $events; + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ @@ -54,20 +65,26 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list>|null $events */ - public static function with(string $url, ?string $secret = null): self - { + public static function with( + string $url, + ?array $events = null, + ?string $secret = null + ): self { $self = new self; $self['url'] = $url; + null !== $events && $self['events'] = $events; null !== $secret && $self['secret'] = $secret; return $self; } /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ public function withURL(string $url): self { @@ -77,6 +94,19 @@ public function withURL(string $url): self return $self; } + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @param list> $events + */ + public function withEvents(array $events): self + { + $self = clone $this; + $self['events'] = $events; + + return $self; + } + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ diff --git a/src/Monitors/MonitorUpdateParams/Webhook/Event.php b/src/Monitors/MonitorUpdateParams/Webhook/Event.php new file mode 100644 index 00000000..e5eb11f0 --- /dev/null +++ b/src/Monitors/MonitorUpdateParams/Webhook/Event.php @@ -0,0 +1,12 @@ +>|null, secret?: string|null + * } */ final class Webhook implements BaseModel { @@ -18,11 +21,19 @@ final class Webhook implements BaseModel use SdkModel; /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ #[Required] public string $url; + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @var list>|null $events + */ + #[Optional(list: Event::class)] + public ?array $events; + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ @@ -52,20 +63,26 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list>|null $events */ - public static function with(string $url, ?string $secret = null): self - { + public static function with( + string $url, + ?array $events = null, + ?string $secret = null + ): self { $self = new self; $self['url'] = $url; + null !== $events && $self['events'] = $events; null !== $secret && $self['secret'] = $secret; return $self; } /** - * Webhook URL called when a change is detected. + * Webhook URL events are delivered to. */ public function withURL(string $url): self { @@ -75,6 +92,19 @@ public function withURL(string $url): self return $self; } + /** + * Events delivered to this endpoint. `change.detected` fires only when a run detects a change; `run.completed` fires on every completed run — including runs that detected no change — and embeds the change when one was detected. Defaults to `["change.detected"]` when omitted. + * + * @param list> $events + */ + public function withEvents(array $events): self + { + $self = clone $this; + $self['events'] = $events; + + return $self; + } + /** * Signing secret used to verify webhook authenticity. Each delivery includes an `X-Context-Signature: t=,v1=` header, where the HMAC is SHA-256 over `"{t}.{rawRequestBody}"` keyed by this secret. Recompute it with a constant-time compare and reject stale timestamps to prevent replay. Generated by the API; cannot be set by clients. */ diff --git a/src/Monitors/MonitorUpdateResponse/Webhook/Event.php b/src/Monitors/MonitorUpdateResponse/Webhook/Event.php new file mode 100644 index 00000000..dc72dcbb --- /dev/null +++ b/src/Monitors/MonitorUpdateResponse/Webhook/Event.php @@ -0,0 +1,12 @@ + 'https://example.com/webhook'], + webhook: [ + 'url' => 'https://example.com/webhook', + 'events' => ['change.detected', 'run.completed'], + ], ); // @phpstan-ignore-next-line method.alreadyNarrowedType From 84ccf401a7453605043d2d8340a4cb044562b816 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 11 Jul 2026 23:27:20 +0000 Subject: [PATCH 046/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 951a04e0..26e1f0f9 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ecf38e27f0c2544a8965f6cee827927343a926e1ab511aa7b34e8aa7d1866c8e.yml -openapi_spec_hash: c5767791a19b95c52ef073902fa5da77 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21b399a0388f04e48b9d8d95f51f622088c5b15b1e17d2988c38583902b9f685.yml +openapi_spec_hash: 6952c95545d272388a655652fc8e7662 config_hash: ff35e224e809656528c44163aa41bebd From e7aec72634e733586f3f5e7a9dbbef57d0f910c1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 06:05:10 +0000 Subject: [PATCH 047/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 12 ++++++------ src/Services/WebService.php | 12 ++++++------ src/Web/WebWebCrawlMdParams.php | 4 ++-- src/Web/WebWebCrawlMdParams/Pdf.php | 25 ++++++++++++++++++++++--- src/Web/WebWebScrapeHTMLParams.php | 4 ++-- src/Web/WebWebScrapeHTMLParams/Pdf.php | 25 ++++++++++++++++++++++--- src/Web/WebWebScrapeMdParams.php | 4 ++-- src/Web/WebWebScrapeMdParams/Pdf.php | 25 ++++++++++++++++++++++--- tests/Services/WebTest.php | 6 +++--- 10 files changed, 89 insertions(+), 32 deletions(-) diff --git a/.stats.yml b/.stats.yml index 26e1f0f9..f0f1a280 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21b399a0388f04e48b9d8d95f51f622088c5b15b1e17d2988c38583902b9f685.yml -openapi_spec_hash: 6952c95545d272388a655652fc8e7662 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-48b7ece3103b7778fbb3fc822ac3e28f8758a220f16a9a74383a0e15f2a381e2.yml +openapi_spec_hash: b1dcb462be67fc1ad751463f01d21d21 config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index a0afdcd9..0a6c2e79 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -212,7 +212,7 @@ public function search( * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. - * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). @@ -237,7 +237,7 @@ public function webCrawlMd( ?int $maxDepth = null, int $maxPages = 100, \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ - 'shouldParse' => true, + 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, bool $shortenBase64Images = true, @@ -259,7 +259,7 @@ public function webCrawlMd( * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable @@ -277,7 +277,7 @@ public function webScrapeHTML( ?array $includeSelectors = null, int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ - 'shouldParse' => true, + 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, ?int $timeoutMs = null, @@ -323,7 +323,7 @@ public function webScrapeImages( * @param bool $includeLinks Preserve hyperlinks in Markdown output * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. - * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -344,7 +344,7 @@ public function webScrapeMd( ?array $includeSelectors = null, int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ - 'shouldParse' => true, + 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, bool $shortenBase64Images = true, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 269de97d..4331ee82 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -348,7 +348,7 @@ public function search( * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param int $maxDepth Maximum link depth from the starting URL (0 = only the starting page) * @param int $maxPages Maximum number of pages to crawl. Hard cap: 500. - * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param \ContextDev\Web\WebWebCrawlMdParams\Pdf|PdfShape1 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). @@ -373,7 +373,7 @@ public function webCrawlMd( ?int $maxDepth = null, int $maxPages = 100, \ContextDev\Web\WebWebCrawlMdParams\Pdf|array $pdf = [ - 'shouldParse' => true, + 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, bool $shortenBase64Images = true, @@ -426,7 +426,7 @@ public function webCrawlMd( * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable @@ -444,7 +444,7 @@ public function webScrapeHTML( ?array $includeSelectors = null, int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ - 'shouldParse' => true, + 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, ?int $timeoutMs = null, @@ -546,7 +546,7 @@ public function webScrapeImages( * @param bool $includeLinks Preserve hyperlinks in Markdown output * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. - * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -567,7 +567,7 @@ public function webScrapeMd( ?array $includeSelectors = null, int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ - 'shouldParse' => true, + 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, bool $shortenBase64Images = true, diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index d89de937..f5aa36de 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -120,7 +120,7 @@ final class WebWebCrawlMdParams implements BaseModel public ?int $maxPages; /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. */ #[Optional] public ?Pdf $pdf; @@ -371,7 +371,7 @@ public function withMaxPages(int $maxPages): self } /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * * @param Pdf|PdfShape $pdf */ diff --git a/src/Web/WebWebCrawlMdParams/Pdf.php b/src/Web/WebWebCrawlMdParams/Pdf.php index b006142b..d412e2eb 100644 --- a/src/Web/WebWebCrawlMdParams/Pdf.php +++ b/src/Web/WebWebCrawlMdParams/Pdf.php @@ -9,10 +9,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * * @phpstan-type PdfShape = array{ - * end?: int|null, shouldParse?: bool|null, start?: int|null + * end?: int|null, ocr?: bool|null, shouldParse?: bool|null, start?: int|null * } */ final class Pdf implements BaseModel @@ -26,6 +26,12 @@ final class Pdf implements BaseModel #[Optional] public ?int $end; + /** + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + */ + #[Optional] + public ?bool $ocr; + /** * When true, PDF pages are fetched and parsed. When false, PDF pages are skipped entirely (not included in results and not counted as failures). */ @@ -50,12 +56,14 @@ public function __construct() */ public static function with( ?int $end = null, + ?bool $ocr = null, ?bool $shouldParse = null, - ?int $start = null + ?int $start = null, ): self { $self = new self; null !== $end && $self['end'] = $end; + null !== $ocr && $self['ocr'] = $ocr; null !== $shouldParse && $self['shouldParse'] = $shouldParse; null !== $start && $self['start'] = $start; @@ -73,6 +81,17 @@ public function withEnd(int $end): self return $self; } + /** + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + */ + public function withOcr(bool $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + /** * When true, PDF pages are fetched and parsed. When false, PDF pages are skipped entirely (not included in results and not counted as failures). */ diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php index a37ee58c..3f3139ab 100644 --- a/src/Web/WebWebScrapeHTMLParams.php +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -91,7 +91,7 @@ final class WebWebScrapeHTMLParams implements BaseModel public ?int $maxAgeMs; /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. */ #[Optional] public ?Pdf $pdf; @@ -269,7 +269,7 @@ public function withMaxAgeMs(int $maxAgeMs): self } /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * * @param Pdf|PdfShape $pdf */ diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf.php b/src/Web/WebWebScrapeHTMLParams/Pdf.php index 0dea8254..94e39185 100644 --- a/src/Web/WebWebScrapeHTMLParams/Pdf.php +++ b/src/Web/WebWebScrapeHTMLParams/Pdf.php @@ -9,10 +9,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * * @phpstan-type PdfShape = array{ - * end?: int|null, shouldParse?: bool|null, start?: int|null + * end?: int|null, ocr?: bool|null, shouldParse?: bool|null, start?: int|null * } */ final class Pdf implements BaseModel @@ -26,6 +26,12 @@ final class Pdf implements BaseModel #[Optional] public ?int $end; + /** + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + */ + #[Optional] + public ?bool $ocr; + /** * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. */ @@ -50,12 +56,14 @@ public function __construct() */ public static function with( ?int $end = null, + ?bool $ocr = null, ?bool $shouldParse = null, - ?int $start = null + ?int $start = null, ): self { $self = new self; null !== $end && $self['end'] = $end; + null !== $ocr && $self['ocr'] = $ocr; null !== $shouldParse && $self['shouldParse'] = $shouldParse; null !== $start && $self['start'] = $start; @@ -73,6 +81,17 @@ public function withEnd(int $end): self return $self; } + /** + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + */ + public function withOcr(bool $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + /** * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. */ diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index c1e95632..b65deafe 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -119,7 +119,7 @@ final class WebWebScrapeMdParams implements BaseModel public ?int $maxAgeMs; /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. */ #[Optional] public ?Pdf $pdf; @@ -331,7 +331,7 @@ public function withMaxAgeMs(int $maxAgeMs): self } /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * * @param Pdf|PdfShape $pdf */ diff --git a/src/Web/WebWebScrapeMdParams/Pdf.php b/src/Web/WebWebScrapeMdParams/Pdf.php index 7418bbe7..39d37bbe 100644 --- a/src/Web/WebWebScrapeMdParams/Pdf.php +++ b/src/Web/WebWebScrapeMdParams/Pdf.php @@ -9,10 +9,10 @@ use ContextDev\Core\Contracts\BaseModel; /** - * PDF parsing controls. Use start/end to limit text extraction and OCR to an inclusive 1-based page range. + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * * @phpstan-type PdfShape = array{ - * end?: int|null, shouldParse?: bool|null, start?: int|null + * end?: int|null, ocr?: bool|null, shouldParse?: bool|null, start?: int|null * } */ final class Pdf implements BaseModel @@ -26,6 +26,12 @@ final class Pdf implements BaseModel #[Optional] public ?int $end; + /** + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + */ + #[Optional] + public ?bool $ocr; + /** * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. */ @@ -50,12 +56,14 @@ public function __construct() */ public static function with( ?int $end = null, + ?bool $ocr = null, ?bool $shouldParse = null, - ?int $start = null + ?int $start = null, ): self { $self = new self; null !== $end && $self['end'] = $end; + null !== $ocr && $self['ocr'] = $ocr; null !== $shouldParse && $self['shouldParse'] = $shouldParse; null !== $start && $self['start'] = $start; @@ -73,6 +81,17 @@ public function withEnd(int $end): self return $self; } + /** + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + */ + public function withOcr(bool $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + /** * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. */ diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index 6c2ca761..f3044c88 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -239,7 +239,7 @@ public function testWebCrawlMdWithOptionalParams(): void maxAgeMs: 0, maxDepth: 0, maxPages: 1, - pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], settleAnimations: true, shortenBase64Images: true, stopAfterMs: 10000, @@ -281,7 +281,7 @@ public function testWebScrapeHTMLWithOptionalParams(): void includeFrames: true, includeSelectors: ['string'], maxAgeMs: 0, - pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], settleAnimations: true, timeoutMs: 1000, useMainContentOnly: true, @@ -361,7 +361,7 @@ public function testWebScrapeMdWithOptionalParams(): void includeLinks: true, includeSelectors: ['string'], maxAgeMs: 0, - pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], settleAnimations: true, shortenBase64Images: true, timeoutMs: 1000, From 78f16379dc9a26c3833fdfd2fa93a4952001cd55 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 06:52:52 +0000 Subject: [PATCH 048/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f0f1a280..66d8d6b5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-48b7ece3103b7778fbb3fc822ac3e28f8758a220f16a9a74383a0e15f2a381e2.yml -openapi_spec_hash: b1dcb462be67fc1ad751463f01d21d21 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2b4fb3b310c35a1036b88e33c7252f42716d05ef19ea4d462426e0a28e0294a3.yml +openapi_spec_hash: cda6b6aaf724e39575e1848f3ea6eb10 config_hash: ff35e224e809656528c44163aa41bebd From 29ba3efe9926988c19f0b3666c89ad2c1a581aec Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 07:51:47 +0000 Subject: [PATCH 049/130] feat(api): api update --- .stats.yml | 4 +- .../MonitorListAccountRunsResponse/Data.php | 16 +- .../Data/WebhookDelivery.php | 200 ------------------ .../Data/WebhookDelivery/Error.php | 74 ------- .../Data/WebhookDelivery/Event.php | 15 -- .../Data/WebhookDelivery/Status.php | 19 -- .../Data/WebhookDelivery1.php | 196 ----------------- .../Data/WebhookDelivery1/Error.php | 74 ------- .../Data/WebhookDelivery1/Event.php | 15 -- .../Data/WebhookDelivery1/Status.php | 19 -- src/Monitors/MonitorListRunsResponse/Data.php | 16 +- .../Data/WebhookDelivery1.php | 196 ----------------- .../Data/WebhookDelivery1/Error.php | 74 ------- .../Data/WebhookDelivery1/Event.php | 15 -- .../Data/WebhookDelivery1/Status.php | 19 -- .../Data => }/WebhookDelivery.php | 32 ++- .../Data => }/WebhookDelivery/Error.php | 2 +- .../Data => }/WebhookDelivery/Event.php | 2 +- .../Data => }/WebhookDelivery/Status.php | 2 +- 19 files changed, 31 insertions(+), 959 deletions(-) delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Status.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Status.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Status.php rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery.php (79%) rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery/Error.php (95%) rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery/Event.php (77%) rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery/Status.php (84%) diff --git a/.stats.yml b/.stats.yml index 66d8d6b5..3d6d2e8c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2b4fb3b310c35a1036b88e33c7252f42716d05ef19ea4d462426e0a28e0294a3.yml -openapi_spec_hash: cda6b6aaf724e39575e1848f3ea6eb10 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-27dde3a14459d2e2ade277b142906f33c1b9e04c05b91ae9eb10b798eb82eb0b.yml +openapi_spec_hash: bf7879be38ebf3397a939c80b261a47a config_hash: ff35e224e809656528c44163aa41bebd diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data.php b/src/Monitors/MonitorListAccountRunsResponse/Data.php index f87eef43..a73960d5 100644 --- a/src/Monitors/MonitorListAccountRunsResponse/Data.php +++ b/src/Monitors/MonitorListAccountRunsResponse/Data.php @@ -14,13 +14,11 @@ use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\SkipReason; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Status; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\TargetType; -use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery; -use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1; +use ContextDev\Monitors\WebhookDelivery; /** * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Error - * @phpstan-import-type WebhookDelivery1Shape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1 - * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery + * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\WebhookDelivery * * @phpstan-type DataShape = array{ * id: string, @@ -37,7 +35,7 @@ * error?: null|Error|ErrorShape, * skipReason?: null|SkipReason|value-of, * startedAt?: \DateTimeInterface|null, - * webhookDeliveries?: list|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -114,9 +112,9 @@ final class Data implements BaseModel /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @var list|null $webhookDeliveries + * @var list|null $webhookDeliveries */ - #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] + #[Optional('webhook_deliveries', list: WebhookDelivery::class)] public ?array $webhookDeliveries; /** @@ -176,7 +174,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason - * @param list|null $webhookDeliveries + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -366,7 +364,7 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @param list $webhookDeliveries + * @param list $webhookDeliveries */ public function withWebhookDeliveries(array $webhookDeliveries): self { diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php deleted file mode 100644 index 77fd214b..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php +++ /dev/null @@ -1,200 +0,0 @@ -, - * eventID: string, - * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status>, - * } - */ -final class WebhookDelivery implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required('attempted_at')] - public \DateTimeInterface $attemptedAt; - - #[Required] - public ?Error $error; - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @var value-of $event - */ - #[Required(enum: Event::class)] - public string $event; - - /** - * Identifier sent in the X-Context-Id header. - */ - #[Required('event_id')] - public string $eventID; - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - #[Required('http_status')] - public ?int $httpStatus; - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @var value-of $status - */ - #[Required( - enum: Status::class, - )] - public string $status; - - /** - * `new WebhookDelivery()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * WebhookDelivery::with( - * attemptedAt: ..., - * error: ..., - * event: ..., - * eventID: ..., - * httpStatus: ..., - * status: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new WebhookDelivery) - * ->withAttemptedAt(...) - * ->withError(...) - * ->withEvent(...) - * ->withEventID(...) - * ->withHTTPStatus(...) - * ->withStatus(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Error|ErrorShape|null $error - * @param Event|value-of $event - * @param Status|value-of $status - */ - public static function with( - \DateTimeInterface $attemptedAt, - Error|array|null $error, - Event|string $event, - string $eventID, - ?int $httpStatus, - Status|string $status, - ): self { - $self = new self; - - $self['attemptedAt'] = $attemptedAt; - $self['error'] = $error; - $self['event'] = $event; - $self['eventID'] = $eventID; - $self['httpStatus'] = $httpStatus; - $self['status'] = $status; - - return $self; - } - - public function withAttemptedAt(\DateTimeInterface $attemptedAt): self - { - $self = clone $this; - $self['attemptedAt'] = $attemptedAt; - - return $self; - } - - /** - * @param Error|ErrorShape|null $error - */ - public function withError( - Error|array|null $error, - ): self { - $self = clone $this; - $self['error'] = $error; - - return $self; - } - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @param Event|value-of $event - */ - public function withEvent(Event|string $event): self - { - $self = clone $this; - $self['event'] = $event; - - return $self; - } - - /** - * Identifier sent in the X-Context-Id header. - */ - public function withEventID(string $eventID): self - { - $self = clone $this; - $self['eventID'] = $eventID; - - return $self; - } - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - public function withHTTPStatus(?int $httpStatus): self - { - $self = clone $this; - $self['httpStatus'] = $httpStatus; - - return $self; - } - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @param Status|value-of $status - */ - public function withStatus( - Status|string $status, - ): self { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php deleted file mode 100644 index 951e5b2c..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php +++ /dev/null @@ -1,74 +0,0 @@ - */ - use SdkModel; - - #[Required] - public string $code; - - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php deleted file mode 100644 index dab594a2..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php +++ /dev/null @@ -1,15 +0,0 @@ -, - * eventID: string, - * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status>, - * } - */ -final class WebhookDelivery1 implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required('attempted_at')] - public \DateTimeInterface $attemptedAt; - - #[Required] - public ?Error $error; - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @var value-of $event - */ - #[Required(enum: Event::class)] - public string $event; - - /** - * Identifier sent in the X-Context-Id header. - */ - #[Required('event_id')] - public string $eventID; - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - #[Required('http_status')] - public ?int $httpStatus; - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @var value-of $status - */ - #[Required( - enum: Status::class, - )] - public string $status; - - /** - * `new WebhookDelivery1()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * WebhookDelivery1::with( - * attemptedAt: ..., - * error: ..., - * event: ..., - * eventID: ..., - * httpStatus: ..., - * status: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new WebhookDelivery1) - * ->withAttemptedAt(...) - * ->withError(...) - * ->withEvent(...) - * ->withEventID(...) - * ->withHTTPStatus(...) - * ->withStatus(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Error|ErrorShape|null $error - * @param Event|value-of $event - * @param Status|value-of $status - */ - public static function with( - \DateTimeInterface $attemptedAt, - Error|array|null $error, - Event|string $event, - string $eventID, - ?int $httpStatus, - Status|string $status, - ): self { - $self = new self; - - $self['attemptedAt'] = $attemptedAt; - $self['error'] = $error; - $self['event'] = $event; - $self['eventID'] = $eventID; - $self['httpStatus'] = $httpStatus; - $self['status'] = $status; - - return $self; - } - - public function withAttemptedAt(\DateTimeInterface $attemptedAt): self - { - $self = clone $this; - $self['attemptedAt'] = $attemptedAt; - - return $self; - } - - /** - * @param Error|ErrorShape|null $error - */ - public function withError( - Error|array|null $error, - ): self { - $self = clone $this; - $self['error'] = $error; - - return $self; - } - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @param Event|value-of $event - */ - public function withEvent(Event|string $event): self - { - $self = clone $this; - $self['event'] = $event; - - return $self; - } - - /** - * Identifier sent in the X-Context-Id header. - */ - public function withEventID(string $eventID): self - { - $self = clone $this; - $self['eventID'] = $eventID; - - return $self; - } - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - public function withHTTPStatus(?int $httpStatus): self - { - $self = clone $this; - $self['httpStatus'] = $httpStatus; - - return $self; - } - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @param Status|value-of $status - */ - public function withStatus( - Status|string $status, - ): self { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php deleted file mode 100644 index 96919d87..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php +++ /dev/null @@ -1,74 +0,0 @@ - */ - use SdkModel; - - #[Required] - public string $code; - - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php deleted file mode 100644 index b7971845..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php +++ /dev/null @@ -1,15 +0,0 @@ -, * startedAt?: \DateTimeInterface|null, - * webhookDeliveries?: list|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -114,9 +112,9 @@ final class Data implements BaseModel /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @var list|null $webhookDeliveries + * @var list|null $webhookDeliveries */ - #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] + #[Optional('webhook_deliveries', list: WebhookDelivery::class)] public ?array $webhookDeliveries; /** @@ -176,7 +174,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason - * @param list|null $webhookDeliveries + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -366,7 +364,7 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @param list $webhookDeliveries + * @param list $webhookDeliveries */ public function withWebhookDeliveries(array $webhookDeliveries): self { diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php deleted file mode 100644 index 7c224ea8..00000000 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php +++ /dev/null @@ -1,196 +0,0 @@ -, - * eventID: string, - * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status>, - * } - */ -final class WebhookDelivery1 implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required('attempted_at')] - public \DateTimeInterface $attemptedAt; - - #[Required] - public ?Error $error; - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @var value-of $event - */ - #[Required(enum: Event::class)] - public string $event; - - /** - * Identifier sent in the X-Context-Id header. - */ - #[Required('event_id')] - public string $eventID; - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - #[Required('http_status')] - public ?int $httpStatus; - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @var value-of $status - */ - #[Required( - enum: Status::class, - )] - public string $status; - - /** - * `new WebhookDelivery1()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * WebhookDelivery1::with( - * attemptedAt: ..., - * error: ..., - * event: ..., - * eventID: ..., - * httpStatus: ..., - * status: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new WebhookDelivery1) - * ->withAttemptedAt(...) - * ->withError(...) - * ->withEvent(...) - * ->withEventID(...) - * ->withHTTPStatus(...) - * ->withStatus(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Error|ErrorShape|null $error - * @param Event|value-of $event - * @param Status|value-of $status - */ - public static function with( - \DateTimeInterface $attemptedAt, - Error|array|null $error, - Event|string $event, - string $eventID, - ?int $httpStatus, - Status|string $status, - ): self { - $self = new self; - - $self['attemptedAt'] = $attemptedAt; - $self['error'] = $error; - $self['event'] = $event; - $self['eventID'] = $eventID; - $self['httpStatus'] = $httpStatus; - $self['status'] = $status; - - return $self; - } - - public function withAttemptedAt(\DateTimeInterface $attemptedAt): self - { - $self = clone $this; - $self['attemptedAt'] = $attemptedAt; - - return $self; - } - - /** - * @param Error|ErrorShape|null $error - */ - public function withError( - Error|array|null $error, - ): self { - $self = clone $this; - $self['error'] = $error; - - return $self; - } - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @param Event|value-of $event - */ - public function withEvent(Event|string $event): self - { - $self = clone $this; - $self['event'] = $event; - - return $self; - } - - /** - * Identifier sent in the X-Context-Id header. - */ - public function withEventID(string $eventID): self - { - $self = clone $this; - $self['eventID'] = $eventID; - - return $self; - } - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - public function withHTTPStatus(?int $httpStatus): self - { - $self = clone $this; - $self['httpStatus'] = $httpStatus; - - return $self; - } - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @param Status|value-of $status - */ - public function withStatus( - Status|string $status, - ): self { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php deleted file mode 100644 index 94b8d20a..00000000 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php +++ /dev/null @@ -1,74 +0,0 @@ - */ - use SdkModel; - - #[Required] - public string $code; - - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php deleted file mode 100644 index fe9094a5..00000000 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php +++ /dev/null @@ -1,15 +0,0 @@ -, * eventID: string, * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status>, + * status: Status|value-of, * } */ final class WebhookDelivery implements BaseModel @@ -63,9 +59,7 @@ final class WebhookDelivery implements BaseModel * * @var value-of $status */ - #[Required( - enum: Status::class, - )] + #[Required(enum: Status::class)] public string $status; /** @@ -140,9 +134,8 @@ public function withAttemptedAt(\DateTimeInterface $attemptedAt): self /** * @param Error|ErrorShape|null $error */ - public function withError( - Error|array|null $error, - ): self { + public function withError(Error|array|null $error): self + { $self = clone $this; $self['error'] = $error; @@ -189,9 +182,8 @@ public function withHTTPStatus(?int $httpStatus): self * * @param Status|value-of $status */ - public function withStatus( - Status|string $status, - ): self { + public function withStatus(Status|string $status): self + { $self = clone $this; $self['status'] = $status; diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php b/src/Monitors/WebhookDelivery/Error.php similarity index 95% rename from src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php rename to src/Monitors/WebhookDelivery/Error.php index 16f73bed..41d7b9c5 100644 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php +++ b/src/Monitors/WebhookDelivery/Error.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; +namespace ContextDev\Monitors\WebhookDelivery; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php b/src/Monitors/WebhookDelivery/Event.php similarity index 77% rename from src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php rename to src/Monitors/WebhookDelivery/Event.php index b387c981..cc3d58f7 100644 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php +++ b/src/Monitors/WebhookDelivery/Event.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; +namespace ContextDev\Monitors\WebhookDelivery; /** * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php b/src/Monitors/WebhookDelivery/Status.php similarity index 84% rename from src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php rename to src/Monitors/WebhookDelivery/Status.php index af5edb34..bea34925 100644 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php +++ b/src/Monitors/WebhookDelivery/Status.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; +namespace ContextDev\Monitors\WebhookDelivery; /** * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. From 2eac331d854fbb1fef2b79b61b2786a36b92e56e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 07:56:58 +0000 Subject: [PATCH 050/130] feat(api): manual updates --- .stats.yml | 6 +- src/Client.php | 7 + src/Parse/ParseHandleParams.php | 243 ++++++++++++++++++ src/Parse/ParseHandleResponse.php | 146 +++++++++++ src/Parse/ParseHandleResponse/KeyMetadata.php | 92 +++++++ src/Parse/ParseHandleResponse/Type.php | 93 +++++++ src/ServiceContracts/ParseContract.php | 49 ++++ src/ServiceContracts/ParseRawContract.php | 35 +++ src/Services/ParseRawService.php | 76 ++++++ src/Services/ParseService.php | 87 +++++++ tests/Services/ParseTest.php | 46 ++++ 11 files changed, 877 insertions(+), 3 deletions(-) create mode 100644 src/Parse/ParseHandleParams.php create mode 100644 src/Parse/ParseHandleResponse.php create mode 100644 src/Parse/ParseHandleResponse/KeyMetadata.php create mode 100644 src/Parse/ParseHandleResponse/Type.php create mode 100644 src/ServiceContracts/ParseContract.php create mode 100644 src/ServiceContracts/ParseRawContract.php create mode 100644 src/Services/ParseRawService.php create mode 100644 src/Services/ParseService.php create mode 100644 tests/Services/ParseTest.php diff --git a/.stats.yml b/.stats.yml index 3d6d2e8c..1ba53488 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 29 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-27dde3a14459d2e2ade277b142906f33c1b9e04c05b91ae9eb10b798eb82eb0b.yml +configured_endpoints: 30 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c90f13e3cf4b9ae6a1d8f22c0e7285ab12d412d3a659a51a247a97adc7f08121.yml openapi_spec_hash: bf7879be38ebf3397a939c80b261a47a -config_hash: ff35e224e809656528c44163aa41bebd +config_hash: daabb160675d86b354711da1e77e5129 diff --git a/src/Client.php b/src/Client.php index 338af118..5e571861 100644 --- a/src/Client.php +++ b/src/Client.php @@ -11,6 +11,7 @@ use ContextDev\Services\BrandService; use ContextDev\Services\IndustryService; use ContextDev\Services\MonitorsService; +use ContextDev\Services\ParseService; use ContextDev\Services\UtilityService; use ContextDev\Services\WebService; use Http\Discovery\Psr17FactoryDiscovery; @@ -24,6 +25,11 @@ class Client extends BaseClient { public string $apiKey; + /** + * @api + */ + public ParseService $parse; + /** * @api */ @@ -112,6 +118,7 @@ public function __construct( options: $options ); + $this->parse = new ParseService($this); $this->web = new WebService($this); $this->ai = new AIService($this); $this->brand = new BrandService($this); diff --git a/src/Parse/ParseHandleParams.php b/src/Parse/ParseHandleParams.php new file mode 100644 index 00000000..c0bd5fd9 --- /dev/null +++ b/src/Parse/ParseHandleParams.php @@ -0,0 +1,243 @@ + */ + use SdkModel; + use SdkParams; + + /** + * Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted. + */ + #[Optional] + public ?string $baseURL; + + /** + * Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt. + */ + #[Optional] + public ?string $extension; + + /** + * Optional filename hint used to infer the extension when extension is omitted. + */ + #[Optional] + public ?string $filename; + + /** + * Include image references in Markdown output. + */ + #[Optional] + public ?bool $includeImages; + + /** + * Preserve hyperlinks in Markdown output. + */ + #[Optional] + public ?bool $includeLinks; + + /** + * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback. + */ + #[Optional] + public ?bool $ocr; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided. + */ + #[Optional] + public ?int $pdfEnd; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $pdfStart; + + /** + * Shorten base64-encoded image data in the Markdown output. + */ + #[Optional] + public ?bool $shortenBase64Images; + + /** + * Extract only the main content from HTML-like inputs. + */ + #[Optional] + public ?bool $useMainContentOnly; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $baseURL = null, + ?string $extension = null, + ?string $filename = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, + ?bool $ocr = null, + ?int $pdfEnd = null, + ?int $pdfStart = null, + ?bool $shortenBase64Images = null, + ?bool $useMainContentOnly = null, + ): self { + $self = new self; + + null !== $baseURL && $self['baseURL'] = $baseURL; + null !== $extension && $self['extension'] = $extension; + null !== $filename && $self['filename'] = $filename; + null !== $includeImages && $self['includeImages'] = $includeImages; + null !== $includeLinks && $self['includeLinks'] = $includeLinks; + null !== $ocr && $self['ocr'] = $ocr; + null !== $pdfEnd && $self['pdfEnd'] = $pdfEnd; + null !== $pdfStart && $self['pdfStart'] = $pdfStart; + null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted. + */ + public function withBaseURL(string $baseURL): self + { + $self = clone $this; + $self['baseURL'] = $baseURL; + + return $self; + } + + /** + * Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt. + */ + public function withExtension(string $extension): self + { + $self = clone $this; + $self['extension'] = $extension; + + return $self; + } + + /** + * Optional filename hint used to infer the extension when extension is omitted. + */ + public function withFilename(string $filename): self + { + $self = clone $this; + $self['filename'] = $filename; + + return $self; + } + + /** + * Include image references in Markdown output. + */ + public function withIncludeImages(bool $includeImages): self + { + $self = clone $this; + $self['includeImages'] = $includeImages; + + return $self; + } + + /** + * Preserve hyperlinks in Markdown output. + */ + public function withIncludeLinks(bool $includeLinks): self + { + $self = clone $this; + $self['includeLinks'] = $includeLinks; + + return $self; + } + + /** + * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback. + */ + public function withOcr(bool $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided. + */ + public function withPdfEnd(int $pdfEnd): self + { + $self = clone $this; + $self['pdfEnd'] = $pdfEnd; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withPdfStart(int $pdfStart): self + { + $self = clone $this; + $self['pdfStart'] = $pdfStart; + + return $self; + } + + /** + * Shorten base64-encoded image data in the Markdown output. + */ + public function withShortenBase64Images(bool $shortenBase64Images): self + { + $self = clone $this; + $self['shortenBase64Images'] = $shortenBase64Images; + + return $self; + } + + /** + * Extract only the main content from HTML-like inputs. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } +} diff --git a/src/Parse/ParseHandleResponse.php b/src/Parse/ParseHandleResponse.php new file mode 100644 index 00000000..7009ef8f --- /dev/null +++ b/src/Parse/ParseHandleResponse.php @@ -0,0 +1,146 @@ +, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class ParseHandleResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Input bytes converted to GitHub Flavored Markdown. + */ + #[Required] + public string $markdown; + + /** + * Indicates success. + */ + #[Required] + public bool $success; + + /** + * Detected content type used for parsing. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new ParseHandleResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ParseHandleResponse::with(markdown: ..., success: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ParseHandleResponse)->withMarkdown(...)->withSuccess(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + string $markdown, + bool $success, + Type|string $type, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['markdown'] = $markdown; + $self['success'] = $success; + $self['type'] = $type; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Input bytes converted to GitHub Flavored Markdown. + */ + public function withMarkdown(string $markdown): self + { + $self = clone $this; + $self['markdown'] = $markdown; + + return $self; + } + + /** + * Indicates success. + */ + public function withSuccess(bool $success): self + { + $self = clone $this; + $self['success'] = $success; + + return $self; + } + + /** + * Detected content type used for parsing. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Parse/ParseHandleResponse/KeyMetadata.php b/src/Parse/ParseHandleResponse/KeyMetadata.php new file mode 100644 index 00000000..4a274406 --- /dev/null +++ b/src/Parse/ParseHandleResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Parse/ParseHandleResponse/Type.php b/src/Parse/ParseHandleResponse/Type.php new file mode 100644 index 00000000..d18f8583 --- /dev/null +++ b/src/Parse/ParseHandleResponse/Type.php @@ -0,0 +1,93 @@ +|ParseHandleParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function handle( + string|FileParam $body, + array|ParseHandleParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/Services/ParseRawService.php b/src/Services/ParseRawService.php new file mode 100644 index 00000000..e711bb7a --- /dev/null +++ b/src/Services/ParseRawService.php @@ -0,0 +1,76 @@ + + * + * @throws APIException + */ + public function handle( + string|FileParam $body, + array|ParseHandleParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = ParseHandleParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'parse', + query: Util::array_transform_keys( + array_diff_key($parsed, array_flip(['body'])), + ['baseURL' => 'baseUrl'] + ), + headers: ['Content-Type' => 'application/octet-stream'], + body: $parsed, + options: $options, + convert: ParseHandleResponse::class, + ); + } +} diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php new file mode 100644 index 00000000..5505e925 --- /dev/null +++ b/src/Services/ParseService.php @@ -0,0 +1,87 @@ +raw = new ParseRawService($client); + } + + /** + * @api + * + * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. + * + * @param string|FileParam $body Body param + * @param string $baseURL Query param: Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted. + * @param string $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt + * @param string $filename query param: Optional filename hint used to infer the extension when extension is omitted + * @param bool $includeImages Query param: Include image references in Markdown output + * @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output + * @param bool $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback. + * @param int $pdfEnd Query param: Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided. + * @param int $pdfStart Query param: First 1-based PDF page to parse. When omitted, parsing starts at the first page. + * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output + * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function handle( + string|FileParam $body, + ?string $baseURL = null, + ?string $extension = null, + ?string $filename = null, + bool $includeImages = false, + bool $includeLinks = true, + bool $ocr = false, + ?int $pdfEnd = null, + ?int $pdfStart = null, + bool $shortenBase64Images = true, + bool $useMainContentOnly = false, + RequestOptions|array|null $requestOptions = null, + ): ParseHandleResponse { + $params = Util::removeNulls( + [ + 'baseURL' => $baseURL, + 'extension' => $extension, + 'filename' => $filename, + 'includeImages' => $includeImages, + 'includeLinks' => $includeLinks, + 'ocr' => $ocr, + 'pdfEnd' => $pdfEnd, + 'pdfStart' => $pdfStart, + 'shortenBase64Images' => $shortenBase64Images, + 'useMainContentOnly' => $useMainContentOnly, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->handle($body, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/tests/Services/ParseTest.php b/tests/Services/ParseTest.php new file mode 100644 index 00000000..65e9cebd --- /dev/null +++ b/tests/Services/ParseTest.php @@ -0,0 +1,46 @@ +client = $client; + } + + #[Test] + public function testHandle(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->parse->handle( + FileParam::fromString('Example data', filename: uniqid('file-upload-', true)), + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(ParseHandleResponse::class, $result); + } +} From 0629e95ea328d98de527a8aea7639b9e983e0731 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 07:59:31 +0000 Subject: [PATCH 051/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bfc26f9c..75ec52fc 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.2.0" + ".": "2.3.0" } \ No newline at end of file diff --git a/README.md b/README.md index a58ebc2e..2d896762 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.2.0" +composer require "context-dev/context-dev-php 2.3.0" ``` diff --git a/src/Client.php b/src/Client.php index 5e571861..3eb0752d 100644 --- a/src/Client.php +++ b/src/Client.php @@ -95,7 +95,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.2.0', + 'X-Stainless-Package-Version' => '2.3.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index d5e2aac8..2a0911d0 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.2.0'; +const VERSION = '2.3.0'; // x-release-please-end From a149f701f62e8bc3b0b602e839c44976288f4d46 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 19:47:26 +0000 Subject: [PATCH 052/130] feat(api): api update --- .stats.yml | 4 +- src/Parse/ParseHandleParams.php | 107 +++++---------- src/Parse/ParseHandleParams/Extension.php | 151 ++++++++++++++++++++++ src/Parse/ParseHandleParams/Pdf.php | 74 +++++++++++ src/ServiceContracts/ParseContract.php | 19 ++- src/Services/ParseRawService.php | 18 +-- src/Services/ParseService.php | 26 ++-- 7 files changed, 282 insertions(+), 117 deletions(-) create mode 100644 src/Parse/ParseHandleParams/Extension.php create mode 100644 src/Parse/ParseHandleParams/Pdf.php diff --git a/.stats.yml b/.stats.yml index 1ba53488..7cfdbbab 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c90f13e3cf4b9ae6a1d8f22c0e7285ab12d412d3a659a51a247a97adc7f08121.yml -openapi_spec_hash: bf7879be38ebf3397a939c80b261a47a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-fb56935a194e69348fecd985f7cf8b249795b46af2fb32f6c5c8ef648cf10c15.yml +openapi_spec_hash: 7260a560474283b7ad6ac5d426058ac9 config_hash: daabb160675d86b354711da1e77e5129 diff --git a/src/Parse/ParseHandleParams.php b/src/Parse/ParseHandleParams.php index c0bd5fd9..ca299545 100644 --- a/src/Parse/ParseHandleParams.php +++ b/src/Parse/ParseHandleParams.php @@ -8,21 +8,22 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Parse\ParseHandleParams\Extension; +use ContextDev\Parse\ParseHandleParams\Pdf; /** - * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. + * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. The base request costs 1 credit. When OCR runs (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no OCR ends up running still cost 1 credit. * * @see ContextDev\Services\ParseService::handle() * + * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf + * * @phpstan-type ParseHandleParamsShape = array{ - * baseURL?: string|null, - * extension?: string|null, - * filename?: string|null, + * extension?: null|Extension|value-of, * includeImages?: bool|null, * includeLinks?: bool|null, * ocr?: bool|null, - * pdfEnd?: int|null, - * pdfStart?: int|null, + * pdf?: null|Pdf|PdfShape, * shortenBase64Images?: bool|null, * useMainContentOnly?: bool|null, * } @@ -34,23 +35,13 @@ final class ParseHandleParams implements BaseModel use SdkParams; /** - * Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted. - */ - #[Optional] - public ?string $baseURL; - - /** - * Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt. + * Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). + * + * @var value-of|null $extension */ - #[Optional] + #[Optional(enum: Extension::class)] public ?string $extension; - /** - * Optional filename hint used to infer the extension when extension is omitted. - */ - #[Optional] - public ?string $filename; - /** * Include image references in Markdown output. */ @@ -64,22 +55,16 @@ final class ParseHandleParams implements BaseModel public ?bool $includeLinks; /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback. + * Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. */ #[Optional] public ?bool $ocr; /** - * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided. + * PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. */ #[Optional] - public ?int $pdfEnd; - - /** - * First 1-based PDF page to parse. When omitted, parsing starts at the first page. - */ - #[Optional] - public ?int $pdfStart; + public ?Pdf $pdf; /** * Shorten base64-encoded image data in the Markdown output. @@ -102,29 +87,26 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param Extension|value-of|null $extension + * @param Pdf|PdfShape|null $pdf */ public static function with( - ?string $baseURL = null, - ?string $extension = null, - ?string $filename = null, + Extension|string|null $extension = null, ?bool $includeImages = null, ?bool $includeLinks = null, ?bool $ocr = null, - ?int $pdfEnd = null, - ?int $pdfStart = null, + Pdf|array|null $pdf = null, ?bool $shortenBase64Images = null, ?bool $useMainContentOnly = null, ): self { $self = new self; - null !== $baseURL && $self['baseURL'] = $baseURL; null !== $extension && $self['extension'] = $extension; - null !== $filename && $self['filename'] = $filename; null !== $includeImages && $self['includeImages'] = $includeImages; null !== $includeLinks && $self['includeLinks'] = $includeLinks; null !== $ocr && $self['ocr'] = $ocr; - null !== $pdfEnd && $self['pdfEnd'] = $pdfEnd; - null !== $pdfStart && $self['pdfStart'] = $pdfStart; + null !== $pdf && $self['pdf'] = $pdf; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; @@ -132,20 +114,11 @@ public static function with( } /** - * Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted. - */ - public function withBaseURL(string $baseURL): self - { - $self = clone $this; - $self['baseURL'] = $baseURL; - - return $self; - } - - /** - * Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt. + * Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). + * + * @param Extension|value-of $extension */ - public function withExtension(string $extension): self + public function withExtension(Extension|string $extension): self { $self = clone $this; $self['extension'] = $extension; @@ -153,17 +126,6 @@ public function withExtension(string $extension): self return $self; } - /** - * Optional filename hint used to infer the extension when extension is omitted. - */ - public function withFilename(string $filename): self - { - $self = clone $this; - $self['filename'] = $filename; - - return $self; - } - /** * Include image references in Markdown output. */ @@ -187,7 +149,7 @@ public function withIncludeLinks(bool $includeLinks): self } /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback. + * Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. */ public function withOcr(bool $ocr): self { @@ -198,23 +160,14 @@ public function withOcr(bool $ocr): self } /** - * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided. - */ - public function withPdfEnd(int $pdfEnd): self - { - $self = clone $this; - $self['pdfEnd'] = $pdfEnd; - - return $self; - } - - /** - * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + * PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf */ - public function withPdfStart(int $pdfStart): self + public function withPdf(Pdf|array $pdf): self { $self = clone $this; - $self['pdfStart'] = $pdfStart; + $self['pdf'] = $pdf; return $self; } diff --git a/src/Parse/ParseHandleParams/Extension.php b/src/Parse/ParseHandleParams/Extension.php new file mode 100644 index 00000000..86293e90 --- /dev/null +++ b/src/Parse/ParseHandleParams/Extension.php @@ -0,0 +1,151 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?int $end = null, ?int $start = null): self + { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/ServiceContracts/ParseContract.php b/src/ServiceContracts/ParseContract.php index c46e149d..e6ca67b0 100644 --- a/src/ServiceContracts/ParseContract.php +++ b/src/ServiceContracts/ParseContract.php @@ -6,10 +6,13 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\FileParam; +use ContextDev\Parse\ParseHandleParams\Extension; +use ContextDev\Parse\ParseHandleParams\Pdf; use ContextDev\Parse\ParseHandleResponse; use ContextDev\RequestOptions; /** + * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface ParseContract @@ -18,14 +21,11 @@ interface ParseContract * @api * * @param string|FileParam $body Body param - * @param string $baseURL Query param: Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted. - * @param string $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt - * @param string $filename query param: Optional filename hint used to infer the extension when extension is omitted + * @param Extension|value-of $extension Query param: Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). * @param bool $includeImages Query param: Include image references in Markdown output * @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param bool $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback. - * @param int $pdfEnd Query param: Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided. - * @param int $pdfStart Query param: First 1-based PDF page to parse. When omitted, parsing starts at the first page. + * @param bool $ocr Query param: Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. + * @param Pdf|PdfShape $pdf Query param: PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param RequestOpts|null $requestOptions @@ -34,14 +34,11 @@ interface ParseContract */ public function handle( string|FileParam $body, - ?string $baseURL = null, - ?string $extension = null, - ?string $filename = null, + Extension|string|null $extension = null, bool $includeImages = false, bool $includeLinks = true, bool $ocr = false, - ?int $pdfEnd = null, - ?int $pdfStart = null, + Pdf|array $pdf = (object) [], bool $shortenBase64Images = true, bool $useMainContentOnly = false, RequestOptions|array|null $requestOptions = null, diff --git a/src/Services/ParseRawService.php b/src/Services/ParseRawService.php index e711bb7a..609c9ac5 100644 --- a/src/Services/ParseRawService.php +++ b/src/Services/ParseRawService.php @@ -8,13 +8,15 @@ use ContextDev\Core\Contracts\BaseResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\FileParam; -use ContextDev\Core\Util; use ContextDev\Parse\ParseHandleParams; +use ContextDev\Parse\ParseHandleParams\Extension; +use ContextDev\Parse\ParseHandleParams\Pdf; use ContextDev\Parse\ParseHandleResponse; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\ParseRawContract; /** + * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class ParseRawService implements ParseRawContract @@ -28,18 +30,15 @@ public function __construct(private Client $client) {} /** * @api * - * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. + * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. The base request costs 1 credit. When OCR runs (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no OCR ends up running still cost 1 credit. * * @param string|FileParam $body Body param * @param array{ - * baseURL?: string, - * extension?: string, - * filename?: string, + * extension?: value-of, * includeImages?: bool, * includeLinks?: bool, * ocr?: bool, - * pdfEnd?: int, - * pdfStart?: int, + * pdf?: Pdf|PdfShape, * shortenBase64Images?: bool, * useMainContentOnly?: bool, * }|ParseHandleParams $params @@ -63,10 +62,7 @@ public function handle( return $this->client->request( method: 'post', path: 'parse', - query: Util::array_transform_keys( - array_diff_key($parsed, array_flip(['body'])), - ['baseURL' => 'baseUrl'] - ), + query: array_diff_key($parsed, array_flip(['body'])), headers: ['Content-Type' => 'application/octet-stream'], body: $parsed, options: $options, diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php index 5505e925..fd44ca14 100644 --- a/src/Services/ParseService.php +++ b/src/Services/ParseService.php @@ -8,11 +8,14 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\FileParam; use ContextDev\Core\Util; +use ContextDev\Parse\ParseHandleParams\Extension; +use ContextDev\Parse\ParseHandleParams\Pdf; use ContextDev\Parse\ParseHandleResponse; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\ParseContract; /** + * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class ParseService implements ParseContract @@ -33,17 +36,14 @@ public function __construct(private Client $client) /** * @api * - * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. + * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. The base request costs 1 credit. When OCR runs (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no OCR ends up running still cost 1 credit. * * @param string|FileParam $body Body param - * @param string $baseURL Query param: Optional HTTP(S) source document URL used to resolve relative links and image references. Relative references remain relative when omitted. - * @param string $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt - * @param string $filename query param: Optional filename hint used to infer the extension when extension is omitted + * @param Extension|value-of $extension Query param: Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). * @param bool $includeImages Query param: Include image references in Markdown output * @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param bool $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdfStart/pdfEnd limit the inclusive page range. This is separate from automatic scanned-PDF OCR fallback. - * @param int $pdfEnd Query param: Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to pdfStart when both are provided. - * @param int $pdfStart Query param: First 1-based PDF page to parse. When omitted, parsing starts at the first page. + * @param bool $ocr Query param: Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. + * @param Pdf|PdfShape $pdf Query param: PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param RequestOpts|null $requestOptions @@ -52,28 +52,22 @@ public function __construct(private Client $client) */ public function handle( string|FileParam $body, - ?string $baseURL = null, - ?string $extension = null, - ?string $filename = null, + Extension|string|null $extension = null, bool $includeImages = false, bool $includeLinks = true, bool $ocr = false, - ?int $pdfEnd = null, - ?int $pdfStart = null, + Pdf|array $pdf = (object) [], bool $shortenBase64Images = true, bool $useMainContentOnly = false, RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse { $params = Util::removeNulls( [ - 'baseURL' => $baseURL, 'extension' => $extension, - 'filename' => $filename, 'includeImages' => $includeImages, 'includeLinks' => $includeLinks, 'ocr' => $ocr, - 'pdfEnd' => $pdfEnd, - 'pdfStart' => $pdfStart, + 'pdf' => $pdf, 'shortenBase64Images' => $shortenBase64Images, 'useMainContentOnly' => $useMainContentOnly, ], From 441f6aae22c9ef274025249836366725f3519552 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 12 Jul 2026 19:55:23 +0000 Subject: [PATCH 053/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 75ec52fc..b44b2870 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.3.0" + ".": "2.4.0" } \ No newline at end of file diff --git a/README.md b/README.md index 2d896762..6ab8d0a0 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.3.0" +composer require "context-dev/context-dev-php 2.4.0" ``` diff --git a/src/Client.php b/src/Client.php index 3eb0752d..24cf877e 100644 --- a/src/Client.php +++ b/src/Client.php @@ -95,7 +95,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.3.0', + 'X-Stainless-Package-Version' => '2.4.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 2a0911d0..3d8b9009 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.3.0'; +const VERSION = '2.4.0'; // x-release-please-end From 0dc33e74936f89c675e8febace67ac77ad98d344 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 13 Jul 2026 01:22:25 +0000 Subject: [PATCH 054/130] feat(api): api update --- .stats.yml | 4 +-- src/AI/AIExtractProductParams.php | 30 +++++++++++++++++- src/AI/AIExtractProductsParams.php | 26 +++++++++++++++ src/Brand/BrandRetrieveParams.php | 25 +++++++++++++++ src/Brand/BrandRetrieveSimplifiedParams.php | 32 +++++++++++++++++-- src/Industry/IndustryRetrieveNaicsParams.php | 26 +++++++++++++++ src/Industry/IndustryRetrieveSicParams.php | 25 +++++++++++++++ src/Parse/ParseHandleParams.php | 25 +++++++++++++++ src/ServiceContracts/AIContract.php | 4 +++ src/ServiceContracts/BrandContract.php | 4 +++ src/ServiceContracts/IndustryContract.php | 4 +++ src/ServiceContracts/ParseContract.php | 2 ++ src/ServiceContracts/UtilityContract.php | 2 ++ src/ServiceContracts/WebContract.php | 22 +++++++++++++ src/Services/AIRawService.php | 3 +- src/Services/AIService.php | 12 ++++++- src/Services/BrandRawService.php | 3 +- src/Services/BrandService.php | 12 ++++++- src/Services/IndustryRawService.php | 7 ++++- src/Services/IndustryService.php | 6 ++++ src/Services/ParseRawService.php | 1 + src/Services/ParseService.php | 3 ++ src/Services/UtilityRawService.php | 5 ++- src/Services/UtilityService.php | 9 +++++- src/Services/WebRawService.php | 17 ++++++++-- src/Services/WebService.php | 33 ++++++++++++++++++++ src/Utility/UtilityPrefetchParams.php | 29 ++++++++++++++++- src/Web/WebExtractCompetitorsParams.php | 32 +++++++++++++++++-- src/Web/WebExtractFontsParams.php | 26 +++++++++++++++ src/Web/WebExtractParams.php | 25 +++++++++++++++ src/Web/WebExtractStyleguideParams.php | 25 +++++++++++++++ src/Web/WebScreenshotParams.php | 25 +++++++++++++++ src/Web/WebSearchParams.php | 25 +++++++++++++++ src/Web/WebWebCrawlMdParams.php | 25 +++++++++++++++ src/Web/WebWebScrapeHTMLParams.php | 25 +++++++++++++++ src/Web/WebWebScrapeImagesParams.php | 25 +++++++++++++++ src/Web/WebWebScrapeMdParams.php | 25 +++++++++++++++ src/Web/WebWebScrapeSitemapParams.php | 25 +++++++++++++++ tests/Services/AITest.php | 4 ++- tests/Services/BrandTest.php | 4 ++- tests/Services/IndustryTest.php | 4 ++- tests/Services/UtilityTest.php | 3 +- tests/Services/WebTest.php | 10 +++++- 43 files changed, 657 insertions(+), 22 deletions(-) diff --git a/.stats.yml b/.stats.yml index 7cfdbbab..8e4b5605 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-fb56935a194e69348fecd985f7cf8b249795b46af2fb32f6c5c8ef648cf10c15.yml -openapi_spec_hash: 7260a560474283b7ad6ac5d426058ac9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-98c2abed2e726f7e5006cd4ef2ce9a56e84470d1fead500f7f3d46ed47f5af8b.yml +openapi_spec_hash: 921fc4db282f59e416e3c95d14d534f2 config_hash: daabb160675d86b354711da1e77e5129 diff --git a/src/AI/AIExtractProductParams.php b/src/AI/AIExtractProductParams.php index 52baa9b8..d0b275ea 100644 --- a/src/AI/AIExtractProductParams.php +++ b/src/AI/AIExtractProductParams.php @@ -16,7 +16,10 @@ * @see ContextDev\Services\AIService::extractProduct() * * @phpstan-type AIExtractProductParamsShape = array{ - * url: string, maxAgeMs?: int|null, timeoutMs?: int|null + * url: string, + * maxAgeMs?: int|null, + * tags?: list|null, + * timeoutMs?: int|null, * } */ final class AIExtractProductParams implements BaseModel @@ -37,6 +40,14 @@ final class AIExtractProductParams implements BaseModel #[Optional] public ?int $maxAgeMs; + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -66,10 +77,13 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags */ public static function with( string $url, ?int $maxAgeMs = null, + ?array $tags = null, ?int $timeoutMs = null ): self { $self = new self; @@ -77,6 +91,7 @@ public static function with( $self['url'] = $url; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -104,6 +119,19 @@ public function withMaxAgeMs(int $maxAgeMs): self return $self; } + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/AI/AIExtractProductsParams.php b/src/AI/AIExtractProductsParams.php index 06f62a88..d5b264f7 100644 --- a/src/AI/AIExtractProductsParams.php +++ b/src/AI/AIExtractProductsParams.php @@ -19,6 +19,7 @@ * domain: string, * maxAgeMs?: int|null, * maxProducts?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * directURL: string, * } @@ -47,6 +48,14 @@ final class AIExtractProductsParams implements BaseModel #[Optional] public ?int $maxProducts; + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -82,12 +91,15 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags */ public static function with( string $domain, string $directURL, ?int $maxAgeMs = null, ?int $maxProducts = null, + ?array $tags = null, ?int $timeoutMs = null, ): self { $self = new self; @@ -97,6 +109,7 @@ public static function with( null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $maxProducts && $self['maxProducts'] = $maxProducts; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -135,6 +148,19 @@ public function withMaxProducts(int $maxProducts): self return $self; } + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Brand/BrandRetrieveParams.php b/src/Brand/BrandRetrieveParams.php index 4d98ff97..45a66372 100644 --- a/src/Brand/BrandRetrieveParams.php +++ b/src/Brand/BrandRetrieveParams.php @@ -23,6 +23,7 @@ * forceLanguage?: null|ForceLanguage|value-of, * maxAgeMs?: int|null, * maxSpeed?: bool|null, + * tags?: list|null, * timeoutMs?: int|null, * name: string, * countryGl?: string|null, @@ -73,6 +74,14 @@ final class BrandRetrieveParams implements BaseModel #[Optional] public ?bool $maxSpeed; + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -186,6 +195,7 @@ public function __construct() * * @param Type|value-of $type * @param ForceLanguage|value-of|null $forceLanguage + * @param list|null $tags */ public static function with( string $domain, @@ -198,6 +208,7 @@ public static function with( ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, ?bool $maxSpeed = null, + ?array $tags = null, ?int $timeoutMs = null, ?string $countryGl = null, ?string $tickerExchange = null, @@ -219,6 +230,7 @@ public static function with( null !== $forceLanguage && $self['forceLanguage'] = $forceLanguage; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $maxSpeed && $self['maxSpeed'] = $maxSpeed; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $countryGl && $self['countryGl'] = $countryGl; null !== $tickerExchange && $self['tickerExchange'] = $tickerExchange; @@ -287,6 +299,19 @@ public function withMaxSpeed(bool $maxSpeed): self return $self; } + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Brand/BrandRetrieveSimplifiedParams.php b/src/Brand/BrandRetrieveSimplifiedParams.php index f1024911..1fd9175c 100644 --- a/src/Brand/BrandRetrieveSimplifiedParams.php +++ b/src/Brand/BrandRetrieveSimplifiedParams.php @@ -16,7 +16,10 @@ * @see ContextDev\Services\BrandService::retrieveSimplified() * * @phpstan-type BrandRetrieveSimplifiedParamsShape = array{ - * domain: string, maxAgeMs?: int|null, timeoutMs?: int|null + * domain: string, + * maxAgeMs?: int|null, + * tags?: list|null, + * timeoutMs?: int|null, * } */ final class BrandRetrieveSimplifiedParams implements BaseModel @@ -37,6 +40,14 @@ final class BrandRetrieveSimplifiedParams implements BaseModel #[Optional] public ?int $maxAgeMs; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -66,17 +77,21 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags */ public static function with( string $domain, ?int $maxAgeMs = null, - ?int $timeoutMs = null + ?array $tags = null, + ?int $timeoutMs = null, ): self { $self = new self; $self['domain'] = $domain; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -104,6 +119,19 @@ public function withMaxAgeMs(int $maxAgeMs): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Industry/IndustryRetrieveNaicsParams.php b/src/Industry/IndustryRetrieveNaicsParams.php index cdc69a68..250a24b3 100644 --- a/src/Industry/IndustryRetrieveNaicsParams.php +++ b/src/Industry/IndustryRetrieveNaicsParams.php @@ -19,6 +19,7 @@ * input: string, * maxResults?: int|null, * minResults?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * } */ @@ -46,6 +47,14 @@ final class IndustryRetrieveNaicsParams implements BaseModel #[Optional] public ?int $minResults; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -75,11 +84,14 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags */ public static function with( string $input, ?int $maxResults = null, ?int $minResults = null, + ?array $tags = null, ?int $timeoutMs = null, ): self { $self = new self; @@ -88,6 +100,7 @@ public static function with( null !== $maxResults && $self['maxResults'] = $maxResults; null !== $minResults && $self['minResults'] = $minResults; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -126,6 +139,19 @@ public function withMinResults(int $minResults): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Industry/IndustryRetrieveSicParams.php b/src/Industry/IndustryRetrieveSicParams.php index 97aece5f..be461f4c 100644 --- a/src/Industry/IndustryRetrieveSicParams.php +++ b/src/Industry/IndustryRetrieveSicParams.php @@ -20,6 +20,7 @@ * input: string, * maxResults?: int|null, * minResults?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * type?: null|Type|value-of, * } @@ -48,6 +49,14 @@ final class IndustryRetrieveSicParams implements BaseModel #[Optional] public ?int $minResults; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -86,12 +95,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param list|null $tags * @param Type|value-of|null $type */ public static function with( string $input, ?int $maxResults = null, ?int $minResults = null, + ?array $tags = null, ?int $timeoutMs = null, Type|string|null $type = null, ): self { @@ -101,6 +112,7 @@ public static function with( null !== $maxResults && $self['maxResults'] = $maxResults; null !== $minResults && $self['minResults'] = $minResults; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $type && $self['type'] = $type; @@ -140,6 +152,19 @@ public function withMinResults(int $minResults): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Parse/ParseHandleParams.php b/src/Parse/ParseHandleParams.php index ca299545..9d9bccae 100644 --- a/src/Parse/ParseHandleParams.php +++ b/src/Parse/ParseHandleParams.php @@ -25,6 +25,7 @@ * ocr?: bool|null, * pdf?: null|Pdf|PdfShape, * shortenBase64Images?: bool|null, + * tags?: list|null, * useMainContentOnly?: bool|null, * } */ @@ -72,6 +73,14 @@ final class ParseHandleParams implements BaseModel #[Optional] public ?bool $shortenBase64Images; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Extract only the main content from HTML-like inputs. */ @@ -90,6 +99,7 @@ public function __construct() * * @param Extension|value-of|null $extension * @param Pdf|PdfShape|null $pdf + * @param list|null $tags */ public static function with( Extension|string|null $extension = null, @@ -98,6 +108,7 @@ public static function with( ?bool $ocr = null, Pdf|array|null $pdf = null, ?bool $shortenBase64Images = null, + ?array $tags = null, ?bool $useMainContentOnly = null, ): self { $self = new self; @@ -108,6 +119,7 @@ public static function with( null !== $ocr && $self['ocr'] = $ocr; null !== $pdf && $self['pdf'] = $pdf; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $tags && $self['tags'] = $tags; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; return $self; @@ -183,6 +195,19 @@ public function withShortenBase64Images(bool $shortenBase64Images): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Extract only the main content from HTML-like inputs. */ diff --git a/src/ServiceContracts/AIContract.php b/src/ServiceContracts/AIContract.php index 87465152..b451592b 100644 --- a/src/ServiceContracts/AIContract.php +++ b/src/ServiceContracts/AIContract.php @@ -19,6 +19,7 @@ interface AIContract * * @param string $url the product page URL to extract product data from * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -27,6 +28,7 @@ interface AIContract public function extractProduct( string $url, int $maxAgeMs = 604800000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): AIExtractProductResponse; @@ -38,6 +40,7 @@ public function extractProduct( * @param string $directURL a specific URL to use directly as the starting point for extraction without domain resolution * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param int $maxProducts maximum number of products to extract + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -48,6 +51,7 @@ public function extractProducts( string $directURL, int $maxAgeMs = 604800000, ?int $maxProducts = null, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): AIExtractProductsResponse; diff --git a/src/ServiceContracts/BrandContract.php b/src/ServiceContracts/BrandContract.php index ca83c911..f607add4 100644 --- a/src/ServiceContracts/BrandContract.php +++ b/src/ServiceContracts/BrandContract.php @@ -29,6 +29,7 @@ interface BrandContract * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. @@ -51,6 +52,7 @@ public function retrieve( ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, ?bool $maxSpeed = null, + ?array $tags = null, ?int $timeoutMs = null, ?string $countryGl = null, ?string $tickerExchange = null, @@ -66,6 +68,7 @@ public function retrieve( * * @param string $domain Domain name to retrieve simplified brand data for * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -74,6 +77,7 @@ public function retrieve( public function retrieveSimplified( string $domain, int $maxAgeMs = 7776000000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): BrandGetSimplifiedResponse; diff --git a/src/ServiceContracts/IndustryContract.php b/src/ServiceContracts/IndustryContract.php index ebfb48c1..6a61aaf1 100644 --- a/src/ServiceContracts/IndustryContract.php +++ b/src/ServiceContracts/IndustryContract.php @@ -21,6 +21,7 @@ interface IndustryContract * @param string $input Brand domain or title to retrieve NAICS code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. * @param int $maxResults Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults to 5. * @param int $minResults Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -30,6 +31,7 @@ public function retrieveNaics( string $input, int $maxResults = 5, int $minResults = 1, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): IndustryGetNaicsResponse; @@ -40,6 +42,7 @@ public function retrieveNaics( * @param string $input Brand domain or title to retrieve SIC code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. * @param int $maxResults Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. * @param int $minResults Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Type|value-of $type Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`. * @param RequestOpts|null $requestOptions @@ -50,6 +53,7 @@ public function retrieveSic( string $input, int $maxResults = 5, int $minResults = 1, + ?array $tags = null, ?int $timeoutMs = null, Type|string $type = 'original_sic', RequestOptions|array|null $requestOptions = null, diff --git a/src/ServiceContracts/ParseContract.php b/src/ServiceContracts/ParseContract.php index e6ca67b0..096ed3b2 100644 --- a/src/ServiceContracts/ParseContract.php +++ b/src/ServiceContracts/ParseContract.php @@ -27,6 +27,7 @@ interface ParseContract * @param bool $ocr Query param: Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. * @param Pdf|PdfShape $pdf Query param: PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output + * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param RequestOpts|null $requestOptions * @@ -40,6 +41,7 @@ public function handle( bool $ocr = false, Pdf|array $pdf = (object) [], bool $shortenBase64Images = true, + ?array $tags = null, bool $useMainContentOnly = false, RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse; diff --git a/src/ServiceContracts/UtilityContract.php b/src/ServiceContracts/UtilityContract.php index 64ca1adc..c3181997 100644 --- a/src/ServiceContracts/UtilityContract.php +++ b/src/ServiceContracts/UtilityContract.php @@ -22,6 +22,7 @@ interface UtilityContract * * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -30,6 +31,7 @@ interface UtilityContract public function prefetch( UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, Type|string $type, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): UtilityPrefetchResponse; diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 0a6c2e79..5fb83190 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -54,6 +54,7 @@ interface WebContract * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. * @param Pdf|PdfShape $pdf * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page * @param RequestOpts|null $requestOptions @@ -72,6 +73,7 @@ public function extract( int $maxPages = 5, Pdf|array $pdf = ['shouldParse' => true], int $stopAfterMs = 80000, + ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, @@ -82,6 +84,7 @@ public function extract( * * @param string $domain Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted and normalized to their domain. * @param int $numCompetitors Exact number of direct competitors to return. Defaults to 5. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -90,6 +93,7 @@ public function extract( public function extractCompetitors( string $domain, int $numCompetitors = 5, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebExtractCompetitorsResponse; @@ -100,6 +104,7 @@ public function extractCompetitors( * @param string $directURL A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -109,6 +114,7 @@ public function extractFonts( ?string $directURL = null, ?string $domain = null, int $maxAgeMs = 7776000000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebExtractFontsResponse; @@ -120,6 +126,7 @@ public function extractFonts( * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -130,6 +137,7 @@ public function extractStyleguide( ?string $directURL = null, ?string $domain = null, int $maxAgeMs = 7776000000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebExtractStyleguideResponse; @@ -146,6 +154,7 @@ public function extractStyleguide( * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. @@ -163,6 +172,7 @@ public function screenshot( int $maxAgeMs = 86400000, Page|string|null $page = null, ?int $scrollOffset = null, + ?array $tags = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], int $waitForMs = 3000, @@ -180,6 +190,7 @@ public function screenshot( * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. * @param int $numResults Number of results to request and return (10–100). Defaults to 10. * @param bool $queryFanout expand the query into multiple parallel variants for broader recall + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -194,6 +205,7 @@ public function search( MarkdownOptions|array|null $markdownOptions = null, int $numResults = 10, ?bool $queryFanout = null, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebSearchResponse; @@ -216,6 +228,7 @@ public function search( * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation @@ -242,6 +255,7 @@ public function webCrawlMd( bool $settleAnimations = false, bool $shortenBase64Images = true, int $stopAfterMs = 80000, + ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, bool $useMainContentOnly = false, @@ -261,6 +275,7 @@ public function webCrawlMd( * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). @@ -280,6 +295,7 @@ public function webScrapeHTML( 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, + ?array $tags = null, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -294,6 +310,7 @@ public function webScrapeHTML( * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions @@ -306,6 +323,7 @@ public function webScrapeImages( Enrichment|array|null $enrichment = null, ?array $headers = null, int $maxAgeMs = 86400000, + ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, @@ -326,6 +344,7 @@ public function webScrapeImages( * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). @@ -348,6 +367,7 @@ public function webScrapeMd( ], bool $settleAnimations = false, bool $shortenBase64Images = true, + ?array $tags = null, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -360,6 +380,7 @@ public function webScrapeMd( * @param string $domain Domain to build a sitemap for * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. * @param RequestOpts|null $requestOptions @@ -370,6 +391,7 @@ public function webScrapeSitemap( string $domain, ?array $headers = null, int $maxLinks = 10000, + ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, RequestOptions|array|null $requestOptions = null, diff --git a/src/Services/AIRawService.php b/src/Services/AIRawService.php index cb6349ea..57b7f742 100644 --- a/src/Services/AIRawService.php +++ b/src/Services/AIRawService.php @@ -31,7 +31,7 @@ public function __construct(private Client $client) {} * Given a single URL, determines if it is a product page and extracts the product information. * * @param array{ - * url: string, maxAgeMs?: int, timeoutMs?: int + * url: string, maxAgeMs?: int, tags?: list, timeoutMs?: int * }|AIExtractProductParams $params * @param RequestOpts|null $requestOptions * @@ -67,6 +67,7 @@ public function extractProduct( * domain: string, * maxAgeMs?: int, * maxProducts?: int, + * tags?: list, * timeoutMs?: int, * directURL: string, * }|AIExtractProductsParams $params diff --git a/src/Services/AIService.php b/src/Services/AIService.php index 62949acc..ec959d40 100644 --- a/src/Services/AIService.php +++ b/src/Services/AIService.php @@ -37,6 +37,7 @@ public function __construct(private Client $client) * * @param string $url the product page URL to extract product data from * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -45,11 +46,17 @@ public function __construct(private Client $client) public function extractProduct( string $url, int $maxAgeMs = 604800000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): AIExtractProductResponse { $params = Util::removeNulls( - ['url' => $url, 'maxAgeMs' => $maxAgeMs, 'timeoutMs' => $timeoutMs] + [ + 'url' => $url, + 'maxAgeMs' => $maxAgeMs, + 'tags' => $tags, + 'timeoutMs' => $timeoutMs, + ], ); // @phpstan-ignore-next-line argument.type @@ -67,6 +74,7 @@ public function extractProduct( * @param string $directURL a specific URL to use directly as the starting point for extraction without domain resolution * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param int $maxProducts maximum number of products to extract + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -77,6 +85,7 @@ public function extractProducts( string $directURL, int $maxAgeMs = 604800000, ?int $maxProducts = null, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): AIExtractProductsResponse { @@ -85,6 +94,7 @@ public function extractProducts( 'domain' => $domain, 'maxAgeMs' => $maxAgeMs, 'maxProducts' => $maxProducts, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'directURL' => $directURL, ], diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index b0f6c263..d2c63f88 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -39,6 +39,7 @@ public function __construct(private Client $client) {} * forceLanguage?: value-of, * maxAgeMs?: int, * maxSpeed?: bool, + * tags?: list, * timeoutMs?: int, * name: string, * countryGl?: string, @@ -83,7 +84,7 @@ public function retrieve( * Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. Optimized for faster responses and reduced data transfer. * * @param array{ - * domain: string, maxAgeMs?: int, timeoutMs?: int + * domain: string, maxAgeMs?: int, tags?: list, timeoutMs?: int * }|BrandRetrieveSimplifiedParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index 63e08abc..a8e38e22 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -47,6 +47,7 @@ public function __construct(private Client $client) * @param ForceLanguage|value-of $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. @@ -69,6 +70,7 @@ public function retrieve( ForceLanguage|string|null $forceLanguage = null, ?int $maxAgeMs = null, ?bool $maxSpeed = null, + ?array $tags = null, ?int $timeoutMs = null, ?string $countryGl = null, ?string $tickerExchange = null, @@ -85,6 +87,7 @@ public function retrieve( 'forceLanguage' => $forceLanguage, 'maxAgeMs' => $maxAgeMs, 'maxSpeed' => $maxSpeed, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'name' => $name, 'countryGl' => $countryGl, @@ -113,6 +116,7 @@ public function retrieve( * * @param string $domain Domain name to retrieve simplified brand data for * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -121,11 +125,17 @@ public function retrieve( public function retrieveSimplified( string $domain, int $maxAgeMs = 7776000000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): BrandGetSimplifiedResponse { $params = Util::removeNulls( - ['domain' => $domain, 'maxAgeMs' => $maxAgeMs, 'timeoutMs' => $timeoutMs] + [ + 'domain' => $domain, + 'maxAgeMs' => $maxAgeMs, + 'tags' => $tags, + 'timeoutMs' => $timeoutMs, + ], ); // @phpstan-ignore-next-line argument.type diff --git a/src/Services/IndustryRawService.php b/src/Services/IndustryRawService.php index 9613d743..56ba568f 100644 --- a/src/Services/IndustryRawService.php +++ b/src/Services/IndustryRawService.php @@ -33,7 +33,11 @@ public function __construct(private Client $client) {} * Classify any brand into 2022 NAICS industry codes from its domain or name. * * @param array{ - * input: string, maxResults?: int, minResults?: int, timeoutMs?: int + * input: string, + * maxResults?: int, + * minResults?: int, + * tags?: list, + * timeoutMs?: int, * }|IndustryRetrieveNaicsParams $params * @param RequestOpts|null $requestOptions * @@ -69,6 +73,7 @@ public function retrieveNaics( * input: string, * maxResults?: int, * minResults?: int, + * tags?: list, * timeoutMs?: int, * type?: Type|value-of, * }|IndustryRetrieveSicParams $params diff --git a/src/Services/IndustryService.php b/src/Services/IndustryService.php index 47d6a851..3aea60d0 100644 --- a/src/Services/IndustryService.php +++ b/src/Services/IndustryService.php @@ -39,6 +39,7 @@ public function __construct(private Client $client) * @param string $input Brand domain or title to retrieve NAICS code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. * @param int $maxResults Maximum number of NAICS codes to return. Must be between 1 and 10. Defaults to 5. * @param int $minResults Minimum number of NAICS codes to return. Must be at least 1. Defaults to 1. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -48,6 +49,7 @@ public function retrieveNaics( string $input, int $maxResults = 5, int $minResults = 1, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): IndustryGetNaicsResponse { @@ -56,6 +58,7 @@ public function retrieveNaics( 'input' => $input, 'maxResults' => $maxResults, 'minResults' => $minResults, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, ], ); @@ -74,6 +77,7 @@ public function retrieveNaics( * @param string $input Brand domain or title to retrieve SIC code for. If a valid domain is provided, it will be used for classification, otherwise, we will search for the brand using the provided title. * @param int $maxResults Maximum number of SIC codes to return. Must be between 1 and 10. Defaults to 5. * @param int $minResults Minimum number of SIC codes to return. Must be at least 1. Defaults to 1. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Type|value-of $type Which SIC dataset to classify against. `original_sic` uses the 1987 Standard Industrial Classification system; `latest_sec` uses the current SIC list as published by the SEC. Defaults to `original_sic`. * @param RequestOpts|null $requestOptions @@ -84,6 +88,7 @@ public function retrieveSic( string $input, int $maxResults = 5, int $minResults = 1, + ?array $tags = null, ?int $timeoutMs = null, Type|string $type = 'original_sic', RequestOptions|array|null $requestOptions = null, @@ -93,6 +98,7 @@ public function retrieveSic( 'input' => $input, 'maxResults' => $maxResults, 'minResults' => $minResults, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'type' => $type, ], diff --git a/src/Services/ParseRawService.php b/src/Services/ParseRawService.php index 609c9ac5..1fe132de 100644 --- a/src/Services/ParseRawService.php +++ b/src/Services/ParseRawService.php @@ -40,6 +40,7 @@ public function __construct(private Client $client) {} * ocr?: bool, * pdf?: Pdf|PdfShape, * shortenBase64Images?: bool, + * tags?: list, * useMainContentOnly?: bool, * }|ParseHandleParams $params * @param RequestOpts|null $requestOptions diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php index fd44ca14..0ff57bed 100644 --- a/src/Services/ParseService.php +++ b/src/Services/ParseService.php @@ -45,6 +45,7 @@ public function __construct(private Client $client) * @param bool $ocr Query param: Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. * @param Pdf|PdfShape $pdf Query param: PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output + * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param RequestOpts|null $requestOptions * @@ -58,6 +59,7 @@ public function handle( bool $ocr = false, Pdf|array $pdf = (object) [], bool $shortenBase64Images = true, + ?array $tags = null, bool $useMainContentOnly = false, RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse { @@ -69,6 +71,7 @@ public function handle( 'ocr' => $ocr, 'pdf' => $pdf, 'shortenBase64Images' => $shortenBase64Images, + 'tags' => $tags, 'useMainContentOnly' => $useMainContentOnly, ], ); diff --git a/src/Services/UtilityRawService.php b/src/Services/UtilityRawService.php index 7030cadf..1b10d93c 100644 --- a/src/Services/UtilityRawService.php +++ b/src/Services/UtilityRawService.php @@ -31,7 +31,10 @@ public function __construct(private Client $client) {} * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * * @param array{ - * identifier: IdentifierShape, type: Type|value-of, timeoutMs?: int + * identifier: IdentifierShape, + * type: Type|value-of, + * tags?: list, + * timeoutMs?: int, * }|UtilityPrefetchParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php index 8ea4db95..17e59a6b 100644 --- a/src/Services/UtilityService.php +++ b/src/Services/UtilityService.php @@ -40,6 +40,7 @@ public function __construct(private Client $client) * * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -48,11 +49,17 @@ public function __construct(private Client $client) public function prefetch( UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, Type|string $type, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): UtilityPrefetchResponse { $params = Util::removeNulls( - ['identifier' => $identifier, 'type' => $type, 'timeoutMs' => $timeoutMs] + [ + 'identifier' => $identifier, + 'type' => $type, + 'tags' => $tags, + 'timeoutMs' => $timeoutMs, + ], ); // @phpstan-ignore-next-line argument.type diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index a7eec12a..741b92f8 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -78,6 +78,7 @@ public function __construct(private Client $client) {} * maxPages?: int, * pdf?: Pdf|PdfShape, * stopAfterMs?: int, + * tags?: list, * timeoutMs?: int, * waitForMs?: int, * }|WebExtractParams $params @@ -112,7 +113,7 @@ public function extract( * Analyze a company's landing page and web search evidence to return direct competitors for the same product or market. * * @param array{ - * domain: string, numCompetitors?: int, timeoutMs?: int + * domain: string, numCompetitors?: int, tags?: list, timeoutMs?: int * }|WebExtractCompetitorsParams $params * @param RequestOpts|null $requestOptions * @@ -145,7 +146,11 @@ public function extractCompetitors( * Scrape font information from a website including font families, usage statistics, fallbacks, and element/word counts. * * @param array{ - * directURL?: string, domain?: string, maxAgeMs?: int, timeoutMs?: int + * directURL?: string, + * domain?: string, + * maxAgeMs?: int, + * tags?: list, + * timeoutMs?: int, * }|WebExtractFontsParams $params * @param RequestOpts|null $requestOptions * @@ -185,6 +190,7 @@ public function extractFonts( * directURL?: string, * domain?: string, * maxAgeMs?: int, + * tags?: list, * timeoutMs?: int, * }|WebExtractStyleguideParams $params * @param RequestOpts|null $requestOptions @@ -230,6 +236,7 @@ public function extractStyleguide( * maxAgeMs?: int, * page?: Page|value-of, * scrollOffset?: int, + * tags?: list, * timeoutMs?: int, * viewport?: Viewport|ViewportShape, * waitForMs?: int, @@ -276,6 +283,7 @@ public function screenshot( * markdownOptions?: MarkdownOptions|MarkdownOptionsShape, * numResults?: int, * queryFanout?: bool, + * tags?: list, * timeoutMs?: int, * }|WebSearchParams $params * @param RequestOpts|null $requestOptions @@ -324,6 +332,7 @@ public function search( * settleAnimations?: bool, * shortenBase64Images?: bool, * stopAfterMs?: int, + * tags?: list, * timeoutMs?: int, * urlRegex?: string, * useMainContentOnly?: bool, @@ -369,6 +378,7 @@ public function webCrawlMd( * maxAgeMs?: int, * pdf?: WebWebScrapeHTMLParams\Pdf|PdfShape2, * settleAnimations?: bool, + * tags?: list, * timeoutMs?: int, * useMainContentOnly?: bool, * waitForMs?: int, @@ -409,6 +419,7 @@ public function webScrapeHTML( * enrichment?: Enrichment|EnrichmentShape, * headers?: array, * maxAgeMs?: int, + * tags?: list, * timeoutMs?: int, * waitForMs?: int, * }|WebWebScrapeImagesParams $params @@ -468,6 +479,7 @@ public function webScrapeImages( * pdf?: WebWebScrapeMdParams\Pdf|PdfShape3, * settleAnimations?: bool, * shortenBase64Images?: bool, + * tags?: list, * timeoutMs?: int, * useMainContentOnly?: bool, * waitForMs?: int, @@ -506,6 +518,7 @@ public function webScrapeMd( * domain: string, * headers?: array, * maxLinks?: int, + * tags?: list, * timeoutMs?: int, * urlRegex?: string, * }|WebWebScrapeSitemapParams $params diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 4331ee82..ec22e32f 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -72,6 +72,7 @@ public function __construct(private Client $client) * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. * @param Pdf|PdfShape $pdf * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page * @param RequestOpts|null $requestOptions @@ -90,6 +91,7 @@ public function extract( int $maxPages = 5, Pdf|array $pdf = ['shouldParse' => true], int $stopAfterMs = 80000, + ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, @@ -107,6 +109,7 @@ public function extract( 'maxPages' => $maxPages, 'pdf' => $pdf, 'stopAfterMs' => $stopAfterMs, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'waitForMs' => $waitForMs, ], @@ -125,6 +128,7 @@ public function extract( * * @param string $domain Company domain to analyze, such as `stripe.com`. Full http(s) URLs are accepted and normalized to their domain. * @param int $numCompetitors Exact number of direct competitors to return. Defaults to 5. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -133,6 +137,7 @@ public function extract( public function extractCompetitors( string $domain, int $numCompetitors = 5, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebExtractCompetitorsResponse { @@ -140,6 +145,7 @@ public function extractCompetitors( [ 'domain' => $domain, 'numCompetitors' => $numCompetitors, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, ], ); @@ -158,6 +164,7 @@ public function extractCompetitors( * @param string $directURL A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -167,6 +174,7 @@ public function extractFonts( ?string $directURL = null, ?string $domain = null, int $maxAgeMs = 7776000000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebExtractFontsResponse { @@ -175,6 +183,7 @@ public function extractFonts( 'directURL' => $directURL, 'domain' => $domain, 'maxAgeMs' => $maxAgeMs, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, ], ); @@ -194,6 +203,7 @@ public function extractFonts( * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -204,6 +214,7 @@ public function extractStyleguide( ?string $directURL = null, ?string $domain = null, int $maxAgeMs = 7776000000, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebExtractStyleguideResponse { @@ -213,6 +224,7 @@ public function extractStyleguide( 'directURL' => $directURL, 'domain' => $domain, 'maxAgeMs' => $maxAgeMs, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, ], ); @@ -237,6 +249,7 @@ public function extractStyleguide( * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. @@ -254,6 +267,7 @@ public function screenshot( int $maxAgeMs = 86400000, Page|string|null $page = null, ?int $scrollOffset = null, + ?array $tags = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], int $waitForMs = 3000, @@ -270,6 +284,7 @@ public function screenshot( 'maxAgeMs' => $maxAgeMs, 'page' => $page, 'scrollOffset' => $scrollOffset, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'viewport' => $viewport, 'waitForMs' => $waitForMs, @@ -295,6 +310,7 @@ public function screenshot( * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. * @param int $numResults Number of results to request and return (10–100). Defaults to 10. * @param bool $queryFanout expand the query into multiple parallel variants for broader recall + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -309,6 +325,7 @@ public function search( MarkdownOptions|array|null $markdownOptions = null, int $numResults = 10, ?bool $queryFanout = null, + ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): WebSearchResponse { @@ -322,6 +339,7 @@ public function search( 'markdownOptions' => $markdownOptions, 'numResults' => $numResults, 'queryFanout' => $queryFanout, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, ], ); @@ -352,6 +370,7 @@ public function search( * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation @@ -378,6 +397,7 @@ public function webCrawlMd( bool $settleAnimations = false, bool $shortenBase64Images = true, int $stopAfterMs = 80000, + ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, bool $useMainContentOnly = false, @@ -401,6 +421,7 @@ public function webCrawlMd( 'settleAnimations' => $settleAnimations, 'shortenBase64Images' => $shortenBase64Images, 'stopAfterMs' => $stopAfterMs, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'urlRegex' => $urlRegex, 'useMainContentOnly' => $useMainContentOnly, @@ -428,6 +449,7 @@ public function webCrawlMd( * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). @@ -447,6 +469,7 @@ public function webScrapeHTML( 'shouldParse' => true, 'ocr' => false, ], bool $settleAnimations = false, + ?array $tags = null, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -463,6 +486,7 @@ public function webScrapeHTML( 'maxAgeMs' => $maxAgeMs, 'pdf' => $pdf, 'settleAnimations' => $settleAnimations, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, 'waitForMs' => $waitForMs, @@ -485,6 +509,7 @@ public function webScrapeHTML( * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions @@ -497,6 +522,7 @@ public function webScrapeImages( Enrichment|array|null $enrichment = null, ?array $headers = null, int $maxAgeMs = 86400000, + ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, @@ -508,6 +534,7 @@ public function webScrapeImages( 'enrichment' => $enrichment, 'headers' => $headers, 'maxAgeMs' => $maxAgeMs, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'waitForMs' => $waitForMs, ], @@ -549,6 +576,7 @@ public function webScrapeImages( * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). @@ -571,6 +599,7 @@ public function webScrapeMd( ], bool $settleAnimations = false, bool $shortenBase64Images = true, + ?array $tags = null, ?int $timeoutMs = null, bool $useMainContentOnly = false, ?int $waitForMs = null, @@ -590,6 +619,7 @@ public function webScrapeMd( 'pdf' => $pdf, 'settleAnimations' => $settleAnimations, 'shortenBase64Images' => $shortenBase64Images, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, 'waitForMs' => $waitForMs, @@ -610,6 +640,7 @@ public function webScrapeMd( * @param string $domain Domain to build a sitemap for * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. * @param RequestOpts|null $requestOptions @@ -620,6 +651,7 @@ public function webScrapeSitemap( string $domain, ?array $headers = null, int $maxLinks = 10000, + ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, RequestOptions|array|null $requestOptions = null, @@ -629,6 +661,7 @@ public function webScrapeSitemap( 'domain' => $domain, 'headers' => $headers, 'maxLinks' => $maxLinks, + 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'urlRegex' => $urlRegex, ], diff --git a/src/Utility/UtilityPrefetchParams.php b/src/Utility/UtilityPrefetchParams.php index 0082269d..dfdb9134 100644 --- a/src/Utility/UtilityPrefetchParams.php +++ b/src/Utility/UtilityPrefetchParams.php @@ -22,7 +22,10 @@ * @phpstan-import-type IdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier * * @phpstan-type UtilityPrefetchParamsShape = array{ - * identifier: IdentifierShape, type: Type|value-of, timeoutMs?: int|null + * identifier: IdentifierShape, + * type: Type|value-of, + * tags?: list|null, + * timeoutMs?: int|null, * } */ final class UtilityPrefetchParams implements BaseModel @@ -47,6 +50,14 @@ final class UtilityPrefetchParams implements BaseModel #[Required(enum: Type::class)] public string $type; + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -79,10 +90,12 @@ public function __construct() * * @param IdentifierShape $identifier * @param Type|value-of $type + * @param list|null $tags */ public static function with( UtilityPrefetchDomainIdentifier|array|UtilityPrefetchEmailIdentifier $identifier, Type|string $type, + ?array $tags = null, ?int $timeoutMs = null, ): self { $self = new self; @@ -90,6 +103,7 @@ public static function with( $self['identifier'] = $identifier; $self['type'] = $type; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -122,6 +136,19 @@ public function withType(Type|string $type): self return $self; } + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebExtractCompetitorsParams.php b/src/Web/WebExtractCompetitorsParams.php index fe4f94b7..547ed130 100644 --- a/src/Web/WebExtractCompetitorsParams.php +++ b/src/Web/WebExtractCompetitorsParams.php @@ -16,7 +16,10 @@ * @see ContextDev\Services\WebService::extractCompetitors() * * @phpstan-type WebExtractCompetitorsParamsShape = array{ - * domain: string, numCompetitors?: int|null, timeoutMs?: int|null + * domain: string, + * numCompetitors?: int|null, + * tags?: list|null, + * timeoutMs?: int|null, * } */ final class WebExtractCompetitorsParams implements BaseModel @@ -37,6 +40,14 @@ final class WebExtractCompetitorsParams implements BaseModel #[Optional] public ?int $numCompetitors; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -66,17 +77,21 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags */ public static function with( string $domain, ?int $numCompetitors = null, - ?int $timeoutMs = null + ?array $tags = null, + ?int $timeoutMs = null, ): self { $self = new self; $self['domain'] = $domain; null !== $numCompetitors && $self['numCompetitors'] = $numCompetitors; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -104,6 +119,19 @@ public function withNumCompetitors(int $numCompetitors): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebExtractFontsParams.php b/src/Web/WebExtractFontsParams.php index e8e51d16..18f9a3da 100644 --- a/src/Web/WebExtractFontsParams.php +++ b/src/Web/WebExtractFontsParams.php @@ -18,6 +18,7 @@ * directURL?: string|null, * domain?: string|null, * maxAgeMs?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * } */ @@ -45,6 +46,14 @@ final class WebExtractFontsParams implements BaseModel #[Optional] public ?int $maxAgeMs; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -60,11 +69,14 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags */ public static function with( ?string $directURL = null, ?string $domain = null, ?int $maxAgeMs = null, + ?array $tags = null, ?int $timeoutMs = null, ): self { $self = new self; @@ -72,6 +84,7 @@ public static function with( null !== $directURL && $self['directURL'] = $directURL; null !== $domain && $self['domain'] = $domain; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -110,6 +123,19 @@ public function withMaxAgeMs(int $maxAgeMs): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebExtractParams.php b/src/Web/WebExtractParams.php index 66234f55..47913211 100644 --- a/src/Web/WebExtractParams.php +++ b/src/Web/WebExtractParams.php @@ -30,6 +30,7 @@ * maxPages?: int|null, * pdf?: null|Pdf|PdfShape, * stopAfterMs?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * waitForMs?: int|null, * } @@ -105,6 +106,14 @@ final class WebExtractParams implements BaseModel #[Optional] public ?int $stopAfterMs; + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -143,6 +152,7 @@ public function __construct() * * @param array $schema * @param Pdf|PdfShape|null $pdf + * @param list|null $tags */ public static function with( array $schema, @@ -156,6 +166,7 @@ public static function with( ?int $maxPages = null, Pdf|array|null $pdf = null, ?int $stopAfterMs = null, + ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, ): self { @@ -173,6 +184,7 @@ public static function with( null !== $maxPages && $self['maxPages'] = $maxPages; null !== $pdf && $self['pdf'] = $pdf; null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -302,6 +314,19 @@ public function withStopAfterMs(int $stopAfterMs): self return $self; } + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebExtractStyleguideParams.php b/src/Web/WebExtractStyleguideParams.php index a4ba242f..2ec93187 100644 --- a/src/Web/WebExtractStyleguideParams.php +++ b/src/Web/WebExtractStyleguideParams.php @@ -20,6 +20,7 @@ * directURL?: string|null, * domain?: string|null, * maxAgeMs?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * } */ @@ -55,6 +56,14 @@ final class WebExtractStyleguideParams implements BaseModel #[Optional] public ?int $maxAgeMs; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -72,12 +81,14 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param ColorScheme|value-of|null $colorScheme + * @param list|null $tags */ public static function with( ColorScheme|string|null $colorScheme = null, ?string $directURL = null, ?string $domain = null, ?int $maxAgeMs = null, + ?array $tags = null, ?int $timeoutMs = null, ): self { $self = new self; @@ -86,6 +97,7 @@ public static function with( null !== $directURL && $self['directURL'] = $directURL; null !== $domain && $self['domain'] = $domain; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -137,6 +149,19 @@ public function withMaxAgeMs(int $maxAgeMs): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index ffc9eee3..f3551dca 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -32,6 +32,7 @@ * maxAgeMs?: int|null, * page?: null|Page|value-of, * scrollOffset?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * viewport?: null|Viewport|ViewportShape, * waitForMs?: int|null, @@ -107,6 +108,14 @@ final class WebScreenshotParams implements BaseModel #[Optional] public ?int $scrollOffset; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -140,6 +149,7 @@ public function __construct() * @param FullScreenshot|value-of|null $fullScreenshot * @param HandleCookiePopup|value-of|null $handleCookiePopup * @param Page|value-of|null $page + * @param list|null $tags * @param Viewport|ViewportShape|null $viewport */ public static function with( @@ -152,6 +162,7 @@ public static function with( ?int $maxAgeMs = null, Page|string|null $page = null, ?int $scrollOffset = null, + ?array $tags = null, ?int $timeoutMs = null, Viewport|array|null $viewport = null, ?int $waitForMs = null, @@ -167,6 +178,7 @@ public static function with( null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $page && $self['page'] = $page; null !== $scrollOffset && $self['scrollOffset'] = $scrollOffset; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $viewport && $self['viewport'] = $viewport; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -285,6 +297,19 @@ public function withScrollOffset(int $scrollOffset): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebSearchParams.php b/src/Web/WebSearchParams.php index 82e5f481..755eef28 100644 --- a/src/Web/WebSearchParams.php +++ b/src/Web/WebSearchParams.php @@ -29,6 +29,7 @@ * markdownOptions?: null|MarkdownOptions|MarkdownOptionsShape, * numResults?: int|null, * queryFanout?: bool|null, + * tags?: list|null, * timeoutMs?: int|null, * } */ @@ -94,6 +95,14 @@ final class WebSearchParams implements BaseModel #[Optional] public ?bool $queryFanout; + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -129,6 +138,7 @@ public function __construct() * @param Freshness|value-of|null $freshness * @param list|null $includeDomains * @param MarkdownOptions|MarkdownOptionsShape|null $markdownOptions + * @param list|null $tags */ public static function with( string $query, @@ -139,6 +149,7 @@ public static function with( MarkdownOptions|array|null $markdownOptions = null, ?int $numResults = null, ?bool $queryFanout = null, + ?array $tags = null, ?int $timeoutMs = null, ): self { $self = new self; @@ -152,6 +163,7 @@ public static function with( null !== $markdownOptions && $self['markdownOptions'] = $markdownOptions; null !== $numResults && $self['numResults'] = $numResults; null !== $queryFanout && $self['queryFanout'] = $queryFanout; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -256,6 +268,19 @@ public function withQueryFanout(bool $queryFanout): self return $self; } + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index f5aa36de..4990e420 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -35,6 +35,7 @@ * settleAnimations?: bool|null, * shortenBase64Images?: bool|null, * stopAfterMs?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * urlRegex?: string|null, * useMainContentOnly?: bool|null, @@ -143,6 +144,14 @@ final class WebWebCrawlMdParams implements BaseModel #[Optional] public ?int $stopAfterMs; + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -195,6 +204,7 @@ public function __construct() * @param list|null $excludeSelectors * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf + * @param list|null $tags */ public static function with( string $url, @@ -212,6 +222,7 @@ public static function with( ?bool $settleAnimations = null, ?bool $shortenBase64Images = null, ?int $stopAfterMs = null, + ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, ?bool $useMainContentOnly = null, @@ -235,6 +246,7 @@ public static function with( null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $urlRegex && $self['urlRegex'] = $urlRegex; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; @@ -416,6 +428,19 @@ public function withStopAfterMs(int $stopAfterMs): self return $self; } + /** + * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php index 3f3139ab..cc87922a 100644 --- a/src/Web/WebWebScrapeHTMLParams.php +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -29,6 +29,7 @@ * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, * settleAnimations?: bool|null, + * tags?: list|null, * timeoutMs?: int|null, * useMainContentOnly?: bool|null, * waitForMs?: int|null, @@ -102,6 +103,14 @@ final class WebWebScrapeHTMLParams implements BaseModel #[Optional] public ?bool $settleAnimations; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -149,6 +158,7 @@ public function __construct() * @param array|null $headers * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf + * @param list|null $tags */ public static function with( string $url, @@ -160,6 +170,7 @@ public static function with( ?int $maxAgeMs = null, Pdf|array|null $pdf = null, ?bool $settleAnimations = null, + ?array $tags = null, ?int $timeoutMs = null, ?bool $useMainContentOnly = null, ?int $waitForMs = null, @@ -176,6 +187,7 @@ public static function with( null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $pdf && $self['pdf'] = $pdf; null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -292,6 +304,19 @@ public function withSettleAnimations(bool $settleAnimations): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebWebScrapeImagesParams.php b/src/Web/WebWebScrapeImagesParams.php index 92c8710d..c08f0b1f 100644 --- a/src/Web/WebWebScrapeImagesParams.php +++ b/src/Web/WebWebScrapeImagesParams.php @@ -24,6 +24,7 @@ * enrichment?: null|Enrichment|EnrichmentShape, * headers?: array|null, * maxAgeMs?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * waitForMs?: int|null, * } @@ -66,6 +67,14 @@ final class WebWebScrapeImagesParams implements BaseModel #[Optional] public ?int $maxAgeMs; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -104,6 +113,7 @@ public function __construct() * * @param Enrichment|EnrichmentShape|null $enrichment * @param array|null $headers + * @param list|null $tags */ public static function with( string $url, @@ -111,6 +121,7 @@ public static function with( Enrichment|array|null $enrichment = null, ?array $headers = null, ?int $maxAgeMs = null, + ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, ): self { @@ -122,6 +133,7 @@ public static function with( null !== $enrichment && $self['enrichment'] = $enrichment; null !== $headers && $self['headers'] = $headers; null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -187,6 +199,19 @@ public function withMaxAgeMs(int $maxAgeMs): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index b65deafe..faad8234 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -45,6 +45,7 @@ * pdf?: null|Pdf|PdfShape, * settleAnimations?: bool|null, * shortenBase64Images?: bool|null, + * tags?: list|null, * timeoutMs?: int|null, * useMainContentOnly?: bool|null, * waitForMs?: int|null, @@ -136,6 +137,14 @@ final class WebWebScrapeMdParams implements BaseModel #[Optional] public ?bool $shortenBase64Images; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -183,6 +192,7 @@ public function __construct() * @param array|null $headers * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf + * @param list|null $tags */ public static function with( string $url, @@ -197,6 +207,7 @@ public static function with( Pdf|array|null $pdf = null, ?bool $settleAnimations = null, ?bool $shortenBase64Images = null, + ?array $tags = null, ?int $timeoutMs = null, ?bool $useMainContentOnly = null, ?int $waitForMs = null, @@ -216,6 +227,7 @@ public static function with( null !== $pdf && $self['pdf'] = $pdf; null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; null !== $waitForMs && $self['waitForMs'] = $waitForMs; @@ -365,6 +377,19 @@ public function withShortenBase64Images(bool $shortenBase64Images): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Web/WebWebScrapeSitemapParams.php b/src/Web/WebWebScrapeSitemapParams.php index e1802872..a4d07efa 100644 --- a/src/Web/WebWebScrapeSitemapParams.php +++ b/src/Web/WebWebScrapeSitemapParams.php @@ -19,6 +19,7 @@ * domain: string, * headers?: array|null, * maxLinks?: int|null, + * tags?: list|null, * timeoutMs?: int|null, * urlRegex?: string|null, * } @@ -49,6 +50,14 @@ final class WebWebScrapeSitemapParams implements BaseModel #[Optional] public ?int $maxLinks; + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -86,11 +95,13 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array|null $headers + * @param list|null $tags */ public static function with( string $domain, ?array $headers = null, ?int $maxLinks = null, + ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, ): self { @@ -100,6 +111,7 @@ public static function with( null !== $headers && $self['headers'] = $headers; null !== $maxLinks && $self['maxLinks'] = $maxLinks; + null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $urlRegex && $self['urlRegex'] = $urlRegex; @@ -141,6 +153,19 @@ public function withMaxLinks(int $maxLinks): self return $self; } + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/tests/Services/AITest.php b/tests/Services/AITest.php index eff078e4..f08ca156 100644 --- a/tests/Services/AITest.php +++ b/tests/Services/AITest.php @@ -52,7 +52,8 @@ public function testExtractProductWithOptionalParams(): void $result = $this->client->ai->extractProduct( url: 'https://example.com', maxAgeMs: 0, - timeoutMs: 1000 + tags: ['production', 'team-alpha'], + timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -86,6 +87,7 @@ public function testExtractProductsWithOptionalParams(): void domain: 'domain', maxAgeMs: 0, maxProducts: 1, + tags: ['production', 'team-alpha'], timeoutMs: 1000, directURL: 'https://example.com', ); diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index 7a91ba75..5cb955e4 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -63,6 +63,7 @@ public function testRetrieveWithOptionalParams(): void forceLanguage: 'afrikaans', maxAgeMs: 0, maxSpeed: true, + tags: ['production', 'team-alpha'], timeoutMs: 1000, name: 'xxx', countryGl: 'country_gl', @@ -104,7 +105,8 @@ public function testRetrieveSimplifiedWithOptionalParams(): void $result = $this->client->brand->retrieveSimplified( domain: 'domain', maxAgeMs: 86400000, - timeoutMs: 1000 + tags: ['production', 'team-alpha'], + timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/IndustryTest.php b/tests/Services/IndustryTest.php index 51c80f14..05f96296 100644 --- a/tests/Services/IndustryTest.php +++ b/tests/Services/IndustryTest.php @@ -53,7 +53,8 @@ public function testRetrieveNaicsWithOptionalParams(): void input: 'input', maxResults: 1, minResults: 1, - timeoutMs: 1000 + tags: ['production', 'team-alpha'], + timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -84,6 +85,7 @@ public function testRetrieveSicWithOptionalParams(): void input: 'input', maxResults: 1, minResults: 1, + tags: ['production', 'team-alpha'], timeoutMs: 1000, type: 'original_sic', ); diff --git a/tests/Services/UtilityTest.php b/tests/Services/UtilityTest.php index f59410a4..f9c4917d 100644 --- a/tests/Services/UtilityTest.php +++ b/tests/Services/UtilityTest.php @@ -54,7 +54,8 @@ public function testPrefetchWithOptionalParams(): void $result = $this->client->utility->prefetch( identifier: ['domain' => 'domain'], type: 'brand', - timeoutMs: 1000 + tags: ['production', 'team-alpha'], + timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index f3044c88..da2b09f3 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -83,6 +83,7 @@ public function testExtractWithOptionalParams(): void maxPages: 1, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], stopAfterMs: 10000, + tags: ['production', 'team-alpha'], timeoutMs: 1000, waitForMs: 0, ); @@ -114,7 +115,8 @@ public function testExtractCompetitorsWithOptionalParams(): void $result = $this->client->web->extractCompetitors( domain: 'xxx', numCompetitors: 1, - timeoutMs: 1000 + tags: ['production', 'team-alpha'], + timeoutMs: 1000, ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -200,6 +202,7 @@ public function testSearchWithOptionalParams(): void ], numResults: 10, queryFanout: true, + tags: ['production', 'team-alpha'], timeoutMs: 1000, ); @@ -243,6 +246,7 @@ public function testWebCrawlMdWithOptionalParams(): void settleAnimations: true, shortenBase64Images: true, stopAfterMs: 10000, + tags: ['production', 'team-alpha'], timeoutMs: 1000, urlRegex: '^https?://[^/]+/blog/', useMainContentOnly: true, @@ -283,6 +287,7 @@ public function testWebScrapeHTMLWithOptionalParams(): void maxAgeMs: 0, pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], settleAnimations: true, + tags: ['production', 'team-alpha'], timeoutMs: 1000, useMainContentOnly: true, waitForMs: 0, @@ -323,6 +328,7 @@ public function testWebScrapeImagesWithOptionalParams(): void ], headers: ['foo' => 'J!'], maxAgeMs: 0, + tags: ['production', 'team-alpha'], timeoutMs: 1000, waitForMs: 0, ); @@ -364,6 +370,7 @@ public function testWebScrapeMdWithOptionalParams(): void pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], settleAnimations: true, shortenBase64Images: true, + tags: ['production', 'team-alpha'], timeoutMs: 1000, useMainContentOnly: true, waitForMs: 0, @@ -397,6 +404,7 @@ public function testWebScrapeSitemapWithOptionalParams(): void domain: 'domain', headers: ['foo' => 'J!'], maxLinks: 1, + tags: ['production', 'team-alpha'], timeoutMs: 1000, urlRegex: '^https?://[^/]+/blog/', ); From de8d62d66a5fb37405ebf9e03c9e8e31414d0620 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 14 Jul 2026 00:10:48 +0000 Subject: [PATCH 055/130] feat(api): api update --- .stats.yml | 4 +- src/Brand/BrandGetResponse/Brand.php | 4 +- .../Brand/Industries/Eic/Subindustry.php | 4 +- .../Brand/PrimaryLanguage.php | 2 +- src/Brand/BrandRetrieveParams.php | 40 ++-- src/Brand/BrandRetrieveParams/Mcc.php | 28 +++ src/Brand/BrandRetrieveParams/Phone.php | 28 +++ src/Brand/BrandRetrieveSimplifiedParams.php | 30 ++- .../BrandRetrieveSimplifiedParams/Theme.php | 15 ++ .../MonitorListAccountChangesParams.php | 46 +++- .../ChangeDetectionType.php | 3 + .../TargetType.php | 3 + src/Monitors/MonitorListAccountRunsParams.php | 16 +- .../MonitorListAccountRunsParams/Status.php | 2 +- .../MonitorListAccountRunsResponse/Data.php | 16 +- .../Data/WebhookDelivery.php | 200 ++++++++++++++++++ .../Data/WebhookDelivery/Error.php | 74 +++++++ .../Data/WebhookDelivery/Event.php | 15 ++ .../Data/WebhookDelivery/Status.php | 19 ++ .../Data/WebhookDelivery1.php | 196 +++++++++++++++++ .../Data/WebhookDelivery1/Error.php | 74 +++++++ .../Data/WebhookDelivery1/Event.php | 15 ++ .../Data/WebhookDelivery1/Status.php | 19 ++ src/Monitors/MonitorListChangesParams.php | 24 +++ src/Monitors/MonitorListParams.php | 44 +++- .../MonitorListParams/ChangeDetectionType.php | 3 + src/Monitors/MonitorListParams/Status.php | 2 +- src/Monitors/MonitorListParams/TargetType.php | 3 + src/Monitors/MonitorListRunsParams.php | 16 +- src/Monitors/MonitorListRunsParams/Status.php | 2 +- src/Monitors/MonitorListRunsResponse/Data.php | 16 +- .../Data}/WebhookDelivery.php | 32 +-- .../Data}/WebhookDelivery/Error.php | 2 +- .../Data}/WebhookDelivery/Event.php | 2 +- .../Data}/WebhookDelivery/Status.php | 2 +- .../Data/WebhookDelivery1.php | 196 +++++++++++++++++ .../Data/WebhookDelivery1/Error.php | 74 +++++++ .../Data/WebhookDelivery1/Event.php | 15 ++ .../Data/WebhookDelivery1/Status.php | 19 ++ src/Parse/ParseHandleParams.php | 140 ++++++++---- src/Parse/ParseHandleParams/Extension.php | 2 +- src/Parse/ParseHandleParams/IncludeImages.php | 29 +++ .../IncludeImages/UnionMember1.php | 12 ++ src/Parse/ParseHandleParams/IncludeLinks.php | 29 +++ .../IncludeLinks/UnionMember1.php | 12 ++ src/Parse/ParseHandleParams/Ocr.php | 29 +++ .../ParseHandleParams/Ocr/UnionMember1.php | 12 ++ src/Parse/ParseHandleParams/Pdf.php | 2 +- .../ParseHandleParams/ShortenBase64Images.php | 29 +++ .../ShortenBase64Images/UnionMember1.php | 12 ++ .../ParseHandleParams/UseMainContentOnly.php | 29 +++ .../UseMainContentOnly/UnionMember1.php | 12 ++ src/ServiceContracts/BrandContract.php | 19 +- src/ServiceContracts/MonitorsContract.php | 45 ++-- src/ServiceContracts/ParseContract.php | 32 +-- src/ServiceContracts/WebContract.php | 111 +++++----- src/Services/BrandRawService.php | 13 +- src/Services/BrandService.php | 20 +- src/Services/MonitorsRawService.php | 4 +- src/Services/MonitorsService.php | 45 ++-- src/Services/ParseRawService.php | 18 +- src/Services/ParseService.php | 35 +-- src/Services/WebRawService.php | 72 ++++--- src/Services/WebService.php | 112 +++++----- src/Web/WebExtractFontsParams.php | 8 +- src/Web/WebExtractStyleguideParams.php | 8 +- src/Web/WebScreenshotParams.php | 39 ++-- src/Web/WebScreenshotParams/Country.php | 2 +- .../WebScreenshotParams/HandleCookiePopup.php | 20 +- .../HandleCookiePopup/UnionMember1.php | 12 ++ src/Web/WebWebScrapeHTMLParams.php | 88 +++++--- src/Web/WebWebScrapeHTMLParams/Country.php | 2 +- .../WebWebScrapeHTMLParams/IncludeFrames.php | 29 +++ .../IncludeFrames/UnionMember1.php | 12 ++ src/Web/WebWebScrapeHTMLParams/Pdf.php | 43 +++- src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php | 29 +++ .../Pdf/Ocr/UnionMember1.php | 12 ++ .../Pdf/ShouldParse.php | 29 +++ .../Pdf/ShouldParse/UnionMember1.php | 12 ++ .../SettleAnimations.php | 29 +++ .../SettleAnimations/UnionMember1.php | 12 ++ .../UseMainContentOnly.php | 29 +++ .../UseMainContentOnly/UnionMember1.php | 12 ++ src/Web/WebWebScrapeImagesParams.php | 33 +-- src/Web/WebWebScrapeImagesParams/Dedupe.php | 29 +++ .../Dedupe/UnionMember1.php | 12 ++ .../WebWebScrapeImagesParams/Enrichment.php | 66 ++++-- .../Enrichment/Classification.php | 29 +++ .../Classification/UnionMember1.php | 12 ++ .../Enrichment/HostedURL.php | 29 +++ .../Enrichment/HostedURL/UnionMember1.php | 12 ++ .../Enrichment/Resolution.php | 29 +++ .../Enrichment/Resolution/UnionMember1.php | 12 ++ src/Web/WebWebScrapeMdParams.php | 151 ++++++++----- src/Web/WebWebScrapeMdParams/Country.php | 2 +- .../WebWebScrapeMdParams/IncludeFrames.php | 29 +++ .../IncludeFrames/UnionMember1.php | 12 ++ .../WebWebScrapeMdParams/IncludeImages.php | 29 +++ .../IncludeImages/UnionMember1.php | 12 ++ src/Web/WebWebScrapeMdParams/IncludeLinks.php | 29 +++ .../IncludeLinks/UnionMember1.php | 12 ++ src/Web/WebWebScrapeMdParams/Pdf.php | 43 +++- src/Web/WebWebScrapeMdParams/Pdf/Ocr.php | 29 +++ .../Pdf/Ocr/UnionMember1.php | 12 ++ .../WebWebScrapeMdParams/Pdf/ShouldParse.php | 29 +++ .../Pdf/ShouldParse/UnionMember1.php | 12 ++ .../WebWebScrapeMdParams/SettleAnimations.php | 29 +++ .../SettleAnimations/UnionMember1.php | 12 ++ .../ShortenBase64Images.php | 29 +++ .../ShortenBase64Images/UnionMember1.php | 12 ++ .../UseMainContentOnly.php | 29 +++ .../UseMainContentOnly/UnionMember1.php | 12 ++ src/Web/WebWebScrapeSitemapParams.php | 20 ++ tests/ClientTest.php | 2 +- tests/Services/BrandTest.php | 15 +- tests/Services/IndustryTest.php | 8 +- tests/Services/UtilityTest.php | 4 +- tests/Services/WebTest.php | 51 ++--- 118 files changed, 2980 insertions(+), 514 deletions(-) create mode 100644 src/Brand/BrandRetrieveParams/Mcc.php create mode 100644 src/Brand/BrandRetrieveParams/Phone.php create mode 100644 src/Brand/BrandRetrieveSimplifiedParams/Theme.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Status.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php create mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Status.php rename src/Monitors/{ => MonitorListRunsResponse/Data}/WebhookDelivery.php (79%) rename src/Monitors/{ => MonitorListRunsResponse/Data}/WebhookDelivery/Error.php (95%) rename src/Monitors/{ => MonitorListRunsResponse/Data}/WebhookDelivery/Event.php (77%) rename src/Monitors/{ => MonitorListRunsResponse/Data}/WebhookDelivery/Status.php (84%) create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php create mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Status.php create mode 100644 src/Parse/ParseHandleParams/IncludeImages.php create mode 100644 src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php create mode 100644 src/Parse/ParseHandleParams/IncludeLinks.php create mode 100644 src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php create mode 100644 src/Parse/ParseHandleParams/Ocr.php create mode 100644 src/Parse/ParseHandleParams/Ocr/UnionMember1.php create mode 100644 src/Parse/ParseHandleParams/ShortenBase64Images.php create mode 100644 src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php create mode 100644 src/Parse/ParseHandleParams/UseMainContentOnly.php create mode 100644 src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php create mode 100644 src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php create mode 100644 src/Web/WebWebScrapeHTMLParams/IncludeFrames.php create mode 100644 src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php create mode 100644 src/Web/WebWebScrapeHTMLParams/SettleAnimations.php create mode 100644 src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php create mode 100644 src/Web/WebWebScrapeHTMLParams/UseMainContentOnly.php create mode 100644 src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php create mode 100644 src/Web/WebWebScrapeImagesParams/Dedupe.php create mode 100644 src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php create mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Classification.php create mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php create mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL.php create mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php create mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Resolution.php create mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/IncludeFrames.php create mode 100644 src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/IncludeImages.php create mode 100644 src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/IncludeLinks.php create mode 100644 src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/Pdf/Ocr.php create mode 100644 src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/Pdf/ShouldParse.php create mode 100644 src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/SettleAnimations.php create mode 100644 src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/ShortenBase64Images.php create mode 100644 src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/UseMainContentOnly.php create mode 100644 src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php diff --git a/.stats.yml b/.stats.yml index 8e4b5605..b9d1d304 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-98c2abed2e726f7e5006cd4ef2ce9a56e84470d1fead500f7f3d46ed47f5af8b.yml -openapi_spec_hash: 921fc4db282f59e416e3c95d14d534f2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d49b84cf1125618f171698ff1ee4ff9a8d04151619cb4a56d650103869834465.yml +openapi_spec_hash: 49b7a6f59dcdff1e2bf88feb6474a562 config_hash: daabb160675d86b354711da1e77e5129 diff --git a/src/Brand/BrandGetResponse/Brand.php b/src/Brand/BrandGetResponse/Brand.php index c4e52beb..23527d66 100644 --- a/src/Brand/BrandGetResponse/Brand.php +++ b/src/Brand/BrandGetResponse/Brand.php @@ -126,7 +126,7 @@ final class Brand implements BaseModel public ?string $phone; /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * Language to force for the retrieved brand data. * * @var value-of|null $primaryLanguage */ @@ -353,7 +353,7 @@ public function withPhone(string $phone): self } /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * Language to force for the retrieved brand data. * * @param PrimaryLanguage|value-of|null $primaryLanguage */ diff --git a/src/Brand/BrandGetResponse/Brand/Industries/Eic/Subindustry.php b/src/Brand/BrandGetResponse/Brand/Industries/Eic/Subindustry.php index c9fe4c58..b728b5dd 100644 --- a/src/Brand/BrandGetResponse/Brand/Industries/Eic/Subindustry.php +++ b/src/Brand/BrandGetResponse/Brand/Industries/Eic/Subindustry.php @@ -109,8 +109,6 @@ enum Subindustry: string case CREATOR_ECONOMY_INFLUENCER_PLATFORMS = 'Creator Economy & Influencer Platforms'; - case ADVERTISING_ADTECH_MEDIA_BUYING = 'Advertising, Adtech & Media Buying'; - case FILM_TV_PRODUCTION_STUDIOS = 'Film, TV & Production Studios'; case EVENTS_VENUES_LIVE_ENTERTAINMENT = 'Events, Venues & Live Entertainment'; @@ -231,6 +229,8 @@ enum Subindustry: string case NEWS_PUBLISHING_JOURNALISM = 'News Publishing & Journalism'; + case ADVERTISING_ADTECH_MEDIA_BUYING = 'Advertising, Adtech & Media Buying'; + case DIGITAL_MEDIA_CONTENT_PLATFORMS = 'Digital Media & Content Platforms'; case BROADCASTING_TV_RADIO = 'Broadcasting (TV & Radio)'; diff --git a/src/Brand/BrandGetResponse/Brand/PrimaryLanguage.php b/src/Brand/BrandGetResponse/Brand/PrimaryLanguage.php index d8696bcb..d66bc000 100644 --- a/src/Brand/BrandGetResponse/Brand/PrimaryLanguage.php +++ b/src/Brand/BrandGetResponse/Brand/PrimaryLanguage.php @@ -5,7 +5,7 @@ namespace ContextDev\Brand\BrandGetResponse\Brand; /** - * The primary language of the brand's website content. Detected from the HTML lang tag, page content analysis, or social media descriptions. + * Language to force for the retrieved brand data. */ enum PrimaryLanguage: string { diff --git a/src/Brand/BrandRetrieveParams.php b/src/Brand/BrandRetrieveParams.php index 45a66372..47f3afef 100644 --- a/src/Brand/BrandRetrieveParams.php +++ b/src/Brand/BrandRetrieveParams.php @@ -17,6 +17,11 @@ * * @see ContextDev\Services\BrandService::retrieve() * + * @phpstan-import-type MccVariants from \ContextDev\Brand\BrandRetrieveParams\Mcc + * @phpstan-import-type PhoneVariants from \ContextDev\Brand\BrandRetrieveParams\Phone + * @phpstan-import-type MccShape from \ContextDev\Brand\BrandRetrieveParams\Mcc + * @phpstan-import-type PhoneShape from \ContextDev\Brand\BrandRetrieveParams\Phone + * * @phpstan-type BrandRetrieveParamsShape = array{ * domain: string, * type: Type|value-of, @@ -34,8 +39,8 @@ * transactionInfo: string, * city?: string|null, * highConfidenceOnly?: bool|null, - * mcc?: int|null, - * phone?: float|null, + * mcc?: MccShape|null, + * phone?: PhoneShape|null, * } */ final class BrandRetrieveParams implements BaseModel @@ -59,7 +64,7 @@ final class BrandRetrieveParams implements BaseModel public string $type; /** @var value-of|null $forceLanguage */ - #[Optional('force_language', enum: ForceLanguage::class)] + #[Optional('force_language', enum: ForceLanguage::class, nullable: true)] public ?string $forceLanguage; /** @@ -144,15 +149,19 @@ final class BrandRetrieveParams implements BaseModel /** * Optional Merchant Category Code (MCC) to help identify the business category or industry. + * + * @var MccVariants|null $mcc */ #[Optional] - public ?int $mcc; + public string|float|null $mcc; /** * Optional phone number from the transaction to help verify brand match. + * + * @var PhoneVariants|null $phone */ #[Optional] - public ?float $phone; + public string|float|null $phone; /** * `new BrandRetrieveParams()` is missing required properties by the API. @@ -196,6 +205,8 @@ public function __construct() * @param Type|value-of $type * @param ForceLanguage|value-of|null $forceLanguage * @param list|null $tags + * @param MccShape|null $mcc + * @param PhoneShape|null $phone */ public static function with( string $domain, @@ -214,8 +225,8 @@ public static function with( ?string $tickerExchange = null, ?string $city = null, ?bool $highConfidenceOnly = null, - ?int $mcc = null, - ?float $phone = null, + string|float|null $mcc = null, + string|float|null $phone = null, ): self { $self = new self; @@ -267,10 +278,11 @@ public function withType(Type|string $type): self } /** - * @param ForceLanguage|value-of $forceLanguage + * @param ForceLanguage|value-of|null $forceLanguage */ - public function withForceLanguage(ForceLanguage|string $forceLanguage): self - { + public function withForceLanguage( + ForceLanguage|string|null $forceLanguage + ): self { $self = clone $this; $self['forceLanguage'] = $forceLanguage; @@ -424,8 +436,10 @@ public function withHighConfidenceOnly(bool $highConfidenceOnly): self /** * Optional Merchant Category Code (MCC) to help identify the business category or industry. + * + * @param MccShape $mcc */ - public function withMcc(int $mcc): self + public function withMcc(string|float $mcc): self { $self = clone $this; $self['mcc'] = $mcc; @@ -435,8 +449,10 @@ public function withMcc(int $mcc): self /** * Optional phone number from the transaction to help verify brand match. + * + * @param PhoneShape $phone */ - public function withPhone(float $phone): self + public function withPhone(string|float $phone): self { $self = clone $this; $self['phone'] = $phone; diff --git a/src/Brand/BrandRetrieveParams/Mcc.php b/src/Brand/BrandRetrieveParams/Mcc.php new file mode 100644 index 00000000..4283cead --- /dev/null +++ b/src/Brand/BrandRetrieveParams/Mcc.php @@ -0,0 +1,28 @@ +|array + */ + public static function variants(): array + { + return ['string', 'float']; + } +} diff --git a/src/Brand/BrandRetrieveParams/Phone.php b/src/Brand/BrandRetrieveParams/Phone.php new file mode 100644 index 00000000..ce11b2b9 --- /dev/null +++ b/src/Brand/BrandRetrieveParams/Phone.php @@ -0,0 +1,28 @@ +|array + */ + public static function variants(): array + { + return ['string', 'float']; + } +} diff --git a/src/Brand/BrandRetrieveSimplifiedParams.php b/src/Brand/BrandRetrieveSimplifiedParams.php index 1fd9175c..00df348c 100644 --- a/src/Brand/BrandRetrieveSimplifiedParams.php +++ b/src/Brand/BrandRetrieveSimplifiedParams.php @@ -4,6 +4,7 @@ namespace ContextDev\Brand; +use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; @@ -19,6 +20,7 @@ * domain: string, * maxAgeMs?: int|null, * tags?: list|null, + * theme?: null|Theme|value-of, * timeoutMs?: int|null, * } */ @@ -37,7 +39,7 @@ final class BrandRetrieveSimplifiedParams implements BaseModel /** * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. */ - #[Optional] + #[Optional(nullable: true)] public ?int $maxAgeMs; /** @@ -48,6 +50,14 @@ final class BrandRetrieveSimplifiedParams implements BaseModel #[Optional(list: 'string')] public ?array $tags; + /** + * Optional theme preference used when selecting brand assets. + * + * @var value-of|null $theme + */ + #[Optional(enum: Theme::class)] + public ?string $theme; + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ @@ -79,11 +89,13 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param list|null $tags + * @param Theme|value-of|null $theme */ public static function with( string $domain, ?int $maxAgeMs = null, ?array $tags = null, + Theme|string|null $theme = null, ?int $timeoutMs = null, ): self { $self = new self; @@ -92,6 +104,7 @@ public static function with( null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; null !== $tags && $self['tags'] = $tags; + null !== $theme && $self['theme'] = $theme; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; return $self; @@ -111,7 +124,7 @@ public function withDomain(string $domain): self /** * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. */ - public function withMaxAgeMs(int $maxAgeMs): self + public function withMaxAgeMs(?int $maxAgeMs): self { $self = clone $this; $self['maxAgeMs'] = $maxAgeMs; @@ -132,6 +145,19 @@ public function withTags(array $tags): self return $self; } + /** + * Optional theme preference used when selecting brand assets. + * + * @param Theme|value-of $theme + */ + public function withTheme(Theme|string $theme): self + { + $self = clone $this; + $self['theme'] = $theme; + + return $self; + } + /** * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). */ diff --git a/src/Brand/BrandRetrieveSimplifiedParams/Theme.php b/src/Brand/BrandRetrieveSimplifiedParams/Theme.php new file mode 100644 index 00000000..55e9cac9 --- /dev/null +++ b/src/Brand/BrandRetrieveSimplifiedParams/Theme.php @@ -0,0 +1,15 @@ +|null $changeDetectionType */ + /** + * Filter by change detection type. + * + * @var value-of|null $changeDetectionType + */ #[Optional(enum: ChangeDetectionType::class)] public ?string $changeDetectionType; + /** + * Opaque pagination cursor from a previous response. + */ #[Optional] public ?string $cursor; + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ #[Optional] public ?int $limit; + /** + * Filter changes to a single monitor. + */ #[Optional] public ?string $monitorID; + /** + * Only include items at or after this ISO 8601 timestamp. + */ #[Optional] public ?\DateTimeInterface $since; @@ -55,10 +71,17 @@ final class MonitorListAccountChangesParams implements BaseModel #[Optional] public ?string $tag; - /** @var value-of|null $targetType */ + /** + * Filter by target type. + * + * @var value-of|null $targetType + */ #[Optional(enum: TargetType::class)] public ?string $targetType; + /** + * Only include items before this ISO 8601 timestamp. + */ #[Optional] public ?\DateTimeInterface $until; @@ -100,6 +123,8 @@ public static function with( } /** + * Filter by change detection type. + * * @param ChangeDetectionType|value-of $changeDetectionType */ public function withChangeDetectionType( @@ -111,6 +136,9 @@ public function withChangeDetectionType( return $self; } + /** + * Opaque pagination cursor from a previous response. + */ public function withCursor(string $cursor): self { $self = clone $this; @@ -119,6 +147,9 @@ public function withCursor(string $cursor): self return $self; } + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ public function withLimit(int $limit): self { $self = clone $this; @@ -127,6 +158,9 @@ public function withLimit(int $limit): self return $self; } + /** + * Filter changes to a single monitor. + */ public function withMonitorID(string $monitorID): self { $self = clone $this; @@ -135,6 +169,9 @@ public function withMonitorID(string $monitorID): self return $self; } + /** + * Only include items at or after this ISO 8601 timestamp. + */ public function withSince(\DateTimeInterface $since): self { $self = clone $this; @@ -155,6 +192,8 @@ public function withTag(string $tag): self } /** + * Filter by target type. + * * @param TargetType|value-of $targetType */ public function withTargetType(TargetType|string $targetType): self @@ -165,6 +204,9 @@ public function withTargetType(TargetType|string $targetType): self return $self; } + /** + * Only include items before this ISO 8601 timestamp. + */ public function withUntil(\DateTimeInterface $until): self { $self = clone $this; diff --git a/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php b/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php index 6890569a..671180eb 100644 --- a/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php +++ b/src/Monitors/MonitorListAccountChangesParams/ChangeDetectionType.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListAccountChangesParams; +/** + * Filter by change detection type. + */ enum ChangeDetectionType: string { case EXACT = 'exact'; diff --git a/src/Monitors/MonitorListAccountChangesParams/TargetType.php b/src/Monitors/MonitorListAccountChangesParams/TargetType.php index e627d0dc..df58ce62 100644 --- a/src/Monitors/MonitorListAccountChangesParams/TargetType.php +++ b/src/Monitors/MonitorListAccountChangesParams/TargetType.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListAccountChangesParams; +/** + * Filter by target type. + */ enum TargetType: string { case PAGE = 'page'; diff --git a/src/Monitors/MonitorListAccountRunsParams.php b/src/Monitors/MonitorListAccountRunsParams.php index 474613e6..c1e85d8d 100644 --- a/src/Monitors/MonitorListAccountRunsParams.php +++ b/src/Monitors/MonitorListAccountRunsParams.php @@ -25,14 +25,20 @@ final class MonitorListAccountRunsParams implements BaseModel use SdkModel; use SdkParams; + /** + * Opaque pagination cursor from a previous response. + */ #[Optional] public ?string $cursor; + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ #[Optional] public ?int $limit; /** - * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * Filter runs by lifecycle status. * * @var value-of|null $status */ @@ -65,6 +71,9 @@ public static function with( return $self; } + /** + * Opaque pagination cursor from a previous response. + */ public function withCursor(string $cursor): self { $self = clone $this; @@ -73,6 +82,9 @@ public function withCursor(string $cursor): self return $self; } + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ public function withLimit(int $limit): self { $self = clone $this; @@ -82,7 +94,7 @@ public function withLimit(int $limit): self } /** - * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * Filter runs by lifecycle status. * * @param Status|value-of $status */ diff --git a/src/Monitors/MonitorListAccountRunsParams/Status.php b/src/Monitors/MonitorListAccountRunsParams/Status.php index 585dc956..b710283f 100644 --- a/src/Monitors/MonitorListAccountRunsParams/Status.php +++ b/src/Monitors/MonitorListAccountRunsParams/Status.php @@ -5,7 +5,7 @@ namespace ContextDev\Monitors\MonitorListAccountRunsParams; /** - * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * Filter runs by lifecycle status. */ enum Status: string { diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data.php b/src/Monitors/MonitorListAccountRunsResponse/Data.php index a73960d5..f87eef43 100644 --- a/src/Monitors/MonitorListAccountRunsResponse/Data.php +++ b/src/Monitors/MonitorListAccountRunsResponse/Data.php @@ -14,11 +14,13 @@ use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\SkipReason; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Status; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\TargetType; -use ContextDev\Monitors\WebhookDelivery; +use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery; +use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1; /** * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Error - * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\WebhookDelivery + * @phpstan-import-type WebhookDelivery1Shape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1 + * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery * * @phpstan-type DataShape = array{ * id: string, @@ -35,7 +37,7 @@ * error?: null|Error|ErrorShape, * skipReason?: null|SkipReason|value-of, * startedAt?: \DateTimeInterface|null, - * webhookDeliveries?: list|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -112,9 +114,9 @@ final class Data implements BaseModel /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @var list|null $webhookDeliveries + * @var list|null $webhookDeliveries */ - #[Optional('webhook_deliveries', list: WebhookDelivery::class)] + #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] public ?array $webhookDeliveries; /** @@ -174,7 +176,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason - * @param list|null $webhookDeliveries + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -364,7 +366,7 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @param list $webhookDeliveries + * @param list $webhookDeliveries */ public function withWebhookDeliveries(array $webhookDeliveries): self { diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php new file mode 100644 index 00000000..77fd214b --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php @@ -0,0 +1,200 @@ +, + * eventID: string, + * httpStatus: int|null, + * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status>, + * } + */ +final class WebhookDelivery implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required('attempted_at')] + public \DateTimeInterface $attemptedAt; + + #[Required] + public ?Error $error; + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @var value-of $event + */ + #[Required(enum: Event::class)] + public string $event; + + /** + * Identifier sent in the X-Context-Id header. + */ + #[Required('event_id')] + public string $eventID; + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $status + */ + #[Required( + enum: Status::class, + )] + public string $status; + + /** + * `new WebhookDelivery()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookDelivery::with( + * attemptedAt: ..., + * error: ..., + * event: ..., + * eventID: ..., + * httpStatus: ..., + * status: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookDelivery) + * ->withAttemptedAt(...) + * ->withError(...) + * ->withEvent(...) + * ->withEventID(...) + * ->withHTTPStatus(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Error|ErrorShape|null $error + * @param Event|value-of $event + * @param Status|value-of $status + */ + public static function with( + \DateTimeInterface $attemptedAt, + Error|array|null $error, + Event|string $event, + string $eventID, + ?int $httpStatus, + Status|string $status, + ): self { + $self = new self; + + $self['attemptedAt'] = $attemptedAt; + $self['error'] = $error; + $self['event'] = $event; + $self['eventID'] = $eventID; + $self['httpStatus'] = $httpStatus; + $self['status'] = $status; + + return $self; + } + + public function withAttemptedAt(\DateTimeInterface $attemptedAt): self + { + $self = clone $this; + $self['attemptedAt'] = $attemptedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError( + Error|array|null $error, + ): self { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @param Event|value-of $event + */ + public function withEvent(Event|string $event): self + { + $self = clone $this; + $self['event'] = $event; + + return $self; + } + + /** + * Identifier sent in the X-Context-Id header. + */ + public function withEventID(string $eventID): self + { + $self = clone $this; + $self['eventID'] = $eventID; + + return $self; + } + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status, + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php new file mode 100644 index 00000000..951e5b2c --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php new file mode 100644 index 00000000..dab594a2 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php @@ -0,0 +1,15 @@ +, + * eventID: string, + * httpStatus: int|null, + * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status>, + * } + */ +final class WebhookDelivery1 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required('attempted_at')] + public \DateTimeInterface $attemptedAt; + + #[Required] + public ?Error $error; + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @var value-of $event + */ + #[Required(enum: Event::class)] + public string $event; + + /** + * Identifier sent in the X-Context-Id header. + */ + #[Required('event_id')] + public string $eventID; + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $status + */ + #[Required( + enum: Status::class, + )] + public string $status; + + /** + * `new WebhookDelivery1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookDelivery1::with( + * attemptedAt: ..., + * error: ..., + * event: ..., + * eventID: ..., + * httpStatus: ..., + * status: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookDelivery1) + * ->withAttemptedAt(...) + * ->withError(...) + * ->withEvent(...) + * ->withEventID(...) + * ->withHTTPStatus(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Error|ErrorShape|null $error + * @param Event|value-of $event + * @param Status|value-of $status + */ + public static function with( + \DateTimeInterface $attemptedAt, + Error|array|null $error, + Event|string $event, + string $eventID, + ?int $httpStatus, + Status|string $status, + ): self { + $self = new self; + + $self['attemptedAt'] = $attemptedAt; + $self['error'] = $error; + $self['event'] = $event; + $self['eventID'] = $eventID; + $self['httpStatus'] = $httpStatus; + $self['status'] = $status; + + return $self; + } + + public function withAttemptedAt(\DateTimeInterface $attemptedAt): self + { + $self = clone $this; + $self['attemptedAt'] = $attemptedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError( + Error|array|null $error, + ): self { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @param Event|value-of $event + */ + public function withEvent(Event|string $event): self + { + $self = clone $this; + $self['event'] = $event; + + return $self; + } + + /** + * Identifier sent in the X-Context-Id header. + */ + public function withEventID(string $eventID): self + { + $self = clone $this; + $self['eventID'] = $eventID; + + return $self; + } + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status, + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php new file mode 100644 index 00000000..96919d87 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php new file mode 100644 index 00000000..b7971845 --- /dev/null +++ b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php @@ -0,0 +1,15 @@ +|null $changeDetectionType */ + /** + * Filter by change detection type. + * + * @var value-of|null $changeDetectionType + */ #[Optional(enum: ChangeDetectionType::class)] public ?string $changeDetectionType; + /** + * Opaque pagination cursor from a previous response. + */ #[Optional] public ?string $cursor; + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ #[Optional] public ?int $limit; @@ -59,7 +69,7 @@ final class MonitorListParams implements BaseModel * * @var list>|null $searchBy */ - #[Optional(list: SearchBy::class)] + #[Optional(list: SearchBy::class, nullable: true)] public ?array $searchBy; /** @@ -71,7 +81,7 @@ final class MonitorListParams implements BaseModel public ?string $searchType; /** - * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * Filter monitors by lifecycle status. * * @var value-of|null $status */ @@ -89,10 +99,14 @@ final class MonitorListParams implements BaseModel * * @var list|null $tags */ - #[Optional(list: 'string')] + #[Optional(list: 'string', nullable: true)] public ?array $tags; - /** @var value-of|null $targetType */ + /** + * Filter by target type. + * + * @var value-of|null $targetType + */ #[Optional(enum: TargetType::class)] public ?string $targetType; @@ -142,6 +156,8 @@ public static function with( } /** + * Filter by change detection type. + * * @param ChangeDetectionType|value-of $changeDetectionType */ public function withChangeDetectionType( @@ -153,6 +169,9 @@ public function withChangeDetectionType( return $self; } + /** + * Opaque pagination cursor from a previous response. + */ public function withCursor(string $cursor): self { $self = clone $this; @@ -161,6 +180,9 @@ public function withCursor(string $cursor): self return $self; } + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ public function withLimit(int $limit): self { $self = clone $this; @@ -183,9 +205,9 @@ public function withQ(string $q): self /** * Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. * - * @param list> $searchBy + * @param list>|null $searchBy */ - public function withSearchBy(array $searchBy): self + public function withSearchBy(?array $searchBy): self { $self = clone $this; $self['searchBy'] = $searchBy; @@ -207,7 +229,7 @@ public function withSearchType(SearchType|string $searchType): self } /** - * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * Filter monitors by lifecycle status. * * @param Status|value-of $status */ @@ -233,9 +255,9 @@ public function withTag(string $tag): self /** * Comma-separated list of tags to filter by (matches monitors having any of them). * - * @param list $tags + * @param list|null $tags */ - public function withTags(array $tags): self + public function withTags(?array $tags): self { $self = clone $this; $self['tags'] = $tags; @@ -244,6 +266,8 @@ public function withTags(array $tags): self } /** + * Filter by target type. + * * @param TargetType|value-of $targetType */ public function withTargetType(TargetType|string $targetType): self diff --git a/src/Monitors/MonitorListParams/ChangeDetectionType.php b/src/Monitors/MonitorListParams/ChangeDetectionType.php index d0e29720..51debeb2 100644 --- a/src/Monitors/MonitorListParams/ChangeDetectionType.php +++ b/src/Monitors/MonitorListParams/ChangeDetectionType.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListParams; +/** + * Filter by change detection type. + */ enum ChangeDetectionType: string { case EXACT = 'exact'; diff --git a/src/Monitors/MonitorListParams/Status.php b/src/Monitors/MonitorListParams/Status.php index 84537bd5..c675acf8 100644 --- a/src/Monitors/MonitorListParams/Status.php +++ b/src/Monitors/MonitorListParams/Status.php @@ -5,7 +5,7 @@ namespace ContextDev\Monitors\MonitorListParams; /** - * Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * Filter monitors by lifecycle status. */ enum Status: string { diff --git a/src/Monitors/MonitorListParams/TargetType.php b/src/Monitors/MonitorListParams/TargetType.php index d41270c4..442d9612 100644 --- a/src/Monitors/MonitorListParams/TargetType.php +++ b/src/Monitors/MonitorListParams/TargetType.php @@ -4,6 +4,9 @@ namespace ContextDev\Monitors\MonitorListParams; +/** + * Filter by target type. + */ enum TargetType: string { case PAGE = 'page'; diff --git a/src/Monitors/MonitorListRunsParams.php b/src/Monitors/MonitorListRunsParams.php index 8b87f69f..a2161eba 100644 --- a/src/Monitors/MonitorListRunsParams.php +++ b/src/Monitors/MonitorListRunsParams.php @@ -25,14 +25,20 @@ final class MonitorListRunsParams implements BaseModel use SdkModel; use SdkParams; + /** + * Opaque pagination cursor from a previous response. + */ #[Optional] public ?string $cursor; + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ #[Optional] public ?int $limit; /** - * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * Filter runs by lifecycle status. * * @var value-of|null $status */ @@ -65,6 +71,9 @@ public static function with( return $self; } + /** + * Opaque pagination cursor from a previous response. + */ public function withCursor(string $cursor): self { $self = clone $this; @@ -73,6 +82,9 @@ public function withCursor(string $cursor): self return $self; } + /** + * Maximum number of items to return per page (1-100). Defaults to 25. + */ public function withLimit(int $limit): self { $self = clone $this; @@ -82,7 +94,7 @@ public function withLimit(int $limit): self } /** - * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * Filter runs by lifecycle status. * * @param Status|value-of $status */ diff --git a/src/Monitors/MonitorListRunsParams/Status.php b/src/Monitors/MonitorListRunsParams/Status.php index 765a444e..7863eb63 100644 --- a/src/Monitors/MonitorListRunsParams/Status.php +++ b/src/Monitors/MonitorListRunsParams/Status.php @@ -5,7 +5,7 @@ namespace ContextDev\Monitors\MonitorListRunsParams; /** - * Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * Filter runs by lifecycle status. */ enum Status: string { diff --git a/src/Monitors/MonitorListRunsResponse/Data.php b/src/Monitors/MonitorListRunsResponse/Data.php index b521dcd4..c262135e 100644 --- a/src/Monitors/MonitorListRunsResponse/Data.php +++ b/src/Monitors/MonitorListRunsResponse/Data.php @@ -14,11 +14,13 @@ use ContextDev\Monitors\MonitorListRunsResponse\Data\SkipReason; use ContextDev\Monitors\MonitorListRunsResponse\Data\Status; use ContextDev\Monitors\MonitorListRunsResponse\Data\TargetType; -use ContextDev\Monitors\WebhookDelivery; +use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; +use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1; /** * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListRunsResponse\Data\Error - * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\WebhookDelivery + * @phpstan-import-type WebhookDelivery1Shape from \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1 + * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery * * @phpstan-type DataShape = array{ * id: string, @@ -35,7 +37,7 @@ * error?: null|Error|ErrorShape, * skipReason?: null|SkipReason|value-of, * startedAt?: \DateTimeInterface|null, - * webhookDeliveries?: list|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -112,9 +114,9 @@ final class Data implements BaseModel /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @var list|null $webhookDeliveries + * @var list|null $webhookDeliveries */ - #[Optional('webhook_deliveries', list: WebhookDelivery::class)] + #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] public ?array $webhookDeliveries; /** @@ -174,7 +176,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason - * @param list|null $webhookDeliveries + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -364,7 +366,7 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @param list $webhookDeliveries + * @param list $webhookDeliveries */ public function withWebhookDeliveries(array $webhookDeliveries): self { diff --git a/src/Monitors/WebhookDelivery.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php similarity index 79% rename from src/Monitors/WebhookDelivery.php rename to src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php index 8e85e19a..bea65e0f 100644 --- a/src/Monitors/WebhookDelivery.php +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery.php @@ -2,25 +2,29 @@ declare(strict_types=1); -namespace ContextDev\Monitors; +namespace ContextDev\Monitors\MonitorListRunsResponse\Data; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; -use ContextDev\Monitors\WebhookDelivery\Error; -use ContextDev\Monitors\WebhookDelivery\Event; -use ContextDev\Monitors\WebhookDelivery\Status; +use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Error; +use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Event; +use ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status; /** - * @phpstan-import-type ErrorShape from \ContextDev\Monitors\WebhookDelivery\Error + * Deprecated: use `webhook_deliveries`, which records every attempt now that a run can deliver multiple events. Omitted when no webhook was attempted, including historical runs created before delivery tracking was added. + * + * @deprecated + * + * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Error * * @phpstan-type WebhookDeliveryShape = array{ * attemptedAt: \DateTimeInterface, - * error: null|Error|ErrorShape, + * error: null|\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Error|ErrorShape, * event: Event|value-of, * eventID: string, * httpStatus: int|null, - * status: Status|value-of, + * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status>, * } */ final class WebhookDelivery implements BaseModel @@ -59,7 +63,9 @@ final class WebhookDelivery implements BaseModel * * @var value-of $status */ - #[Required(enum: Status::class)] + #[Required( + enum: Status::class, + )] public string $status; /** @@ -134,8 +140,9 @@ public function withAttemptedAt(\DateTimeInterface $attemptedAt): self /** * @param Error|ErrorShape|null $error */ - public function withError(Error|array|null $error): self - { + public function withError( + Error|array|null $error, + ): self { $self = clone $this; $self['error'] = $error; @@ -182,8 +189,9 @@ public function withHTTPStatus(?int $httpStatus): self * * @param Status|value-of $status */ - public function withStatus(Status|string $status): self - { + public function withStatus( + Status|string $status, + ): self { $self = clone $this; $self['status'] = $status; diff --git a/src/Monitors/WebhookDelivery/Error.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php similarity index 95% rename from src/Monitors/WebhookDelivery/Error.php rename to src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php index 41d7b9c5..16f73bed 100644 --- a/src/Monitors/WebhookDelivery/Error.php +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\WebhookDelivery; +namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; diff --git a/src/Monitors/WebhookDelivery/Event.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php similarity index 77% rename from src/Monitors/WebhookDelivery/Event.php rename to src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php index cc3d58f7..b387c981 100644 --- a/src/Monitors/WebhookDelivery/Event.php +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\WebhookDelivery; +namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; /** * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. diff --git a/src/Monitors/WebhookDelivery/Status.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php similarity index 84% rename from src/Monitors/WebhookDelivery/Status.php rename to src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php index bea34925..af5edb34 100644 --- a/src/Monitors/WebhookDelivery/Status.php +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\WebhookDelivery; +namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; /** * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php new file mode 100644 index 00000000..7c224ea8 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php @@ -0,0 +1,196 @@ +, + * eventID: string, + * httpStatus: int|null, + * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status>, + * } + */ +final class WebhookDelivery1 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required('attempted_at')] + public \DateTimeInterface $attemptedAt; + + #[Required] + public ?Error $error; + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @var value-of $event + */ + #[Required(enum: Event::class)] + public string $event; + + /** + * Identifier sent in the X-Context-Id header. + */ + #[Required('event_id')] + public string $eventID; + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @var value-of $status + */ + #[Required( + enum: Status::class, + )] + public string $status; + + /** + * `new WebhookDelivery1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebhookDelivery1::with( + * attemptedAt: ..., + * error: ..., + * event: ..., + * eventID: ..., + * httpStatus: ..., + * status: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebhookDelivery1) + * ->withAttemptedAt(...) + * ->withError(...) + * ->withEvent(...) + * ->withEventID(...) + * ->withHTTPStatus(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Error|ErrorShape|null $error + * @param Event|value-of $event + * @param Status|value-of $status + */ + public static function with( + \DateTimeInterface $attemptedAt, + Error|array|null $error, + Event|string $event, + string $eventID, + ?int $httpStatus, + Status|string $status, + ): self { + $self = new self; + + $self['attemptedAt'] = $attemptedAt; + $self['error'] = $error; + $self['event'] = $event; + $self['eventID'] = $eventID; + $self['httpStatus'] = $httpStatus; + $self['status'] = $status; + + return $self; + } + + public function withAttemptedAt(\DateTimeInterface $attemptedAt): self + { + $self = clone $this; + $self['attemptedAt'] = $attemptedAt; + + return $self; + } + + /** + * @param Error|ErrorShape|null $error + */ + public function withError( + Error|array|null $error, + ): self { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. + * + * @param Event|value-of $event + */ + public function withEvent(Event|string $event): self + { + $self = clone $this; + $self['event'] = $event; + + return $self; + } + + /** + * Identifier sent in the X-Context-Id header. + */ + public function withEventID(string $eventID): self + { + $self = clone $this; + $self['eventID'] = $eventID; + + return $self; + } + + /** + * The endpoint's final HTTP response status, or null when no response was received. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status, + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php new file mode 100644 index 00000000..94b8d20a --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + #[Required] + public string $code; + + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php new file mode 100644 index 00000000..fe9094a5 --- /dev/null +++ b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php @@ -0,0 +1,15 @@ +, - * includeImages?: bool|null, - * includeLinks?: bool|null, - * ocr?: bool|null, + * includeImages?: IncludeImagesShape|null, + * includeLinks?: IncludeLinksShape|null, + * ocr?: OcrShape|null, * pdf?: null|Pdf|PdfShape, - * shortenBase64Images?: bool|null, + * shortenBase64Images?: ShortenBase64ImagesShape|null, * tags?: list|null, - * useMainContentOnly?: bool|null, + * useMainContentOnly?: UseMainContentOnlyShape|null, * } */ final class ParseHandleParams implements BaseModel @@ -36,7 +53,13 @@ final class ParseHandleParams implements BaseModel use SdkParams; /** - * Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). + * Optional client identifier used for usage attribution. + */ + #[Optional] + public ?string $client; + + /** + * Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt. * * @var value-of|null $extension */ @@ -45,33 +68,41 @@ final class ParseHandleParams implements BaseModel /** * Include image references in Markdown output. + * + * @var IncludeImagesVariants|null $includeImages */ - #[Optional] - public ?bool $includeImages; + #[Optional(union: IncludeImages::class)] + public bool|string|null $includeImages; /** * Preserve hyperlinks in Markdown output. + * + * @var IncludeLinksVariants|null $includeLinks */ - #[Optional] - public ?bool $includeLinks; + #[Optional(union: IncludeLinks::class)] + public bool|string|null $includeLinks; /** - * Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. + * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * + * @var OcrVariants|null $ocr */ - #[Optional] - public ?bool $ocr; + #[Optional(union: Ocr::class)] + public bool|string|null $ocr; /** - * PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. + * PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. */ #[Optional] public ?Pdf $pdf; /** * Shorten base64-encoded image data in the Markdown output. + * + * @var ShortenBase64ImagesVariants|null $shortenBase64Images */ - #[Optional] - public ?bool $shortenBase64Images; + #[Optional(union: ShortenBase64Images::class)] + public bool|string|null $shortenBase64Images; /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -83,9 +114,11 @@ final class ParseHandleParams implements BaseModel /** * Extract only the main content from HTML-like inputs. + * + * @var UseMainContentOnlyVariants|null $useMainContentOnly */ - #[Optional] - public ?bool $useMainContentOnly; + #[Optional(union: UseMainContentOnly::class)] + public bool|string|null $useMainContentOnly; public function __construct() { @@ -98,21 +131,28 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param Extension|value-of|null $extension + * @param IncludeImagesShape|null $includeImages + * @param IncludeLinksShape|null $includeLinks + * @param OcrShape|null $ocr * @param Pdf|PdfShape|null $pdf + * @param ShortenBase64ImagesShape|null $shortenBase64Images * @param list|null $tags + * @param UseMainContentOnlyShape|null $useMainContentOnly */ public static function with( + ?string $client = null, Extension|string|null $extension = null, - ?bool $includeImages = null, - ?bool $includeLinks = null, - ?bool $ocr = null, + bool|UnionMember1|string|null $includeImages = null, + bool|IncludeLinks\UnionMember1|string|null $includeLinks = null, + bool|Ocr\UnionMember1|string|null $ocr = null, Pdf|array|null $pdf = null, - ?bool $shortenBase64Images = null, + bool|ShortenBase64Images\UnionMember1|string|null $shortenBase64Images = null, ?array $tags = null, - ?bool $useMainContentOnly = null, + bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, ): self { $self = new self; + null !== $client && $self['client'] = $client; null !== $extension && $self['extension'] = $extension; null !== $includeImages && $self['includeImages'] = $includeImages; null !== $includeLinks && $self['includeLinks'] = $includeLinks; @@ -126,7 +166,18 @@ public static function with( } /** - * Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). + * Optional client identifier used for usage attribution. + */ + public function withClient(string $client): self + { + $self = clone $this; + $self['client'] = $client; + + return $self; + } + + /** + * Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt. * * @param Extension|value-of $extension */ @@ -140,9 +191,12 @@ public function withExtension(Extension|string $extension): self /** * Include image references in Markdown output. + * + * @param IncludeImagesShape $includeImages */ - public function withIncludeImages(bool $includeImages): self - { + public function withIncludeImages( + bool|UnionMember1|string $includeImages + ): self { $self = clone $this; $self['includeImages'] = $includeImages; @@ -151,9 +205,12 @@ public function withIncludeImages(bool $includeImages): self /** * Preserve hyperlinks in Markdown output. + * + * @param IncludeLinksShape $includeLinks */ - public function withIncludeLinks(bool $includeLinks): self - { + public function withIncludeLinks( + bool|IncludeLinks\UnionMember1|string $includeLinks, + ): self { $self = clone $this; $self['includeLinks'] = $includeLinks; @@ -161,10 +218,13 @@ public function withIncludeLinks(bool $includeLinks): self } /** - * Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. + * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * + * @param OcrShape $ocr */ - public function withOcr(bool $ocr): self - { + public function withOcr( + bool|Ocr\UnionMember1|string $ocr + ): self { $self = clone $this; $self['ocr'] = $ocr; @@ -172,7 +232,7 @@ public function withOcr(bool $ocr): self } /** - * PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. + * PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. * * @param Pdf|PdfShape $pdf */ @@ -186,9 +246,12 @@ public function withPdf(Pdf|array $pdf): self /** * Shorten base64-encoded image data in the Markdown output. + * + * @param ShortenBase64ImagesShape $shortenBase64Images */ - public function withShortenBase64Images(bool $shortenBase64Images): self - { + public function withShortenBase64Images( + bool|ShortenBase64Images\UnionMember1|string $shortenBase64Images, + ): self { $self = clone $this; $self['shortenBase64Images'] = $shortenBase64Images; @@ -210,9 +273,12 @@ public function withTags(array $tags): self /** * Extract only the main content from HTML-like inputs. + * + * @param UseMainContentOnlyShape $useMainContentOnly */ - public function withUseMainContentOnly(bool $useMainContentOnly): self - { + public function withUseMainContentOnly( + bool|UseMainContentOnly\UnionMember1|string $useMainContentOnly, + ): self { $self = clone $this; $self['useMainContentOnly'] = $useMainContentOnly; diff --git a/src/Parse/ParseHandleParams/Extension.php b/src/Parse/ParseHandleParams/Extension.php index 86293e90..fe705d3b 100644 --- a/src/Parse/ParseHandleParams/Extension.php +++ b/src/Parse/ParseHandleParams/Extension.php @@ -5,7 +5,7 @@ namespace ContextDev\Parse\ParseHandleParams; /** - * Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). + * Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt. */ enum Extension: string { diff --git a/src/Parse/ParseHandleParams/IncludeImages.php b/src/Parse/ParseHandleParams/IncludeImages.php new file mode 100644 index 00000000..0aeba32f --- /dev/null +++ b/src/Parse/ParseHandleParams/IncludeImages.php @@ -0,0 +1,29 @@ + + * @phpstan-type IncludeImagesShape = IncludeImagesVariants + */ +final class IncludeImages implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php b/src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php new file mode 100644 index 00000000..414b4f49 --- /dev/null +++ b/src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type IncludeLinksShape = IncludeLinksVariants + */ +final class IncludeLinks implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php b/src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php new file mode 100644 index 00000000..77b25f62 --- /dev/null +++ b/src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type OcrShape = OcrVariants + */ +final class Ocr implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Parse/ParseHandleParams/Ocr/UnionMember1.php b/src/Parse/ParseHandleParams/Ocr/UnionMember1.php new file mode 100644 index 00000000..e1f1eaf4 --- /dev/null +++ b/src/Parse/ParseHandleParams/Ocr/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShortenBase64ImagesShape = ShortenBase64ImagesVariants + */ +final class ShortenBase64Images implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php b/src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php new file mode 100644 index 00000000..8d28751e --- /dev/null +++ b/src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type UseMainContentOnlyShape = UseMainContentOnlyVariants + */ +final class UseMainContentOnly implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php b/src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php new file mode 100644 index 00000000..af6ff084 --- /dev/null +++ b/src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php @@ -0,0 +1,12 @@ + $forceLanguage + * @param ForceLanguage|value-of|null $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -35,8 +38,8 @@ interface BrandContract * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. * @param string $city optional city name to prioritize when searching for the brand * @param bool $highConfidenceOnly when set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence - * @param int $mcc optional Merchant Category Code (MCC) to help identify the business category or industry - * @param float $phone optional phone number from the transaction to help verify brand match + * @param MccShape $mcc optional Merchant Category Code (MCC) to help identify the business category or industry + * @param PhoneShape $phone optional phone number from the transaction to help verify brand match * @param RequestOpts|null $requestOptions * * @throws APIException @@ -58,8 +61,8 @@ public function retrieve( ?string $tickerExchange = null, ?string $city = null, ?bool $highConfidenceOnly = null, - ?int $mcc = null, - ?float $phone = null, + string|float|null $mcc = null, + string|float|null $phone = null, RequestOptions|array|null $requestOptions = null, ): BrandGetResponse; @@ -67,8 +70,9 @@ public function retrieve( * @api * * @param string $domain Domain name to retrieve simplified brand data for - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int|null $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param Theme|value-of $theme optional theme preference used when selecting brand assets * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -76,8 +80,9 @@ public function retrieve( */ public function retrieveSimplified( string $domain, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = 7776000000, ?array $tags = null, + Theme|string|null $theme = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): BrandGetSimplifiedResponse; diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php index d18f9e9f..0d657e63 100644 --- a/src/ServiceContracts/MonitorsContract.php +++ b/src/ServiceContracts/MonitorsContract.php @@ -108,14 +108,16 @@ public function update( /** * @api * - * @param ChangeDetectionType|value-of $changeDetectionType + * @param ChangeDetectionType|value-of $changeDetectionType filter by change detection type + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. * @param string $q free-text search term, matched against the fields named in `search_by` - * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. + * @param list>|null $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching - * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status filter monitors by lifecycle status * @param string $tag filter to items that have this tag - * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) - * @param TargetType|value-of $targetType + * @param list|null $tags comma-separated list of tags to filter by (matches monitors having any of them) + * @param TargetType|value-of $targetType filter by target type * @param RequestOpts|null $requestOptions * * @throws APIException @@ -123,10 +125,10 @@ public function update( public function list( ChangeDetectionType|string|null $changeDetectionType = null, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, ?string $q = null, ?array $searchBy = null, - SearchType|string $searchType = 'prefix', + SearchType|string|null $searchType = null, \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, ?string $tag = null, ?array $tags = null, @@ -149,9 +151,14 @@ public function delete( /** * @api * - * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType filter by change detection type + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param string $monitorID filter changes to a single monitor + * @param \DateTimeInterface $since only include items at or after this ISO 8601 timestamp * @param string $tag filter to items that have this tag - * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType filter by target type + * @param \DateTimeInterface $until only include items before this ISO 8601 timestamp * @param RequestOpts|null $requestOptions * * @throws APIException @@ -159,7 +166,7 @@ public function delete( public function listAccountChanges( \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|string|null $changeDetectionType = null, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, ?string $monitorID = null, ?\DateTimeInterface $since = null, ?string $tag = null, @@ -171,14 +178,16 @@ public function listAccountChanges( /** * @api * - * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status filter runs by lifecycle status * @param RequestOpts|null $requestOptions * * @throws APIException */ public function listAccountRuns( ?string $cursor = null, - int $limit = 25, + ?int $limit = null, \ContextDev\Monitors\MonitorListAccountRunsParams\Status|string|null $status = null, RequestOptions|array|null $requestOptions = null, ): MonitorListAccountRunsResponse; @@ -186,7 +195,11 @@ public function listAccountRuns( /** * @api * + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param \DateTimeInterface $since only include items at or after this ISO 8601 timestamp * @param string $tag filter to items that have this tag + * @param \DateTimeInterface $until only include items before this ISO 8601 timestamp * @param RequestOpts|null $requestOptions * * @throws APIException @@ -194,7 +207,7 @@ public function listAccountRuns( public function listChanges( string $monitorID, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, ?\DateTimeInterface $since = null, ?string $tag = null, ?\DateTimeInterface $until = null, @@ -204,7 +217,9 @@ public function listChanges( /** * @api * - * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status filter runs by lifecycle status * @param RequestOpts|null $requestOptions * * @throws APIException @@ -212,7 +227,7 @@ public function listChanges( public function listRuns( string $monitorID, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, \ContextDev\Monitors\MonitorListRunsParams\Status|string|null $status = null, RequestOptions|array|null $requestOptions = null, ): MonitorListRunsResponse; diff --git a/src/ServiceContracts/ParseContract.php b/src/ServiceContracts/ParseContract.php index 096ed3b2..baec6c1c 100644 --- a/src/ServiceContracts/ParseContract.php +++ b/src/ServiceContracts/ParseContract.php @@ -7,12 +7,18 @@ use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\FileParam; use ContextDev\Parse\ParseHandleParams\Extension; +use ContextDev\Parse\ParseHandleParams\IncludeImages\UnionMember1; use ContextDev\Parse\ParseHandleParams\Pdf; use ContextDev\Parse\ParseHandleResponse; use ContextDev\RequestOptions; /** + * @phpstan-import-type IncludeImagesShape from \ContextDev\Parse\ParseHandleParams\IncludeImages + * @phpstan-import-type IncludeLinksShape from \ContextDev\Parse\ParseHandleParams\IncludeLinks + * @phpstan-import-type OcrShape from \ContextDev\Parse\ParseHandleParams\Ocr * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf + * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Parse\ParseHandleParams\ShortenBase64Images + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Parse\ParseHandleParams\UseMainContentOnly * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface ParseContract @@ -21,28 +27,30 @@ interface ParseContract * @api * * @param string|FileParam $body Body param - * @param Extension|value-of $extension Query param: Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). - * @param bool $includeImages Query param: Include image references in Markdown output - * @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param bool $ocr Query param: Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. - * @param Pdf|PdfShape $pdf Query param: PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. - * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output + * @param string $client query param: Optional client identifier used for usage attribution + * @param Extension|value-of $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt + * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output + * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output + * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. + * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs + * @param UseMainContentOnlyShape $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param RequestOpts|null $requestOptions * * @throws APIException */ public function handle( string|FileParam $body, + ?string $client = null, Extension|string|null $extension = null, - bool $includeImages = false, - bool $includeLinks = true, - bool $ocr = false, + bool|UnionMember1|string $includeImages = false, + bool|\ContextDev\Parse\ParseHandleParams\IncludeLinks\UnionMember1|string $includeLinks = true, + bool|\ContextDev\Parse\ParseHandleParams\Ocr\UnionMember1|string $ocr = false, Pdf|array $pdf = (object) [], - bool $shortenBase64Images = true, + bool|\ContextDev\Parse\ParseHandleParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, ?array $tags = null, - bool $useMainContentOnly = false, + bool|\ContextDev\Parse\ParseHandleParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse; } diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 5fb83190..4b8beca3 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -14,7 +14,7 @@ use ContextDev\Web\WebExtractStyleguideResponse; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; -use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; +use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; use ContextDev\Web\WebScreenshotResponse; @@ -30,12 +30,23 @@ /** * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf + * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 + * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 + * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly + * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment + * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 + * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages + * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 + * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations as SettleAnimationsShape1 + * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly as UseMainContentOnlyShape1 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface WebContract @@ -103,7 +114,7 @@ public function extractCompetitors( * * @param string $directURL A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. - * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int|null $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -113,7 +124,7 @@ public function extractCompetitors( public function extractFonts( ?string $directURL = null, ?string $domain = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = 7776000000, ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, @@ -125,7 +136,7 @@ public function extractFonts( * @param ColorScheme|value-of $colorScheme Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key. * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. - * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int|null $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -136,7 +147,7 @@ public function extractStyleguide( ColorScheme|string|null $colorScheme = null, ?string $directURL = null, ?string $domain = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = 7776000000, ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, @@ -146,18 +157,18 @@ public function extractStyleguide( * @api * * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. - * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). - * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. - * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. + * @param HandleCookiePopupShape $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * @param int|null $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. - * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + * @param int|null $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -168,14 +179,14 @@ public function screenshot( ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, - HandleCookiePopup|string $handleCookiePopup = 'false', - int $maxAgeMs = 86400000, + bool|UnionMember1|string $handleCookiePopup = false, + ?int $maxAgeMs = 86400000, Page|string|null $page = null, ?int $scrollOffset = null, ?array $tags = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], - int $waitForMs = 3000, + ?int $waitForMs = 3000, RequestOptions|array|null $requestOptions = null, ): WebScreenshotResponse; @@ -267,18 +278,18 @@ public function webCrawlMd( * @api * * @param string $url Full URL to scrape (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. - * @param list $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML - * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". - * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML + * @param list|null $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param SettleAnimationsShape $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + * @param UseMainContentOnlyShape $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions * * @throws APIException @@ -288,16 +299,16 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool $includeFrames = false, + bool|\ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames\UnionMember1|string $includeFrames = false, ?array $includeSelectors = null, - int $maxAgeMs = 86400000, + ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool $settleAnimations = false, + bool|\ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations\UnionMember1|string $settleAnimations = false, ?array $tags = null, ?int $timeoutMs = null, - bool $useMainContentOnly = false, + bool|\ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, ): WebWebScrapeHTMLResponse; @@ -306,23 +317,23 @@ public function webScrapeHTML( * @api * * @param string $url Page URL to inspect. Must include http:// or https://. - * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. - * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true + * @param DedupeShape $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + * @param int|null $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function webScrapeImages( string $url, - bool $dedupe = false, + bool|\ContextDev\Web\WebWebScrapeImagesParams\Dedupe\UnionMember1|string $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, - int $maxAgeMs = 86400000, + ?int $maxAgeMs = 86400000, ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, @@ -333,21 +344,21 @@ public function webScrapeImages( * @api * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. - * @param list $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown - * @param bool $includeImages Include image references in Markdown output - * @param bool $includeLinks Preserve hyperlinks in Markdown output - * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". - * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown + * @param IncludeImagesShape $includeImages Include image references in Markdown output + * @param IncludeLinksShape $includeLinks Preserve hyperlinks in Markdown output + * @param list|null $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param SettleAnimationsShape1 $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param ShortenBase64ImagesShape $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + * @param UseMainContentOnlyShape1 $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions * * @throws APIException @@ -357,19 +368,19 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool $includeFrames = false, - bool $includeImages = false, - bool $includeLinks = true, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1|string $includeFrames = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeImages\UnionMember1|string $includeImages = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeLinks\UnionMember1|string $includeLinks = true, ?array $includeSelectors = null, - int $maxAgeMs = 86400000, + ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool $settleAnimations = false, - bool $shortenBase64Images = true, + bool|\ContextDev\Web\WebWebScrapeMdParams\SettleAnimations\UnionMember1|string $settleAnimations = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, ?array $tags = null, ?int $timeoutMs = null, - bool $useMainContentOnly = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, ): WebWebScrapeMdResponse; @@ -380,6 +391,7 @@ public function webScrapeMd( * @param string $domain Domain to build a sitemap for * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param string $sitemapURL Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. @@ -391,6 +403,7 @@ public function webScrapeSitemap( string $domain, ?array $headers = null, int $maxLinks = 10000, + ?string $sitemapURL = null, ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index d2c63f88..7796a7dc 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -10,6 +10,7 @@ use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Brand\BrandRetrieveSimplifiedParams; +use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; use ContextDev\Client; use ContextDev\Core\Contracts\BaseResponse; use ContextDev\Core\Exceptions\APIException; @@ -18,6 +19,8 @@ use ContextDev\ServiceContracts\BrandRawContract; /** + * @phpstan-import-type MccShape from \ContextDev\Brand\BrandRetrieveParams\Mcc + * @phpstan-import-type PhoneShape from \ContextDev\Brand\BrandRetrieveParams\Phone * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class BrandRawService implements BrandRawContract @@ -50,8 +53,8 @@ public function __construct(private Client $client) {} * transactionInfo: string, * city?: string, * highConfidenceOnly?: bool, - * mcc?: int, - * phone?: float, + * mcc?: MccShape, + * phone?: PhoneShape, * }|BrandRetrieveParams $params * @param RequestOpts|null $requestOptions * @@ -84,7 +87,11 @@ public function retrieve( * Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. Optimized for faster responses and reduced data transfer. * * @param array{ - * domain: string, maxAgeMs?: int, tags?: list, timeoutMs?: int + * domain: string, + * maxAgeMs?: int|null, + * tags?: list, + * theme?: Theme|value-of, + * timeoutMs?: int, * }|BrandRetrieveSimplifiedParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index a8e38e22..96210d0a 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -8,6 +8,7 @@ use ContextDev\Brand\BrandGetSimplifiedResponse; use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Brand\BrandRetrieveParams\Type; +use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\Util; @@ -15,6 +16,8 @@ use ContextDev\ServiceContracts\BrandContract; /** + * @phpstan-import-type MccShape from \ContextDev\Brand\BrandRetrieveParams\Mcc + * @phpstan-import-type PhoneShape from \ContextDev\Brand\BrandRetrieveParams\Phone * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class BrandService implements BrandContract @@ -44,7 +47,7 @@ public function __construct(private Client $client) * @param string $ticker Stock ticker symbol to retrieve brand data for (e.g., 'AAPL'). * @param string $directURL Full http(s) URL to fetch brand data from (e.g., 'https://stripe.com/enterprise'). Only this URL is fetched — not the entire internet. * @param string $transactionInfo transaction information to identify the brand - * @param ForceLanguage|value-of $forceLanguage + * @param ForceLanguage|value-of|null $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -53,8 +56,8 @@ public function __construct(private Client $client) * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. * @param string $city optional city name to prioritize when searching for the brand * @param bool $highConfidenceOnly when set to true, the API performs additional verification to ensure the identified brand matches the transaction with high confidence - * @param int $mcc optional Merchant Category Code (MCC) to help identify the business category or industry - * @param float $phone optional phone number from the transaction to help verify brand match + * @param MccShape $mcc optional Merchant Category Code (MCC) to help identify the business category or industry + * @param PhoneShape $phone optional phone number from the transaction to help verify brand match * @param RequestOpts|null $requestOptions * * @throws APIException @@ -76,8 +79,8 @@ public function retrieve( ?string $tickerExchange = null, ?string $city = null, ?bool $highConfidenceOnly = null, - ?int $mcc = null, - ?float $phone = null, + string|float|null $mcc = null, + string|float|null $phone = null, RequestOptions|array|null $requestOptions = null, ): BrandGetResponse { $params = Util::removeNulls( @@ -115,8 +118,9 @@ public function retrieve( * Returns a simplified version of brand data containing only essential information: domain, title, colors, logos, and backdrops. Optimized for faster responses and reduced data transfer. * * @param string $domain Domain name to retrieve simplified brand data for - * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int|null $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param Theme|value-of $theme optional theme preference used when selecting brand assets * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -124,8 +128,9 @@ public function retrieve( */ public function retrieveSimplified( string $domain, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = 7776000000, ?array $tags = null, + Theme|string|null $theme = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): BrandGetSimplifiedResponse { @@ -134,6 +139,7 @@ public function retrieveSimplified( 'domain' => $domain, 'maxAgeMs' => $maxAgeMs, 'tags' => $tags, + 'theme' => $theme, 'timeoutMs' => $timeoutMs, ], ); diff --git a/src/Services/MonitorsRawService.php b/src/Services/MonitorsRawService.php index 029e994b..7251d06b 100644 --- a/src/Services/MonitorsRawService.php +++ b/src/Services/MonitorsRawService.php @@ -171,11 +171,11 @@ public function update( * cursor?: string, * limit?: int, * q?: string, - * searchBy?: list>, + * searchBy?: list>|null, * searchType?: SearchType|value-of, * status?: MonitorListParams\Status|value-of, * tag?: string, - * tags?: list, + * tags?: list|null, * targetType?: TargetType|value-of, * }|MonitorListParams $params * @param RequestOpts|null $requestOptions diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php index d46ad6ad..0432335d 100644 --- a/src/Services/MonitorsService.php +++ b/src/Services/MonitorsService.php @@ -173,14 +173,16 @@ public function update( * * Lists monitors for the authenticated organization. Supports free-text search (`q` over `search_by` fields, `prefix` or `exact` via `search_type`) plus status/type/tag filters. Results are paginated via the opaque `cursor`. * - * @param ChangeDetectionType|value-of $changeDetectionType + * @param ChangeDetectionType|value-of $changeDetectionType filter by change detection type + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. * @param string $q free-text search term, matched against the fields named in `search_by` - * @param list> $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. + * @param list>|null $searchBy Comma-separated fields to search with `q`. Defaults to all of them. Note `instructions` only exists on extract monitors. * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching - * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status Monitor lifecycle status. `failed` means the most recent run failed (see the monitor's `last_error`); failed monitors keep running on schedule and flip back to `active` on the next successful run. Monitors are auto-`paused` after repeated consecutive failures or insufficient-credit skips; resume by PATCHing status to `active`. + * @param \ContextDev\Monitors\MonitorListParams\Status|value-of<\ContextDev\Monitors\MonitorListParams\Status> $status filter monitors by lifecycle status * @param string $tag filter to items that have this tag - * @param list $tags comma-separated list of tags to filter by (matches monitors having any of them) - * @param TargetType|value-of $targetType + * @param list|null $tags comma-separated list of tags to filter by (matches monitors having any of them) + * @param TargetType|value-of $targetType filter by target type * @param RequestOpts|null $requestOptions * * @throws APIException @@ -188,10 +190,10 @@ public function update( public function list( ChangeDetectionType|string|null $changeDetectionType = null, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, ?string $q = null, ?array $searchBy = null, - SearchType|string $searchType = 'prefix', + SearchType|string|null $searchType = null, \ContextDev\Monitors\MonitorListParams\Status|string|null $status = null, ?string $tag = null, ?array $tags = null, @@ -243,9 +245,14 @@ public function delete( * * Returns an account-wide feed of detected changes across monitors. * - * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType> $changeDetectionType filter by change detection type + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param string $monitorID filter changes to a single monitor + * @param \DateTimeInterface $since only include items at or after this ISO 8601 timestamp * @param string $tag filter to items that have this tag - * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType + * @param \ContextDev\Monitors\MonitorListAccountChangesParams\TargetType|value-of<\ContextDev\Monitors\MonitorListAccountChangesParams\TargetType> $targetType filter by target type + * @param \DateTimeInterface $until only include items before this ISO 8601 timestamp * @param RequestOpts|null $requestOptions * * @throws APIException @@ -253,7 +260,7 @@ public function delete( public function listAccountChanges( \ContextDev\Monitors\MonitorListAccountChangesParams\ChangeDetectionType|string|null $changeDetectionType = null, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, ?string $monitorID = null, ?\DateTimeInterface $since = null, ?string $tag = null, @@ -285,14 +292,16 @@ public function listAccountChanges( * * Returns an account-wide feed of monitor runs across all monitors. * - * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param \ContextDev\Monitors\MonitorListAccountRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsParams\Status> $status filter runs by lifecycle status * @param RequestOpts|null $requestOptions * * @throws APIException */ public function listAccountRuns( ?string $cursor = null, - int $limit = 25, + ?int $limit = null, \ContextDev\Monitors\MonitorListAccountRunsParams\Status|string|null $status = null, RequestOptions|array|null $requestOptions = null, ): MonitorListAccountRunsResponse { @@ -311,7 +320,11 @@ public function listAccountRuns( * * List changes for a monitor * + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param \DateTimeInterface $since only include items at or after this ISO 8601 timestamp * @param string $tag filter to items that have this tag + * @param \DateTimeInterface $until only include items before this ISO 8601 timestamp * @param RequestOpts|null $requestOptions * * @throws APIException @@ -319,7 +332,7 @@ public function listAccountRuns( public function listChanges( string $monitorID, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, ?\DateTimeInterface $since = null, ?string $tag = null, ?\DateTimeInterface $until = null, @@ -346,7 +359,9 @@ public function listChanges( * * List monitor runs * - * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status Lifecycle status of a run. `skipped` runs never executed — see `skip_reason` (insufficient credits, monitor paused, or superseded by a concurrent run). + * @param string $cursor opaque pagination cursor from a previous response + * @param int $limit Maximum number of items to return per page (1-100). Defaults to 25. + * @param \ContextDev\Monitors\MonitorListRunsParams\Status|value-of<\ContextDev\Monitors\MonitorListRunsParams\Status> $status filter runs by lifecycle status * @param RequestOpts|null $requestOptions * * @throws APIException @@ -354,7 +369,7 @@ public function listChanges( public function listRuns( string $monitorID, ?string $cursor = null, - int $limit = 25, + ?int $limit = null, \ContextDev\Monitors\MonitorListRunsParams\Status|string|null $status = null, RequestOptions|array|null $requestOptions = null, ): MonitorListRunsResponse { diff --git a/src/Services/ParseRawService.php b/src/Services/ParseRawService.php index 1fe132de..74ec978f 100644 --- a/src/Services/ParseRawService.php +++ b/src/Services/ParseRawService.php @@ -16,7 +16,12 @@ use ContextDev\ServiceContracts\ParseRawContract; /** + * @phpstan-import-type IncludeImagesShape from \ContextDev\Parse\ParseHandleParams\IncludeImages + * @phpstan-import-type IncludeLinksShape from \ContextDev\Parse\ParseHandleParams\IncludeLinks + * @phpstan-import-type OcrShape from \ContextDev\Parse\ParseHandleParams\Ocr * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf + * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Parse\ParseHandleParams\ShortenBase64Images + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Parse\ParseHandleParams\UseMainContentOnly * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class ParseRawService implements ParseRawContract @@ -30,18 +35,19 @@ public function __construct(private Client $client) {} /** * @api * - * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. The base request costs 1 credit. When OCR runs (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no OCR ends up running still cost 1 credit. + * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. * * @param string|FileParam $body Body param * @param array{ + * client?: string, * extension?: value-of, - * includeImages?: bool, - * includeLinks?: bool, - * ocr?: bool, + * includeImages?: IncludeImagesShape, + * includeLinks?: IncludeLinksShape, + * ocr?: OcrShape, * pdf?: Pdf|PdfShape, - * shortenBase64Images?: bool, + * shortenBase64Images?: ShortenBase64ImagesShape, * tags?: list, - * useMainContentOnly?: bool, + * useMainContentOnly?: UseMainContentOnlyShape, * }|ParseHandleParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php index 0ff57bed..b2dffe05 100644 --- a/src/Services/ParseService.php +++ b/src/Services/ParseService.php @@ -9,13 +9,19 @@ use ContextDev\Core\FileParam; use ContextDev\Core\Util; use ContextDev\Parse\ParseHandleParams\Extension; +use ContextDev\Parse\ParseHandleParams\IncludeImages\UnionMember1; use ContextDev\Parse\ParseHandleParams\Pdf; use ContextDev\Parse\ParseHandleResponse; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\ParseContract; /** + * @phpstan-import-type IncludeImagesShape from \ContextDev\Parse\ParseHandleParams\IncludeImages + * @phpstan-import-type IncludeLinksShape from \ContextDev\Parse\ParseHandleParams\IncludeLinks + * @phpstan-import-type OcrShape from \ContextDev\Parse\ParseHandleParams\Ocr * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf + * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Parse\ParseHandleParams\ShortenBase64Images + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Parse\ParseHandleParams\UseMainContentOnly * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class ParseService implements ParseContract @@ -36,35 +42,38 @@ public function __construct(private Client $client) /** * @api * - * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. The base request costs 1 credit. When OCR runs (requires ocr=true), the entire call costs 5 credits; ocr=true requests where no OCR ends up running still cost 1 credit. + * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. * * @param string|FileParam $body Body param - * @param Extension|value-of $extension Query param: Optional file extension hint. Case-insensitive; a leading dot is accepted (e.g. ".pdf"). - * @param bool $includeImages Query param: Include image references in Markdown output - * @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param bool $ocr Query param: Gates all OCR. When true, PDFs get embedded-image OCR (recognized text inserted at each image's position in page reading order, preserving the text layer; pdf.start/pdf.end limit the page range), scanned PDFs with no text layer get full-document OCR, and raster images get their visible text transcribed. When false, no OCR runs: scanned PDFs may yield no content and images return only format/dimension metadata. Calls where OCR actually runs cost 5 credits instead of 1. - * @param Pdf|PdfShape $pdf Query param: PDF page-range controls. Use start/end to limit parsing (and OCR when ocr=true) to an inclusive 1-based page range. - * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output + * @param string $client query param: Optional client identifier used for usage attribution + * @param Extension|value-of $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt + * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output + * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output + * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. + * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs + * @param UseMainContentOnlyShape $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param RequestOpts|null $requestOptions * * @throws APIException */ public function handle( string|FileParam $body, + ?string $client = null, Extension|string|null $extension = null, - bool $includeImages = false, - bool $includeLinks = true, - bool $ocr = false, + bool|UnionMember1|string $includeImages = false, + bool|\ContextDev\Parse\ParseHandleParams\IncludeLinks\UnionMember1|string $includeLinks = true, + bool|\ContextDev\Parse\ParseHandleParams\Ocr\UnionMember1|string $ocr = false, Pdf|array $pdf = (object) [], - bool $shortenBase64Images = true, + bool|\ContextDev\Parse\ParseHandleParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, ?array $tags = null, - bool $useMainContentOnly = false, + bool|\ContextDev\Parse\ParseHandleParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse { $params = Util::removeNulls( [ + 'client' => $client, 'extension' => $extension, 'includeImages' => $includeImages, 'includeLinks' => $includeLinks, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 741b92f8..a9d005de 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -23,7 +23,6 @@ use ContextDev\Web\WebScreenshotParams; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; -use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; use ContextDev\Web\WebScreenshotResponse; @@ -45,12 +44,23 @@ /** * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf + * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 + * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 + * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly + * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment + * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 + * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages + * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 + * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations as SettleAnimationsShape1 + * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly as UseMainContentOnlyShape1 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class WebRawService implements WebRawContract @@ -148,7 +158,7 @@ public function extractCompetitors( * @param array{ * directURL?: string, * domain?: string, - * maxAgeMs?: int, + * maxAgeMs?: int|null, * tags?: list, * timeoutMs?: int, * }|WebExtractFontsParams $params @@ -189,7 +199,7 @@ public function extractFonts( * colorScheme?: ColorScheme|value-of, * directURL?: string, * domain?: string, - * maxAgeMs?: int, + * maxAgeMs?: int|null, * tags?: list, * timeoutMs?: int, * }|WebExtractStyleguideParams $params @@ -232,14 +242,14 @@ public function extractStyleguide( * directURL?: string, * domain?: string, * fullScreenshot?: FullScreenshot|value-of, - * handleCookiePopup?: HandleCookiePopup|value-of, - * maxAgeMs?: int, + * handleCookiePopup?: HandleCookiePopupShape, + * maxAgeMs?: int|null, * page?: Page|value-of, - * scrollOffset?: int, + * scrollOffset?: int|null, * tags?: list, * timeoutMs?: int, * viewport?: Viewport|ViewportShape, - * waitForMs?: int, + * waitForMs?: int|null, * }|WebScreenshotParams $params * @param RequestOpts|null $requestOptions * @@ -371,17 +381,17 @@ public function webCrawlMd( * @param array{ * url: string, * country?: value-of, - * excludeSelectors?: list, + * excludeSelectors?: list|null, * headers?: array, - * includeFrames?: bool, - * includeSelectors?: list, - * maxAgeMs?: int, + * includeFrames?: IncludeFramesShape, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, * pdf?: WebWebScrapeHTMLParams\Pdf|PdfShape2, - * settleAnimations?: bool, + * settleAnimations?: SettleAnimationsShape, * tags?: list, * timeoutMs?: int, - * useMainContentOnly?: bool, - * waitForMs?: int, + * useMainContentOnly?: UseMainContentOnlyShape, + * waitForMs?: int|null, * }|WebWebScrapeHTMLParams $params * @param RequestOpts|null $requestOptions * @@ -415,13 +425,13 @@ public function webScrapeHTML( * * @param array{ * url: string, - * dedupe?: bool, - * enrichment?: Enrichment|EnrichmentShape, + * dedupe?: DedupeShape, + * enrichment?: Enrichment|EnrichmentShape|null, * headers?: array, - * maxAgeMs?: int, + * maxAgeMs?: int|null, * tags?: list, * timeoutMs?: int, - * waitForMs?: int, + * waitForMs?: int|null, * }|WebWebScrapeImagesParams $params * @param RequestOpts|null $requestOptions * @@ -469,20 +479,20 @@ public function webScrapeImages( * @param array{ * url: string, * country?: value-of, - * excludeSelectors?: list, + * excludeSelectors?: list|null, * headers?: array, - * includeFrames?: bool, - * includeImages?: bool, - * includeLinks?: bool, - * includeSelectors?: list, - * maxAgeMs?: int, + * includeFrames?: IncludeFramesShape1, + * includeImages?: IncludeImagesShape, + * includeLinks?: IncludeLinksShape, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, * pdf?: WebWebScrapeMdParams\Pdf|PdfShape3, - * settleAnimations?: bool, - * shortenBase64Images?: bool, + * settleAnimations?: SettleAnimationsShape1, + * shortenBase64Images?: ShortenBase64ImagesShape, * tags?: list, * timeoutMs?: int, - * useMainContentOnly?: bool, - * waitForMs?: int, + * useMainContentOnly?: UseMainContentOnlyShape1, + * waitForMs?: int|null, * }|WebWebScrapeMdParams $params * @param RequestOpts|null $requestOptions * @@ -518,6 +528,7 @@ public function webScrapeMd( * domain: string, * headers?: array, * maxLinks?: int, + * sitemapURL?: string, * tags?: list, * timeoutMs?: int, * urlRegex?: string, @@ -541,7 +552,10 @@ public function webScrapeSitemap( return $this->client->request( method: 'get', path: 'web/scrape/sitemap', - query: Util::array_transform_keys($parsed, ['timeoutMs' => 'timeoutMS']), + query: Util::array_transform_keys( + $parsed, + ['sitemapURL' => 'sitemapUrl', 'timeoutMs' => 'timeoutMS'] + ), options: $options, convert: WebWebScrapeSitemapResponse::class, ); diff --git a/src/Services/WebService.php b/src/Services/WebService.php index ec22e32f..129ad401 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -17,7 +17,7 @@ use ContextDev\Web\WebExtractStyleguideResponse; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; -use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; +use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; use ContextDev\Web\WebScreenshotResponse; @@ -33,12 +33,23 @@ /** * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf + * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 + * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 + * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly + * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment + * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 + * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages + * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 + * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations as SettleAnimationsShape1 + * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images + * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly as UseMainContentOnlyShape1 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class WebService implements WebContract @@ -163,7 +174,7 @@ public function extractCompetitors( * * @param string $directURL A specific URL to fetch fonts from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, fonts are extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract fonts from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. - * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int|null $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -173,7 +184,7 @@ public function extractCompetitors( public function extractFonts( ?string $directURL = null, ?string $domain = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = 7776000000, ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, @@ -202,7 +213,7 @@ public function extractFonts( * @param ColorScheme|value-of $colorScheme Optional browser color scheme to emulate for websites that respond to prefers-color-scheme. This value is part of the styleguide cache key. * @param string $directURL A specific URL to fetch the styleguide from directly, bypassing domain resolution (e.g., 'https://example.com/design-system'). When provided, the styleguide is extracted from this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to extract styleguide from (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. - * @param int $maxAgeMs Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * @param int|null $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions @@ -213,7 +224,7 @@ public function extractStyleguide( ColorScheme|string|null $colorScheme = null, ?string $directURL = null, ?string $domain = null, - int $maxAgeMs = 7776000000, + ?int $maxAgeMs = 7776000000, ?array $tags = null, ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, @@ -241,18 +252,18 @@ public function extractStyleguide( * Capture a screenshot of a website. * * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. - * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). - * @param HandleCookiePopup|value-of $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. - * @param int $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. + * @param HandleCookiePopupShape $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * @param int|null $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. - * @param int $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. + * @param int|null $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -263,14 +274,14 @@ public function screenshot( ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, - HandleCookiePopup|string $handleCookiePopup = 'false', - int $maxAgeMs = 86400000, + bool|UnionMember1|string $handleCookiePopup = false, + ?int $maxAgeMs = 86400000, Page|string|null $page = null, ?int $scrollOffset = null, ?array $tags = null, ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], - int $waitForMs = 3000, + ?int $waitForMs = 3000, RequestOptions|array|null $requestOptions = null, ): WebScreenshotResponse { $params = Util::removeNulls( @@ -441,18 +452,18 @@ public function webCrawlMd( * Scrapes the given URL and returns the raw HTML content of the page. * * @param string $url Full URL to scrape (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. - * @param list $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML - * @param list $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". - * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML + * @param list|null $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param SettleAnimationsShape $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + * @param UseMainContentOnlyShape $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions * * @throws APIException @@ -462,16 +473,16 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool $includeFrames = false, + bool|\ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames\UnionMember1|string $includeFrames = false, ?array $includeSelectors = null, - int $maxAgeMs = 86400000, + ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool $settleAnimations = false, + bool|\ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations\UnionMember1|string $settleAnimations = false, ?array $tags = null, ?int $timeoutMs = null, - bool $useMainContentOnly = false, + bool|\ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, ): WebWebScrapeHTMLResponse { @@ -505,23 +516,23 @@ public function webScrapeHTML( * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. * * @param string $url Page URL to inspect. Must include http:// or https://. - * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. - * @param Enrichment|EnrichmentShape $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true + * @param DedupeShape $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param int $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). + * @param int|null $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function webScrapeImages( string $url, - bool $dedupe = false, + bool|\ContextDev\Web\WebWebScrapeImagesParams\Dedupe\UnionMember1|string $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, - int $maxAgeMs = 86400000, + ?int $maxAgeMs = 86400000, ?array $tags = null, ?int $timeoutMs = null, ?int $waitForMs = null, @@ -565,21 +576,21 @@ public function webScrapeImages( * | 500 | No | Internal error | * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. - * @param list $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown - * @param bool $includeImages Include image references in Markdown output - * @param bool $includeLinks Preserve hyperlinks in Markdown output - * @param list $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". - * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown + * @param IncludeImagesShape $includeImages Include image references in Markdown output + * @param IncludeLinksShape $includeLinks Preserve hyperlinks in Markdown output + * @param list|null $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". + * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param SettleAnimationsShape1 $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param ShortenBase64ImagesShape $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + * @param UseMainContentOnlyShape1 $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation + * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). * @param RequestOpts|null $requestOptions * * @throws APIException @@ -589,19 +600,19 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool $includeFrames = false, - bool $includeImages = false, - bool $includeLinks = true, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1|string $includeFrames = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeImages\UnionMember1|string $includeImages = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeLinks\UnionMember1|string $includeLinks = true, ?array $includeSelectors = null, - int $maxAgeMs = 86400000, + ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool $settleAnimations = false, - bool $shortenBase64Images = true, + bool|\ContextDev\Web\WebWebScrapeMdParams\SettleAnimations\UnionMember1|string $settleAnimations = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, ?array $tags = null, ?int $timeoutMs = null, - bool $useMainContentOnly = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, RequestOptions|array|null $requestOptions = null, ): WebWebScrapeMdResponse { @@ -640,6 +651,7 @@ public function webScrapeMd( * @param string $domain Domain to build a sitemap for * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param string $sitemapURL Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. @@ -651,6 +663,7 @@ public function webScrapeSitemap( string $domain, ?array $headers = null, int $maxLinks = 10000, + ?string $sitemapURL = null, ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, @@ -661,6 +674,7 @@ public function webScrapeSitemap( 'domain' => $domain, 'headers' => $headers, 'maxLinks' => $maxLinks, + 'sitemapURL' => $sitemapURL, 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'urlRegex' => $urlRegex, diff --git a/src/Web/WebExtractFontsParams.php b/src/Web/WebExtractFontsParams.php index 18f9a3da..ce89edc3 100644 --- a/src/Web/WebExtractFontsParams.php +++ b/src/Web/WebExtractFontsParams.php @@ -41,9 +41,9 @@ final class WebExtractFontsParams implements BaseModel public ?string $domain; /** - * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. */ - #[Optional] + #[Optional(nullable: true)] public ?int $maxAgeMs; /** @@ -113,9 +113,9 @@ public function withDomain(string $domain): self } /** - * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. */ - public function withMaxAgeMs(int $maxAgeMs): self + public function withMaxAgeMs(?int $maxAgeMs): self { $self = clone $this; $self['maxAgeMs'] = $maxAgeMs; diff --git a/src/Web/WebExtractStyleguideParams.php b/src/Web/WebExtractStyleguideParams.php index 2ec93187..af8fd347 100644 --- a/src/Web/WebExtractStyleguideParams.php +++ b/src/Web/WebExtractStyleguideParams.php @@ -51,9 +51,9 @@ final class WebExtractStyleguideParams implements BaseModel public ?string $domain; /** - * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. */ - #[Optional] + #[Optional(nullable: true)] public ?int $maxAgeMs; /** @@ -139,9 +139,9 @@ public function withDomain(string $domain): self } /** - * Maximum age in milliseconds for cached data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. + * Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. */ - public function withMaxAgeMs(int $maxAgeMs): self + public function withMaxAgeMs(?int $maxAgeMs): self { $self = clone $this; $self['maxAgeMs'] = $maxAgeMs; diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index f3551dca..3f818a3c 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -12,6 +12,7 @@ use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; +use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; @@ -20,6 +21,8 @@ * * @see ContextDev\Services\WebService::screenshot() * + * @phpstan-import-type HandleCookiePopupVariants from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup + * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * * @phpstan-type WebScreenshotParamsShape = array{ @@ -28,7 +31,7 @@ * directURL?: string|null, * domain?: string|null, * fullScreenshot?: null|FullScreenshot|value-of, - * handleCookiePopup?: null|HandleCookiePopup|value-of, + * handleCookiePopup?: HandleCookiePopupShape|null, * maxAgeMs?: int|null, * page?: null|Page|value-of, * scrollOffset?: int|null, @@ -53,7 +56,7 @@ final class WebScreenshotParams implements BaseModel public ?string $colorScheme; /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * * @var value-of|null $country */ @@ -83,15 +86,15 @@ final class WebScreenshotParams implements BaseModel /** * Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * - * @var value-of|null $handleCookiePopup + * @var HandleCookiePopupVariants|null $handleCookiePopup */ - #[Optional(enum: HandleCookiePopup::class)] - public ?string $handleCookiePopup; + #[Optional(union: HandleCookiePopup::class)] + public bool|string|null $handleCookiePopup; /** * Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. */ - #[Optional] + #[Optional(nullable: true)] public ?int $maxAgeMs; /** @@ -105,7 +108,7 @@ final class WebScreenshotParams implements BaseModel /** * Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. */ - #[Optional] + #[Optional(nullable: true)] public ?int $scrollOffset; /** @@ -129,9 +132,9 @@ final class WebScreenshotParams implements BaseModel public ?Viewport $viewport; /** - * Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. */ - #[Optional] + #[Optional(nullable: true)] public ?int $waitForMs; public function __construct() @@ -147,7 +150,7 @@ public function __construct() * @param ColorScheme|value-of|null $colorScheme * @param Country|value-of|null $country * @param FullScreenshot|value-of|null $fullScreenshot - * @param HandleCookiePopup|value-of|null $handleCookiePopup + * @param HandleCookiePopupShape|null $handleCookiePopup * @param Page|value-of|null $page * @param list|null $tags * @param Viewport|ViewportShape|null $viewport @@ -158,7 +161,7 @@ public static function with( ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, - HandleCookiePopup|string|null $handleCookiePopup = null, + bool|UnionMember1|string|null $handleCookiePopup = null, ?int $maxAgeMs = null, Page|string|null $page = null, ?int $scrollOffset = null, @@ -200,7 +203,7 @@ public function withColorScheme(ColorScheme|string $colorScheme): self } /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * * @param Country|value-of $country */ @@ -251,10 +254,10 @@ public function withFullScreenshot( /** * Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * - * @param HandleCookiePopup|value-of $handleCookiePopup + * @param HandleCookiePopupShape $handleCookiePopup */ public function withHandleCookiePopup( - HandleCookiePopup|string $handleCookiePopup + bool|UnionMember1|string $handleCookiePopup ): self { $self = clone $this; $self['handleCookiePopup'] = $handleCookiePopup; @@ -265,7 +268,7 @@ public function withHandleCookiePopup( /** * Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. */ - public function withMaxAgeMs(int $maxAgeMs): self + public function withMaxAgeMs(?int $maxAgeMs): self { $self = clone $this; $self['maxAgeMs'] = $maxAgeMs; @@ -289,7 +292,7 @@ public function withPage(Page|string $page): self /** * Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. */ - public function withScrollOffset(int $scrollOffset): self + public function withScrollOffset(?int $scrollOffset): self { $self = clone $this; $self['scrollOffset'] = $scrollOffset; @@ -335,9 +338,9 @@ public function withViewport(Viewport|array $viewport): self } /** - * Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. */ - public function withWaitForMs(int $waitForMs): self + public function withWaitForMs(?int $waitForMs): self { $self = clone $this; $self['waitForMs'] = $waitForMs; diff --git a/src/Web/WebScreenshotParams/Country.php b/src/Web/WebScreenshotParams/Country.php index 912e4350..9715cfcb 100644 --- a/src/Web/WebScreenshotParams/Country.php +++ b/src/Web/WebScreenshotParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebScreenshotParams; /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. */ enum Country: string { diff --git a/src/Web/WebScreenshotParams/HandleCookiePopup.php b/src/Web/WebScreenshotParams/HandleCookiePopup.php index 574b402b..0b9f790c 100644 --- a/src/Web/WebScreenshotParams/HandleCookiePopup.php +++ b/src/Web/WebScreenshotParams/HandleCookiePopup.php @@ -4,12 +4,26 @@ namespace ContextDev\Web\WebScreenshotParams; +use ContextDev\Core\Concerns\SdkUnion; +use ContextDev\Core\Conversion\Contracts\Converter; +use ContextDev\Core\Conversion\Contracts\ConverterSource; +use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; + /** * Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * + * @phpstan-type HandleCookiePopupVariants = bool|value-of + * @phpstan-type HandleCookiePopupShape = HandleCookiePopupVariants */ -enum HandleCookiePopup: string +final class HandleCookiePopup implements ConverterSource { - case TRUE = 'true'; + use SdkUnion; - case FALSE = 'false'; + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } } diff --git a/src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php b/src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php new file mode 100644 index 00000000..defd4c44 --- /dev/null +++ b/src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php @@ -0,0 +1,12 @@ +, * excludeSelectors?: list|null, * headers?: array|null, - * includeFrames?: bool|null, + * includeFrames?: IncludeFramesShape|null, * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, - * settleAnimations?: bool|null, + * settleAnimations?: SettleAnimationsShape|null, * tags?: list|null, * timeoutMs?: int|null, - * useMainContentOnly?: bool|null, + * useMainContentOnly?: UseMainContentOnlyShape|null, * waitForMs?: int|null, * } */ @@ -48,7 +58,7 @@ final class WebWebScrapeHTMLParams implements BaseModel public string $url; /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * * @var value-of|null $country */ @@ -60,7 +70,7 @@ final class WebWebScrapeHTMLParams implements BaseModel * * @var list|null $excludeSelectors */ - #[Optional(list: 'string')] + #[Optional(list: 'string', nullable: true)] public ?array $excludeSelectors; /** @@ -73,22 +83,24 @@ final class WebWebScrapeHTMLParams implements BaseModel /** * When true, iframes are rendered inline into the returned HTML. + * + * @var IncludeFramesVariants|null $includeFrames */ - #[Optional] - public ?bool $includeFrames; + #[Optional(union: IncludeFrames::class)] + public bool|string|null $includeFrames; /** * CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * * @var list|null $includeSelectors */ - #[Optional(list: 'string')] + #[Optional(list: 'string', nullable: true)] public ?array $includeSelectors; /** * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. */ - #[Optional] + #[Optional(nullable: true)] public ?int $maxAgeMs; /** @@ -99,9 +111,11 @@ final class WebWebScrapeHTMLParams implements BaseModel /** * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * + * @var SettleAnimationsVariants|null $settleAnimations */ - #[Optional] - public ?bool $settleAnimations; + #[Optional(union: SettleAnimations::class)] + public bool|string|null $settleAnimations; /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -119,14 +133,16 @@ final class WebWebScrapeHTMLParams implements BaseModel /** * When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable. + * + * @var UseMainContentOnlyVariants|null $useMainContentOnly */ - #[Optional] - public ?bool $useMainContentOnly; + #[Optional(union: UseMainContentOnly::class)] + public bool|string|null $useMainContentOnly; /** * Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). */ - #[Optional] + #[Optional(nullable: true)] public ?int $waitForMs; /** @@ -156,23 +172,26 @@ public function __construct() * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers + * @param IncludeFramesShape|null $includeFrames * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf + * @param SettleAnimationsShape|null $settleAnimations * @param list|null $tags + * @param UseMainContentOnlyShape|null $useMainContentOnly */ public static function with( string $url, Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - ?bool $includeFrames = null, + bool|UnionMember1|string|null $includeFrames = null, ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, - ?bool $settleAnimations = null, + bool|SettleAnimations\UnionMember1|string|null $settleAnimations = null, ?array $tags = null, ?int $timeoutMs = null, - ?bool $useMainContentOnly = null, + bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, ?int $waitForMs = null, ): self { $self = new self; @@ -207,7 +226,7 @@ public function withURL(string $url): self } /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * * @param Country|value-of $country */ @@ -222,9 +241,9 @@ public function withCountry(Country|string $country): self /** * CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * - * @param list $excludeSelectors + * @param list|null $excludeSelectors */ - public function withExcludeSelectors(array $excludeSelectors): self + public function withExcludeSelectors(?array $excludeSelectors): self { $self = clone $this; $self['excludeSelectors'] = $excludeSelectors; @@ -247,9 +266,12 @@ public function withHeaders(array $headers): self /** * When true, iframes are rendered inline into the returned HTML. + * + * @param IncludeFramesShape $includeFrames */ - public function withIncludeFrames(bool $includeFrames): self - { + public function withIncludeFrames( + bool|UnionMember1|string $includeFrames + ): self { $self = clone $this; $self['includeFrames'] = $includeFrames; @@ -259,9 +281,9 @@ public function withIncludeFrames(bool $includeFrames): self /** * CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * - * @param list $includeSelectors + * @param list|null $includeSelectors */ - public function withIncludeSelectors(array $includeSelectors): self + public function withIncludeSelectors(?array $includeSelectors): self { $self = clone $this; $self['includeSelectors'] = $includeSelectors; @@ -272,7 +294,7 @@ public function withIncludeSelectors(array $includeSelectors): self /** * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. */ - public function withMaxAgeMs(int $maxAgeMs): self + public function withMaxAgeMs(?int $maxAgeMs): self { $self = clone $this; $self['maxAgeMs'] = $maxAgeMs; @@ -295,9 +317,12 @@ public function withPdf(Pdf|array $pdf): self /** * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * + * @param SettleAnimationsShape $settleAnimations */ - public function withSettleAnimations(bool $settleAnimations): self - { + public function withSettleAnimations( + bool|SettleAnimations\UnionMember1|string $settleAnimations, + ): self { $self = clone $this; $self['settleAnimations'] = $settleAnimations; @@ -330,9 +355,12 @@ public function withTimeoutMs(int $timeoutMs): self /** * When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable. + * + * @param UseMainContentOnlyShape $useMainContentOnly */ - public function withUseMainContentOnly(bool $useMainContentOnly): self - { + public function withUseMainContentOnly( + bool|UseMainContentOnly\UnionMember1|string $useMainContentOnly, + ): self { $self = clone $this; $self['useMainContentOnly'] = $useMainContentOnly; @@ -342,7 +370,7 @@ public function withUseMainContentOnly(bool $useMainContentOnly): self /** * Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). */ - public function withWaitForMs(int $waitForMs): self + public function withWaitForMs(?int $waitForMs): self { $self = clone $this; $self['waitForMs'] = $waitForMs; diff --git a/src/Web/WebWebScrapeHTMLParams/Country.php b/src/Web/WebWebScrapeHTMLParams/Country.php index 6c784e4c..5588f0a9 100644 --- a/src/Web/WebWebScrapeHTMLParams/Country.php +++ b/src/Web/WebWebScrapeHTMLParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeHTMLParams; /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. */ enum Country: string { diff --git a/src/Web/WebWebScrapeHTMLParams/IncludeFrames.php b/src/Web/WebWebScrapeHTMLParams/IncludeFrames.php new file mode 100644 index 00000000..84047a8b --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/IncludeFrames.php @@ -0,0 +1,29 @@ + + * @phpstan-type IncludeFramesShape = IncludeFramesVariants + */ +final class IncludeFrames implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php new file mode 100644 index 00000000..9d192560 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type OcrShape = OcrVariants + */ +final class Ocr implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php new file mode 100644 index 00000000..dfb79b27 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShouldParseShape = ShouldParseVariants + */ +final class ShouldParse implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php new file mode 100644 index 00000000..9de72ad9 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type SettleAnimationsShape = SettleAnimationsVariants + */ +final class SettleAnimations implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php new file mode 100644 index 00000000..899122c3 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type UseMainContentOnlyShape = UseMainContentOnlyVariants + */ +final class UseMainContentOnly implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php new file mode 100644 index 00000000..38c3ff7f --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php @@ -0,0 +1,12 @@ +|null, * maxAgeMs?: int|null, @@ -43,14 +47,16 @@ final class WebWebScrapeImagesParams implements BaseModel /** * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + * + * @var DedupeVariants|null $dedupe */ - #[Optional] - public ?bool $dedupe; + #[Optional(union: Dedupe::class)] + public bool|string|null $dedupe; /** * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. */ - #[Optional] + #[Optional(nullable: true)] public ?Enrichment $enrichment; /** @@ -64,7 +70,7 @@ final class WebWebScrapeImagesParams implements BaseModel /** * Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). */ - #[Optional] + #[Optional(nullable: true)] public ?int $maxAgeMs; /** @@ -84,7 +90,7 @@ final class WebWebScrapeImagesParams implements BaseModel /** * Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). */ - #[Optional] + #[Optional(nullable: true)] public ?int $waitForMs; /** @@ -111,13 +117,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param DedupeShape|null $dedupe * @param Enrichment|EnrichmentShape|null $enrichment * @param array|null $headers * @param list|null $tags */ public static function with( string $url, - ?bool $dedupe = null, + bool|UnionMember1|string|null $dedupe = null, Enrichment|array|null $enrichment = null, ?array $headers = null, ?int $maxAgeMs = null, @@ -153,8 +160,10 @@ public function withURL(string $url): self /** * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + * + * @param DedupeShape $dedupe */ - public function withDedupe(bool $dedupe): self + public function withDedupe(bool|UnionMember1|string $dedupe): self { $self = clone $this; $self['dedupe'] = $dedupe; @@ -165,9 +174,9 @@ public function withDedupe(bool $dedupe): self /** * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. * - * @param Enrichment|EnrichmentShape $enrichment + * @param Enrichment|EnrichmentShape|null $enrichment */ - public function withEnrichment(Enrichment|array $enrichment): self + public function withEnrichment(Enrichment|array|null $enrichment): self { $self = clone $this; $self['enrichment'] = $enrichment; @@ -191,7 +200,7 @@ public function withHeaders(array $headers): self /** * Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). */ - public function withMaxAgeMs(int $maxAgeMs): self + public function withMaxAgeMs(?int $maxAgeMs): self { $self = clone $this; $self['maxAgeMs'] = $maxAgeMs; @@ -226,7 +235,7 @@ public function withTimeoutMs(int $timeoutMs): self /** * Optional browser wait time in milliseconds after initial page load before collecting images. Min: 0. Max: 30000 (30 seconds). */ - public function withWaitForMs(int $waitForMs): self + public function withWaitForMs(?int $waitForMs): self { $self = clone $this; $self['waitForMs'] = $waitForMs; diff --git a/src/Web/WebWebScrapeImagesParams/Dedupe.php b/src/Web/WebWebScrapeImagesParams/Dedupe.php new file mode 100644 index 00000000..c1fd6ec7 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Dedupe.php @@ -0,0 +1,29 @@ + + * @phpstan-type DedupeShape = DedupeVariants + */ +final class Dedupe implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php new file mode 100644 index 00000000..4950f305 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ClassificationShape = ClassificationVariants + */ +final class Classification implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php new file mode 100644 index 00000000..4d5c01fe --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type HostedURLShape = HostedURLVariants + */ +final class HostedURL implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php new file mode 100644 index 00000000..c3531093 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ResolutionShape = ResolutionVariants + */ +final class Resolution implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php new file mode 100644 index 00000000..7dcafd56 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php @@ -0,0 +1,12 @@ +, * excludeSelectors?: list|null, * headers?: array|null, - * includeFrames?: bool|null, - * includeImages?: bool|null, - * includeLinks?: bool|null, + * includeFrames?: IncludeFramesShape|null, + * includeImages?: IncludeImagesShape|null, + * includeLinks?: IncludeLinksShape|null, * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, - * settleAnimations?: bool|null, - * shortenBase64Images?: bool|null, + * settleAnimations?: SettleAnimationsShape|null, + * shortenBase64Images?: ShortenBase64ImagesShape|null, * tags?: list|null, * timeoutMs?: int|null, - * useMainContentOnly?: bool|null, + * useMainContentOnly?: UseMainContentOnlyShape|null, * waitForMs?: int|null, * } */ @@ -64,7 +83,7 @@ final class WebWebScrapeMdParams implements BaseModel public string $url; /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * * @var value-of|null $country */ @@ -76,7 +95,7 @@ final class WebWebScrapeMdParams implements BaseModel * * @var list|null $excludeSelectors */ - #[Optional(list: 'string')] + #[Optional(list: 'string', nullable: true)] public ?array $excludeSelectors; /** @@ -89,34 +108,40 @@ final class WebWebScrapeMdParams implements BaseModel /** * When true, the contents of iframes are rendered to Markdown. + * + * @var IncludeFramesVariants|null $includeFrames */ - #[Optional] - public ?bool $includeFrames; + #[Optional(union: IncludeFrames::class)] + public bool|string|null $includeFrames; /** * Include image references in Markdown output. + * + * @var IncludeImagesVariants|null $includeImages */ - #[Optional] - public ?bool $includeImages; + #[Optional(union: IncludeImages::class)] + public bool|string|null $includeImages; /** * Preserve hyperlinks in Markdown output. + * + * @var IncludeLinksVariants|null $includeLinks */ - #[Optional] - public ?bool $includeLinks; + #[Optional(union: IncludeLinks::class)] + public bool|string|null $includeLinks; /** * CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * * @var list|null $includeSelectors */ - #[Optional(list: 'string')] + #[Optional(list: 'string', nullable: true)] public ?array $includeSelectors; /** * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. */ - #[Optional] + #[Optional(nullable: true)] public ?int $maxAgeMs; /** @@ -127,15 +152,19 @@ final class WebWebScrapeMdParams implements BaseModel /** * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * + * @var SettleAnimationsVariants|null $settleAnimations */ - #[Optional] - public ?bool $settleAnimations; + #[Optional(union: SettleAnimations::class)] + public bool|string|null $settleAnimations; /** * Shorten base64-encoded image data in the Markdown output. + * + * @var ShortenBase64ImagesVariants|null $shortenBase64Images */ - #[Optional] - public ?bool $shortenBase64Images; + #[Optional(union: ShortenBase64Images::class)] + public bool|string|null $shortenBase64Images; /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -153,14 +182,16 @@ final class WebWebScrapeMdParams implements BaseModel /** * Extract only the main content of the page, excluding headers, footers, sidebars, and navigation. + * + * @var UseMainContentOnlyVariants|null $useMainContentOnly */ - #[Optional] - public ?bool $useMainContentOnly; + #[Optional(union: UseMainContentOnly::class)] + public bool|string|null $useMainContentOnly; /** * Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). */ - #[Optional] + #[Optional(nullable: true)] public ?int $waitForMs; /** @@ -190,26 +221,32 @@ public function __construct() * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers + * @param IncludeFramesShape|null $includeFrames + * @param IncludeImagesShape|null $includeImages + * @param IncludeLinksShape|null $includeLinks * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf + * @param SettleAnimationsShape|null $settleAnimations + * @param ShortenBase64ImagesShape|null $shortenBase64Images * @param list|null $tags + * @param UseMainContentOnlyShape|null $useMainContentOnly */ public static function with( string $url, Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - ?bool $includeFrames = null, - ?bool $includeImages = null, - ?bool $includeLinks = null, + bool|UnionMember1|string|null $includeFrames = null, + bool|IncludeImages\UnionMember1|string|null $includeImages = null, + bool|IncludeLinks\UnionMember1|string|null $includeLinks = null, ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, - ?bool $settleAnimations = null, - ?bool $shortenBase64Images = null, + bool|SettleAnimations\UnionMember1|string|null $settleAnimations = null, + bool|ShortenBase64Images\UnionMember1|string|null $shortenBase64Images = null, ?array $tags = null, ?int $timeoutMs = null, - ?bool $useMainContentOnly = null, + bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, ?int $waitForMs = null, ): self { $self = new self; @@ -247,7 +284,7 @@ public function withURL(string $url): self } /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * * @param Country|value-of $country */ @@ -262,9 +299,9 @@ public function withCountry(Country|string $country): self /** * CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * - * @param list $excludeSelectors + * @param list|null $excludeSelectors */ - public function withExcludeSelectors(array $excludeSelectors): self + public function withExcludeSelectors(?array $excludeSelectors): self { $self = clone $this; $self['excludeSelectors'] = $excludeSelectors; @@ -287,9 +324,12 @@ public function withHeaders(array $headers): self /** * When true, the contents of iframes are rendered to Markdown. + * + * @param IncludeFramesShape $includeFrames */ - public function withIncludeFrames(bool $includeFrames): self - { + public function withIncludeFrames( + bool|UnionMember1|string $includeFrames + ): self { $self = clone $this; $self['includeFrames'] = $includeFrames; @@ -298,9 +338,12 @@ public function withIncludeFrames(bool $includeFrames): self /** * Include image references in Markdown output. + * + * @param IncludeImagesShape $includeImages */ - public function withIncludeImages(bool $includeImages): self - { + public function withIncludeImages( + bool|IncludeImages\UnionMember1|string $includeImages, + ): self { $self = clone $this; $self['includeImages'] = $includeImages; @@ -309,9 +352,12 @@ public function withIncludeImages(bool $includeImages): self /** * Preserve hyperlinks in Markdown output. + * + * @param IncludeLinksShape $includeLinks */ - public function withIncludeLinks(bool $includeLinks): self - { + public function withIncludeLinks( + bool|IncludeLinks\UnionMember1|string $includeLinks, + ): self { $self = clone $this; $self['includeLinks'] = $includeLinks; @@ -321,9 +367,9 @@ public function withIncludeLinks(bool $includeLinks): self /** * CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * - * @param list $includeSelectors + * @param list|null $includeSelectors */ - public function withIncludeSelectors(array $includeSelectors): self + public function withIncludeSelectors(?array $includeSelectors): self { $self = clone $this; $self['includeSelectors'] = $includeSelectors; @@ -334,7 +380,7 @@ public function withIncludeSelectors(array $includeSelectors): self /** * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. */ - public function withMaxAgeMs(int $maxAgeMs): self + public function withMaxAgeMs(?int $maxAgeMs): self { $self = clone $this; $self['maxAgeMs'] = $maxAgeMs; @@ -357,9 +403,12 @@ public function withPdf(Pdf|array $pdf): self /** * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * + * @param SettleAnimationsShape $settleAnimations */ - public function withSettleAnimations(bool $settleAnimations): self - { + public function withSettleAnimations( + bool|SettleAnimations\UnionMember1|string $settleAnimations, + ): self { $self = clone $this; $self['settleAnimations'] = $settleAnimations; @@ -368,9 +417,12 @@ public function withSettleAnimations(bool $settleAnimations): self /** * Shorten base64-encoded image data in the Markdown output. + * + * @param ShortenBase64ImagesShape $shortenBase64Images */ - public function withShortenBase64Images(bool $shortenBase64Images): self - { + public function withShortenBase64Images( + bool|ShortenBase64Images\UnionMember1|string $shortenBase64Images, + ): self { $self = clone $this; $self['shortenBase64Images'] = $shortenBase64Images; @@ -403,9 +455,12 @@ public function withTimeoutMs(int $timeoutMs): self /** * Extract only the main content of the page, excluding headers, footers, sidebars, and navigation. + * + * @param UseMainContentOnlyShape $useMainContentOnly */ - public function withUseMainContentOnly(bool $useMainContentOnly): self - { + public function withUseMainContentOnly( + bool|UseMainContentOnly\UnionMember1|string $useMainContentOnly, + ): self { $self = clone $this; $self['useMainContentOnly'] = $useMainContentOnly; @@ -415,7 +470,7 @@ public function withUseMainContentOnly(bool $useMainContentOnly): self /** * Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). */ - public function withWaitForMs(int $waitForMs): self + public function withWaitForMs(?int $waitForMs): self { $self = clone $this; $self['waitForMs'] = $waitForMs; diff --git a/src/Web/WebWebScrapeMdParams/Country.php b/src/Web/WebWebScrapeMdParams/Country.php index 3d1460eb..97005342 100644 --- a/src/Web/WebWebScrapeMdParams/Country.php +++ b/src/Web/WebWebScrapeMdParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeMdParams; /** - * Two-letter ISO 3166-1 alpha-2 country code for the website request location. When provided, Context.dev fetches the target page from that country. + * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. */ enum Country: string { diff --git a/src/Web/WebWebScrapeMdParams/IncludeFrames.php b/src/Web/WebWebScrapeMdParams/IncludeFrames.php new file mode 100644 index 00000000..dc3254f5 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/IncludeFrames.php @@ -0,0 +1,29 @@ + + * @phpstan-type IncludeFramesShape = IncludeFramesVariants + */ +final class IncludeFrames implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php new file mode 100644 index 00000000..d887bb50 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type IncludeImagesShape = IncludeImagesVariants + */ +final class IncludeImages implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php new file mode 100644 index 00000000..9f1df337 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type IncludeLinksShape = IncludeLinksVariants + */ +final class IncludeLinks implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php new file mode 100644 index 00000000..99b18faf --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type OcrShape = OcrVariants + */ +final class Ocr implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php b/src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php new file mode 100644 index 00000000..8bd15b5c --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShouldParseShape = ShouldParseVariants + */ +final class ShouldParse implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php b/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php new file mode 100644 index 00000000..4db8b2ba --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type SettleAnimationsShape = SettleAnimationsVariants + */ +final class SettleAnimations implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php b/src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php new file mode 100644 index 00000000..915f75ec --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShortenBase64ImagesShape = ShortenBase64ImagesVariants + */ +final class ShortenBase64Images implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php b/src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php new file mode 100644 index 00000000..d064e43b --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type UseMainContentOnlyShape = UseMainContentOnlyVariants + */ +final class UseMainContentOnly implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php b/src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php new file mode 100644 index 00000000..52449fec --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php @@ -0,0 +1,12 @@ +|null, * maxLinks?: int|null, + * sitemapURL?: string|null, * tags?: list|null, * timeoutMs?: int|null, * urlRegex?: string|null, @@ -50,6 +51,12 @@ final class WebWebScrapeSitemapParams implements BaseModel #[Optional] public ?int $maxLinks; + /** + * Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. + */ + #[Optional] + public ?string $sitemapURL; + /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @@ -101,6 +108,7 @@ public static function with( string $domain, ?array $headers = null, ?int $maxLinks = null, + ?string $sitemapURL = null, ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, @@ -111,6 +119,7 @@ public static function with( null !== $headers && $self['headers'] = $headers; null !== $maxLinks && $self['maxLinks'] = $maxLinks; + null !== $sitemapURL && $self['sitemapURL'] = $sitemapURL; null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $urlRegex && $self['urlRegex'] = $urlRegex; @@ -153,6 +162,17 @@ public function withMaxLinks(int $maxLinks): self return $self; } + /** + * Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. + */ + public function withSitemapURL(string $sitemapURL): self + { + $self = clone $this; + $self['sitemapURL'] = $sitemapURL; + + return $self; + } + /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 07473e5f..2b244ae4 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -33,7 +33,7 @@ public function testDefaultHeaders(): void ); $client->brand->retrieve( - domain: 'domain', + domain: 'xxx', type: 'by_transaction', name: 'xxx', email: 'dev@stainless.com', diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index 5cb955e4..b5ab8fc6 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -37,7 +37,7 @@ public function testRetrieve(): void } $result = $this->client->brand->retrieve( - domain: 'domain', + domain: 'xxx', type: 'by_transaction', name: 'xxx', email: 'dev@stainless.com', @@ -58,7 +58,7 @@ public function testRetrieveWithOptionalParams(): void } $result = $this->client->brand->retrieve( - domain: 'domain', + domain: 'xxx', type: 'by_transaction', forceLanguage: 'afrikaans', maxAgeMs: 0, @@ -74,8 +74,8 @@ public function testRetrieveWithOptionalParams(): void transactionInfo: 'xxx', city: 'city', highConfidenceOnly: true, - mcc: 0, - phone: 0, + mcc: 'string', + phone: 'string', ); // @phpstan-ignore-next-line method.alreadyNarrowedType @@ -89,7 +89,7 @@ public function testRetrieveSimplified(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->brand->retrieveSimplified(domain: 'domain'); + $result = $this->client->brand->retrieveSimplified(domain: 'xxx'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(BrandGetSimplifiedResponse::class, $result); @@ -103,9 +103,10 @@ public function testRetrieveSimplifiedWithOptionalParams(): void } $result = $this->client->brand->retrieveSimplified( - domain: 'domain', - maxAgeMs: 86400000, + domain: 'xxx', + maxAgeMs: 0, tags: ['production', 'team-alpha'], + theme: 'light', timeoutMs: 1000, ); diff --git a/tests/Services/IndustryTest.php b/tests/Services/IndustryTest.php index 05f96296..ad6fc726 100644 --- a/tests/Services/IndustryTest.php +++ b/tests/Services/IndustryTest.php @@ -36,7 +36,7 @@ public function testRetrieveNaics(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->industry->retrieveNaics(input: 'input'); + $result = $this->client->industry->retrieveNaics(input: 'xxxx'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(IndustryGetNaicsResponse::class, $result); @@ -50,7 +50,7 @@ public function testRetrieveNaicsWithOptionalParams(): void } $result = $this->client->industry->retrieveNaics( - input: 'input', + input: 'xxxx', maxResults: 1, minResults: 1, tags: ['production', 'team-alpha'], @@ -68,7 +68,7 @@ public function testRetrieveSic(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->industry->retrieveSic(input: 'input'); + $result = $this->client->industry->retrieveSic(input: 'xxxx'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(IndustryGetSicResponse::class, $result); @@ -82,7 +82,7 @@ public function testRetrieveSicWithOptionalParams(): void } $result = $this->client->industry->retrieveSic( - input: 'input', + input: 'xxxx', maxResults: 1, minResults: 1, tags: ['production', 'team-alpha'], diff --git a/tests/Services/UtilityTest.php b/tests/Services/UtilityTest.php index f9c4917d..474d4f01 100644 --- a/tests/Services/UtilityTest.php +++ b/tests/Services/UtilityTest.php @@ -36,7 +36,7 @@ public function testPrefetch(): void } $result = $this->client->utility->prefetch( - identifier: ['domain' => 'domain'], + identifier: ['domain' => 'xxx'], type: 'brand' ); @@ -52,7 +52,7 @@ public function testPrefetchWithOptionalParams(): void } $result = $this->client->utility->prefetch( - identifier: ['domain' => 'domain'], + identifier: ['domain' => 'xxx'], type: 'brand', tags: ['production', 'team-alpha'], timeoutMs: 1000, diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index da2b09f3..598fa422 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -280,16 +280,16 @@ public function testWebScrapeHTMLWithOptionalParams(): void $result = $this->client->web->webScrapeHTML( url: 'https://example.com', country: 'de', - excludeSelectors: ['string'], + excludeSelectors: ['x'], headers: ['foo' => 'J!'], - includeFrames: true, - includeSelectors: ['string'], + includeFrames: 'true', + includeSelectors: ['x'], maxAgeMs: 0, - pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], - settleAnimations: true, + pdf: ['end' => 1, 'ocr' => 'true', 'shouldParse' => 'true', 'start' => 1], + settleAnimations: 'true', tags: ['production', 'team-alpha'], - timeoutMs: 1000, - useMainContentOnly: true, + timeoutMs: 1, + useMainContentOnly: 'true', waitForMs: 0, ); @@ -319,17 +319,17 @@ public function testWebScrapeImagesWithOptionalParams(): void $result = $this->client->web->webScrapeImages( url: 'https://example.com', - dedupe: true, + dedupe: 'true', enrichment: [ - 'classification' => true, - 'hostedURL' => true, + 'classification' => 'true', + 'hostedURL' => 'true', 'maxTimePerMs' => 1, - 'resolution' => true, + 'resolution' => 'true', ], headers: ['foo' => 'J!'], maxAgeMs: 0, tags: ['production', 'team-alpha'], - timeoutMs: 1000, + timeoutMs: 1, waitForMs: 0, ); @@ -360,19 +360,19 @@ public function testWebScrapeMdWithOptionalParams(): void $result = $this->client->web->webScrapeMd( url: 'https://example.com', country: 'de', - excludeSelectors: ['string'], + excludeSelectors: ['x'], headers: ['foo' => 'J!'], - includeFrames: true, - includeImages: true, - includeLinks: true, - includeSelectors: ['string'], + includeFrames: 'true', + includeImages: 'true', + includeLinks: 'true', + includeSelectors: ['x'], maxAgeMs: 0, - pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], - settleAnimations: true, - shortenBase64Images: true, + pdf: ['end' => 1, 'ocr' => 'true', 'shouldParse' => 'true', 'start' => 1], + settleAnimations: 'true', + shortenBase64Images: 'true', tags: ['production', 'team-alpha'], - timeoutMs: 1000, - useMainContentOnly: true, + timeoutMs: 1, + useMainContentOnly: 'true', waitForMs: 0, ); @@ -387,7 +387,7 @@ public function testWebScrapeSitemap(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->web->webScrapeSitemap(domain: 'domain'); + $result = $this->client->web->webScrapeSitemap(domain: 'xxx'); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(WebWebScrapeSitemapResponse::class, $result); @@ -401,11 +401,12 @@ public function testWebScrapeSitemapWithOptionalParams(): void } $result = $this->client->web->webScrapeSitemap( - domain: 'domain', + domain: 'xxx', headers: ['foo' => 'J!'], maxLinks: 1, + sitemapURL: 'https://example.com', tags: ['production', 'team-alpha'], - timeoutMs: 1000, + timeoutMs: 1, urlRegex: '^https?://[^/]+/blog/', ); From 856a766ad9c5954cfe257deabfa2fbf0a91b04c8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 18 Jul 2026 02:02:56 +0000 Subject: [PATCH 056/130] feat(stlc): configurable CI runner and private-production-repo support in workflow templates --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 243cf423..84d8fb1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: lint: timeout-minutes: 10 name: lint - runs-on: ${{ github.repository == 'stainless-sdks/context.dev-php' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: @@ -37,7 +37,7 @@ jobs: test: timeout-minutes: 10 name: test - runs-on: ${{ github.repository == 'stainless-sdks/context.dev-php' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + runs-on: ${{ startsWith(github.repository, 'stainless-sdks/') && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} if: github.event_name == 'push' || github.event.pull_request.head.repo.fork steps: - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 From 109881b7d65e15cc59cc6717d1d6b1bf39ce2ebd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 19 Jul 2026 19:35:58 +0000 Subject: [PATCH 057/130] feat(api): api update --- .stats.yml | 4 ++-- src/AI/AIExtractProductParams.php | 4 ++-- src/AI/AIExtractProductsParams.php | 4 ++-- src/Brand/BrandRetrieveParams.php | 4 ++-- src/ServiceContracts/AIContract.php | 4 ++-- src/ServiceContracts/BrandContract.php | 2 +- src/ServiceContracts/UtilityContract.php | 2 +- src/ServiceContracts/WebContract.php | 8 +++++--- src/Services/AIService.php | 4 ++-- src/Services/BrandService.php | 2 +- src/Services/UtilityService.php | 2 +- src/Services/WebRawService.php | 1 + src/Services/WebService.php | 9 ++++++--- src/Utility/UtilityPrefetchParams.php | 4 ++-- src/Web/WebExtractParams.php | 24 ++++++++++++++++++++++-- src/Web/WebSearchParams.php | 4 ++-- src/Web/WebWebCrawlMdParams.php | 4 ++-- tests/Services/WebTest.php | 1 + 18 files changed, 57 insertions(+), 30 deletions(-) diff --git a/.stats.yml b/.stats.yml index b9d1d304..91b45dcb 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d49b84cf1125618f171698ff1ee4ff9a8d04151619cb4a56d650103869834465.yml -openapi_spec_hash: 49b7a6f59dcdff1e2bf88feb6474a562 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8cd70a2b5bd380b75e5f94dc376bd8c704ee0431bdfe8af1b017facc2b883097.yml +openapi_spec_hash: bb1d32ae5c46be85ee8bb3b13f5b1150 config_hash: daabb160675d86b354711da1e77e5129 diff --git a/src/AI/AIExtractProductParams.php b/src/AI/AIExtractProductParams.php index d0b275ea..821ff02b 100644 --- a/src/AI/AIExtractProductParams.php +++ b/src/AI/AIExtractProductParams.php @@ -41,7 +41,7 @@ final class AIExtractProductParams implements BaseModel public ?int $maxAgeMs; /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @var list|null $tags */ @@ -120,7 +120,7 @@ public function withMaxAgeMs(int $maxAgeMs): self } /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @param list $tags */ diff --git a/src/AI/AIExtractProductsParams.php b/src/AI/AIExtractProductsParams.php index d5b264f7..f6bb0b05 100644 --- a/src/AI/AIExtractProductsParams.php +++ b/src/AI/AIExtractProductsParams.php @@ -49,7 +49,7 @@ final class AIExtractProductsParams implements BaseModel public ?int $maxProducts; /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @var list|null $tags */ @@ -149,7 +149,7 @@ public function withMaxProducts(int $maxProducts): self } /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @param list $tags */ diff --git a/src/Brand/BrandRetrieveParams.php b/src/Brand/BrandRetrieveParams.php index 47f3afef..5ffa05db 100644 --- a/src/Brand/BrandRetrieveParams.php +++ b/src/Brand/BrandRetrieveParams.php @@ -80,7 +80,7 @@ final class BrandRetrieveParams implements BaseModel public ?bool $maxSpeed; /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @var list|null $tags */ @@ -312,7 +312,7 @@ public function withMaxSpeed(bool $maxSpeed): self } /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @param list $tags */ diff --git a/src/ServiceContracts/AIContract.php b/src/ServiceContracts/AIContract.php index b451592b..e4105f8d 100644 --- a/src/ServiceContracts/AIContract.php +++ b/src/ServiceContracts/AIContract.php @@ -19,7 +19,7 @@ interface AIContract * * @param string $url the product page URL to extract product data from * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -40,7 +40,7 @@ public function extractProduct( * @param string $directURL a specific URL to use directly as the starting point for extraction without domain resolution * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param int $maxProducts maximum number of products to extract - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * diff --git a/src/ServiceContracts/BrandContract.php b/src/ServiceContracts/BrandContract.php index 3ca75ea4..ce818d87 100644 --- a/src/ServiceContracts/BrandContract.php +++ b/src/ServiceContracts/BrandContract.php @@ -32,7 +32,7 @@ interface BrandContract * @param ForceLanguage|value-of|null $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. diff --git a/src/ServiceContracts/UtilityContract.php b/src/ServiceContracts/UtilityContract.php index c3181997..eebf6f16 100644 --- a/src/ServiceContracts/UtilityContract.php +++ b/src/ServiceContracts/UtilityContract.php @@ -22,7 +22,7 @@ interface UtilityContract * * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 4b8beca3..cbe81b13 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -64,8 +64,9 @@ interface WebContract * @param int $maxDepth Optional maximum link depth from the starting URL (0 = only the starting page). If omitted, there is no crawl depth limit. * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. * @param Pdf|PdfShape $pdf + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page * @param RequestOpts|null $requestOptions @@ -83,6 +84,7 @@ public function extract( ?int $maxDepth = null, int $maxPages = 5, Pdf|array $pdf = ['shouldParse' => true], + bool $settleAnimations = false, int $stopAfterMs = 80000, ?array $tags = null, ?int $timeoutMs = null, @@ -201,7 +203,7 @@ public function screenshot( * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. * @param int $numResults Number of results to request and return (10–100). Defaults to 10. * @param bool $queryFanout expand the query into multiple parallel variants for broader recall - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -239,7 +241,7 @@ public function search( * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation diff --git a/src/Services/AIService.php b/src/Services/AIService.php index ec959d40..bb468da1 100644 --- a/src/Services/AIService.php +++ b/src/Services/AIService.php @@ -37,7 +37,7 @@ public function __construct(private Client $client) * * @param string $url the product page URL to extract product data from * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -74,7 +74,7 @@ public function extractProduct( * @param string $directURL a specific URL to use directly as the starting point for extraction without domain resolution * @param int $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 7 days (604800000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param int $maxProducts maximum number of products to extract - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index 96210d0a..0ab38c56 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -50,7 +50,7 @@ public function __construct(private Client $client) * @param ForceLanguage|value-of|null $forceLanguage * @param int $maxAgeMs Maximum age in milliseconds for cached brand data before the API performs a hard refresh. Defaults to 3 months (7776000000 ms). Values below 1 day (86400000 ms) are clamped to 1 day; values above 1 year (31536000000 ms) are clamped to 1 year. * @param bool $maxSpeed Optional parameter to optimize the API call for maximum speed. When set to true, the API will skip time-consuming operations for faster response at the cost of less comprehensive data. - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $countryGl optional country code hint (GL parameter) to specify the country when identifying a transaction * @param string $tickerExchange Optional stock exchange for the ticker. Defaults to NASDAQ if not specified. diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php index 17e59a6b..3ba999f0 100644 --- a/src/Services/UtilityService.php +++ b/src/Services/UtilityService.php @@ -40,7 +40,7 @@ public function __construct(private Client $client) * * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index a9d005de..5f87e163 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -87,6 +87,7 @@ public function __construct(private Client $client) {} * maxDepth?: int, * maxPages?: int, * pdf?: Pdf|PdfShape, + * settleAnimations?: bool, * stopAfterMs?: int, * tags?: list, * timeoutMs?: int, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 129ad401..23d30dd8 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -82,8 +82,9 @@ public function __construct(private Client $client) * @param int $maxDepth Optional maximum link depth from the starting URL (0 = only the starting page). If omitted, there is no crawl depth limit. * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. * @param Pdf|PdfShape $pdf + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page * @param RequestOpts|null $requestOptions @@ -101,6 +102,7 @@ public function extract( ?int $maxDepth = null, int $maxPages = 5, Pdf|array $pdf = ['shouldParse' => true], + bool $settleAnimations = false, int $stopAfterMs = 80000, ?array $tags = null, ?int $timeoutMs = null, @@ -119,6 +121,7 @@ public function extract( 'maxDepth' => $maxDepth, 'maxPages' => $maxPages, 'pdf' => $pdf, + 'settleAnimations' => $settleAnimations, 'stopAfterMs' => $stopAfterMs, 'tags' => $tags, 'timeoutMs' => $timeoutMs, @@ -321,7 +324,7 @@ public function screenshot( * @param MarkdownOptions|MarkdownOptionsShape $markdownOptions Inline Markdown scraping for each result. Set `enabled: true` to activate. * @param int $numResults Number of results to request and return (10–100). Defaults to 10. * @param bool $queryFanout expand the query into multiple parallel variants for broader recall - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions * @@ -381,7 +384,7 @@ public function search( * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param bool $shortenBase64Images Truncate base64-encoded image data in the Markdown output * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). - * @param list $tags Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation diff --git a/src/Utility/UtilityPrefetchParams.php b/src/Utility/UtilityPrefetchParams.php index dfdb9134..2025df68 100644 --- a/src/Utility/UtilityPrefetchParams.php +++ b/src/Utility/UtilityPrefetchParams.php @@ -51,7 +51,7 @@ final class UtilityPrefetchParams implements BaseModel public string $type; /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @var list|null $tags */ @@ -137,7 +137,7 @@ public function withType(Type|string $type): self } /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @param list $tags */ diff --git a/src/Web/WebExtractParams.php b/src/Web/WebExtractParams.php index 47913211..1140f0fb 100644 --- a/src/Web/WebExtractParams.php +++ b/src/Web/WebExtractParams.php @@ -29,6 +29,7 @@ * maxDepth?: int|null, * maxPages?: int|null, * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, * stopAfterMs?: int|null, * tags?: list|null, * timeoutMs?: int|null, @@ -100,6 +101,12 @@ final class WebExtractParams implements BaseModel #[Optional] public ?Pdf $pdf; + /** + * When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + #[Optional] + public ?bool $settleAnimations; + /** * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). */ @@ -107,7 +114,7 @@ final class WebExtractParams implements BaseModel public ?int $stopAfterMs; /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @var list|null $tags */ @@ -165,6 +172,7 @@ public static function with( ?int $maxDepth = null, ?int $maxPages = null, Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, ?int $stopAfterMs = null, ?array $tags = null, ?int $timeoutMs = null, @@ -183,6 +191,7 @@ public static function with( null !== $maxDepth && $self['maxDepth'] = $maxDepth; null !== $maxPages && $self['maxPages'] = $maxPages; null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; null !== $stopAfterMs && $self['stopAfterMs'] = $stopAfterMs; null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; @@ -303,6 +312,17 @@ public function withPdf(Pdf|array $pdf): self return $self; } + /** + * When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + /** * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). */ @@ -315,7 +335,7 @@ public function withStopAfterMs(int $stopAfterMs): self } /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @param list $tags */ diff --git a/src/Web/WebSearchParams.php b/src/Web/WebSearchParams.php index 755eef28..61c1898b 100644 --- a/src/Web/WebSearchParams.php +++ b/src/Web/WebSearchParams.php @@ -96,7 +96,7 @@ final class WebSearchParams implements BaseModel public ?bool $queryFanout; /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @var list|null $tags */ @@ -269,7 +269,7 @@ public function withQueryFanout(bool $queryFanout): self } /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @param list $tags */ diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index 4990e420..4c60ae68 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -145,7 +145,7 @@ final class WebWebCrawlMdParams implements BaseModel public ?int $stopAfterMs; /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @var list|null $tags */ @@ -429,7 +429,7 @@ public function withStopAfterMs(int $stopAfterMs): self } /** - * Optional caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * * @param list $tags */ diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index 598fa422..e797854d 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -82,6 +82,7 @@ public function testExtractWithOptionalParams(): void maxDepth: 0, maxPages: 1, pdf: ['end' => 1, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, stopAfterMs: 10000, tags: ['production', 'team-alpha'], timeoutMs: 1000, From fd60d05a7606d16c9adf4a4812f8c6cc7b7e0f9b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 21 Jul 2026 17:28:08 +0000 Subject: [PATCH 058/130] feat(api): api update --- .stats.yml | 4 ++-- src/Parse/ParseHandleParams.php | 26 +++++++++++++++++++++++ src/Parse/ParseHandleParams/Zdr.php | 15 +++++++++++++ src/ServiceContracts/ParseContract.php | 3 +++ src/ServiceContracts/WebContract.php | 11 ++++++++++ src/Services/ParseRawService.php | 2 ++ src/Services/ParseService.php | 4 ++++ src/Services/WebRawService.php | 6 ++++++ src/Services/WebService.php | 16 ++++++++++++++ src/Web/WebScreenshotParams.php | 26 +++++++++++++++++++++++ src/Web/WebScreenshotParams/Zdr.php | 15 +++++++++++++ src/Web/WebScreenshotResponse.php | 4 ++-- src/Web/WebWebCrawlMdParams.php | 26 +++++++++++++++++++++++ src/Web/WebWebCrawlMdParams/Zdr.php | 15 +++++++++++++ src/Web/WebWebScrapeHTMLParams.php | 26 +++++++++++++++++++++++ src/Web/WebWebScrapeHTMLParams/Zdr.php | 15 +++++++++++++ src/Web/WebWebScrapeMdParams.php | 26 +++++++++++++++++++++++ src/Web/WebWebScrapeMdParams/Zdr.php | 15 +++++++++++++ src/Web/WebWebScrapeSitemapParams.php | 26 +++++++++++++++++++++++ src/Web/WebWebScrapeSitemapParams/Zdr.php | 15 +++++++++++++ tests/Services/WebTest.php | 4 ++++ 21 files changed, 296 insertions(+), 4 deletions(-) create mode 100644 src/Parse/ParseHandleParams/Zdr.php create mode 100644 src/Web/WebScreenshotParams/Zdr.php create mode 100644 src/Web/WebWebCrawlMdParams/Zdr.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Zdr.php create mode 100644 src/Web/WebWebScrapeMdParams/Zdr.php create mode 100644 src/Web/WebWebScrapeSitemapParams/Zdr.php diff --git a/.stats.yml b/.stats.yml index 91b45dcb..231a6da1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8cd70a2b5bd380b75e5f94dc376bd8c704ee0431bdfe8af1b017facc2b883097.yml -openapi_spec_hash: bb1d32ae5c46be85ee8bb3b13f5b1150 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-42c531dcf60b5d35e3996c1a669a3fe2de19d8caedf2bfd69e4864a1041c9bfa.yml +openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738 config_hash: daabb160675d86b354711da1e77e5129 diff --git a/src/Parse/ParseHandleParams.php b/src/Parse/ParseHandleParams.php index ae520e00..7e18b75a 100644 --- a/src/Parse/ParseHandleParams.php +++ b/src/Parse/ParseHandleParams.php @@ -16,6 +16,7 @@ use ContextDev\Parse\ParseHandleParams\Pdf; use ContextDev\Parse\ParseHandleParams\ShortenBase64Images; use ContextDev\Parse\ParseHandleParams\UseMainContentOnly; +use ContextDev\Parse\ParseHandleParams\Zdr; /** * Converts raw text, source code, web/data, PDF, Microsoft Office, and image bytes into LLM-usable Markdown. @@ -44,6 +45,7 @@ * shortenBase64Images?: ShortenBase64ImagesShape|null, * tags?: list|null, * useMainContentOnly?: UseMainContentOnlyShape|null, + * zdr?: null|Zdr|value-of, * } */ final class ParseHandleParams implements BaseModel @@ -120,6 +122,14 @@ final class ParseHandleParams implements BaseModel #[Optional(union: UseMainContentOnly::class)] public bool|string|null $useMainContentOnly; + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @var value-of|null $zdr + */ + #[Optional(enum: Zdr::class)] + public ?string $zdr; + public function __construct() { $this->initialize(); @@ -138,6 +148,7 @@ public function __construct() * @param ShortenBase64ImagesShape|null $shortenBase64Images * @param list|null $tags * @param UseMainContentOnlyShape|null $useMainContentOnly + * @param Zdr|value-of|null $zdr */ public static function with( ?string $client = null, @@ -149,6 +160,7 @@ public static function with( bool|ShortenBase64Images\UnionMember1|string|null $shortenBase64Images = null, ?array $tags = null, bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, + Zdr|string|null $zdr = null, ): self { $self = new self; @@ -161,6 +173,7 @@ public static function with( null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; null !== $tags && $self['tags'] = $tags; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $zdr && $self['zdr'] = $zdr; return $self; } @@ -284,4 +297,17 @@ public function withUseMainContentOnly( return $self; } + + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @param Zdr|value-of $zdr + */ + public function withZdr(Zdr|string $zdr): self + { + $self = clone $this; + $self['zdr'] = $zdr; + + return $self; + } } diff --git a/src/Parse/ParseHandleParams/Zdr.php b/src/Parse/ParseHandleParams/Zdr.php new file mode 100644 index 00000000..201fdd29 --- /dev/null +++ b/src/Parse/ParseHandleParams/Zdr.php @@ -0,0 +1,15 @@ + $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param UseMainContentOnlyShape $useMainContentOnly Query param: Extract only the main content from HTML-like inputs + * @param Zdr|value-of $zdr Query param: Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -51,6 +53,7 @@ public function handle( bool|\ContextDev\Parse\ParseHandleParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, ?array $tags = null, bool|\ContextDev\Parse\ParseHandleParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse; } diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index cbe81b13..204ce853 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -17,6 +17,7 @@ use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; +use ContextDev\Web\WebScreenshotParams\Zdr; use ContextDev\Web\WebScreenshotResponse; use ContextDev\Web\WebSearchParams\Freshness; use ContextDev\Web\WebSearchParams\MarkdownOptions; @@ -171,6 +172,7 @@ public function extractStyleguide( * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * @param Zdr|value-of $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -189,6 +191,7 @@ public function screenshot( ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], ?int $waitForMs = 3000, + Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebScreenshotResponse; @@ -246,6 +249,7 @@ public function search( * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation * @param int $waitForMs Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * @param \ContextDev\Web\WebWebCrawlMdParams\Zdr|value-of<\ContextDev\Web\WebWebCrawlMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -273,6 +277,7 @@ public function webCrawlMd( ?string $urlRegex = null, bool $useMainContentOnly = false, ?int $waitForMs = null, + \ContextDev\Web\WebWebCrawlMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebCrawlMdResponse; @@ -292,6 +297,7 @@ public function webCrawlMd( * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param UseMainContentOnlyShape $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -312,6 +318,7 @@ public function webScrapeHTML( ?int $timeoutMs = null, bool|\ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, + \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebScrapeHTMLResponse; @@ -361,6 +368,7 @@ public function webScrapeImages( * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param UseMainContentOnlyShape1 $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + * @param \ContextDev\Web\WebWebScrapeMdParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -384,6 +392,7 @@ public function webScrapeMd( ?int $timeoutMs = null, bool|\ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, + \ContextDev\Web\WebWebScrapeMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebScrapeMdResponse; @@ -397,6 +406,7 @@ public function webScrapeMd( * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. + * @param \ContextDev\Web\WebWebScrapeSitemapParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeSitemapParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -409,6 +419,7 @@ public function webScrapeSitemap( ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, + \ContextDev\Web\WebWebScrapeSitemapParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebScrapeSitemapResponse; } diff --git a/src/Services/ParseRawService.php b/src/Services/ParseRawService.php index 74ec978f..bd76bd49 100644 --- a/src/Services/ParseRawService.php +++ b/src/Services/ParseRawService.php @@ -11,6 +11,7 @@ use ContextDev\Parse\ParseHandleParams; use ContextDev\Parse\ParseHandleParams\Extension; use ContextDev\Parse\ParseHandleParams\Pdf; +use ContextDev\Parse\ParseHandleParams\Zdr; use ContextDev\Parse\ParseHandleResponse; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\ParseRawContract; @@ -48,6 +49,7 @@ public function __construct(private Client $client) {} * shortenBase64Images?: ShortenBase64ImagesShape, * tags?: list, * useMainContentOnly?: UseMainContentOnlyShape, + * zdr?: Zdr|value-of, * }|ParseHandleParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php index b2dffe05..8d6df770 100644 --- a/src/Services/ParseService.php +++ b/src/Services/ParseService.php @@ -11,6 +11,7 @@ use ContextDev\Parse\ParseHandleParams\Extension; use ContextDev\Parse\ParseHandleParams\IncludeImages\UnionMember1; use ContextDev\Parse\ParseHandleParams\Pdf; +use ContextDev\Parse\ParseHandleParams\Zdr; use ContextDev\Parse\ParseHandleResponse; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\ParseContract; @@ -54,6 +55,7 @@ public function __construct(private Client $client) * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param UseMainContentOnlyShape $useMainContentOnly Query param: Extract only the main content from HTML-like inputs + * @param Zdr|value-of $zdr Query param: Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -69,6 +71,7 @@ public function handle( bool|\ContextDev\Parse\ParseHandleParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, ?array $tags = null, bool|\ContextDev\Parse\ParseHandleParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse { $params = Util::removeNulls( @@ -82,6 +85,7 @@ public function handle( 'shortenBase64Images' => $shortenBase64Images, 'tags' => $tags, 'useMainContentOnly' => $useMainContentOnly, + 'zdr' => $zdr, ], ); diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 5f87e163..7d2f17eb 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -25,6 +25,7 @@ use ContextDev\Web\WebScreenshotParams\FullScreenshot; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; +use ContextDev\Web\WebScreenshotParams\Zdr; use ContextDev\Web\WebScreenshotResponse; use ContextDev\Web\WebSearchParams; use ContextDev\Web\WebSearchParams\Freshness; @@ -251,6 +252,7 @@ public function extractStyleguide( * timeoutMs?: int, * viewport?: Viewport|ViewportShape, * waitForMs?: int|null, + * zdr?: Zdr|value-of, * }|WebScreenshotParams $params * @param RequestOpts|null $requestOptions * @@ -348,6 +350,7 @@ public function search( * urlRegex?: string, * useMainContentOnly?: bool, * waitForMs?: int, + * zdr?: WebWebCrawlMdParams\Zdr|value-of, * }|WebWebCrawlMdParams $params * @param RequestOpts|null $requestOptions * @@ -393,6 +396,7 @@ public function webCrawlMd( * timeoutMs?: int, * useMainContentOnly?: UseMainContentOnlyShape, * waitForMs?: int|null, + * zdr?: WebWebScrapeHTMLParams\Zdr|value-of, * }|WebWebScrapeHTMLParams $params * @param RequestOpts|null $requestOptions * @@ -494,6 +498,7 @@ public function webScrapeImages( * timeoutMs?: int, * useMainContentOnly?: UseMainContentOnlyShape1, * waitForMs?: int|null, + * zdr?: WebWebScrapeMdParams\Zdr|value-of, * }|WebWebScrapeMdParams $params * @param RequestOpts|null $requestOptions * @@ -533,6 +538,7 @@ public function webScrapeMd( * tags?: list, * timeoutMs?: int, * urlRegex?: string, + * zdr?: WebWebScrapeSitemapParams\Zdr|value-of, * }|WebWebScrapeSitemapParams $params * @param RequestOpts|null $requestOptions * diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 23d30dd8..4e449c11 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -20,6 +20,7 @@ use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; +use ContextDev\Web\WebScreenshotParams\Zdr; use ContextDev\Web\WebScreenshotResponse; use ContextDev\Web\WebSearchParams\Freshness; use ContextDev\Web\WebSearchParams\MarkdownOptions; @@ -267,6 +268,7 @@ public function extractStyleguide( * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param Viewport|ViewportShape $viewport Optional browser viewport dimensions for the screenshot. Defaults to 1920x1080. * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before taking the screenshot. Min: 0. Max: 30000 (30 seconds). Defaults to 3000 ms when omitted. + * @param Zdr|value-of $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -285,6 +287,7 @@ public function screenshot( ?int $timeoutMs = null, Viewport|array $viewport = ['width' => 1920, 'height' => 1080], ?int $waitForMs = 3000, + Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebScreenshotResponse { $params = Util::removeNulls( @@ -302,6 +305,7 @@ public function screenshot( 'timeoutMs' => $timeoutMs, 'viewport' => $viewport, 'waitForMs' => $waitForMs, + 'zdr' => $zdr, ], ); @@ -389,6 +393,7 @@ public function search( * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation * @param int $waitForMs Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * @param \ContextDev\Web\WebWebCrawlMdParams\Zdr|value-of<\ContextDev\Web\WebWebCrawlMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -416,6 +421,7 @@ public function webCrawlMd( ?string $urlRegex = null, bool $useMainContentOnly = false, ?int $waitForMs = null, + \ContextDev\Web\WebWebCrawlMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebCrawlMdResponse { $params = Util::removeNulls( @@ -440,6 +446,7 @@ public function webCrawlMd( 'urlRegex' => $urlRegex, 'useMainContentOnly' => $useMainContentOnly, 'waitForMs' => $waitForMs, + 'zdr' => $zdr, ], ); @@ -467,6 +474,7 @@ public function webCrawlMd( * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param UseMainContentOnlyShape $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -487,6 +495,7 @@ public function webScrapeHTML( ?int $timeoutMs = null, bool|\ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, + \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebScrapeHTMLResponse { $params = Util::removeNulls( @@ -504,6 +513,7 @@ public function webScrapeHTML( 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, 'waitForMs' => $waitForMs, + 'zdr' => $zdr, ], ); @@ -594,6 +604,7 @@ public function webScrapeImages( * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param UseMainContentOnlyShape1 $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). + * @param \ContextDev\Web\WebWebScrapeMdParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -617,6 +628,7 @@ public function webScrapeMd( ?int $timeoutMs = null, bool|\ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, ?int $waitForMs = null, + \ContextDev\Web\WebWebScrapeMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebScrapeMdResponse { $params = Util::removeNulls( @@ -637,6 +649,7 @@ public function webScrapeMd( 'timeoutMs' => $timeoutMs, 'useMainContentOnly' => $useMainContentOnly, 'waitForMs' => $waitForMs, + 'zdr' => $zdr, ], ); @@ -658,6 +671,7 @@ public function webScrapeMd( * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param string $urlRegex Optional RE2-compatible regex pattern. Only URLs matching this pattern are returned and counted against maxLinks. + * @param \ContextDev\Web\WebWebScrapeSitemapParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeSitemapParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -670,6 +684,7 @@ public function webScrapeSitemap( ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, + \ContextDev\Web\WebWebScrapeSitemapParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebScrapeSitemapResponse { $params = Util::removeNulls( @@ -681,6 +696,7 @@ public function webScrapeSitemap( 'tags' => $tags, 'timeoutMs' => $timeoutMs, 'urlRegex' => $urlRegex, + 'zdr' => $zdr, ], ); diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index 3f818a3c..bf56e01a 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -15,6 +15,7 @@ use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; +use ContextDev\Web\WebScreenshotParams\Zdr; /** * Capture a screenshot of a website. @@ -39,6 +40,7 @@ * timeoutMs?: int|null, * viewport?: null|Viewport|ViewportShape, * waitForMs?: int|null, + * zdr?: null|Zdr|value-of, * } */ final class WebScreenshotParams implements BaseModel @@ -137,6 +139,14 @@ final class WebScreenshotParams implements BaseModel #[Optional(nullable: true)] public ?int $waitForMs; + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @var value-of|null $zdr + */ + #[Optional(enum: Zdr::class)] + public ?string $zdr; + public function __construct() { $this->initialize(); @@ -154,6 +164,7 @@ public function __construct() * @param Page|value-of|null $page * @param list|null $tags * @param Viewport|ViewportShape|null $viewport + * @param Zdr|value-of|null $zdr */ public static function with( ColorScheme|string|null $colorScheme = null, @@ -169,6 +180,7 @@ public static function with( ?int $timeoutMs = null, Viewport|array|null $viewport = null, ?int $waitForMs = null, + Zdr|string|null $zdr = null, ): self { $self = new self; @@ -185,6 +197,7 @@ public static function with( null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $viewport && $self['viewport'] = $viewport; null !== $waitForMs && $self['waitForMs'] = $waitForMs; + null !== $zdr && $self['zdr'] = $zdr; return $self; } @@ -347,4 +360,17 @@ public function withWaitForMs(?int $waitForMs): self return $self; } + + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @param Zdr|value-of $zdr + */ + public function withZdr(Zdr|string $zdr): self + { + $self = clone $this; + $self['zdr'] = $zdr; + + return $self; + } } diff --git a/src/Web/WebScreenshotParams/Zdr.php b/src/Web/WebScreenshotParams/Zdr.php new file mode 100644 index 00000000..7bca9a2f --- /dev/null +++ b/src/Web/WebScreenshotParams/Zdr.php @@ -0,0 +1,15 @@ +, * } */ final class WebWebCrawlMdParams implements BaseModel @@ -176,6 +178,14 @@ final class WebWebCrawlMdParams implements BaseModel #[Optional] public ?int $waitForMs; + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @var value-of|null $zdr + */ + #[Optional(enum: Zdr::class)] + public ?string $zdr; + /** * `new WebWebCrawlMdParams()` is missing required properties by the API. * @@ -205,6 +215,7 @@ public function __construct() * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf * @param list|null $tags + * @param Zdr|value-of|null $zdr */ public static function with( string $url, @@ -227,6 +238,7 @@ public static function with( ?string $urlRegex = null, ?bool $useMainContentOnly = null, ?int $waitForMs = null, + Zdr|string|null $zdr = null, ): self { $self = new self; @@ -251,6 +263,7 @@ public static function with( null !== $urlRegex && $self['urlRegex'] = $urlRegex; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; null !== $waitForMs && $self['waitForMs'] = $waitForMs; + null !== $zdr && $self['zdr'] = $zdr; return $self; } @@ -484,4 +497,17 @@ public function withWaitForMs(int $waitForMs): self return $self; } + + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @param Zdr|value-of $zdr + */ + public function withZdr(Zdr|string $zdr): self + { + $self = clone $this; + $self['zdr'] = $zdr; + + return $self; + } } diff --git a/src/Web/WebWebCrawlMdParams/Zdr.php b/src/Web/WebWebCrawlMdParams/Zdr.php new file mode 100644 index 00000000..1fbf6b0c --- /dev/null +++ b/src/Web/WebWebCrawlMdParams/Zdr.php @@ -0,0 +1,15 @@ +, * } */ final class WebWebScrapeHTMLParams implements BaseModel @@ -145,6 +147,14 @@ final class WebWebScrapeHTMLParams implements BaseModel #[Optional(nullable: true)] public ?int $waitForMs; + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @var value-of|null $zdr + */ + #[Optional(enum: Zdr::class)] + public ?string $zdr; + /** * `new WebWebScrapeHTMLParams()` is missing required properties by the API. * @@ -178,6 +188,7 @@ public function __construct() * @param SettleAnimationsShape|null $settleAnimations * @param list|null $tags * @param UseMainContentOnlyShape|null $useMainContentOnly + * @param Zdr|value-of|null $zdr */ public static function with( string $url, @@ -193,6 +204,7 @@ public static function with( ?int $timeoutMs = null, bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, ?int $waitForMs = null, + Zdr|string|null $zdr = null, ): self { $self = new self; @@ -210,6 +222,7 @@ public static function with( null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; null !== $waitForMs && $self['waitForMs'] = $waitForMs; + null !== $zdr && $self['zdr'] = $zdr; return $self; } @@ -377,4 +390,17 @@ public function withWaitForMs(?int $waitForMs): self return $self; } + + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @param Zdr|value-of $zdr + */ + public function withZdr(Zdr|string $zdr): self + { + $self = clone $this; + $self['zdr'] = $zdr; + + return $self; + } } diff --git a/src/Web/WebWebScrapeHTMLParams/Zdr.php b/src/Web/WebWebScrapeHTMLParams/Zdr.php new file mode 100644 index 00000000..d76f9d8b --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Zdr.php @@ -0,0 +1,15 @@ +, * } */ final class WebWebScrapeMdParams implements BaseModel @@ -194,6 +196,14 @@ final class WebWebScrapeMdParams implements BaseModel #[Optional(nullable: true)] public ?int $waitForMs; + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @var value-of|null $zdr + */ + #[Optional(enum: Zdr::class)] + public ?string $zdr; + /** * `new WebWebScrapeMdParams()` is missing required properties by the API. * @@ -230,6 +240,7 @@ public function __construct() * @param ShortenBase64ImagesShape|null $shortenBase64Images * @param list|null $tags * @param UseMainContentOnlyShape|null $useMainContentOnly + * @param Zdr|value-of|null $zdr */ public static function with( string $url, @@ -248,6 +259,7 @@ public static function with( ?int $timeoutMs = null, bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, ?int $waitForMs = null, + Zdr|string|null $zdr = null, ): self { $self = new self; @@ -268,6 +280,7 @@ public static function with( null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; null !== $waitForMs && $self['waitForMs'] = $waitForMs; + null !== $zdr && $self['zdr'] = $zdr; return $self; } @@ -477,4 +490,17 @@ public function withWaitForMs(?int $waitForMs): self return $self; } + + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @param Zdr|value-of $zdr + */ + public function withZdr(Zdr|string $zdr): self + { + $self = clone $this; + $self['zdr'] = $zdr; + + return $self; + } } diff --git a/src/Web/WebWebScrapeMdParams/Zdr.php b/src/Web/WebWebScrapeMdParams/Zdr.php new file mode 100644 index 00000000..0ca87878 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Zdr.php @@ -0,0 +1,15 @@ +|null, * timeoutMs?: int|null, * urlRegex?: string|null, + * zdr?: null|Zdr|value-of, * } */ final class WebWebScrapeSitemapParams implements BaseModel @@ -77,6 +79,14 @@ final class WebWebScrapeSitemapParams implements BaseModel #[Optional] public ?string $urlRegex; + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @var value-of|null $zdr + */ + #[Optional(enum: Zdr::class)] + public ?string $zdr; + /** * `new WebWebScrapeSitemapParams()` is missing required properties by the API. * @@ -103,6 +113,7 @@ public function __construct() * * @param array|null $headers * @param list|null $tags + * @param Zdr|value-of|null $zdr */ public static function with( string $domain, @@ -112,6 +123,7 @@ public static function with( ?array $tags = null, ?int $timeoutMs = null, ?string $urlRegex = null, + Zdr|string|null $zdr = null, ): self { $self = new self; @@ -123,6 +135,7 @@ public static function with( null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; null !== $urlRegex && $self['urlRegex'] = $urlRegex; + null !== $zdr && $self['zdr'] = $zdr; return $self; } @@ -207,4 +220,17 @@ public function withURLRegex(string $urlRegex): self return $self; } + + /** + * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. + * + * @param Zdr|value-of $zdr + */ + public function withZdr(Zdr|string $zdr): self + { + $self = clone $this; + $self['zdr'] = $zdr; + + return $self; + } } diff --git a/src/Web/WebWebScrapeSitemapParams/Zdr.php b/src/Web/WebWebScrapeSitemapParams/Zdr.php new file mode 100644 index 00000000..c82b03b0 --- /dev/null +++ b/src/Web/WebWebScrapeSitemapParams/Zdr.php @@ -0,0 +1,15 @@ + Date: Wed, 22 Jul 2026 08:05:29 +0000 Subject: [PATCH 059/130] feat(api): manual updates --- .stats.yml | 6 +- src/Monitors/MonitorGetCreditUsageParams.php | 82 ++++++++++++ .../MonitorGetCreditUsageResponse.php | 91 +++++++++++++ .../MonitorGetCreditUsageResponse/Data.php | 122 ++++++++++++++++++ src/Monitors/MonitorGetLimitsResponse.php | 119 +++++++++++++++++ .../MonitorGetLimitsResponse/Plan.php | 19 +++ src/ServiceContracts/MonitorsContract.php | 28 ++++ src/ServiceContracts/MonitorsRawContract.php | 31 +++++ src/Services/MonitorsRawService.php | 59 +++++++++ src/Services/MonitorsService.php | 44 +++++++ tests/Services/MonitorsTest.php | 28 ++++ 11 files changed, 626 insertions(+), 3 deletions(-) create mode 100644 src/Monitors/MonitorGetCreditUsageParams.php create mode 100644 src/Monitors/MonitorGetCreditUsageResponse.php create mode 100644 src/Monitors/MonitorGetCreditUsageResponse/Data.php create mode 100644 src/Monitors/MonitorGetLimitsResponse.php create mode 100644 src/Monitors/MonitorGetLimitsResponse/Plan.php diff --git a/.stats.yml b/.stats.yml index 231a6da1..674523c1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 30 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-42c531dcf60b5d35e3996c1a669a3fe2de19d8caedf2bfd69e4864a1041c9bfa.yml +configured_endpoints: 32 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d25300a20809f87d2069c1f4417b158b2e2d1cef3ca9b6bf7653e02233deba2c.yml openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738 -config_hash: daabb160675d86b354711da1e77e5129 +config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/src/Monitors/MonitorGetCreditUsageParams.php b/src/Monitors/MonitorGetCreditUsageParams.php new file mode 100644 index 00000000..d1f51482 --- /dev/null +++ b/src/Monitors/MonitorGetCreditUsageParams.php @@ -0,0 +1,82 @@ + */ + use SdkModel; + use SdkParams; + + /** + * Only include items at or after this ISO 8601 timestamp. + */ + #[Optional] + public ?\DateTimeInterface $since; + + /** + * Only include items before this ISO 8601 timestamp. + */ + #[Optional] + public ?\DateTimeInterface $until; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?\DateTimeInterface $since = null, + ?\DateTimeInterface $until = null + ): self { + $self = new self; + + null !== $since && $self['since'] = $since; + null !== $until && $self['until'] = $until; + + return $self; + } + + /** + * Only include items at or after this ISO 8601 timestamp. + */ + public function withSince(\DateTimeInterface $since): self + { + $self = clone $this; + $self['since'] = $since; + + return $self; + } + + /** + * Only include items before this ISO 8601 timestamp. + */ + public function withUntil(\DateTimeInterface $until): self + { + $self = clone $this; + $self['until'] = $until; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetCreditUsageResponse.php b/src/Monitors/MonitorGetCreditUsageResponse.php new file mode 100644 index 00000000..2d10354e --- /dev/null +++ b/src/Monitors/MonitorGetCreditUsageResponse.php @@ -0,0 +1,91 @@ +, totalCredits: int + * } + */ +final class MonitorGetCreditUsageResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + /** + * Sum of credits across all monitors in the window. + */ + #[Required('total_credits')] + public int $totalCredits; + + /** + * `new MonitorGetCreditUsageResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorGetCreditUsageResponse::with(data: ..., totalCredits: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorGetCreditUsageResponse)->withData(...)->withTotalCredits(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + */ + public static function with(array $data, int $totalCredits): self + { + $self = new self; + + $self['data'] = $data; + $self['totalCredits'] = $totalCredits; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * Sum of credits across all monitors in the window. + */ + public function withTotalCredits(int $totalCredits): self + { + $self = clone $this; + $self['totalCredits'] = $totalCredits; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetCreditUsageResponse/Data.php b/src/Monitors/MonitorGetCreditUsageResponse/Data.php new file mode 100644 index 00000000..2cc39bb3 --- /dev/null +++ b/src/Monitors/MonitorGetCreditUsageResponse/Data.php @@ -0,0 +1,122 @@ + */ + use SdkModel; + + /** + * Credits charged to this monitor over the window. + */ + #[Required] + public int $credits; + + #[Required('monitor_id')] + public string $monitorID; + + /** + * Monitor name (falls back to the id when the monitor was deleted). + */ + #[Required] + public string $name; + + /** + * Number of billed runs over the window. + */ + #[Required] + public int $runs; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with(credits: ..., monitorID: ..., name: ..., runs: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data)->withCredits(...)->withMonitorID(...)->withName(...)->withRuns(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $credits, + string $monitorID, + string $name, + int $runs + ): self { + $self = new self; + + $self['credits'] = $credits; + $self['monitorID'] = $monitorID; + $self['name'] = $name; + $self['runs'] = $runs; + + return $self; + } + + /** + * Credits charged to this monitor over the window. + */ + public function withCredits(int $credits): self + { + $self = clone $this; + $self['credits'] = $credits; + + return $self; + } + + public function withMonitorID(string $monitorID): self + { + $self = clone $this; + $self['monitorID'] = $monitorID; + + return $self; + } + + /** + * Monitor name (falls back to the id when the monitor was deleted). + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Number of billed runs over the window. + */ + public function withRuns(int $runs): self + { + $self = clone $this; + $self['runs'] = $runs; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetLimitsResponse.php b/src/Monitors/MonitorGetLimitsResponse.php new file mode 100644 index 00000000..e8e692e9 --- /dev/null +++ b/src/Monitors/MonitorGetLimitsResponse.php @@ -0,0 +1,119 @@ + + * } + */ +final class MonitorGetLimitsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Maximum number of monitors allowed for the account. Defaults to the plan allowance unless a custom limit is set for the organization. + */ + #[Required('monitors_limit')] + public int $monitorsLimit; + + /** + * Number of monitors the account currently has. + */ + #[Required('monitors_used')] + public int $monitorsUsed; + + /** + * The plan tier the limit was resolved from. + * + * @var value-of $plan + */ + #[Required(enum: Plan::class)] + public string $plan; + + /** + * `new MonitorGetLimitsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * MonitorGetLimitsResponse::with(monitorsLimit: ..., monitorsUsed: ..., plan: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new MonitorGetLimitsResponse) + * ->withMonitorsLimit(...) + * ->withMonitorsUsed(...) + * ->withPlan(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Plan|value-of $plan + */ + public static function with( + int $monitorsLimit, + int $monitorsUsed, + Plan|string $plan + ): self { + $self = new self; + + $self['monitorsLimit'] = $monitorsLimit; + $self['monitorsUsed'] = $monitorsUsed; + $self['plan'] = $plan; + + return $self; + } + + /** + * Maximum number of monitors allowed for the account. Defaults to the plan allowance unless a custom limit is set for the organization. + */ + public function withMonitorsLimit(int $monitorsLimit): self + { + $self = clone $this; + $self['monitorsLimit'] = $monitorsLimit; + + return $self; + } + + /** + * Number of monitors the account currently has. + */ + public function withMonitorsUsed(int $monitorsUsed): self + { + $self = clone $this; + $self['monitorsUsed'] = $monitorsUsed; + + return $self; + } + + /** + * The plan tier the limit was resolved from. + * + * @param Plan|value-of $plan + */ + public function withPlan(Plan|string $plan): self + { + $self = clone $this; + $self['plan'] = $plan; + + return $self; + } +} diff --git a/src/Monitors/MonitorGetLimitsResponse/Plan.php b/src/Monitors/MonitorGetLimitsResponse/Plan.php new file mode 100644 index 00000000..9b23fe34 --- /dev/null +++ b/src/Monitors/MonitorGetLimitsResponse/Plan.php @@ -0,0 +1,19 @@ +|MonitorGetCreditUsageParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function getCreditUsage( + array|MonitorGetCreditUsageParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function getLimits( + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + /** * @api * diff --git a/src/Services/MonitorsRawService.php b/src/Services/MonitorsRawService.php index 7251d06b..365560fe 100644 --- a/src/Services/MonitorsRawService.php +++ b/src/Services/MonitorsRawService.php @@ -14,6 +14,9 @@ use ContextDev\Monitors\MonitorCreateParams\Webhook; use ContextDev\Monitors\MonitorDeleteResponse; use ContextDev\Monitors\MonitorGetChangeResponse; +use ContextDev\Monitors\MonitorGetCreditUsageParams; +use ContextDev\Monitors\MonitorGetCreditUsageResponse; +use ContextDev\Monitors\MonitorGetLimitsResponse; use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesParams; use ContextDev\Monitors\MonitorListAccountChangesResponse; @@ -235,6 +238,62 @@ public function delete( ); } + /** + * @api + * + * Returns credits charged per monitor over an optional [since, until] window, newest spenders first. + * + * @param array{ + * since?: \DateTimeInterface, until?: \DateTimeInterface + * }|MonitorGetCreditUsageParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function getCreditUsage( + array|MonitorGetCreditUsageParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = MonitorGetCreditUsageParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors/credit-usage', + query: $parsed, + options: $options, + convert: MonitorGetCreditUsageResponse::class, + ); + } + + /** + * @api + * + * Returns how many monitors the account has and the maximum it allows. + * + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function getLimits( + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'monitors/limits', + options: $requestOptions, + convert: MonitorGetLimitsResponse::class, + ); + } + /** * @api * diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php index 0432335d..c25ae33a 100644 --- a/src/Services/MonitorsService.php +++ b/src/Services/MonitorsService.php @@ -17,6 +17,8 @@ use ContextDev\Monitors\MonitorCreateParams\Webhook; use ContextDev\Monitors\MonitorDeleteResponse; use ContextDev\Monitors\MonitorGetChangeResponse; +use ContextDev\Monitors\MonitorGetCreditUsageResponse; +use ContextDev\Monitors\MonitorGetLimitsResponse; use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesResponse; use ContextDev\Monitors\MonitorListAccountRunsResponse; @@ -240,6 +242,48 @@ public function delete( return $response->parse(); } + /** + * @api + * + * Returns credits charged per monitor over an optional [since, until] window, newest spenders first. + * + * @param \DateTimeInterface $since only include items at or after this ISO 8601 timestamp + * @param \DateTimeInterface $until only include items before this ISO 8601 timestamp + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function getCreditUsage( + ?\DateTimeInterface $since = null, + ?\DateTimeInterface $until = null, + RequestOptions|array|null $requestOptions = null, + ): MonitorGetCreditUsageResponse { + $params = Util::removeNulls(['since' => $since, 'until' => $until]); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->getCreditUsage(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Returns how many monitors the account has and the maximum it allows. + * + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function getLimits( + RequestOptions|array|null $requestOptions = null + ): MonitorGetLimitsResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->getLimits(requestOptions: $requestOptions); + + return $response->parse(); + } + /** * @api * diff --git a/tests/Services/MonitorsTest.php b/tests/Services/MonitorsTest.php index 904d9d4c..d60e90d0 100644 --- a/tests/Services/MonitorsTest.php +++ b/tests/Services/MonitorsTest.php @@ -6,6 +6,8 @@ use ContextDev\Core\Util; use ContextDev\Monitors\MonitorDeleteResponse; use ContextDev\Monitors\MonitorGetChangeResponse; +use ContextDev\Monitors\MonitorGetCreditUsageResponse; +use ContextDev\Monitors\MonitorGetLimitsResponse; use ContextDev\Monitors\MonitorGetResponse; use ContextDev\Monitors\MonitorListAccountChangesResponse; use ContextDev\Monitors\MonitorListAccountRunsResponse; @@ -136,6 +138,32 @@ public function testDelete(): void $this->assertInstanceOf(MonitorDeleteResponse::class, $result); } + #[Test] + public function testGetCreditUsage(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->getCreditUsage(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorGetCreditUsageResponse::class, $result); + } + + #[Test] + public function testGetLimits(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->monitors->getLimits(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(MonitorGetLimitsResponse::class, $result); + } + #[Test] public function testListAccountChanges(): void { From acba705c1ff3390457e0f623602570d2432e76c5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2026 08:18:07 +0000 Subject: [PATCH 060/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 674523c1..1a4b8983 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d25300a20809f87d2069c1f4417b158b2e2d1cef3ca9b6bf7653e02233deba2c.yml -openapi_spec_hash: e43dd84c75e6d710c7346b9f12c34738 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-65d8d9d461368f72da68cd7606e0498cde07b586235769d8e3e04b7a3c42858d.yml +openapi_spec_hash: 048da2b1bfe8095b6c2e805c515e20e2 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 From 7581ba306db16ef482e6aa66c5ae131c37fded01 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2026 08:31:58 +0000 Subject: [PATCH 061/130] feat(api): api update --- .stats.yml | 4 ++-- src/Monitors/MonitorCreateParams.php | 4 ++-- .../MonitorCreateParams/Target/MonitorsSitemapTarget.php | 8 ++++---- src/Monitors/MonitorGetChangeResponse.php | 4 ++-- src/Monitors/MonitorGetResponse.php | 4 ++-- .../MonitorGetResponse/Target/MonitorsSitemapTarget.php | 8 ++++---- src/Monitors/MonitorListAccountChangesResponse/Data.php | 4 ++-- src/Monitors/MonitorListChangesResponse/Data.php | 4 ++-- src/Monitors/MonitorListResponse/Data.php | 4 ++-- .../Data/Target/MonitorsSitemapTarget.php | 8 ++++---- src/Monitors/MonitorNewResponse.php | 4 ++-- .../MonitorNewResponse/Target/MonitorsSitemapTarget.php | 8 ++++---- src/Monitors/MonitorUpdateParams.php | 4 ++-- .../MonitorUpdateParams/Target/MonitorsSitemapTarget.php | 8 ++++---- src/Monitors/MonitorUpdateResponse.php | 4 ++-- .../Target/MonitorsSitemapTarget.php | 8 ++++---- src/ServiceContracts/MonitorsContract.php | 4 ++-- src/Services/MonitorsService.php | 4 ++-- 18 files changed, 48 insertions(+), 48 deletions(-) diff --git a/.stats.yml b/.stats.yml index 1a4b8983..d1ed301b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-65d8d9d461368f72da68cd7606e0498cde07b586235769d8e3e04b7a3c42858d.yml -openapi_spec_hash: 048da2b1bfe8095b6c2e805c515e20e2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-48449a9e476c712dc65557934c8b97ac9708b06b7f96fa5c22d135037eeb9ce5.yml +openapi_spec_hash: 6a0575b3dc2ea3e5d47c4961f0251213 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/src/Monitors/MonitorCreateParams.php b/src/Monitors/MonitorCreateParams.php index 292b75b6..56eec6e4 100644 --- a/src/Monitors/MonitorCreateParams.php +++ b/src/Monitors/MonitorCreateParams.php @@ -82,7 +82,7 @@ final class MonitorCreateParams implements BaseModel public ?string $mode; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -215,7 +215,7 @@ public function withMode(Mode|string $mode): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php index a16f4183..4ec7ff16 100644 --- a/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsSitemapTarget.php @@ -36,7 +36,7 @@ final class MonitorsSitemapTarget implements BaseModel public string $url; /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @var list|null $exclude */ @@ -44,7 +44,7 @@ final class MonitorsSitemapTarget implements BaseModel public ?array $exclude; /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @var list|null $include */ @@ -124,7 +124,7 @@ public function withURL(string $url): self } /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @param list $exclude */ @@ -137,7 +137,7 @@ public function withExclude(array $exclude): self } /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @param list $include */ diff --git a/src/Monitors/MonitorGetChangeResponse.php b/src/Monitors/MonitorGetChangeResponse.php index a73cf033..f36d5fe0 100644 --- a/src/Monitors/MonitorGetChangeResponse.php +++ b/src/Monitors/MonitorGetChangeResponse.php @@ -81,7 +81,7 @@ final class MonitorGetChangeResponse implements BaseModel public string $summary; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list $tags */ @@ -335,7 +335,7 @@ public function withSummary(string $summary): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorGetResponse.php b/src/Monitors/MonitorGetResponse.php index 63221624..cfa14ffe 100644 --- a/src/Monitors/MonitorGetResponse.php +++ b/src/Monitors/MonitorGetResponse.php @@ -141,7 +141,7 @@ final class MonitorGetResponse implements BaseModel public ?\DateTimeInterface $nextRunAt; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -408,7 +408,7 @@ public function withNextRunAt(?\DateTimeInterface $nextRunAt): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php index 28ee9ec6..3d10355a 100644 --- a/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsSitemapTarget.php @@ -36,7 +36,7 @@ final class MonitorsSitemapTarget implements BaseModel public string $url; /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @var list|null $exclude */ @@ -44,7 +44,7 @@ final class MonitorsSitemapTarget implements BaseModel public ?array $exclude; /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @var list|null $include */ @@ -124,7 +124,7 @@ public function withURL(string $url): self } /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @param list $exclude */ @@ -137,7 +137,7 @@ public function withExclude(array $exclude): self } /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @param list $include */ diff --git a/src/Monitors/MonitorListAccountChangesResponse/Data.php b/src/Monitors/MonitorListAccountChangesResponse/Data.php index 9d2a5609..26bde447 100644 --- a/src/Monitors/MonitorListAccountChangesResponse/Data.php +++ b/src/Monitors/MonitorListAccountChangesResponse/Data.php @@ -90,7 +90,7 @@ final class Data implements BaseModel public ?int $removedURLCount; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -313,7 +313,7 @@ public function withRemovedURLCount(int $removedURLCount): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorListChangesResponse/Data.php b/src/Monitors/MonitorListChangesResponse/Data.php index cf01a7a4..d52716ea 100644 --- a/src/Monitors/MonitorListChangesResponse/Data.php +++ b/src/Monitors/MonitorListChangesResponse/Data.php @@ -90,7 +90,7 @@ final class Data implements BaseModel public ?int $removedURLCount; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -313,7 +313,7 @@ public function withRemovedURLCount(int $removedURLCount): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorListResponse/Data.php b/src/Monitors/MonitorListResponse/Data.php index ce0be235..ceffa407 100644 --- a/src/Monitors/MonitorListResponse/Data.php +++ b/src/Monitors/MonitorListResponse/Data.php @@ -141,7 +141,7 @@ final class Data implements BaseModel public ?\DateTimeInterface $nextRunAt; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -408,7 +408,7 @@ public function withNextRunAt(?\DateTimeInterface $nextRunAt): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php index b16de60d..f14d6a7b 100644 --- a/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsSitemapTarget.php @@ -36,7 +36,7 @@ final class MonitorsSitemapTarget implements BaseModel public string $url; /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @var list|null $exclude */ @@ -44,7 +44,7 @@ final class MonitorsSitemapTarget implements BaseModel public ?array $exclude; /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @var list|null $include */ @@ -124,7 +124,7 @@ public function withURL(string $url): self } /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @param list $exclude */ @@ -137,7 +137,7 @@ public function withExclude(array $exclude): self } /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @param list $include */ diff --git a/src/Monitors/MonitorNewResponse.php b/src/Monitors/MonitorNewResponse.php index 8cbef5f2..d70d44ef 100644 --- a/src/Monitors/MonitorNewResponse.php +++ b/src/Monitors/MonitorNewResponse.php @@ -141,7 +141,7 @@ final class MonitorNewResponse implements BaseModel public ?\DateTimeInterface $nextRunAt; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -408,7 +408,7 @@ public function withNextRunAt(?\DateTimeInterface $nextRunAt): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php index f01e31ba..6ac56c89 100644 --- a/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsSitemapTarget.php @@ -36,7 +36,7 @@ final class MonitorsSitemapTarget implements BaseModel public string $url; /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @var list|null $exclude */ @@ -44,7 +44,7 @@ final class MonitorsSitemapTarget implements BaseModel public ?array $exclude; /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @var list|null $include */ @@ -124,7 +124,7 @@ public function withURL(string $url): self } /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @param list $exclude */ @@ -137,7 +137,7 @@ public function withExclude(array $exclude): self } /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @param list $include */ diff --git a/src/Monitors/MonitorUpdateParams.php b/src/Monitors/MonitorUpdateParams.php index 606b67ce..472d6e2f 100644 --- a/src/Monitors/MonitorUpdateParams.php +++ b/src/Monitors/MonitorUpdateParams.php @@ -69,7 +69,7 @@ final class MonitorUpdateParams implements BaseModel public ?string $status; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -176,7 +176,7 @@ public function withStatus(Status|string $status): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php index 5da0cb21..2b002b1b 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsSitemapTarget.php @@ -36,7 +36,7 @@ final class MonitorsSitemapTarget implements BaseModel public string $url; /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @var list|null $exclude */ @@ -44,7 +44,7 @@ final class MonitorsSitemapTarget implements BaseModel public ?array $exclude; /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @var list|null $include */ @@ -124,7 +124,7 @@ public function withURL(string $url): self } /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @param list $exclude */ @@ -137,7 +137,7 @@ public function withExclude(array $exclude): self } /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @param list $include */ diff --git a/src/Monitors/MonitorUpdateResponse.php b/src/Monitors/MonitorUpdateResponse.php index 885d6860..4e9b8a53 100644 --- a/src/Monitors/MonitorUpdateResponse.php +++ b/src/Monitors/MonitorUpdateResponse.php @@ -141,7 +141,7 @@ final class MonitorUpdateResponse implements BaseModel public ?\DateTimeInterface $nextRunAt; /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @var list|null $tags */ @@ -408,7 +408,7 @@ public function withNextRunAt(?\DateTimeInterface $nextRunAt): self } /** - * User-defined tags for grouping and filtering monitors and their changes. + * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * * @param list $tags */ diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php index 28a9b2f9..2df7fc10 100644 --- a/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsSitemapTarget.php @@ -36,7 +36,7 @@ final class MonitorsSitemapTarget implements BaseModel public string $url; /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @var list|null $exclude */ @@ -44,7 +44,7 @@ final class MonitorsSitemapTarget implements BaseModel public ?array $exclude; /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @var list|null $include */ @@ -124,7 +124,7 @@ public function withURL(string $url): self } /** - * URL path patterns to exclude. + * URL path patterns to exclude (max 50). * * @param list $exclude */ @@ -137,7 +137,7 @@ public function withExclude(array $exclude): self } /** - * URL path patterns to include. + * URL path patterns to include (max 50). * * @param list $include */ diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php index 91390379..6a3ae2e8 100644 --- a/src/ServiceContracts/MonitorsContract.php +++ b/src/ServiceContracts/MonitorsContract.php @@ -53,7 +53,7 @@ interface MonitorsContract * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param TargetShape $target discriminated union describing what the monitor watches * @param Mode|value-of $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. - * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param list $tags User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * @param Webhook|WebhookShape|null $webhook * @param RequestOpts|null $requestOptions * @@ -88,7 +88,7 @@ public function retrieve( * @param ChangeDetectionShape1 $changeDetection discriminated union describing how changes are detected * @param \ContextDev\Monitors\MonitorUpdateParams\Schedule|ScheduleShape1 $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param Status|value-of $status - * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param list $tags User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * @param TargetShape1 $target discriminated union describing what the monitor watches * @param \ContextDev\Monitors\MonitorUpdateParams\Webhook|WebhookShape1|null $webhook set to null to remove the webhook * @param RequestOpts|null $requestOptions diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php index c25ae33a..0ed99c16 100644 --- a/src/Services/MonitorsService.php +++ b/src/Services/MonitorsService.php @@ -73,7 +73,7 @@ public function __construct(private Client $client) * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param TargetShape $target discriminated union describing what the monitor watches * @param Mode|value-of $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. - * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param list $tags User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * @param Webhook|WebhookShape|null $webhook * @param RequestOpts|null $requestOptions * @@ -134,7 +134,7 @@ public function retrieve( * @param ChangeDetectionShape1 $changeDetection discriminated union describing how changes are detected * @param \ContextDev\Monitors\MonitorUpdateParams\Schedule|ScheduleShape1 $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param Status|value-of $status - * @param list $tags user-defined tags for grouping and filtering monitors and their changes + * @param list $tags User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * @param TargetShape1 $target discriminated union describing what the monitor watches * @param \ContextDev\Monitors\MonitorUpdateParams\Webhook|WebhookShape1|null $webhook set to null to remove the webhook * @param RequestOpts|null $requestOptions From 0e4513320b3583695e46d5ba61a0018721561a14 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2026 08:55:54 +0000 Subject: [PATCH 062/130] feat(api): api update --- .stats.yml | 4 +- src/ServiceContracts/WebContract.php | 9 +++ src/Services/WebRawService.php | 12 ++- src/Services/WebService.php | 18 ++++- src/Web/WebWebScrapeHTMLParams.php | 30 ++++++- src/Web/WebWebScrapeHTMLParams/Action.php | 41 ++++++++++ .../Action/WebScrapePerformAction.php | 79 +++++++++++++++++++ .../Action/WebScrapeWaitAction.php | 79 +++++++++++++++++++ src/Web/WebWebScrapeImagesParams.php | 30 ++++++- src/Web/WebWebScrapeImagesParams/Action.php | 41 ++++++++++ .../Action/WebScrapePerformAction.php | 79 +++++++++++++++++++ .../Action/WebScrapeWaitAction.php | 79 +++++++++++++++++++ src/Web/WebWebScrapeMdParams.php | 30 ++++++- src/Web/WebWebScrapeMdParams/Action.php | 41 ++++++++++ .../Action/WebScrapePerformAction.php | 79 +++++++++++++++++++ .../Action/WebScrapeWaitAction.php | 79 +++++++++++++++++++ tests/Services/WebTest.php | 3 + 17 files changed, 722 insertions(+), 11 deletions(-) create mode 100644 src/Web/WebWebScrapeHTMLParams/Action.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Action/WebScrapePerformAction.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Action/WebScrapeWaitAction.php create mode 100644 src/Web/WebWebScrapeImagesParams/Action.php create mode 100644 src/Web/WebWebScrapeImagesParams/Action/WebScrapePerformAction.php create mode 100644 src/Web/WebWebScrapeImagesParams/Action/WebScrapeWaitAction.php create mode 100644 src/Web/WebWebScrapeMdParams/Action.php create mode 100644 src/Web/WebWebScrapeMdParams/Action/WebScrapePerformAction.php create mode 100644 src/Web/WebWebScrapeMdParams/Action/WebScrapeWaitAction.php diff --git a/.stats.yml b/.stats.yml index d1ed301b..f41ab2ed 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-48449a9e476c712dc65557934c8b97ac9708b06b7f96fa5c22d135037eeb9ce5.yml -openapi_spec_hash: 6a0575b3dc2ea3e5d47c4961f0251213 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1ad134d4ef2ddefee790dc464dd2da3e4c0614652620b25fbb1379d8f5676526.yml +openapi_spec_hash: 24809b018c6869838112f064e5558509 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 204ce853..42edb5d9 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -35,12 +35,15 @@ * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks @@ -285,6 +288,7 @@ public function webCrawlMd( * @api * * @param string $url Full URL to scrape (must include http:// or https:// protocol) + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -304,6 +308,7 @@ public function webCrawlMd( */ public function webScrapeHTML( string $url, + ?array $actions = null, \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, @@ -326,6 +331,7 @@ public function webScrapeHTML( * @api * * @param string $url Page URL to inspect. Must include http:// or https://. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param DedupeShape $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -339,6 +345,7 @@ public function webScrapeHTML( */ public function webScrapeImages( string $url, + ?array $actions = null, bool|\ContextDev\Web\WebWebScrapeImagesParams\Dedupe\UnionMember1|string $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, @@ -353,6 +360,7 @@ public function webScrapeImages( * @api * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -375,6 +383,7 @@ public function webScrapeImages( */ public function webScrapeMd( string $url, + ?array $actions = null, \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 7d2f17eb..3a1a7f40 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -49,12 +49,15 @@ * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks @@ -380,10 +383,11 @@ public function webCrawlMd( /** * @api * - * Scrapes the given URL and returns the raw HTML content of the page. + * Scrapes the given URL and returns the raw HTML content of the page. The base request costs 1 credit; requests with browser actions cost 2 credits. * * @param array{ * url: string, + * actions?: list|null, * country?: value-of, * excludeSelectors?: list|null, * headers?: array, @@ -426,10 +430,11 @@ public function webScrapeHTML( /** * @api * - * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. + * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit, or 2 credits with browser actions. When enrichment is enabled, the entire call costs 5 credits, including requests that also use actions. * * @param array{ * url: string, + * actions?: list|null, * dedupe?: DedupeShape, * enrichment?: Enrichment|EnrichmentShape|null, * headers?: array, @@ -472,7 +477,7 @@ public function webScrapeImages( * * | HTTP status | Billed? | Meaning | * | --- | --- | --- | - * | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing | + * | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | @@ -483,6 +488,7 @@ public function webScrapeImages( * * @param array{ * url: string, + * actions?: list|null, * country?: value-of, * excludeSelectors?: list|null, * headers?: array, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 4e449c11..a4a17995 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -38,12 +38,15 @@ * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks @@ -459,9 +462,10 @@ public function webCrawlMd( /** * @api * - * Scrapes the given URL and returns the raw HTML content of the page. + * Scrapes the given URL and returns the raw HTML content of the page. The base request costs 1 credit; requests with browser actions cost 2 credits. * * @param string $url Full URL to scrape (must include http:// or https:// protocol) + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -481,6 +485,7 @@ public function webCrawlMd( */ public function webScrapeHTML( string $url, + ?array $actions = null, \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, @@ -501,6 +506,7 @@ public function webScrapeHTML( $params = Util::removeNulls( [ 'url' => $url, + 'actions' => $actions, 'country' => $country, 'excludeSelectors' => $excludeSelectors, 'headers' => $headers, @@ -526,9 +532,10 @@ public function webScrapeHTML( /** * @api * - * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. + * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit, or 2 credits with browser actions. When enrichment is enabled, the entire call costs 5 credits, including requests that also use actions. * * @param string $url Page URL to inspect. Must include http:// or https://. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param DedupeShape $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -542,6 +549,7 @@ public function webScrapeHTML( */ public function webScrapeImages( string $url, + ?array $actions = null, bool|\ContextDev\Web\WebWebScrapeImagesParams\Dedupe\UnionMember1|string $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, @@ -554,6 +562,7 @@ public function webScrapeImages( $params = Util::removeNulls( [ 'url' => $url, + 'actions' => $actions, 'dedupe' => $dedupe, 'enrichment' => $enrichment, 'headers' => $headers, @@ -579,7 +588,7 @@ public function webScrapeImages( * * | HTTP status | Billed? | Meaning | * | --- | --- | --- | - * | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing | + * | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | @@ -589,6 +598,7 @@ public function webScrapeImages( * | 500 | No | Internal error | * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -611,6 +621,7 @@ public function webScrapeImages( */ public function webScrapeMd( string $url, + ?array $actions = null, \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, @@ -634,6 +645,7 @@ public function webScrapeMd( $params = Util::removeNulls( [ 'url' => $url, + 'actions' => $actions, 'country' => $country, 'excludeSelectors' => $excludeSelectors, 'headers' => $headers, diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php index f1be42d0..de09678d 100644 --- a/src/Web/WebWebScrapeHTMLParams.php +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -9,6 +9,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebWebScrapeHTMLParams\Action; use ContextDev\Web\WebWebScrapeHTMLParams\Country; use ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames; use ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames\UnionMember1; @@ -18,13 +19,15 @@ use ContextDev\Web\WebWebScrapeHTMLParams\Zdr; /** - * Scrapes the given URL and returns the raw HTML content of the page. + * Scrapes the given URL and returns the raw HTML content of the page. The base request costs 1 credit; requests with browser actions cost 2 credits. * * @see ContextDev\Services\WebService::webScrapeHTML() * + * @phpstan-import-type ActionVariants from \ContextDev\Web\WebWebScrapeHTMLParams\Action * @phpstan-import-type IncludeFramesVariants from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type SettleAnimationsVariants from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations * @phpstan-import-type UseMainContentOnlyVariants from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations @@ -32,6 +35,7 @@ * * @phpstan-type WebWebScrapeHTMLParamsShape = array{ * url: string, + * actions?: list|null, * country?: null|Country|value-of, * excludeSelectors?: list|null, * headers?: array|null, @@ -59,6 +63,14 @@ final class WebWebScrapeHTMLParams implements BaseModel #[Required] public string $url; + /** + * Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * + * @var list|null $actions + */ + #[Optional(list: Action::class, nullable: true)] + public ?array $actions; + /** * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @@ -179,6 +191,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param list|null $actions * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers @@ -192,6 +205,7 @@ public function __construct() */ public static function with( string $url, + ?array $actions = null, Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, @@ -210,6 +224,7 @@ public static function with( $self['url'] = $url; + null !== $actions && $self['actions'] = $actions; null !== $country && $self['country'] = $country; null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; null !== $headers && $self['headers'] = $headers; @@ -238,6 +253,19 @@ public function withURL(string $url): self return $self; } + /** + * Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * + * @param list|null $actions + */ + public function withActions(?array $actions): self + { + $self = clone $this; + $self['actions'] = $actions; + + return $self; + } + /** * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * diff --git a/src/Web/WebWebScrapeHTMLParams/Action.php b/src/Web/WebWebScrapeHTMLParams/Action.php new file mode 100644 index 00000000..02d0da17 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Action.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'wait' => WebScrapeWaitAction::class, + 'perform' => WebScrapePerformAction::class, + ]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/Action/WebScrapePerformAction.php b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapePerformAction.php new file mode 100644 index 00000000..b546008f --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapePerformAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'perform' $do */ + #[Required] + public string $do = 'perform'; + + #[Required] + public string $action; + + /** + * `new WebScrapePerformAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapePerformAction::with(action: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapePerformAction)->withAction(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $action): self + { + $self = new self; + + $self['action'] = $action; + + return $self; + } + + public function withAction(string $action): self + { + $self = clone $this; + $self['action'] = $action; + + return $self; + } + + /** + * @param 'perform' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeWaitAction.php b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeWaitAction.php new file mode 100644 index 00000000..19922383 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeWaitAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'wait' $do */ + #[Required] + public string $do = 'wait'; + + #[Required] + public int $timeMs; + + /** + * `new WebScrapeWaitAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapeWaitAction::with(timeMs: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapeWaitAction)->withTimeMs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $timeMs): self + { + $self = new self; + + $self['timeMs'] = $timeMs; + + return $self; + } + + /** + * @param 'wait' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + public function withTimeMs(int $timeMs): self + { + $self = clone $this; + $self['timeMs'] = $timeMs; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesParams.php b/src/Web/WebWebScrapeImagesParams.php index d6c7d8d5..6f90b034 100644 --- a/src/Web/WebWebScrapeImagesParams.php +++ b/src/Web/WebWebScrapeImagesParams.php @@ -9,21 +9,25 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebWebScrapeImagesParams\Action; use ContextDev\Web\WebWebScrapeImagesParams\Dedupe; use ContextDev\Web\WebWebScrapeImagesParams\Dedupe\UnionMember1; use ContextDev\Web\WebWebScrapeImagesParams\Enrichment; /** - * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit. When enrichment is enabled, the entire call costs 5 credits. + * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit, or 2 credits with browser actions. When enrichment is enabled, the entire call costs 5 credits, including requests that also use actions. * * @see ContextDev\Services\WebService::webScrapeImages() * + * @phpstan-import-type ActionVariants from \ContextDev\Web\WebWebScrapeImagesParams\Action * @phpstan-import-type DedupeVariants from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment * * @phpstan-type WebWebScrapeImagesParamsShape = array{ * url: string, + * actions?: list|null, * dedupe?: DedupeShape|null, * enrichment?: null|Enrichment|EnrichmentShape, * headers?: array|null, @@ -45,6 +49,14 @@ final class WebWebScrapeImagesParams implements BaseModel #[Required] public string $url; + /** + * Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * + * @var list|null $actions + */ + #[Optional(list: Action::class, nullable: true)] + public ?array $actions; + /** * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @@ -117,6 +129,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param list|null $actions * @param DedupeShape|null $dedupe * @param Enrichment|EnrichmentShape|null $enrichment * @param array|null $headers @@ -124,6 +137,7 @@ public function __construct() */ public static function with( string $url, + ?array $actions = null, bool|UnionMember1|string|null $dedupe = null, Enrichment|array|null $enrichment = null, ?array $headers = null, @@ -136,6 +150,7 @@ public static function with( $self['url'] = $url; + null !== $actions && $self['actions'] = $actions; null !== $dedupe && $self['dedupe'] = $dedupe; null !== $enrichment && $self['enrichment'] = $enrichment; null !== $headers && $self['headers'] = $headers; @@ -158,6 +173,19 @@ public function withURL(string $url): self return $self; } + /** + * Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * + * @param list|null $actions + */ + public function withActions(?array $actions): self + { + $self = clone $this; + $self['actions'] = $actions; + + return $self; + } + /** * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * diff --git a/src/Web/WebWebScrapeImagesParams/Action.php b/src/Web/WebWebScrapeImagesParams/Action.php new file mode 100644 index 00000000..9f64d83e --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Action.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'wait' => WebScrapeWaitAction::class, + 'perform' => WebScrapePerformAction::class, + ]; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Action/WebScrapePerformAction.php b/src/Web/WebWebScrapeImagesParams/Action/WebScrapePerformAction.php new file mode 100644 index 00000000..1f9f1478 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Action/WebScrapePerformAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'perform' $do */ + #[Required] + public string $do = 'perform'; + + #[Required] + public string $action; + + /** + * `new WebScrapePerformAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapePerformAction::with(action: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapePerformAction)->withAction(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $action): self + { + $self = new self; + + $self['action'] = $action; + + return $self; + } + + public function withAction(string $action): self + { + $self = clone $this; + $self['action'] = $action; + + return $self; + } + + /** + * @param 'perform' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Action/WebScrapeWaitAction.php b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeWaitAction.php new file mode 100644 index 00000000..c47f3407 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeWaitAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'wait' $do */ + #[Required] + public string $do = 'wait'; + + #[Required] + public int $timeMs; + + /** + * `new WebScrapeWaitAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapeWaitAction::with(timeMs: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapeWaitAction)->withTimeMs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $timeMs): self + { + $self = new self; + + $self['timeMs'] = $timeMs; + + return $self; + } + + /** + * @param 'wait' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + public function withTimeMs(int $timeMs): self + { + $self = clone $this; + $self['timeMs'] = $timeMs; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index e2a245fa..63fb55c3 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -9,6 +9,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebWebScrapeMdParams\Action; use ContextDev\Web\WebWebScrapeMdParams\Country; use ContextDev\Web\WebWebScrapeMdParams\IncludeFrames; use ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1; @@ -27,7 +28,7 @@ * * | HTTP status | Billed? | Meaning | * | --- | --- | --- | - * | 200 | Yes — 1 credit | Successful scrape, including a zero-length result when includeSelectors matched nothing | + * | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | @@ -38,12 +39,14 @@ * * @see ContextDev\Services\WebService::webScrapeMd() * + * @phpstan-import-type ActionVariants from \ContextDev\Web\WebWebScrapeMdParams\Action * @phpstan-import-type IncludeFramesVariants from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames * @phpstan-import-type IncludeImagesVariants from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksVariants from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type SettleAnimationsVariants from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations * @phpstan-import-type ShortenBase64ImagesVariants from \ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images * @phpstan-import-type UseMainContentOnlyVariants from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks @@ -54,6 +57,7 @@ * * @phpstan-type WebWebScrapeMdParamsShape = array{ * url: string, + * actions?: list|null, * country?: null|Country|value-of, * excludeSelectors?: list|null, * headers?: array|null, @@ -84,6 +88,14 @@ final class WebWebScrapeMdParams implements BaseModel #[Required] public string $url; + /** + * Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * + * @var list|null $actions + */ + #[Optional(list: Action::class, nullable: true)] + public ?array $actions; + /** * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * @@ -228,6 +240,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param list|null $actions * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers @@ -244,6 +257,7 @@ public function __construct() */ public static function with( string $url, + ?array $actions = null, Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, @@ -265,6 +279,7 @@ public static function with( $self['url'] = $url; + null !== $actions && $self['actions'] = $actions; null !== $country && $self['country'] = $country; null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; null !== $headers && $self['headers'] = $headers; @@ -296,6 +311,19 @@ public function withURL(string $url): self return $self; } + /** + * Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * + * @param list|null $actions + */ + public function withActions(?array $actions): self + { + $self = clone $this; + $self['actions'] = $actions; + + return $self; + } + /** * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. * diff --git a/src/Web/WebWebScrapeMdParams/Action.php b/src/Web/WebWebScrapeMdParams/Action.php new file mode 100644 index 00000000..349deb02 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Action.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'wait' => WebScrapeWaitAction::class, + 'perform' => WebScrapePerformAction::class, + ]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/Action/WebScrapePerformAction.php b/src/Web/WebWebScrapeMdParams/Action/WebScrapePerformAction.php new file mode 100644 index 00000000..7910b74a --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Action/WebScrapePerformAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'perform' $do */ + #[Required] + public string $do = 'perform'; + + #[Required] + public string $action; + + /** + * `new WebScrapePerformAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapePerformAction::with(action: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapePerformAction)->withAction(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $action): self + { + $self = new self; + + $self['action'] = $action; + + return $self; + } + + public function withAction(string $action): self + { + $self = clone $this; + $self['action'] = $action; + + return $self; + } + + /** + * @param 'perform' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdParams/Action/WebScrapeWaitAction.php b/src/Web/WebWebScrapeMdParams/Action/WebScrapeWaitAction.php new file mode 100644 index 00000000..c5943ee1 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Action/WebScrapeWaitAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'wait' $do */ + #[Required] + public string $do = 'wait'; + + #[Required] + public int $timeMs; + + /** + * `new WebScrapeWaitAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapeWaitAction::with(timeMs: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapeWaitAction)->withTimeMs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $timeMs): self + { + $self = new self; + + $self['timeMs'] = $timeMs; + + return $self; + } + + /** + * @param 'wait' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + public function withTimeMs(int $timeMs): self + { + $self = clone $this; + $self['timeMs'] = $timeMs; + + return $self; + } +} diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index 370b94c5..c0febb04 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -281,6 +281,7 @@ public function testWebScrapeHTMLWithOptionalParams(): void $result = $this->client->web->webScrapeHTML( url: 'https://example.com', + actions: [['do' => 'wait', 'timeMs' => 0]], country: 'de', excludeSelectors: ['x'], headers: ['foo' => 'J!'], @@ -322,6 +323,7 @@ public function testWebScrapeImagesWithOptionalParams(): void $result = $this->client->web->webScrapeImages( url: 'https://example.com', + actions: [['do' => 'wait', 'timeMs' => 0]], dedupe: 'true', enrichment: [ 'classification' => 'true', @@ -362,6 +364,7 @@ public function testWebScrapeMdWithOptionalParams(): void $result = $this->client->web->webScrapeMd( url: 'https://example.com', + actions: [['do' => 'wait', 'timeMs' => 0]], country: 'de', excludeSelectors: ['x'], headers: ['foo' => 'J!'], From d5f71a5ae64e251a73b5f325ad090f70a51041e4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2026 09:18:07 +0000 Subject: [PATCH 063/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f41ab2ed..dd88a667 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1ad134d4ef2ddefee790dc464dd2da3e4c0614652620b25fbb1379d8f5676526.yml -openapi_spec_hash: 24809b018c6869838112f064e5558509 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4dea765de04ef16556290055d83312b58e0dc16586e9a717d378dc451f068113.yml +openapi_spec_hash: e4c702985962f8e35fffffcc821700b6 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 From fbfd565f7986b2b8f3fe15b44a4d2c86bbaffca8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2026 18:06:28 +0000 Subject: [PATCH 064/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index dd88a667..53999f48 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4dea765de04ef16556290055d83312b58e0dc16586e9a717d378dc451f068113.yml -openapi_spec_hash: e4c702985962f8e35fffffcc821700b6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ce19e3abfe1f07d4a615d2fb35666e99f7918b821dfc270b38bfd9c0de39fc4e.yml +openapi_spec_hash: 71623548f792037a7f13fb693b41e217 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 From 7f3356fdc89a6ce0b530718d2517954e2c70dd6c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2026 18:45:39 +0000 Subject: [PATCH 065/130] feat(api): api update --- .stats.yml | 4 +- .../MonitorListAccountRunsResponse/Data.php | 16 +- .../Data/WebhookDelivery.php | 200 ------------------ .../Data/WebhookDelivery/Error.php | 74 ------- .../Data/WebhookDelivery/Event.php | 15 -- .../Data/WebhookDelivery/Status.php | 19 -- .../Data/WebhookDelivery1.php | 196 ----------------- .../Data/WebhookDelivery1/Error.php | 74 ------- .../Data/WebhookDelivery1/Event.php | 15 -- .../Data/WebhookDelivery1/Status.php | 19 -- src/Monitors/MonitorListRunsResponse/Data.php | 16 +- .../Data/WebhookDelivery1.php | 196 ----------------- .../Data/WebhookDelivery1/Error.php | 74 ------- .../Data/WebhookDelivery1/Event.php | 15 -- .../Data/WebhookDelivery1/Status.php | 19 -- .../Data => }/WebhookDelivery.php | 32 ++- .../Data => }/WebhookDelivery/Error.php | 2 +- .../Data => }/WebhookDelivery/Event.php | 2 +- .../Data => }/WebhookDelivery/Status.php | 2 +- 19 files changed, 31 insertions(+), 959 deletions(-) delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Status.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php delete mode 100644 src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Status.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php delete mode 100644 src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Status.php rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery.php (79%) rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery/Error.php (95%) rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery/Event.php (77%) rename src/Monitors/{MonitorListRunsResponse/Data => }/WebhookDelivery/Status.php (84%) diff --git a/.stats.yml b/.stats.yml index 53999f48..0ac1eb3a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-ce19e3abfe1f07d4a615d2fb35666e99f7918b821dfc270b38bfd9c0de39fc4e.yml -openapi_spec_hash: 71623548f792037a7f13fb693b41e217 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-242450ea46eb8c3e843fd6c4bf87e73192b5f62f6da697cd091d13c6aa7a991b.yml +openapi_spec_hash: c1c561976de1abcacede71fd5ab9b3d9 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data.php b/src/Monitors/MonitorListAccountRunsResponse/Data.php index f87eef43..a73960d5 100644 --- a/src/Monitors/MonitorListAccountRunsResponse/Data.php +++ b/src/Monitors/MonitorListAccountRunsResponse/Data.php @@ -14,13 +14,11 @@ use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\SkipReason; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Status; use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\TargetType; -use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery; -use ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1; +use ContextDev\Monitors\WebhookDelivery; /** * @phpstan-import-type ErrorShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\Error - * @phpstan-import-type WebhookDelivery1Shape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1 - * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery + * @phpstan-import-type WebhookDeliveryShape from \ContextDev\Monitors\WebhookDelivery * * @phpstan-type DataShape = array{ * id: string, @@ -37,7 +35,7 @@ * error?: null|Error|ErrorShape, * skipReason?: null|SkipReason|value-of, * startedAt?: \DateTimeInterface|null, - * webhookDeliveries?: list|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -114,9 +112,9 @@ final class Data implements BaseModel /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @var list|null $webhookDeliveries + * @var list|null $webhookDeliveries */ - #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] + #[Optional('webhook_deliveries', list: WebhookDelivery::class)] public ?array $webhookDeliveries; /** @@ -176,7 +174,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason - * @param list|null $webhookDeliveries + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -366,7 +364,7 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @param list $webhookDeliveries + * @param list $webhookDeliveries */ public function withWebhookDeliveries(array $webhookDeliveries): self { diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php deleted file mode 100644 index 77fd214b..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery.php +++ /dev/null @@ -1,200 +0,0 @@ -, - * eventID: string, - * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery\Status>, - * } - */ -final class WebhookDelivery implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required('attempted_at')] - public \DateTimeInterface $attemptedAt; - - #[Required] - public ?Error $error; - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @var value-of $event - */ - #[Required(enum: Event::class)] - public string $event; - - /** - * Identifier sent in the X-Context-Id header. - */ - #[Required('event_id')] - public string $eventID; - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - #[Required('http_status')] - public ?int $httpStatus; - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @var value-of $status - */ - #[Required( - enum: Status::class, - )] - public string $status; - - /** - * `new WebhookDelivery()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * WebhookDelivery::with( - * attemptedAt: ..., - * error: ..., - * event: ..., - * eventID: ..., - * httpStatus: ..., - * status: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new WebhookDelivery) - * ->withAttemptedAt(...) - * ->withError(...) - * ->withEvent(...) - * ->withEventID(...) - * ->withHTTPStatus(...) - * ->withStatus(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Error|ErrorShape|null $error - * @param Event|value-of $event - * @param Status|value-of $status - */ - public static function with( - \DateTimeInterface $attemptedAt, - Error|array|null $error, - Event|string $event, - string $eventID, - ?int $httpStatus, - Status|string $status, - ): self { - $self = new self; - - $self['attemptedAt'] = $attemptedAt; - $self['error'] = $error; - $self['event'] = $event; - $self['eventID'] = $eventID; - $self['httpStatus'] = $httpStatus; - $self['status'] = $status; - - return $self; - } - - public function withAttemptedAt(\DateTimeInterface $attemptedAt): self - { - $self = clone $this; - $self['attemptedAt'] = $attemptedAt; - - return $self; - } - - /** - * @param Error|ErrorShape|null $error - */ - public function withError( - Error|array|null $error, - ): self { - $self = clone $this; - $self['error'] = $error; - - return $self; - } - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @param Event|value-of $event - */ - public function withEvent(Event|string $event): self - { - $self = clone $this; - $self['event'] = $event; - - return $self; - } - - /** - * Identifier sent in the X-Context-Id header. - */ - public function withEventID(string $eventID): self - { - $self = clone $this; - $self['eventID'] = $eventID; - - return $self; - } - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - public function withHTTPStatus(?int $httpStatus): self - { - $self = clone $this; - $self['httpStatus'] = $httpStatus; - - return $self; - } - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @param Status|value-of $status - */ - public function withStatus( - Status|string $status, - ): self { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php deleted file mode 100644 index 951e5b2c..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Error.php +++ /dev/null @@ -1,74 +0,0 @@ - */ - use SdkModel; - - #[Required] - public string $code; - - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php deleted file mode 100644 index dab594a2..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery/Event.php +++ /dev/null @@ -1,15 +0,0 @@ -, - * eventID: string, - * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListAccountRunsResponse\Data\WebhookDelivery1\Status>, - * } - */ -final class WebhookDelivery1 implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required('attempted_at')] - public \DateTimeInterface $attemptedAt; - - #[Required] - public ?Error $error; - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @var value-of $event - */ - #[Required(enum: Event::class)] - public string $event; - - /** - * Identifier sent in the X-Context-Id header. - */ - #[Required('event_id')] - public string $eventID; - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - #[Required('http_status')] - public ?int $httpStatus; - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @var value-of $status - */ - #[Required( - enum: Status::class, - )] - public string $status; - - /** - * `new WebhookDelivery1()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * WebhookDelivery1::with( - * attemptedAt: ..., - * error: ..., - * event: ..., - * eventID: ..., - * httpStatus: ..., - * status: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new WebhookDelivery1) - * ->withAttemptedAt(...) - * ->withError(...) - * ->withEvent(...) - * ->withEventID(...) - * ->withHTTPStatus(...) - * ->withStatus(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Error|ErrorShape|null $error - * @param Event|value-of $event - * @param Status|value-of $status - */ - public static function with( - \DateTimeInterface $attemptedAt, - Error|array|null $error, - Event|string $event, - string $eventID, - ?int $httpStatus, - Status|string $status, - ): self { - $self = new self; - - $self['attemptedAt'] = $attemptedAt; - $self['error'] = $error; - $self['event'] = $event; - $self['eventID'] = $eventID; - $self['httpStatus'] = $httpStatus; - $self['status'] = $status; - - return $self; - } - - public function withAttemptedAt(\DateTimeInterface $attemptedAt): self - { - $self = clone $this; - $self['attemptedAt'] = $attemptedAt; - - return $self; - } - - /** - * @param Error|ErrorShape|null $error - */ - public function withError( - Error|array|null $error, - ): self { - $self = clone $this; - $self['error'] = $error; - - return $self; - } - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @param Event|value-of $event - */ - public function withEvent(Event|string $event): self - { - $self = clone $this; - $self['event'] = $event; - - return $self; - } - - /** - * Identifier sent in the X-Context-Id header. - */ - public function withEventID(string $eventID): self - { - $self = clone $this; - $self['eventID'] = $eventID; - - return $self; - } - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - public function withHTTPStatus(?int $httpStatus): self - { - $self = clone $this; - $self['httpStatus'] = $httpStatus; - - return $self; - } - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @param Status|value-of $status - */ - public function withStatus( - Status|string $status, - ): self { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php deleted file mode 100644 index 96919d87..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Error.php +++ /dev/null @@ -1,74 +0,0 @@ - */ - use SdkModel; - - #[Required] - public string $code; - - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php deleted file mode 100644 index b7971845..00000000 --- a/src/Monitors/MonitorListAccountRunsResponse/Data/WebhookDelivery1/Event.php +++ /dev/null @@ -1,15 +0,0 @@ -, * startedAt?: \DateTimeInterface|null, - * webhookDeliveries?: list|null, + * webhookDeliveries?: list|null, * webhookDelivery?: null|WebhookDelivery|WebhookDeliveryShape, * } */ @@ -114,9 +112,9 @@ final class Data implements BaseModel /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @var list|null $webhookDeliveries + * @var list|null $webhookDeliveries */ - #[Optional('webhook_deliveries', list: WebhookDelivery1::class)] + #[Optional('webhook_deliveries', list: WebhookDelivery::class)] public ?array $webhookDeliveries; /** @@ -176,7 +174,7 @@ public function __construct() * @param TargetType|value-of $targetType * @param Error|ErrorShape|null $error * @param SkipReason|value-of|null $skipReason - * @param list|null $webhookDeliveries + * @param list|null $webhookDeliveries * @param WebhookDelivery|WebhookDeliveryShape|null $webhookDelivery */ public static function with( @@ -366,7 +364,7 @@ public function withStartedAt(?\DateTimeInterface $startedAt): self /** * All webhook deliveries attempted by this run — one per subscribed event that fired. Omitted when no webhook was attempted, including runs created before event selection was added. * - * @param list $webhookDeliveries + * @param list $webhookDeliveries */ public function withWebhookDeliveries(array $webhookDeliveries): self { diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php deleted file mode 100644 index 7c224ea8..00000000 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1.php +++ /dev/null @@ -1,196 +0,0 @@ -, - * eventID: string, - * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery1\Status>, - * } - */ -final class WebhookDelivery1 implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - #[Required('attempted_at')] - public \DateTimeInterface $attemptedAt; - - #[Required] - public ?Error $error; - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @var value-of $event - */ - #[Required(enum: Event::class)] - public string $event; - - /** - * Identifier sent in the X-Context-Id header. - */ - #[Required('event_id')] - public string $eventID; - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - #[Required('http_status')] - public ?int $httpStatus; - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @var value-of $status - */ - #[Required( - enum: Status::class, - )] - public string $status; - - /** - * `new WebhookDelivery1()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * WebhookDelivery1::with( - * attemptedAt: ..., - * error: ..., - * event: ..., - * eventID: ..., - * httpStatus: ..., - * status: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new WebhookDelivery1) - * ->withAttemptedAt(...) - * ->withError(...) - * ->withEvent(...) - * ->withEventID(...) - * ->withHTTPStatus(...) - * ->withStatus(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Error|ErrorShape|null $error - * @param Event|value-of $event - * @param Status|value-of $status - */ - public static function with( - \DateTimeInterface $attemptedAt, - Error|array|null $error, - Event|string $event, - string $eventID, - ?int $httpStatus, - Status|string $status, - ): self { - $self = new self; - - $self['attemptedAt'] = $attemptedAt; - $self['error'] = $error; - $self['event'] = $event; - $self['eventID'] = $eventID; - $self['httpStatus'] = $httpStatus; - $self['status'] = $status; - - return $self; - } - - public function withAttemptedAt(\DateTimeInterface $attemptedAt): self - { - $self = clone $this; - $self['attemptedAt'] = $attemptedAt; - - return $self; - } - - /** - * @param Error|ErrorShape|null $error - */ - public function withError( - Error|array|null $error, - ): self { - $self = clone $this; - $self['error'] = $error; - - return $self; - } - - /** - * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. - * - * @param Event|value-of $event - */ - public function withEvent(Event|string $event): self - { - $self = clone $this; - $self['event'] = $event; - - return $self; - } - - /** - * Identifier sent in the X-Context-Id header. - */ - public function withEventID(string $eventID): self - { - $self = clone $this; - $self['eventID'] = $eventID; - - return $self; - } - - /** - * The endpoint's final HTTP response status, or null when no response was received. - */ - public function withHTTPStatus(?int $httpStatus): self - { - $self = clone $this; - $self['httpStatus'] = $httpStatus; - - return $self; - } - - /** - * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. - * - * @param Status|value-of $status - */ - public function withStatus( - Status|string $status, - ): self { - $self = clone $this; - $self['status'] = $status; - - return $self; - } -} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php deleted file mode 100644 index 94b8d20a..00000000 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Error.php +++ /dev/null @@ -1,74 +0,0 @@ - */ - use SdkModel; - - #[Required] - public string $code; - - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php b/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php deleted file mode 100644 index fe9094a5..00000000 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery1/Event.php +++ /dev/null @@ -1,15 +0,0 @@ -, * eventID: string, * httpStatus: int|null, - * status: \ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status|value-of<\ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery\Status>, + * status: Status|value-of, * } */ final class WebhookDelivery implements BaseModel @@ -63,9 +59,7 @@ final class WebhookDelivery implements BaseModel * * @var value-of $status */ - #[Required( - enum: Status::class, - )] + #[Required(enum: Status::class)] public string $status; /** @@ -140,9 +134,8 @@ public function withAttemptedAt(\DateTimeInterface $attemptedAt): self /** * @param Error|ErrorShape|null $error */ - public function withError( - Error|array|null $error, - ): self { + public function withError(Error|array|null $error): self + { $self = clone $this; $self['error'] = $error; @@ -189,9 +182,8 @@ public function withHTTPStatus(?int $httpStatus): self * * @param Status|value-of $status */ - public function withStatus( - Status|string $status, - ): self { + public function withStatus(Status|string $status): self + { $self = clone $this; $self['status'] = $status; diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php b/src/Monitors/WebhookDelivery/Error.php similarity index 95% rename from src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php rename to src/Monitors/WebhookDelivery/Error.php index 16f73bed..41d7b9c5 100644 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Error.php +++ b/src/Monitors/WebhookDelivery/Error.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; +namespace ContextDev\Monitors\WebhookDelivery; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php b/src/Monitors/WebhookDelivery/Event.php similarity index 77% rename from src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php rename to src/Monitors/WebhookDelivery/Event.php index b387c981..cc3d58f7 100644 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Event.php +++ b/src/Monitors/WebhookDelivery/Event.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; +namespace ContextDev\Monitors\WebhookDelivery; /** * The event this delivery carried. Deliveries recorded before event selection existed report change.detected. diff --git a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php b/src/Monitors/WebhookDelivery/Status.php similarity index 84% rename from src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php rename to src/Monitors/WebhookDelivery/Status.php index af5edb34..bea34925 100644 --- a/src/Monitors/MonitorListRunsResponse/Data/WebhookDelivery/Status.php +++ b/src/Monitors/WebhookDelivery/Status.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Monitors\MonitorListRunsResponse\Data\WebhookDelivery; +namespace ContextDev\Monitors\WebhookDelivery; /** * Delivery outcome. delivered means any 2xx response; rejected means a non-2xx response; failed means no HTTP response was received; skipped_unsafe_url means the URL failed the public-endpoint safety check. From 20639bfc5bac7441d7f19ebc85629ed28e2dda34 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 22 Jul 2026 18:49:01 +0000 Subject: [PATCH 066/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index b44b2870..4dedeaeb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.4.0" + ".": "2.5.0" } \ No newline at end of file diff --git a/README.md b/README.md index 6ab8d0a0..ca69c9f3 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.4.0" +composer require "context-dev/context-dev-php 2.5.0" ``` diff --git a/src/Client.php b/src/Client.php index 24cf877e..1e9514d7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -95,7 +95,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.4.0', + 'X-Stainless-Package-Version' => '2.5.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 3d8b9009..1c11a974 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.4.0'; +const VERSION = '2.5.0'; // x-release-please-end From 38ae85b352f4ae8118a6a030d31a4e0036712bc8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 25 Jul 2026 07:12:48 +0000 Subject: [PATCH 067/130] feat(api): api update --- .stats.yml | 4 +- src/Monitors/MonitorCreateParams.php | 106 ++++++++++------------ src/Monitors/MonitorNewResponse.php | 24 ++++- src/ServiceContracts/MonitorsContract.php | 10 +- src/Services/MonitorsRawService.php | 6 +- src/Services/MonitorsService.php | 14 +-- tests/Services/MonitorsTest.php | 6 +- 7 files changed, 92 insertions(+), 78 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0ac1eb3a..6da46828 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-242450ea46eb8c3e843fd6c4bf87e73192b5f62f6da697cd091d13c6aa7a991b.yml -openapi_spec_hash: c1c561976de1abcacede71fd5ab9b3d9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2bf2b44f6593c44b2948683469bbb2b09cd8e90c97b12057fac6220cf0d2eee7.yml +openapi_spec_hash: ae8b5109ec997cac8d3e6ec96040f6c8 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/src/Monitors/MonitorCreateParams.php b/src/Monitors/MonitorCreateParams.php index 56eec6e4..6786369f 100644 --- a/src/Monitors/MonitorCreateParams.php +++ b/src/Monitors/MonitorCreateParams.php @@ -25,19 +25,19 @@ * * @see ContextDev\Services\MonitorsService::create() * - * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorCreateParams\Target + * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection + * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorCreateParams\Schedule - * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorCreateParams\Webhook * * @phpstan-type MonitorCreateParamsShape = array{ - * changeDetection: ChangeDetectionShape, * name: string, - * schedule: Schedule|ScheduleShape, * target: TargetShape, + * changeDetection?: ChangeDetectionShape|null, * mode?: null|Mode|value-of, + * schedule?: null|Schedule|ScheduleShape, * tags?: list|null, * webhook?: null|Webhook|WebhookShape, * } @@ -48,23 +48,9 @@ final class MonitorCreateParams implements BaseModel use SdkModel; use SdkParams; - /** - * Discriminated union describing how changes are detected. - * - * @var ChangeDetectionVariants $changeDetection - */ - #[Required('change_detection', union: ChangeDetection::class)] - public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection $changeDetection; - #[Required] public string $name; - /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. - */ - #[Required] - public Schedule $schedule; - /** * Discriminated union describing what the monitor watches. * @@ -73,6 +59,14 @@ final class MonitorCreateParams implements BaseModel #[Required(union: Target::class)] public MonitorsPageTarget|MonitorsSitemapTarget|MonitorsExtractTarget $target; + /** + * Discriminated union describing how changes are detected. + * + * @var ChangeDetectionVariants|null $changeDetection + */ + #[Optional('change_detection', union: ChangeDetection::class)] + public MonitorsExactChangeDetection|MonitorsSemanticChangeDetection|null $changeDetection; + /** * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. * @@ -81,6 +75,12 @@ final class MonitorCreateParams implements BaseModel #[Optional(enum: Mode::class)] public ?string $mode; + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + */ + #[Optional] + public ?Schedule $schedule; + /** * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * @@ -97,19 +97,13 @@ final class MonitorCreateParams implements BaseModel * * To enforce required parameters use * ``` - * MonitorCreateParams::with( - * changeDetection: ..., name: ..., schedule: ..., target: ... - * ) + * MonitorCreateParams::with(name: ..., target: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new MonitorCreateParams) - * ->withChangeDetection(...) - * ->withName(...) - * ->withSchedule(...) - * ->withTarget(...) + * (new MonitorCreateParams)->withName(...)->withTarget(...) * ``` */ public function __construct() @@ -122,50 +116,36 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param ChangeDetectionShape $changeDetection - * @param Schedule|ScheduleShape $schedule * @param TargetShape $target + * @param ChangeDetectionShape|null $changeDetection * @param Mode|value-of|null $mode + * @param Schedule|ScheduleShape|null $schedule * @param list|null $tags * @param Webhook|WebhookShape|null $webhook */ public static function with( - MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, string $name, - Schedule|array $schedule, MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, Mode|string|null $mode = null, + Schedule|array|null $schedule = null, ?array $tags = null, Webhook|array|null $webhook = null, ): self { $self = new self; - $self['changeDetection'] = $changeDetection; $self['name'] = $name; - $self['schedule'] = $schedule; $self['target'] = $target; + null !== $changeDetection && $self['changeDetection'] = $changeDetection; null !== $mode && $self['mode'] = $mode; + null !== $schedule && $self['schedule'] = $schedule; null !== $tags && $self['tags'] = $tags; null !== $webhook && $self['webhook'] = $webhook; return $self; } - /** - * Discriminated union describing how changes are detected. - * - * @param ChangeDetectionShape $changeDetection - */ - public function withChangeDetection( - MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, - ): self { - $self = clone $this; - $self['changeDetection'] = $changeDetection; - - return $self; - } - public function withName(string $name): self { $self = clone $this; @@ -175,28 +155,29 @@ public function withName(string $name): self } /** - * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * Discriminated union describing what the monitor watches. * - * @param Schedule|ScheduleShape $schedule + * @param TargetShape $target */ - public function withSchedule(Schedule|array $schedule): self - { + public function withTarget( + MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + ): self { $self = clone $this; - $self['schedule'] = $schedule; + $self['target'] = $target; return $self; } /** - * Discriminated union describing what the monitor watches. + * Discriminated union describing how changes are detected. * - * @param TargetShape $target + * @param ChangeDetectionShape $changeDetection */ - public function withTarget( - MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target + public function withChangeDetection( + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, ): self { $self = clone $this; - $self['target'] = $target; + $self['changeDetection'] = $changeDetection; return $self; } @@ -214,6 +195,19 @@ public function withMode(Mode|string $mode): self return $self; } + /** + * Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. + * + * @param Schedule|ScheduleShape $schedule + */ + public function withSchedule(Schedule|array $schedule): self + { + $self = clone $this; + $self['schedule'] = $schedule; + + return $self; + } + /** * User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * diff --git a/src/Monitors/MonitorNewResponse.php b/src/Monitors/MonitorNewResponse.php index d70d44ef..809d8225 100644 --- a/src/Monitors/MonitorNewResponse.php +++ b/src/Monitors/MonitorNewResponse.php @@ -26,7 +26,7 @@ use ContextDev\Monitors\MonitorNewResponse\WebhookFailure; /** - * A web monitor. `mode` is the constant `web`; behavior is described by `target` (page/sitemap/extract) and `change_detection` (exact/semantic). + * A newly created monitor plus `initial_run_id`, the id of the baseline run queued at creation. * * @phpstan-import-type ChangeDetectionVariants from \ContextDev\Monitors\MonitorNewResponse\ChangeDetection * @phpstan-import-type TargetVariants from \ContextDev\Monitors\MonitorNewResponse\Target @@ -43,6 +43,7 @@ * id: string, * changeDetection: ChangeDetectionShape, * createdAt: \DateTimeInterface, + * initialRunID: string|null, * mode: Mode|value-of, * name: string, * schedule: Schedule|ScheduleShape, @@ -78,6 +79,12 @@ final class MonitorNewResponse implements BaseModel #[Required('created_at')] public \DateTimeInterface $createdAt; + /** + * The baseline run queued by this create call, or null if it could not be queued immediately (in which case the baseline runs on the next scheduled tick). Poll GET /monitors/{monitor_id}/runs/{run_id}. + */ + #[Required('initial_run_id')] + public ?string $initialRunID; + /** * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. * @@ -166,6 +173,7 @@ final class MonitorNewResponse implements BaseModel * id: ..., * changeDetection: ..., * createdAt: ..., + * initialRunID: ..., * mode: ..., * name: ..., * schedule: ..., @@ -182,6 +190,7 @@ final class MonitorNewResponse implements BaseModel * ->withID(...) * ->withChangeDetection(...) * ->withCreatedAt(...) + * ->withInitialRunID(...) * ->withMode(...) * ->withName(...) * ->withSchedule(...) @@ -215,6 +224,7 @@ public static function with( string $id, MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, \DateTimeInterface $createdAt, + ?string $initialRunID, Mode|string $mode, string $name, Schedule|array $schedule, @@ -235,6 +245,7 @@ public static function with( $self['id'] = $id; $self['changeDetection'] = $changeDetection; $self['createdAt'] = $createdAt; + $self['initialRunID'] = $initialRunID; $self['mode'] = $mode; $self['name'] = $name; $self['schedule'] = $schedule; @@ -284,6 +295,17 @@ public function withCreatedAt(\DateTimeInterface $createdAt): self return $self; } + /** + * The baseline run queued by this create call, or null if it could not be queued immediately (in which case the baseline runs on the next scheduled tick). Poll GET /monitors/{monitor_id}/runs/{run_id}. + */ + public function withInitialRunID(?string $initialRunID): self + { + $self = clone $this; + $self['initialRunID'] = $initialRunID; + + return $self; + } + /** * Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. * diff --git a/src/ServiceContracts/MonitorsContract.php b/src/ServiceContracts/MonitorsContract.php index 6a3ae2e8..5f9c1fd9 100644 --- a/src/ServiceContracts/MonitorsContract.php +++ b/src/ServiceContracts/MonitorsContract.php @@ -34,9 +34,9 @@ use ContextDev\RequestOptions; /** + * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorCreateParams\Schedule - * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorCreateParams\Webhook * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorUpdateParams\ChangeDetection as ChangeDetectionShape1 * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorUpdateParams\Schedule as ScheduleShape1 @@ -49,10 +49,10 @@ interface MonitorsContract /** * @api * - * @param ChangeDetectionShape $changeDetection discriminated union describing how changes are detected - * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param TargetShape $target discriminated union describing what the monitor watches + * @param ChangeDetectionShape $changeDetection discriminated union describing how changes are detected * @param Mode|value-of $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param list $tags User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * @param Webhook|WebhookShape|null $webhook * @param RequestOpts|null $requestOptions @@ -60,11 +60,11 @@ interface MonitorsContract * @throws APIException */ public function create( - MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, string $name, - Schedule|array $schedule, MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, Mode|string|null $mode = null, + Schedule|array|null $schedule = null, ?array $tags = null, Webhook|array|null $webhook = null, RequestOptions|array|null $requestOptions = null, diff --git a/src/Services/MonitorsRawService.php b/src/Services/MonitorsRawService.php index 365560fe..ae9e8ed9 100644 --- a/src/Services/MonitorsRawService.php +++ b/src/Services/MonitorsRawService.php @@ -43,9 +43,9 @@ /** * Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas. * + * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorCreateParams\Schedule - * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorCreateParams\Webhook * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorUpdateParams\ChangeDetection as ChangeDetectionShape1 * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorUpdateParams\Schedule as ScheduleShape1 @@ -67,11 +67,11 @@ public function __construct(private Client $client) {} * Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline. * * @param array{ - * changeDetection: ChangeDetectionShape, * name: string, - * schedule: Schedule|ScheduleShape, * target: TargetShape, + * changeDetection?: ChangeDetectionShape, * mode?: Mode|value-of, + * schedule?: Schedule|ScheduleShape, * tags?: list, * webhook?: Webhook|WebhookShape|null, * }|MonitorCreateParams $params diff --git a/src/Services/MonitorsService.php b/src/Services/MonitorsService.php index 0ed99c16..e8c89261 100644 --- a/src/Services/MonitorsService.php +++ b/src/Services/MonitorsService.php @@ -39,9 +39,9 @@ /** * Monitor pages, sitemaps, and extracted website data for exact or semantic changes. Webhook payloads are documented by the MonitorsChangeDetectedWebhookPayload and MonitorsRunCompletedWebhookPayload schemas. * + * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorCreateParams\ChangeDetection * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorCreateParams\Schedule - * @phpstan-import-type TargetShape from \ContextDev\Monitors\MonitorCreateParams\Target * @phpstan-import-type WebhookShape from \ContextDev\Monitors\MonitorCreateParams\Webhook * @phpstan-import-type ChangeDetectionShape from \ContextDev\Monitors\MonitorUpdateParams\ChangeDetection as ChangeDetectionShape1 * @phpstan-import-type ScheduleShape from \ContextDev\Monitors\MonitorUpdateParams\Schedule as ScheduleShape1 @@ -69,10 +69,10 @@ public function __construct(private Client $client) * * Creates a monitor. The request body is a union of the supported target/change detection combinations. The monitor runs immediately after creation to create its initial baseline. * - * @param ChangeDetectionShape $changeDetection discriminated union describing how changes are detected - * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param TargetShape $target discriminated union describing what the monitor watches + * @param ChangeDetectionShape $changeDetection discriminated union describing how changes are detected * @param Mode|value-of $mode Top-level monitor category. Always `web` today; the concrete behavior is described by `target` and `change_detection`. + * @param Schedule|ScheduleShape $schedule Run the monitor on a fixed interval defined by a frequency and a unit, e.g. every 6 hours or every 2 days. The total interval (frequency × unit) must be between 10 minutes and 1 year. * @param list $tags User-defined tags for grouping and filtering monitors and their changes. Duplicates are removed. * @param Webhook|WebhookShape|null $webhook * @param RequestOpts|null $requestOptions @@ -80,22 +80,22 @@ public function __construct(private Client $client) * @throws APIException */ public function create( - MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection $changeDetection, string $name, - Schedule|array $schedule, MonitorsPageTarget|array|MonitorsSitemapTarget|MonitorsExtractTarget $target, + MonitorsExactChangeDetection|array|MonitorsSemanticChangeDetection|null $changeDetection = null, Mode|string|null $mode = null, + Schedule|array|null $schedule = null, ?array $tags = null, Webhook|array|null $webhook = null, RequestOptions|array|null $requestOptions = null, ): MonitorNewResponse { $params = Util::removeNulls( [ - 'changeDetection' => $changeDetection, 'name' => $name, - 'schedule' => $schedule, 'target' => $target, + 'changeDetection' => $changeDetection, 'mode' => $mode, + 'schedule' => $schedule, 'tags' => $tags, 'webhook' => $webhook, ], diff --git a/tests/Services/MonitorsTest.php b/tests/Services/MonitorsTest.php index d60e90d0..f9bef0f2 100644 --- a/tests/Services/MonitorsTest.php +++ b/tests/Services/MonitorsTest.php @@ -48,9 +48,7 @@ public function testCreate(): void } $result = $this->client->monitors->create( - changeDetection: ['type' => 'exact'], name: 'Acme pricing page', - schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], target: ['type' => 'page', 'url' => 'https://acme.com/pricing'], ); @@ -66,15 +64,15 @@ public function testCreateWithOptionalParams(): void } $result = $this->client->monitors->create( - changeDetection: ['type' => 'exact'], name: 'Acme pricing page', - schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], target: [ 'type' => 'page', 'url' => 'https://acme.com/pricing', 'normalizeWhitespace' => true, ], + changeDetection: ['type' => 'exact'], mode: 'web', + schedule: ['frequency' => 6, 'type' => 'interval', 'unit' => 'hours'], tags: ['pricing', 'competitor'], webhook: [ 'url' => 'https://example.com/webhook', From 8671bd4784fd46db9dbd368e2131eafe817d0954 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 27 Jul 2026 06:43:20 +0000 Subject: [PATCH 068/130] feat(api): api update --- .stats.yml | 4 +-- .../MonitorsSemanticChangeDetection.php | 2 +- .../Target/MonitorsPageTarget.php | 26 +++++++++++++++++-- .../MonitorsSemanticChangeDetection.php | 2 +- .../Target/MonitorsPageTarget.php | 26 +++++++++++++++++-- .../MonitorsSemanticChangeDetection.php | 2 +- .../Data/Target/MonitorsPageTarget.php | 26 +++++++++++++++++-- .../MonitorsSemanticChangeDetection.php | 2 +- .../Target/MonitorsPageTarget.php | 26 +++++++++++++++++-- .../MonitorsSemanticChangeDetection.php | 2 +- .../Target/MonitorsPageTarget.php | 26 +++++++++++++++++-- .../MonitorsSemanticChangeDetection.php | 2 +- .../Target/MonitorsPageTarget.php | 26 +++++++++++++++++-- tests/Services/MonitorsTest.php | 1 + 14 files changed, 153 insertions(+), 20 deletions(-) diff --git a/.stats.yml b/.stats.yml index 6da46828..3f4cd2e0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2bf2b44f6593c44b2948683469bbb2b09cd8e90c97b12057fac6220cf0d2eee7.yml -openapi_spec_hash: ae8b5109ec997cac8d3e6ec96040f6c8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-91f4286859fc23813c5255b877395c87dd81520c3913fdfdae3cfa343e1a4873.yml +openapi_spec_hash: 71746b5b65f20617ee021e071d5f7f92 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 diff --git a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php index 2f32c230..a986e3ef 100644 --- a/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorCreateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + * Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php b/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php index c5908acc..bc4b982b 100644 --- a/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php +++ b/src/Monitors/MonitorCreateParams/Target/MonitorsPageTarget.php @@ -10,10 +10,13 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a single web page. + * Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. * * @phpstan-type MonitorsPageTargetShape = array{ - * type: 'page', url: string, normalizeWhitespace?: bool|null + * type: 'page', + * url: string, + * instructions?: string|null, + * normalizeWhitespace?: bool|null, * } */ final class MonitorsPageTarget implements BaseModel @@ -28,6 +31,12 @@ final class MonitorsPageTarget implements BaseModel #[Required] public string $url; + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + #[Optional] + public ?string $instructions; + /** * Normalize whitespace before comparing or analyzing text. */ @@ -60,12 +69,14 @@ public function __construct() */ public static function with( string $url, + ?string $instructions = null, ?bool $normalizeWhitespace = null ): self { $self = new self; $self['url'] = $url; + null !== $instructions && $self['instructions'] = $instructions; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; return $self; @@ -90,6 +101,17 @@ public function withURL(string $url): self return $self; } + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * Normalize whitespace before comparing or analyzing text. */ diff --git a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index 1fe50cb2..45361f58 100644 --- a/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorGetResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + * Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php b/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php index 0689dc39..52520393 100644 --- a/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php +++ b/src/Monitors/MonitorGetResponse/Target/MonitorsPageTarget.php @@ -10,10 +10,13 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a single web page. + * Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. * * @phpstan-type MonitorsPageTargetShape = array{ - * type: 'page', url: string, normalizeWhitespace?: bool|null + * type: 'page', + * url: string, + * instructions?: string|null, + * normalizeWhitespace?: bool|null, * } */ final class MonitorsPageTarget implements BaseModel @@ -28,6 +31,12 @@ final class MonitorsPageTarget implements BaseModel #[Required] public string $url; + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + #[Optional] + public ?string $instructions; + /** * Normalize whitespace before comparing or analyzing text. */ @@ -60,12 +69,14 @@ public function __construct() */ public static function with( string $url, + ?string $instructions = null, ?bool $normalizeWhitespace = null ): self { $self = new self; $self['url'] = $url; + null !== $instructions && $self['instructions'] = $instructions; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; return $self; @@ -90,6 +101,17 @@ public function withURL(string $url): self return $self; } + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * Normalize whitespace before comparing or analyzing text. */ diff --git a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php index bf1868d6..711853a2 100644 --- a/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorListResponse/Data/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + * Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php b/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php index bff04894..b0591426 100644 --- a/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php +++ b/src/Monitors/MonitorListResponse/Data/Target/MonitorsPageTarget.php @@ -10,10 +10,13 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a single web page. + * Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. * * @phpstan-type MonitorsPageTargetShape = array{ - * type: 'page', url: string, normalizeWhitespace?: bool|null + * type: 'page', + * url: string, + * instructions?: string|null, + * normalizeWhitespace?: bool|null, * } */ final class MonitorsPageTarget implements BaseModel @@ -28,6 +31,12 @@ final class MonitorsPageTarget implements BaseModel #[Required] public string $url; + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + #[Optional] + public ?string $instructions; + /** * Normalize whitespace before comparing or analyzing text. */ @@ -60,12 +69,14 @@ public function __construct() */ public static function with( string $url, + ?string $instructions = null, ?bool $normalizeWhitespace = null ): self { $self = new self; $self['url'] = $url; + null !== $instructions && $self['instructions'] = $instructions; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; return $self; @@ -90,6 +101,17 @@ public function withURL(string $url): self return $self; } + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * Normalize whitespace before comparing or analyzing text. */ diff --git a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index 9ca859f0..010fea76 100644 --- a/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorNewResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + * Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php b/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php index cb684a97..56c8a616 100644 --- a/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php +++ b/src/Monitors/MonitorNewResponse/Target/MonitorsPageTarget.php @@ -10,10 +10,13 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a single web page. + * Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. * * @phpstan-type MonitorsPageTargetShape = array{ - * type: 'page', url: string, normalizeWhitespace?: bool|null + * type: 'page', + * url: string, + * instructions?: string|null, + * normalizeWhitespace?: bool|null, * } */ final class MonitorsPageTarget implements BaseModel @@ -28,6 +31,12 @@ final class MonitorsPageTarget implements BaseModel #[Required] public string $url; + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + #[Optional] + public ?string $instructions; + /** * Normalize whitespace before comparing or analyzing text. */ @@ -60,12 +69,14 @@ public function __construct() */ public static function with( string $url, + ?string $instructions = null, ?bool $normalizeWhitespace = null ): self { $self = new self; $self['url'] = $url; + null !== $instructions && $self['instructions'] = $instructions; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; return $self; @@ -90,6 +101,17 @@ public function withURL(string $url): self return $self; } + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * Normalize whitespace before comparing or analyzing text. */ diff --git a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php index b25c4520..8b759788 100644 --- a/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorUpdateParams/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + * Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php index 6e4bf1e4..a86aa197 100644 --- a/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php +++ b/src/Monitors/MonitorUpdateParams/Target/MonitorsPageTarget.php @@ -10,10 +10,13 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a single web page. + * Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. * * @phpstan-type MonitorsPageTargetShape = array{ - * type: 'page', url: string, normalizeWhitespace?: bool|null + * type: 'page', + * url: string, + * instructions?: string|null, + * normalizeWhitespace?: bool|null, * } */ final class MonitorsPageTarget implements BaseModel @@ -28,6 +31,12 @@ final class MonitorsPageTarget implements BaseModel #[Required] public string $url; + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + #[Optional] + public ?string $instructions; + /** * Normalize whitespace before comparing or analyzing text. */ @@ -60,12 +69,14 @@ public function __construct() */ public static function with( string $url, + ?string $instructions = null, ?bool $normalizeWhitespace = null ): self { $self = new self; $self['url'] = $url; + null !== $instructions && $self['instructions'] = $instructions; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; return $self; @@ -90,6 +101,17 @@ public function withURL(string $url): self return $self; } + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * Normalize whitespace before comparing or analyzing text. */ diff --git a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php index c1ccfc6c..9c22a5ea 100644 --- a/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php +++ b/src/Monitors/MonitorUpdateResponse/ChangeDetection/MonitorsSemanticChangeDetection.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Detect meaning-level changes to tracked page content, ignoring cosmetic or paraphrase-only differences. Which changes are meaningful is judged against the extract target's `instructions` (and `schema`, when provided). + * Detect meaning-level changes to page content, ignoring cosmetic or instruction-irrelevant differences. Which changes are meaningful is judged against the page or extract target's `instructions` (and an extract target's `schema`, when provided). * * @phpstan-type MonitorsSemanticChangeDetectionShape = array{ * type: 'semantic', confidenceThreshold?: float|null diff --git a/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php b/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php index 80d0b6b4..3fd14677 100644 --- a/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php +++ b/src/Monitors/MonitorUpdateResponse/Target/MonitorsPageTarget.php @@ -10,10 +10,13 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Watch a single web page. + * Watch a single web page. Exact detection reports visible-text diffs; semantic detection judges confirmed stable diffs against `instructions`. * * @phpstan-type MonitorsPageTargetShape = array{ - * type: 'page', url: string, normalizeWhitespace?: bool|null + * type: 'page', + * url: string, + * instructions?: string|null, + * normalizeWhitespace?: bool|null, * } */ final class MonitorsPageTarget implements BaseModel @@ -28,6 +31,12 @@ final class MonitorsPageTarget implements BaseModel #[Required] public string $url; + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + #[Optional] + public ?string $instructions; + /** * Normalize whitespace before comparing or analyzing text. */ @@ -60,12 +69,14 @@ public function __construct() */ public static function with( string $url, + ?string $instructions = null, ?bool $normalizeWhitespace = null ): self { $self = new self; $self['url'] = $url; + null !== $instructions && $self['instructions'] = $instructions; null !== $normalizeWhitespace && $self['normalizeWhitespace'] = $normalizeWhitespace; return $self; @@ -90,6 +101,17 @@ public function withURL(string $url): self return $self; } + /** + * Plain-language goal describing which page changes matter. When provided without change_detection, semantic detection is inferred. + */ + public function withInstructions(string $instructions): self + { + $self = clone $this; + $self['instructions'] = $instructions; + + return $self; + } + /** * Normalize whitespace before comparing or analyzing text. */ diff --git a/tests/Services/MonitorsTest.php b/tests/Services/MonitorsTest.php index f9bef0f2..957feecd 100644 --- a/tests/Services/MonitorsTest.php +++ b/tests/Services/MonitorsTest.php @@ -68,6 +68,7 @@ public function testCreateWithOptionalParams(): void target: [ 'type' => 'page', 'url' => 'https://acme.com/pricing', + 'instructions' => 'Report pricing or plan availability changes. Ignore counters, timestamps, testimonials, and navigation.', 'normalizeWhitespace' => true, ], changeDetection: ['type' => 'exact'], From 5db23c7e95772af35fc7c8417c8e2f025eeb6e54 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:18:54 +0000 Subject: [PATCH 069/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3f4cd2e0..6183d03e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-91f4286859fc23813c5255b877395c87dd81520c3913fdfdae3cfa343e1a4873.yml -openapi_spec_hash: 71746b5b65f20617ee021e071d5f7f92 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9ee1d9a454772b4cd978d5e0ad8ead21d732fa559686130daf0540084b5f6be5.yml +openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 config_hash: 70e7e80b5e87f94981bee396c6cd41e8 From 6ec8c38ff2dac77b8ba73fdb34ce33b8c4e8bcd1 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 07:57:36 +0000 Subject: [PATCH 070/130] feat(api): manual updates --- .stats.yml | 6 +- src/Batch/BatchCancelParams.php | 66 +++ src/Batch/BatchCancelResponse.php | 373 ++++++++++++++ src/Batch/BatchCancelResponse/Credits.php | 88 ++++ src/Batch/BatchCancelResponse/Error.php | 88 ++++ src/Batch/BatchCancelResponse/Error1.php | 86 ++++ src/Batch/BatchCancelResponse/Input.php | 134 +++++ src/Batch/BatchCancelResponse/KeyMetadata.php | 92 ++++ src/Batch/BatchCancelResponse/Mode.php | 15 + src/Batch/BatchCancelResponse/Progress.php | 106 ++++ src/Batch/BatchCancelResponse/Results.php | 99 ++++ .../BatchCancelResponse/Results/File.php | 104 ++++ src/Batch/BatchCancelResponse/Status.php | 23 + src/Batch/BatchCancelResponse/Timing.php | 109 ++++ src/Batch/BatchCancelResponse/Type.php | 15 + src/Batch/BatchGetResponse.php | 422 +++++++++++++++ src/Batch/BatchGetResponse/Credits.php | 88 ++++ src/Batch/BatchGetResponse/Error.php | 88 ++++ src/Batch/BatchGetResponse/Error1.php | 86 ++++ src/Batch/BatchGetResponse/Input.php | 134 +++++ src/Batch/BatchGetResponse/InvalidURL.php | 86 ++++ src/Batch/BatchGetResponse/KeyMetadata.php | 92 ++++ src/Batch/BatchGetResponse/Mode.php | 15 + src/Batch/BatchGetResponse/Progress.php | 106 ++++ src/Batch/BatchGetResponse/Results.php | 99 ++++ src/Batch/BatchGetResponse/Results/File.php | 104 ++++ src/Batch/BatchGetResponse/Status.php | 23 + src/Batch/BatchGetResponse/Timing.php | 109 ++++ src/Batch/BatchGetResponse/Type.php | 15 + src/Batch/BatchGetResultsParams.php | 107 ++++ src/Batch/BatchGetResultsResponse.php | 132 +++++ src/Batch/BatchGetResultsResponse/Data.php | 38 ++ .../Data/FailedPage.php | 183 +++++++ .../Data/ScrapedPage.php | 253 +++++++++ .../Data/ScrapedPage/Metadata.php | 479 ++++++++++++++++++ .../ScrapedPage/Metadata/AdditionalMeta.php | 27 + .../Data/ScrapedPage/Metadata/Alternate.php | 130 +++++ .../Data/ScrapedPage/Metadata/OpenGraph.php | 27 + .../Data/ScrapedPage/Metadata/Twitter.php | 27 + .../BatchGetResultsResponse/KeyMetadata.php | 92 ++++ src/Batch/BatchListParams.php | 135 +++++ src/Batch/BatchListParams/Status.php | 23 + src/Batch/BatchListResponse.php | 131 +++++ src/Batch/BatchListResponse/Data.php | 348 +++++++++++++ src/Batch/BatchListResponse/Data/Credits.php | 88 ++++ src/Batch/BatchListResponse/Data/Error.php | 88 ++++ src/Batch/BatchListResponse/Data/Error1.php | 86 ++++ src/Batch/BatchListResponse/Data/Input.php | 134 +++++ src/Batch/BatchListResponse/Data/Mode.php | 15 + src/Batch/BatchListResponse/Data/Progress.php | 106 ++++ src/Batch/BatchListResponse/Data/Results.php | 99 ++++ .../BatchListResponse/Data/Results/File.php | 104 ++++ src/Batch/BatchListResponse/Data/Status.php | 23 + src/Batch/BatchListResponse/Data/Timing.php | 109 ++++ src/Batch/BatchListResponse/Data/Type.php | 15 + src/Batch/BatchListResponse/KeyMetadata.php | 92 ++++ src/Batch/BatchRetrieveParams.php | 66 +++ src/Batch/BatchSubmitParams.php | 131 +++++ src/Batch/BatchSubmitParams/Identifiers.php | 56 ++ src/Batch/BatchSubmitResponse.php | 186 +++++++ src/Batch/BatchSubmitResponse/Code.php | 13 + src/Batch/BatchSubmitResponse/KeyMetadata.php | 92 ++++ src/Batch/BatchSubmitResponse/Metadata.php | 188 +++++++ .../Metadata/Identifiers.php | 56 ++ .../Metadata/SourcesAttempted.php | 18 + .../Metadata/SourcesSucceeded.php | 18 + src/Batch/BatchSubmitResponse/Person.php | 165 ++++++ .../BatchSubmitResponse/Person/Education.php | 165 ++++++ .../Person/Education/Dates.php | 111 ++++ .../Person/Education/Dates/EndDate.php | 111 ++++ .../Person/Education/Dates/StartDate.php | 113 +++++ .../Person/Education/Institution.php | 94 ++++ .../BatchSubmitResponse/Person/Experience.php | 145 ++++++ .../Person/Experience/Company.php | 92 ++++ .../Person/Experience/Dates.php | 111 ++++ .../Person/Experience/Dates/EndDate.php | 111 ++++ .../Person/Experience/Dates/StartDate.php | 113 +++++ .../BatchSubmitResponse/Person/Profile.php | 139 +++++ .../BatchSubmitResponse/Person/Skill.php | 111 ++++ src/Batch/BatchSubmitResponse/Status.php | 13 + src/Client.php | 7 + src/ServiceContracts/BatchContract.php | 107 ++++ src/ServiceContracts/BatchRawContract.php | 106 ++++ src/Services/BatchRawService.php | 208 ++++++++ src/Services/BatchService.php | 183 +++++++ tests/Services/BatchTest.php | 118 +++++ 86 files changed, 9106 insertions(+), 3 deletions(-) create mode 100644 src/Batch/BatchCancelParams.php create mode 100644 src/Batch/BatchCancelResponse.php create mode 100644 src/Batch/BatchCancelResponse/Credits.php create mode 100644 src/Batch/BatchCancelResponse/Error.php create mode 100644 src/Batch/BatchCancelResponse/Error1.php create mode 100644 src/Batch/BatchCancelResponse/Input.php create mode 100644 src/Batch/BatchCancelResponse/KeyMetadata.php create mode 100644 src/Batch/BatchCancelResponse/Mode.php create mode 100644 src/Batch/BatchCancelResponse/Progress.php create mode 100644 src/Batch/BatchCancelResponse/Results.php create mode 100644 src/Batch/BatchCancelResponse/Results/File.php create mode 100644 src/Batch/BatchCancelResponse/Status.php create mode 100644 src/Batch/BatchCancelResponse/Timing.php create mode 100644 src/Batch/BatchCancelResponse/Type.php create mode 100644 src/Batch/BatchGetResponse.php create mode 100644 src/Batch/BatchGetResponse/Credits.php create mode 100644 src/Batch/BatchGetResponse/Error.php create mode 100644 src/Batch/BatchGetResponse/Error1.php create mode 100644 src/Batch/BatchGetResponse/Input.php create mode 100644 src/Batch/BatchGetResponse/InvalidURL.php create mode 100644 src/Batch/BatchGetResponse/KeyMetadata.php create mode 100644 src/Batch/BatchGetResponse/Mode.php create mode 100644 src/Batch/BatchGetResponse/Progress.php create mode 100644 src/Batch/BatchGetResponse/Results.php create mode 100644 src/Batch/BatchGetResponse/Results/File.php create mode 100644 src/Batch/BatchGetResponse/Status.php create mode 100644 src/Batch/BatchGetResponse/Timing.php create mode 100644 src/Batch/BatchGetResponse/Type.php create mode 100644 src/Batch/BatchGetResultsParams.php create mode 100644 src/Batch/BatchGetResultsResponse.php create mode 100644 src/Batch/BatchGetResultsResponse/Data.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/FailedPage.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/AdditionalMeta.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Alternate.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/OpenGraph.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Twitter.php create mode 100644 src/Batch/BatchGetResultsResponse/KeyMetadata.php create mode 100644 src/Batch/BatchListParams.php create mode 100644 src/Batch/BatchListParams/Status.php create mode 100644 src/Batch/BatchListResponse.php create mode 100644 src/Batch/BatchListResponse/Data.php create mode 100644 src/Batch/BatchListResponse/Data/Credits.php create mode 100644 src/Batch/BatchListResponse/Data/Error.php create mode 100644 src/Batch/BatchListResponse/Data/Error1.php create mode 100644 src/Batch/BatchListResponse/Data/Input.php create mode 100644 src/Batch/BatchListResponse/Data/Mode.php create mode 100644 src/Batch/BatchListResponse/Data/Progress.php create mode 100644 src/Batch/BatchListResponse/Data/Results.php create mode 100644 src/Batch/BatchListResponse/Data/Results/File.php create mode 100644 src/Batch/BatchListResponse/Data/Status.php create mode 100644 src/Batch/BatchListResponse/Data/Timing.php create mode 100644 src/Batch/BatchListResponse/Data/Type.php create mode 100644 src/Batch/BatchListResponse/KeyMetadata.php create mode 100644 src/Batch/BatchRetrieveParams.php create mode 100644 src/Batch/BatchSubmitParams.php create mode 100644 src/Batch/BatchSubmitParams/Identifiers.php create mode 100644 src/Batch/BatchSubmitResponse.php create mode 100644 src/Batch/BatchSubmitResponse/Code.php create mode 100644 src/Batch/BatchSubmitResponse/KeyMetadata.php create mode 100644 src/Batch/BatchSubmitResponse/Metadata.php create mode 100644 src/Batch/BatchSubmitResponse/Metadata/Identifiers.php create mode 100644 src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php create mode 100644 src/Batch/BatchSubmitResponse/Metadata/SourcesSucceeded.php create mode 100644 src/Batch/BatchSubmitResponse/Person.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Education.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Education/Dates.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Education/Dates/EndDate.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Education/Dates/StartDate.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Education/Institution.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Experience.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Experience/Company.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Experience/Dates.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Experience/Dates/EndDate.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Experience/Dates/StartDate.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Profile.php create mode 100644 src/Batch/BatchSubmitResponse/Person/Skill.php create mode 100644 src/Batch/BatchSubmitResponse/Status.php create mode 100644 src/ServiceContracts/BatchContract.php create mode 100644 src/ServiceContracts/BatchRawContract.php create mode 100644 src/Services/BatchRawService.php create mode 100644 src/Services/BatchService.php create mode 100644 tests/Services/BatchTest.php diff --git a/.stats.yml b/.stats.yml index 6183d03e..a173ebea 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 32 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-9ee1d9a454772b4cd978d5e0ad8ead21d732fa559686130daf0540084b5f6be5.yml +configured_endpoints: 37 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6dfc33639ef5ad1fd0fa05f9f00fcdd59940188ef625252c6ee9db85c6f8fc59.yml openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 -config_hash: 70e7e80b5e87f94981bee396c6cd41e8 +config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchCancelParams.php b/src/Batch/BatchCancelParams.php new file mode 100644 index 00000000..e84b867a --- /dev/null +++ b/src/Batch/BatchCancelParams.php @@ -0,0 +1,66 @@ +|null} + */ +final class BatchCancelParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags + */ + public static function with(?array $tags = null): self + { + $self = new self; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse.php b/src/Batch/BatchCancelResponse.php new file mode 100644 index 00000000..ef75113d --- /dev/null +++ b/src/Batch/BatchCancelResponse.php @@ -0,0 +1,373 @@ +, + * input: Input|InputShape, + * mode: Mode|value-of, + * progress: Progress|ProgressShape, + * results: null|Results|ResultsShape, + * status: Status|value-of, + * timing: Timing|TimingShape, + * type: Type|value-of, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class BatchCancelResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Batch ID used to retrieve or cancel the job. + */ + #[Required] + public string $id; + + /** + * Reserved and used credits. + */ + #[Required] + public Credits $credits; + + /** + * Batch-level error. Null unless `status` is `failed`. + */ + #[Required] + public ?Error $error; + + /** + * Page failures grouped by error code. + * + * @var list $errors + */ + #[Required(list: Error1::class)] + public array $errors; + + /** + * Submission counts. + */ + #[Required] + public Input $input; + + /** + * How pages are selected. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + /** + * Current processing counts. Use `status` to check completion. + */ + #[Required] + public Progress $progress; + + /** + * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + */ + #[Required] + public ?Results $results; + + /** + * Current state. `completed`, `cancelled`, and `failed` are final. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Timing $timing; + + /** + * Output format. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * API key usage for this request. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new BatchCancelResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BatchCancelResponse::with( + * id: ..., + * credits: ..., + * error: ..., + * errors: ..., + * input: ..., + * mode: ..., + * progress: ..., + * results: ..., + * status: ..., + * timing: ..., + * type: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BatchCancelResponse) + * ->withID(...) + * ->withCredits(...) + * ->withError(...) + * ->withErrors(...) + * ->withInput(...) + * ->withMode(...) + * ->withProgress(...) + * ->withResults(...) + * ->withStatus(...) + * ->withTiming(...) + * ->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Credits|CreditsShape $credits + * @param Error|ErrorShape|null $error + * @param list $errors + * @param Input|InputShape $input + * @param Mode|value-of $mode + * @param Progress|ProgressShape $progress + * @param Results|ResultsShape|null $results + * @param Status|value-of $status + * @param Timing|TimingShape $timing + * @param Type|value-of $type + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + string $id, + Credits|array $credits, + Error|array|null $error, + array $errors, + Input|array $input, + Mode|string $mode, + Progress|array $progress, + Results|array|null $results, + Status|string $status, + Timing|array $timing, + Type|string $type, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['credits'] = $credits; + $self['error'] = $error; + $self['errors'] = $errors; + $self['input'] = $input; + $self['mode'] = $mode; + $self['progress'] = $progress; + $self['results'] = $results; + $self['status'] = $status; + $self['timing'] = $timing; + $self['type'] = $type; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Batch ID used to retrieve or cancel the job. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Reserved and used credits. + * + * @param Credits|CreditsShape $credits + */ + public function withCredits(Credits|array $credits): self + { + $self = clone $this; + $self['credits'] = $credits; + + return $self; + } + + /** + * Batch-level error. Null unless `status` is `failed`. + * + * @param Error|ErrorShape|null $error + */ + public function withError(Error|array|null $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * Page failures grouped by error code. + * + * @param list $errors + */ + public function withErrors(array $errors): self + { + $self = clone $this; + $self['errors'] = $errors; + + return $self; + } + + /** + * Submission counts. + * + * @param Input|InputShape $input + */ + public function withInput(Input|array $input): self + { + $self = clone $this; + $self['input'] = $input; + + return $self; + } + + /** + * How pages are selected. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Current processing counts. Use `status` to check completion. + * + * @param Progress|ProgressShape $progress + */ + public function withProgress(Progress|array $progress): self + { + $self = clone $this; + $self['progress'] = $progress; + + return $self; + } + + /** + * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * + * @param Results|ResultsShape|null $results + */ + public function withResults(Results|array|null $results): self + { + $self = clone $this; + $self['results'] = $results; + + return $self; + } + + /** + * Current state. `completed`, `cancelled`, and `failed` are final. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Timing|TimingShape $timing + */ + public function withTiming(Timing|array $timing): self + { + $self = clone $this; + $self['timing'] = $timing; + + return $self; + } + + /** + * Output format. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * API key usage for this request. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Credits.php b/src/Batch/BatchCancelResponse/Credits.php new file mode 100644 index 00000000..6484e733 --- /dev/null +++ b/src/Batch/BatchCancelResponse/Credits.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Credits used by successful pages. + */ + #[Required] + public int $charged; + + /** + * Credits reserved when the batch was accepted. + */ + #[Required] + public int $estimated; + + /** + * `new Credits()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Credits::with(charged: ..., estimated: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Credits)->withCharged(...)->withEstimated(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $charged, int $estimated): self + { + $self = new self; + + $self['charged'] = $charged; + $self['estimated'] = $estimated; + + return $self; + } + + /** + * Credits used by successful pages. + */ + public function withCharged(int $charged): self + { + $self = clone $this; + $self['charged'] = $charged; + + return $self; + } + + /** + * Credits reserved when the batch was accepted. + */ + public function withEstimated(int $estimated): self + { + $self = clone $this; + $self['estimated'] = $estimated; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Error.php b/src/Batch/BatchCancelResponse/Error.php new file mode 100644 index 00000000..bb27e9e7 --- /dev/null +++ b/src/Batch/BatchCancelResponse/Error.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Batch error code. + */ + #[Required] + public string $code; + + /** + * Batch error message. + */ + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + /** + * Batch error code. + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Batch error message. + */ + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Error1.php b/src/Batch/BatchCancelResponse/Error1.php new file mode 100644 index 00000000..f447cf7c --- /dev/null +++ b/src/Batch/BatchCancelResponse/Error1.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Error code for these failures. + */ + #[Required] + public string $code; + + /** + * Pages that failed with this code. + */ + #[Required] + public int $count; + + /** + * `new Error1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error1::with(code: ..., count: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error1)->withCode(...)->withCount(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, int $count): self + { + $self = new self; + + $self['code'] = $code; + $self['count'] = $count; + + return $self; + } + + /** + * Error code for these failures. + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Pages that failed with this code. + */ + public function withCount(int $count): self + { + $self = clone $this; + $self['count'] = $count; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Input.php b/src/Batch/BatchCancelResponse/Input.php new file mode 100644 index 00000000..684dc94d --- /dev/null +++ b/src/Batch/BatchCancelResponse/Input.php @@ -0,0 +1,134 @@ + */ + use SdkModel; + + /** + * Pages accepted, or the crawl page limit. Credits are reserved for this count. + */ + #[Required] + public int $accepted; + + /** + * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + */ + #[Required] + public int $duplicates; + + /** + * Pages rejected during validation. + */ + #[Required] + public int $invalid; + + /** + * Pages submitted before validation. For a crawl, the page limit. + */ + #[Required] + public int $submitted; + + /** + * `new Input()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Input) + * ->withAccepted(...) + * ->withDuplicates(...) + * ->withInvalid(...) + * ->withSubmitted(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $accepted, + int $duplicates, + int $invalid, + int $submitted + ): self { + $self = new self; + + $self['accepted'] = $accepted; + $self['duplicates'] = $duplicates; + $self['invalid'] = $invalid; + $self['submitted'] = $submitted; + + return $self; + } + + /** + * Pages accepted, or the crawl page limit. Credits are reserved for this count. + */ + public function withAccepted(int $accepted): self + { + $self = clone $this; + $self['accepted'] = $accepted; + + return $self; + } + + /** + * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + */ + public function withDuplicates(int $duplicates): self + { + $self = clone $this; + $self['duplicates'] = $duplicates; + + return $self; + } + + /** + * Pages rejected during validation. + */ + public function withInvalid(int $invalid): self + { + $self = clone $this; + $self['invalid'] = $invalid; + + return $self; + } + + /** + * Pages submitted before validation. For a crawl, the page limit. + */ + public function withSubmitted(int $submitted): self + { + $self = clone $this; + $self['submitted'] = $submitted; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/KeyMetadata.php b/src/Batch/BatchCancelResponse/KeyMetadata.php new file mode 100644 index 00000000..f072b095 --- /dev/null +++ b/src/Batch/BatchCancelResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Mode.php b/src/Batch/BatchCancelResponse/Mode.php new file mode 100644 index 00000000..c530dfac --- /dev/null +++ b/src/Batch/BatchCancelResponse/Mode.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * Pages that could not be scraped. + */ + #[Required] + public int $failed; + + /** + * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + */ + #[Required] + public int $pending; + + /** + * Pages scraped successfully. + */ + #[Required] + public int $succeeded; + + /** + * `new Progress()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Progress::with(failed: ..., pending: ..., succeeded: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Progress)->withFailed(...)->withPending(...)->withSucceeded(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $failed, int $pending, int $succeeded): self + { + $self = new self; + + $self['failed'] = $failed; + $self['pending'] = $pending; + $self['succeeded'] = $succeeded; + + return $self; + } + + /** + * Pages that could not be scraped. + */ + public function withFailed(int $failed): self + { + $self = clone $this; + $self['failed'] = $failed; + + return $self; + } + + /** + * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + */ + public function withPending(int $pending): self + { + $self = clone $this; + $self['pending'] = $pending; + + return $self; + } + + /** + * Pages scraped successfully. + */ + public function withSucceeded(int $succeeded): self + { + $self = clone $this; + $self['succeeded'] = $succeeded; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Results.php b/src/Batch/BatchCancelResponse/Results.php new file mode 100644 index 00000000..f28b3d3a --- /dev/null +++ b/src/Batch/BatchCancelResponse/Results.php @@ -0,0 +1,99 @@ + + * } + */ +final class Results implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When the download URLs expire. + */ + #[Required('expires_at')] + public string $expiresAt; + + /** + * Result files. Order is not guaranteed. + * + * @var list $files + */ + #[Required(list: File::class)] + public array $files; + + /** + * `new Results()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Results::with(expiresAt: ..., files: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Results)->withExpiresAt(...)->withFiles(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $files + */ + public static function with(string $expiresAt, array $files): self + { + $self = new self; + + $self['expiresAt'] = $expiresAt; + $self['files'] = $files; + + return $self; + } + + /** + * When the download URLs expire. + */ + public function withExpiresAt(string $expiresAt): self + { + $self = clone $this; + $self['expiresAt'] = $expiresAt; + + return $self; + } + + /** + * Result files. Order is not guaranteed. + * + * @param list $files + */ + public function withFiles(array $files): self + { + $self = clone $this; + $self['files'] = $files; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Results/File.php b/src/Batch/BatchCancelResponse/Results/File.php new file mode 100644 index 00000000..0867a930 --- /dev/null +++ b/src/Batch/BatchCancelResponse/Results/File.php @@ -0,0 +1,104 @@ + */ + use SdkModel; + + /** + * Compressed file size in bytes. + */ + #[Required] + public int $bytes; + + /** + * Results in this file. + */ + #[Required] + public int $items; + + /** + * Temporary URL for a gzipped NDJSON file. + */ + #[Required] + public string $url; + + /** + * `new File()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * File::with(bytes: ..., items: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new File)->withBytes(...)->withItems(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $bytes, int $items, string $url): self + { + $self = new self; + + $self['bytes'] = $bytes; + $self['items'] = $items; + $self['url'] = $url; + + return $self; + } + + /** + * Compressed file size in bytes. + */ + public function withBytes(int $bytes): self + { + $self = clone $this; + $self['bytes'] = $bytes; + + return $self; + } + + /** + * Results in this file. + */ + public function withItems(int $items): self + { + $self = clone $this; + $self['items'] = $items; + + return $self; + } + + /** + * Temporary URL for a gzipped NDJSON file. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Status.php b/src/Batch/BatchCancelResponse/Status.php new file mode 100644 index 00000000..01a1e5ae --- /dev/null +++ b/src/Batch/BatchCancelResponse/Status.php @@ -0,0 +1,23 @@ + */ + use SdkModel; + + /** + * When processing finished. Null while active. + */ + #[Required('completed_at')] + public ?string $completedAt; + + /** + * When the batch was created. + */ + #[Required('created_at')] + public string $createdAt; + + /** + * When processing started. Null while queued. + */ + #[Required('started_at')] + public ?string $startedAt; + + /** + * `new Timing()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Timing::with(completedAt: ..., createdAt: ..., startedAt: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Timing)->withCompletedAt(...)->withCreatedAt(...)->withStartedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $completedAt, + string $createdAt, + ?string $startedAt + ): self { + $self = new self; + + $self['completedAt'] = $completedAt; + $self['createdAt'] = $createdAt; + $self['startedAt'] = $startedAt; + + return $self; + } + + /** + * When processing finished. Null while active. + */ + public function withCompletedAt(?string $completedAt): self + { + $self = clone $this; + $self['completedAt'] = $completedAt; + + return $self; + } + + /** + * When the batch was created. + */ + public function withCreatedAt(string $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * When processing started. Null while queued. + */ + public function withStartedAt(?string $startedAt): self + { + $self = clone $this; + $self['startedAt'] = $startedAt; + + return $self; + } +} diff --git a/src/Batch/BatchCancelResponse/Type.php b/src/Batch/BatchCancelResponse/Type.php new file mode 100644 index 00000000..30a60b2b --- /dev/null +++ b/src/Batch/BatchCancelResponse/Type.php @@ -0,0 +1,15 @@ +, + * input: Input|InputShape, + * invalidURLs: list, + * mode: Mode|value-of, + * progress: Progress|ProgressShape, + * results: null|Results|ResultsShape, + * status: Status|value-of, + * timing: Timing|TimingShape, + * type: Type|value-of, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * webhookSecret?: string|null, + * } + */ +final class BatchGetResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Batch ID used to retrieve or cancel the job. + */ + #[Required] + public string $id; + + /** + * Reserved and used credits. + */ + #[Required] + public Credits $credits; + + /** + * Batch-level error. Null unless `status` is `failed`. + */ + #[Required] + public ?Error $error; + + /** + * Page failures grouped by error code. + * + * @var list $errors + */ + #[Required(list: Error1::class)] + public array $errors; + + /** + * Submission counts. + */ + #[Required] + public Input $input; + + /** + * Rejected URLs, up to 100. These are not charged. + * + * @var list $invalidURLs + */ + #[Required('invalid_urls', list: InvalidURL::class)] + public array $invalidURLs; + + /** + * How pages are selected. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + /** + * Current processing counts. Use `status` to check completion. + */ + #[Required] + public Progress $progress; + + /** + * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + */ + #[Required] + public ?Results $results; + + /** + * Current state. `completed`, `cancelled`, and `failed` are final. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Timing $timing; + + /** + * Output format. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * API key usage for this request. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Webhook signing secret. Also returned by GET /batch/{batch_id}. + */ + #[Optional('webhook_secret')] + public ?string $webhookSecret; + + /** + * `new BatchGetResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BatchGetResponse::with( + * id: ..., + * credits: ..., + * error: ..., + * errors: ..., + * input: ..., + * invalidURLs: ..., + * mode: ..., + * progress: ..., + * results: ..., + * status: ..., + * timing: ..., + * type: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BatchGetResponse) + * ->withID(...) + * ->withCredits(...) + * ->withError(...) + * ->withErrors(...) + * ->withInput(...) + * ->withInvalidURLs(...) + * ->withMode(...) + * ->withProgress(...) + * ->withResults(...) + * ->withStatus(...) + * ->withTiming(...) + * ->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Credits|CreditsShape $credits + * @param Error|ErrorShape|null $error + * @param list $errors + * @param Input|InputShape $input + * @param list $invalidURLs + * @param Mode|value-of $mode + * @param Progress|ProgressShape $progress + * @param Results|ResultsShape|null $results + * @param Status|value-of $status + * @param Timing|TimingShape $timing + * @param Type|value-of $type + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + string $id, + Credits|array $credits, + Error|array|null $error, + array $errors, + Input|array $input, + array $invalidURLs, + Mode|string $mode, + Progress|array $progress, + Results|array|null $results, + Status|string $status, + Timing|array $timing, + Type|string $type, + KeyMetadata|array|null $keyMetadata = null, + ?string $webhookSecret = null, + ): self { + $self = new self; + + $self['id'] = $id; + $self['credits'] = $credits; + $self['error'] = $error; + $self['errors'] = $errors; + $self['input'] = $input; + $self['invalidURLs'] = $invalidURLs; + $self['mode'] = $mode; + $self['progress'] = $progress; + $self['results'] = $results; + $self['status'] = $status; + $self['timing'] = $timing; + $self['type'] = $type; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $webhookSecret && $self['webhookSecret'] = $webhookSecret; + + return $self; + } + + /** + * Batch ID used to retrieve or cancel the job. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Reserved and used credits. + * + * @param Credits|CreditsShape $credits + */ + public function withCredits(Credits|array $credits): self + { + $self = clone $this; + $self['credits'] = $credits; + + return $self; + } + + /** + * Batch-level error. Null unless `status` is `failed`. + * + * @param Error|ErrorShape|null $error + */ + public function withError(Error|array|null $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * Page failures grouped by error code. + * + * @param list $errors + */ + public function withErrors(array $errors): self + { + $self = clone $this; + $self['errors'] = $errors; + + return $self; + } + + /** + * Submission counts. + * + * @param Input|InputShape $input + */ + public function withInput(Input|array $input): self + { + $self = clone $this; + $self['input'] = $input; + + return $self; + } + + /** + * Rejected URLs, up to 100. These are not charged. + * + * @param list $invalidURLs + */ + public function withInvalidURLs(array $invalidURLs): self + { + $self = clone $this; + $self['invalidURLs'] = $invalidURLs; + + return $self; + } + + /** + * How pages are selected. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Current processing counts. Use `status` to check completion. + * + * @param Progress|ProgressShape $progress + */ + public function withProgress(Progress|array $progress): self + { + $self = clone $this; + $self['progress'] = $progress; + + return $self; + } + + /** + * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * + * @param Results|ResultsShape|null $results + */ + public function withResults(Results|array|null $results): self + { + $self = clone $this; + $self['results'] = $results; + + return $self; + } + + /** + * Current state. `completed`, `cancelled`, and `failed` are final. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Timing|TimingShape $timing + */ + public function withTiming(Timing|array $timing): self + { + $self = clone $this; + $self['timing'] = $timing; + + return $self; + } + + /** + * Output format. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * API key usage for this request. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Webhook signing secret. Also returned by GET /batch/{batch_id}. + */ + public function withWebhookSecret(string $webhookSecret): self + { + $self = clone $this; + $self['webhookSecret'] = $webhookSecret; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Credits.php b/src/Batch/BatchGetResponse/Credits.php new file mode 100644 index 00000000..5014503d --- /dev/null +++ b/src/Batch/BatchGetResponse/Credits.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Credits used by successful pages. + */ + #[Required] + public int $charged; + + /** + * Credits reserved when the batch was accepted. + */ + #[Required] + public int $estimated; + + /** + * `new Credits()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Credits::with(charged: ..., estimated: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Credits)->withCharged(...)->withEstimated(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $charged, int $estimated): self + { + $self = new self; + + $self['charged'] = $charged; + $self['estimated'] = $estimated; + + return $self; + } + + /** + * Credits used by successful pages. + */ + public function withCharged(int $charged): self + { + $self = clone $this; + $self['charged'] = $charged; + + return $self; + } + + /** + * Credits reserved when the batch was accepted. + */ + public function withEstimated(int $estimated): self + { + $self = clone $this; + $self['estimated'] = $estimated; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Error.php b/src/Batch/BatchGetResponse/Error.php new file mode 100644 index 00000000..3151f0ce --- /dev/null +++ b/src/Batch/BatchGetResponse/Error.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Batch error code. + */ + #[Required] + public string $code; + + /** + * Batch error message. + */ + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + /** + * Batch error code. + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Batch error message. + */ + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Error1.php b/src/Batch/BatchGetResponse/Error1.php new file mode 100644 index 00000000..2b58eae6 --- /dev/null +++ b/src/Batch/BatchGetResponse/Error1.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Error code for these failures. + */ + #[Required] + public string $code; + + /** + * Pages that failed with this code. + */ + #[Required] + public int $count; + + /** + * `new Error1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error1::with(code: ..., count: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error1)->withCode(...)->withCount(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, int $count): self + { + $self = new self; + + $self['code'] = $code; + $self['count'] = $count; + + return $self; + } + + /** + * Error code for these failures. + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Pages that failed with this code. + */ + public function withCount(int $count): self + { + $self = clone $this; + $self['count'] = $count; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Input.php b/src/Batch/BatchGetResponse/Input.php new file mode 100644 index 00000000..84c30d0a --- /dev/null +++ b/src/Batch/BatchGetResponse/Input.php @@ -0,0 +1,134 @@ + */ + use SdkModel; + + /** + * Pages accepted, or the crawl page limit. Credits are reserved for this count. + */ + #[Required] + public int $accepted; + + /** + * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + */ + #[Required] + public int $duplicates; + + /** + * Pages rejected during validation. + */ + #[Required] + public int $invalid; + + /** + * Pages submitted before validation. For a crawl, the page limit. + */ + #[Required] + public int $submitted; + + /** + * `new Input()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Input) + * ->withAccepted(...) + * ->withDuplicates(...) + * ->withInvalid(...) + * ->withSubmitted(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $accepted, + int $duplicates, + int $invalid, + int $submitted + ): self { + $self = new self; + + $self['accepted'] = $accepted; + $self['duplicates'] = $duplicates; + $self['invalid'] = $invalid; + $self['submitted'] = $submitted; + + return $self; + } + + /** + * Pages accepted, or the crawl page limit. Credits are reserved for this count. + */ + public function withAccepted(int $accepted): self + { + $self = clone $this; + $self['accepted'] = $accepted; + + return $self; + } + + /** + * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + */ + public function withDuplicates(int $duplicates): self + { + $self = clone $this; + $self['duplicates'] = $duplicates; + + return $self; + } + + /** + * Pages rejected during validation. + */ + public function withInvalid(int $invalid): self + { + $self = clone $this; + $self['invalid'] = $invalid; + + return $self; + } + + /** + * Pages submitted before validation. For a crawl, the page limit. + */ + public function withSubmitted(int $submitted): self + { + $self = clone $this; + $self['submitted'] = $submitted; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/InvalidURL.php b/src/Batch/BatchGetResponse/InvalidURL.php new file mode 100644 index 00000000..dd103b22 --- /dev/null +++ b/src/Batch/BatchGetResponse/InvalidURL.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Why it was rejected. + */ + #[Required] + public string $reason; + + /** + * Rejected URL. + */ + #[Required] + public string $url; + + /** + * `new InvalidURL()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * InvalidURL::with(reason: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new InvalidURL)->withReason(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $reason, string $url): self + { + $self = new self; + + $self['reason'] = $reason; + $self['url'] = $url; + + return $self; + } + + /** + * Why it was rejected. + */ + public function withReason(string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * Rejected URL. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/KeyMetadata.php b/src/Batch/BatchGetResponse/KeyMetadata.php new file mode 100644 index 00000000..77c3861a --- /dev/null +++ b/src/Batch/BatchGetResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Mode.php b/src/Batch/BatchGetResponse/Mode.php new file mode 100644 index 00000000..78ded37b --- /dev/null +++ b/src/Batch/BatchGetResponse/Mode.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * Pages that could not be scraped. + */ + #[Required] + public int $failed; + + /** + * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + */ + #[Required] + public int $pending; + + /** + * Pages scraped successfully. + */ + #[Required] + public int $succeeded; + + /** + * `new Progress()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Progress::with(failed: ..., pending: ..., succeeded: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Progress)->withFailed(...)->withPending(...)->withSucceeded(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $failed, int $pending, int $succeeded): self + { + $self = new self; + + $self['failed'] = $failed; + $self['pending'] = $pending; + $self['succeeded'] = $succeeded; + + return $self; + } + + /** + * Pages that could not be scraped. + */ + public function withFailed(int $failed): self + { + $self = clone $this; + $self['failed'] = $failed; + + return $self; + } + + /** + * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + */ + public function withPending(int $pending): self + { + $self = clone $this; + $self['pending'] = $pending; + + return $self; + } + + /** + * Pages scraped successfully. + */ + public function withSucceeded(int $succeeded): self + { + $self = clone $this; + $self['succeeded'] = $succeeded; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Results.php b/src/Batch/BatchGetResponse/Results.php new file mode 100644 index 00000000..a91153c0 --- /dev/null +++ b/src/Batch/BatchGetResponse/Results.php @@ -0,0 +1,99 @@ + + * } + */ +final class Results implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When the download URLs expire. + */ + #[Required('expires_at')] + public string $expiresAt; + + /** + * Result files. Order is not guaranteed. + * + * @var list $files + */ + #[Required(list: File::class)] + public array $files; + + /** + * `new Results()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Results::with(expiresAt: ..., files: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Results)->withExpiresAt(...)->withFiles(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $files + */ + public static function with(string $expiresAt, array $files): self + { + $self = new self; + + $self['expiresAt'] = $expiresAt; + $self['files'] = $files; + + return $self; + } + + /** + * When the download URLs expire. + */ + public function withExpiresAt(string $expiresAt): self + { + $self = clone $this; + $self['expiresAt'] = $expiresAt; + + return $self; + } + + /** + * Result files. Order is not guaranteed. + * + * @param list $files + */ + public function withFiles(array $files): self + { + $self = clone $this; + $self['files'] = $files; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Results/File.php b/src/Batch/BatchGetResponse/Results/File.php new file mode 100644 index 00000000..019b67bc --- /dev/null +++ b/src/Batch/BatchGetResponse/Results/File.php @@ -0,0 +1,104 @@ + */ + use SdkModel; + + /** + * Compressed file size in bytes. + */ + #[Required] + public int $bytes; + + /** + * Results in this file. + */ + #[Required] + public int $items; + + /** + * Temporary URL for a gzipped NDJSON file. + */ + #[Required] + public string $url; + + /** + * `new File()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * File::with(bytes: ..., items: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new File)->withBytes(...)->withItems(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $bytes, int $items, string $url): self + { + $self = new self; + + $self['bytes'] = $bytes; + $self['items'] = $items; + $self['url'] = $url; + + return $self; + } + + /** + * Compressed file size in bytes. + */ + public function withBytes(int $bytes): self + { + $self = clone $this; + $self['bytes'] = $bytes; + + return $self; + } + + /** + * Results in this file. + */ + public function withItems(int $items): self + { + $self = clone $this; + $self['items'] = $items; + + return $self; + } + + /** + * Temporary URL for a gzipped NDJSON file. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Status.php b/src/Batch/BatchGetResponse/Status.php new file mode 100644 index 00000000..fba2606d --- /dev/null +++ b/src/Batch/BatchGetResponse/Status.php @@ -0,0 +1,23 @@ + */ + use SdkModel; + + /** + * When processing finished. Null while active. + */ + #[Required('completed_at')] + public ?string $completedAt; + + /** + * When the batch was created. + */ + #[Required('created_at')] + public string $createdAt; + + /** + * When processing started. Null while queued. + */ + #[Required('started_at')] + public ?string $startedAt; + + /** + * `new Timing()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Timing::with(completedAt: ..., createdAt: ..., startedAt: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Timing)->withCompletedAt(...)->withCreatedAt(...)->withStartedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $completedAt, + string $createdAt, + ?string $startedAt + ): self { + $self = new self; + + $self['completedAt'] = $completedAt; + $self['createdAt'] = $createdAt; + $self['startedAt'] = $startedAt; + + return $self; + } + + /** + * When processing finished. Null while active. + */ + public function withCompletedAt(?string $completedAt): self + { + $self = clone $this; + $self['completedAt'] = $completedAt; + + return $self; + } + + /** + * When the batch was created. + */ + public function withCreatedAt(string $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * When processing started. Null while queued. + */ + public function withStartedAt(?string $startedAt): self + { + $self = clone $this; + $self['startedAt'] = $startedAt; + + return $self; + } +} diff --git a/src/Batch/BatchGetResponse/Type.php b/src/Batch/BatchGetResponse/Type.php new file mode 100644 index 00000000..def0a615 --- /dev/null +++ b/src/Batch/BatchGetResponse/Type.php @@ -0,0 +1,15 @@ +|null + * } + */ +final class BatchGetResultsParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * next_cursor from the previous page. + */ + #[Optional] + public ?string $cursor; + + /** + * Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records. + */ + #[Optional] + public ?int $limit; + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + ?array $tags = null + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + /** + * next_cursor from the previous page. + */ + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + /** + * Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records. + */ + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse.php b/src/Batch/BatchGetResultsResponse.php new file mode 100644 index 00000000..7f816926 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse.php @@ -0,0 +1,132 @@ +|null, + * hasMore?: bool|null, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * nextCursor?: string|null, + * } + */ +final class BatchGetResultsResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Result records on this page. + * + * @var list|null $data + */ + #[Optional(list: Data::class)] + public ?array $data; + + /** + * Whether another page is available. + */ + #[Optional('has_more')] + public ?bool $hasMore; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Cursor for the next page. + */ + #[Optional('next_cursor', nullable: true)] + public ?string $nextCursor; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $data + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + ?array $data = null, + ?bool $hasMore = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $nextCursor = null, + ): self { + $self = new self; + + null !== $data && $self['data'] = $data; + null !== $hasMore && $self['hasMore'] = $hasMore; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $nextCursor && $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * Result records on this page. + * + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * Whether another page is available. + */ + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Cursor for the next page. + */ + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data.php b/src/Batch/BatchGetResultsResponse/Data.php new file mode 100644 index 00000000..27b46baf --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data.php @@ -0,0 +1,38 @@ +|array + */ + public static function variants(): array + { + return ['ok' => ScrapedPage::class, 'error' => FailedPage::class]; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/FailedPage.php b/src/Batch/BatchGetResultsResponse/Data/FailedPage.php new file mode 100644 index 00000000..ccdb3b1f --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/FailedPage.php @@ -0,0 +1,183 @@ +|null, + * } + */ +final class FailedPage implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * The page could not be scraped. + * + * @var 'error' $status + */ + #[Required] + public string $status = 'error'; + + /** + * Why the page failed. + */ + #[Required('error_code')] + public string $errorCode; + + /** + * Human-readable failure detail. + */ + #[Required] + public string $message; + + /** + * URL as submitted, or as discovered by the crawl. + */ + #[Required] + public string $url; + + /** + * Caller-supplied identifier echoed from submission. + */ + #[Optional('itemId')] + public ?string $itemID; + + /** + * Caller-supplied metadata echoed from submission. + * + * @var array|null $meta + */ + #[Optional(map: 'mixed')] + public ?array $meta; + + /** + * `new FailedPage()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * FailedPage::with(errorCode: ..., message: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new FailedPage)->withErrorCode(...)->withMessage(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $meta + */ + public static function with( + string $errorCode, + string $message, + string $url, + ?string $itemID = null, + ?array $meta = null, + ): self { + $self = new self; + + $self['errorCode'] = $errorCode; + $self['message'] = $message; + $self['url'] = $url; + + null !== $itemID && $self['itemID'] = $itemID; + null !== $meta && $self['meta'] = $meta; + + return $self; + } + + /** + * Why the page failed. + */ + public function withErrorCode(string $errorCode): self + { + $self = clone $this; + $self['errorCode'] = $errorCode; + + return $self; + } + + /** + * Human-readable failure detail. + */ + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } + + /** + * The page could not be scraped. + * + * @param 'error' $status + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * URL as submitted, or as discovered by the crawl. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Caller-supplied identifier echoed from submission. + */ + public function withItemID(string $itemID): self + { + $self = clone $this; + $self['itemID'] = $itemID; + + return $self; + } + + /** + * Caller-supplied metadata echoed from submission. + * + * @param array $meta + */ + public function withMeta(array $meta): self + { + $self = clone $this; + $self['meta'] = $meta; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php new file mode 100644 index 00000000..aafb7cf3 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php @@ -0,0 +1,253 @@ +|null, + * } + */ +final class ScrapedPage implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * The page was scraped. + * + * @var 'ok' $status + */ + #[Required] + public string $status = 'ok'; + + /** + * URL the content was read from, after redirects. + */ + #[Required('final_url')] + public string $finalURL; + + /** + * HTTP status of the final response, when known. + */ + #[Required('http_status')] + public ?int $httpStatus; + + /** + * Metadata extracted from the scraped page HTML. + */ + #[Required] + public Metadata $metadata; + + /** + * URL as submitted, or as discovered by the crawl. + */ + #[Required] + public string $url; + + /** + * Raw page HTML. Present on html batches. + */ + #[Optional] + public ?string $html; + + /** + * Caller-supplied identifier echoed from submission. + */ + #[Optional('itemId')] + public ?string $itemID; + + /** + * Page content as Markdown. Present on markdown batches. + */ + #[Optional] + public ?string $markdown; + + /** + * Caller-supplied metadata echoed from submission. + * + * @var array|null $meta + */ + #[Optional(map: 'mixed')] + public ?array $meta; + + /** + * `new ScrapedPage()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ScrapedPage::with(finalURL: ..., httpStatus: ..., metadata: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ScrapedPage) + * ->withFinalURL(...) + * ->withHTTPStatus(...) + * ->withMetadata(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Metadata|MetadataShape $metadata + * @param array|null $meta + */ + public static function with( + string $finalURL, + ?int $httpStatus, + Metadata|array $metadata, + string $url, + ?string $html = null, + ?string $itemID = null, + ?string $markdown = null, + ?array $meta = null, + ): self { + $self = new self; + + $self['finalURL'] = $finalURL; + $self['httpStatus'] = $httpStatus; + $self['metadata'] = $metadata; + $self['url'] = $url; + + null !== $html && $self['html'] = $html; + null !== $itemID && $self['itemID'] = $itemID; + null !== $markdown && $self['markdown'] = $markdown; + null !== $meta && $self['meta'] = $meta; + + return $self; + } + + /** + * URL the content was read from, after redirects. + */ + public function withFinalURL(string $finalURL): self + { + $self = clone $this; + $self['finalURL'] = $finalURL; + + return $self; + } + + /** + * HTTP status of the final response, when known. + */ + public function withHTTPStatus(?int $httpStatus): self + { + $self = clone $this; + $self['httpStatus'] = $httpStatus; + + return $self; + } + + /** + * Metadata extracted from the scraped page HTML. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * The page was scraped. + * + * @param 'ok' $status + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * URL as submitted, or as discovered by the crawl. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Raw page HTML. Present on html batches. + */ + public function withHTML(string $html): self + { + $self = clone $this; + $self['html'] = $html; + + return $self; + } + + /** + * Caller-supplied identifier echoed from submission. + */ + public function withItemID(string $itemID): self + { + $self = clone $this; + $self['itemID'] = $itemID; + + return $self; + } + + /** + * Page content as Markdown. Present on markdown batches. + */ + public function withMarkdown(string $markdown): self + { + $self = clone $this; + $self['markdown'] = $markdown; + + return $self; + } + + /** + * Caller-supplied metadata echoed from submission. + * + * @param array $meta + */ + public function withMeta(array $meta): self + { + $self = clone $this; + $self['meta'] = $meta; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php new file mode 100644 index 00000000..d3619e88 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php @@ -0,0 +1,479 @@ +|null, + * alternates?: list|null, + * author?: string|null, + * canonicalURL?: string|null, + * description?: string|null, + * favicon?: string|null, + * image?: string|null, + * jsonLd?: list>|null, + * keywords?: list|null, + * language?: string|null, + * modifiedTime?: string|null, + * openGraph?: array|null, + * publishedTime?: string|null, + * robots?: string|null, + * siteName?: string|null, + * title?: string|null, + * twitter?: array|null, + * } + */ +final class Metadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + #[Required('finalUrl')] + public string $finalURL; + + /** + * Original URL requested by the caller. + */ + #[Required('sourceUrl')] + public string $sourceURL; + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @var array|null $additionalMeta + */ + #[Optional(map: AdditionalMeta::class)] + public ?array $additionalMeta; + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @var list|null $alternates + */ + #[Optional(list: Alternate::class)] + public ?array $alternates; + + /** + * Author metadata, when present. + */ + #[Optional] + public ?string $author; + + /** + * Resolved canonical URL, when present. + */ + #[Optional('canonicalUrl')] + public ?string $canonicalURL; + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + #[Optional] + public ?string $description; + + /** + * Resolved favicon URL, when present. + */ + #[Optional] + public ?string $favicon; + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + #[Optional] + public ?string $image; + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @var list>|null $jsonLd + */ + #[Optional(list: new MapOf('mixed'))] + public ?array $jsonLd; + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @var list|null $keywords + */ + #[Optional(list: 'string')] + public ?array $keywords; + + /** + * Language extracted from html lang or language meta tags. + */ + #[Optional] + public ?string $language; + + /** + * Modified timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $modifiedTime; + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @var array|null $openGraph + */ + #[Optional(map: OpenGraph::class)] + public ?array $openGraph; + + /** + * Published timestamp/date from page metadata, when present. + */ + #[Optional] + public ?string $publishedTime; + + /** + * Robots meta directive, when present. + */ + #[Optional] + public ?string $robots; + + /** + * Site or application name from page metadata. + */ + #[Optional] + public ?string $siteName; + + /** + * Best title extracted from the page. + */ + #[Optional] + public ?string $title; + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @var array|null $twitter + */ + #[Optional(map: Twitter::class)] + public ?array $twitter; + + /** + * `new Metadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metadata::with(finalURL: ..., sourceURL: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metadata)->withFinalURL(...)->withSourceURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $additionalMeta + * @param list|null $alternates + * @param list>|null $jsonLd + * @param list|null $keywords + * @param array|null $openGraph + * @param array|null $twitter + */ + public static function with( + string $finalURL, + string $sourceURL, + ?array $additionalMeta = null, + ?array $alternates = null, + ?string $author = null, + ?string $canonicalURL = null, + ?string $description = null, + ?string $favicon = null, + ?string $image = null, + ?array $jsonLd = null, + ?array $keywords = null, + ?string $language = null, + ?string $modifiedTime = null, + ?array $openGraph = null, + ?string $publishedTime = null, + ?string $robots = null, + ?string $siteName = null, + ?string $title = null, + ?array $twitter = null, + ): self { + $self = new self; + + $self['finalURL'] = $finalURL; + $self['sourceURL'] = $sourceURL; + + null !== $additionalMeta && $self['additionalMeta'] = $additionalMeta; + null !== $alternates && $self['alternates'] = $alternates; + null !== $author && $self['author'] = $author; + null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; + null !== $description && $self['description'] = $description; + null !== $favicon && $self['favicon'] = $favicon; + null !== $image && $self['image'] = $image; + null !== $jsonLd && $self['jsonLd'] = $jsonLd; + null !== $keywords && $self['keywords'] = $keywords; + null !== $language && $self['language'] = $language; + null !== $modifiedTime && $self['modifiedTime'] = $modifiedTime; + null !== $openGraph && $self['openGraph'] = $openGraph; + null !== $publishedTime && $self['publishedTime'] = $publishedTime; + null !== $robots && $self['robots'] = $robots; + null !== $siteName && $self['siteName'] = $siteName; + null !== $title && $self['title'] = $title; + null !== $twitter && $self['twitter'] = $twitter; + + return $self; + } + + /** + * Final URL scraped after redirects or scraper fallback, when known. Falls back to sourceUrl when unavailable. + */ + public function withFinalURL(string $finalURL): self + { + $self = clone $this; + $self['finalURL'] = $finalURL; + + return $self; + } + + /** + * Original URL requested by the caller. + */ + public function withSourceURL(string $sourceURL): self + { + $self = clone $this; + $self['sourceURL'] = $sourceURL; + + return $self; + } + + /** + * Additional non-social meta tags not promoted to top-level metadata fields. + * + * @param array $additionalMeta + */ + public function withAdditionalMeta(array $additionalMeta): self + { + $self = clone $this; + $self['additionalMeta'] = $additionalMeta; + + return $self; + } + + /** + * Resolved alternate links from link rel=alternate tags. + * + * @param list $alternates + */ + public function withAlternates(array $alternates): self + { + $self = clone $this; + $self['alternates'] = $alternates; + + return $self; + } + + /** + * Author metadata, when present. + */ + public function withAuthor(string $author): self + { + $self = clone $this; + $self['author'] = $author; + + return $self; + } + + /** + * Resolved canonical URL, when present. + */ + public function withCanonicalURL(string $canonicalURL): self + { + $self = clone $this; + $self['canonicalURL'] = $canonicalURL; + + return $self; + } + + /** + * Best description extracted from standard, Open Graph, or Twitter metadata. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * Resolved favicon URL, when present. + */ + public function withFavicon(string $favicon): self + { + $self = clone $this; + $self['favicon'] = $favicon; + + return $self; + } + + /** + * Primary resolved preview image from Open Graph, Twitter, or image metadata. + */ + public function withImage(string $image): self + { + $self = clone $this; + $self['image'] = $image; + + return $self; + } + + /** + * JSON-LD structured data blocks parsed from the page. + * + * @param list> $jsonLd + */ + public function withJsonLd(array $jsonLd): self + { + $self = clone $this; + $self['jsonLd'] = $jsonLd; + + return $self; + } + + /** + * Keywords extracted from the page's keywords meta tag. + * + * @param list $keywords + */ + public function withKeywords(array $keywords): self + { + $self = clone $this; + $self['keywords'] = $keywords; + + return $self; + } + + /** + * Language extracted from html lang or language meta tags. + */ + public function withLanguage(string $language): self + { + $self = clone $this; + $self['language'] = $language; + + return $self; + } + + /** + * Modified timestamp/date from page metadata, when present. + */ + public function withModifiedTime(string $modifiedTime): self + { + $self = clone $this; + $self['modifiedTime'] = $modifiedTime; + + return $self; + } + + /** + * Open Graph metadata with the og: prefix removed and keys camel-cased. + * + * @param array $openGraph + */ + public function withOpenGraph(array $openGraph): self + { + $self = clone $this; + $self['openGraph'] = $openGraph; + + return $self; + } + + /** + * Published timestamp/date from page metadata, when present. + */ + public function withPublishedTime(string $publishedTime): self + { + $self = clone $this; + $self['publishedTime'] = $publishedTime; + + return $self; + } + + /** + * Robots meta directive, when present. + */ + public function withRobots(string $robots): self + { + $self = clone $this; + $self['robots'] = $robots; + + return $self; + } + + /** + * Site or application name from page metadata. + */ + public function withSiteName(string $siteName): self + { + $self = clone $this; + $self['siteName'] = $siteName; + + return $self; + } + + /** + * Best title extracted from the page. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Twitter card metadata with the twitter: prefix removed and keys camel-cased. + * + * @param array $twitter + */ + public function withTwitter(array $twitter): self + { + $self = clone $this; + $self['twitter'] = $twitter; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/AdditionalMeta.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/AdditionalMeta.php new file mode 100644 index 00000000..39c38007 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/AdditionalMeta.php @@ -0,0 +1,27 @@ + + * @phpstan-type AdditionalMetaShape = AdditionalMetaVariants + */ +final class AdditionalMeta implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Alternate.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Alternate.php new file mode 100644 index 00000000..43ab7435 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Alternate.php @@ -0,0 +1,130 @@ + */ + use SdkModel; + + /** + * Resolved alternate URL. + */ + #[Required] + public string $href; + + /** + * Language or locale for the alternate URL, when present. + */ + #[Optional] + public ?string $hreflang; + + /** + * Alternate resource title, when present. + */ + #[Optional] + public ?string $title; + + /** + * Alternate resource MIME type, when present. + */ + #[Optional] + public ?string $type; + + /** + * `new Alternate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Alternate::with(href: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Alternate)->withHref(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $href, + ?string $hreflang = null, + ?string $title = null, + ?string $type = null, + ): self { + $self = new self; + + $self['href'] = $href; + + null !== $hreflang && $self['hreflang'] = $hreflang; + null !== $title && $self['title'] = $title; + null !== $type && $self['type'] = $type; + + return $self; + } + + /** + * Resolved alternate URL. + */ + public function withHref(string $href): self + { + $self = clone $this; + $self['href'] = $href; + + return $self; + } + + /** + * Language or locale for the alternate URL, when present. + */ + public function withHreflang(string $hreflang): self + { + $self = clone $this; + $self['hreflang'] = $hreflang; + + return $self; + } + + /** + * Alternate resource title, when present. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Alternate resource MIME type, when present. + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/OpenGraph.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/OpenGraph.php new file mode 100644 index 00000000..4b6b5718 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/OpenGraph.php @@ -0,0 +1,27 @@ + + * @phpstan-type OpenGraphShape = OpenGraphVariants + */ +final class OpenGraph implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Twitter.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Twitter.php new file mode 100644 index 00000000..e9861f63 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Twitter.php @@ -0,0 +1,27 @@ + + * @phpstan-type TwitterShape = TwitterVariants + */ +final class Twitter implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['string', new ListOf('string')]; + } +} diff --git a/src/Batch/BatchGetResultsResponse/KeyMetadata.php b/src/Batch/BatchGetResultsResponse/KeyMetadata.php new file mode 100644 index 00000000..4ccf5326 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Batch/BatchListParams.php b/src/Batch/BatchListParams.php new file mode 100644 index 00000000..95cea08a --- /dev/null +++ b/src/Batch/BatchListParams.php @@ -0,0 +1,135 @@ +, + * tags?: list|null, + * } + */ +final class BatchListParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Cursor from the previous page. + */ + #[Optional] + public ?string $cursor; + + /** + * Batches per page. Defaults to 25. + */ + #[Optional] + public ?int $limit; + + /** + * Filter by status. + * + * @var value-of|null $status + */ + #[Optional(enum: Status::class)] + public ?string $status; + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of|null $status + * @param list|null $tags + */ + public static function with( + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null, + ?array $tags = null, + ): self { + $self = new self; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $limit && $self['limit'] = $limit; + null !== $status && $self['status'] = $status; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + /** + * Cursor from the previous page. + */ + public function withCursor(string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + /** + * Batches per page. Defaults to 25. + */ + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * Filter by status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Batch/BatchListParams/Status.php b/src/Batch/BatchListParams/Status.php new file mode 100644 index 00000000..648778e4 --- /dev/null +++ b/src/Batch/BatchListParams/Status.php @@ -0,0 +1,23 @@ +|null, + * hasMore?: bool|null, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * nextCursor?: string|null, + * } + */ +final class BatchListResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Batches on this page. + * + * @var list|null $data + */ + #[Optional(list: Data::class)] + public ?array $data; + + /** + * Whether another page is available. + */ + #[Optional('has_more')] + public ?bool $hasMore; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * Cursor for the next page. + */ + #[Optional('next_cursor', nullable: true)] + public ?string $nextCursor; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $data + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + ?array $data = null, + ?bool $hasMore = null, + KeyMetadata|array|null $keyMetadata = null, + ?string $nextCursor = null, + ): self { + $self = new self; + + null !== $data && $self['data'] = $data; + null !== $hasMore && $self['hasMore'] = $hasMore; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $nextCursor && $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * Batches on this page. + * + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * Whether another page is available. + */ + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Cursor for the next page. + */ + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data.php b/src/Batch/BatchListResponse/Data.php new file mode 100644 index 00000000..896dd401 --- /dev/null +++ b/src/Batch/BatchListResponse/Data.php @@ -0,0 +1,348 @@ +, + * input: Input|InputShape, + * mode: Mode|value-of, + * progress: Progress|ProgressShape, + * results: null|Results|ResultsShape, + * status: Status|value-of, + * timing: Timing|TimingShape, + * type: Type|value-of, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Batch ID used to retrieve or cancel the job. + */ + #[Required] + public string $id; + + /** + * Reserved and used credits. + */ + #[Required] + public Credits $credits; + + /** + * Batch-level error. Null unless `status` is `failed`. + */ + #[Required] + public ?Error $error; + + /** + * Page failures grouped by error code. + * + * @var list $errors + */ + #[Required(list: Error1::class)] + public array $errors; + + /** + * Submission counts. + */ + #[Required] + public Input $input; + + /** + * How pages are selected. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + /** + * Current processing counts. Use `status` to check completion. + */ + #[Required] + public Progress $progress; + + /** + * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + */ + #[Required] + public ?Results $results; + + /** + * Current state. `completed`, `cancelled`, and `failed` are final. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + #[Required] + public Timing $timing; + + /** + * Output format. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * credits: ..., + * error: ..., + * errors: ..., + * input: ..., + * mode: ..., + * progress: ..., + * results: ..., + * status: ..., + * timing: ..., + * type: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withCredits(...) + * ->withError(...) + * ->withErrors(...) + * ->withInput(...) + * ->withMode(...) + * ->withProgress(...) + * ->withResults(...) + * ->withStatus(...) + * ->withTiming(...) + * ->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Credits|CreditsShape $credits + * @param Error|ErrorShape|null $error + * @param list $errors + * @param Input|InputShape $input + * @param Mode|value-of $mode + * @param Progress|ProgressShape $progress + * @param Results|ResultsShape|null $results + * @param Status|value-of $status + * @param Timing|TimingShape $timing + * @param Type|value-of $type + */ + public static function with( + string $id, + Credits|array $credits, + Error|array|null $error, + array $errors, + Input|array $input, + Mode|string $mode, + Progress|array $progress, + Results|array|null $results, + Status|string $status, + Timing|array $timing, + Type|string $type, + ): self { + $self = new self; + + $self['id'] = $id; + $self['credits'] = $credits; + $self['error'] = $error; + $self['errors'] = $errors; + $self['input'] = $input; + $self['mode'] = $mode; + $self['progress'] = $progress; + $self['results'] = $results; + $self['status'] = $status; + $self['timing'] = $timing; + $self['type'] = $type; + + return $self; + } + + /** + * Batch ID used to retrieve or cancel the job. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Reserved and used credits. + * + * @param Credits|CreditsShape $credits + */ + public function withCredits(Credits|array $credits): self + { + $self = clone $this; + $self['credits'] = $credits; + + return $self; + } + + /** + * Batch-level error. Null unless `status` is `failed`. + * + * @param Error|ErrorShape|null $error + */ + public function withError(Error|array|null $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + /** + * Page failures grouped by error code. + * + * @param list $errors + */ + public function withErrors(array $errors): self + { + $self = clone $this; + $self['errors'] = $errors; + + return $self; + } + + /** + * Submission counts. + * + * @param Input|InputShape $input + */ + public function withInput(Input|array $input): self + { + $self = clone $this; + $self['input'] = $input; + + return $self; + } + + /** + * How pages are selected. + * + * @param Mode|value-of $mode + */ + public function withMode(Mode|string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } + + /** + * Current processing counts. Use `status` to check completion. + * + * @param Progress|ProgressShape $progress + */ + public function withProgress(Progress|array $progress): self + { + $self = clone $this; + $self['progress'] = $progress; + + return $self; + } + + /** + * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * + * @param Results|ResultsShape|null $results + */ + public function withResults(Results|array|null $results): self + { + $self = clone $this; + $self['results'] = $results; + + return $self; + } + + /** + * Current state. `completed`, `cancelled`, and `failed` are final. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * @param Timing|TimingShape $timing + */ + public function withTiming(Timing|array $timing): self + { + $self = clone $this; + $self['timing'] = $timing; + + return $self; + } + + /** + * Output format. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Credits.php b/src/Batch/BatchListResponse/Data/Credits.php new file mode 100644 index 00000000..285e6042 --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Credits.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Credits used by successful pages. + */ + #[Required] + public int $charged; + + /** + * Credits reserved when the batch was accepted. + */ + #[Required] + public int $estimated; + + /** + * `new Credits()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Credits::with(charged: ..., estimated: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Credits)->withCharged(...)->withEstimated(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $charged, int $estimated): self + { + $self = new self; + + $self['charged'] = $charged; + $self['estimated'] = $estimated; + + return $self; + } + + /** + * Credits used by successful pages. + */ + public function withCharged(int $charged): self + { + $self = clone $this; + $self['charged'] = $charged; + + return $self; + } + + /** + * Credits reserved when the batch was accepted. + */ + public function withEstimated(int $estimated): self + { + $self = clone $this; + $self['estimated'] = $estimated; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Error.php b/src/Batch/BatchListResponse/Data/Error.php new file mode 100644 index 00000000..7ee624b1 --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Error.php @@ -0,0 +1,88 @@ + */ + use SdkModel; + + /** + * Batch error code. + */ + #[Required] + public string $code; + + /** + * Batch error message. + */ + #[Required] + public string $message; + + /** + * `new Error()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error::with(code: ..., message: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error)->withCode(...)->withMessage(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, string $message): self + { + $self = new self; + + $self['code'] = $code; + $self['message'] = $message; + + return $self; + } + + /** + * Batch error code. + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Batch error message. + */ + public function withMessage(string $message): self + { + $self = clone $this; + $self['message'] = $message; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Error1.php b/src/Batch/BatchListResponse/Data/Error1.php new file mode 100644 index 00000000..26d8dd81 --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Error1.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Error code for these failures. + */ + #[Required] + public string $code; + + /** + * Pages that failed with this code. + */ + #[Required] + public int $count; + + /** + * `new Error1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Error1::with(code: ..., count: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Error1)->withCode(...)->withCount(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $code, int $count): self + { + $self = new self; + + $self['code'] = $code; + $self['count'] = $count; + + return $self; + } + + /** + * Error code for these failures. + */ + public function withCode(string $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Pages that failed with this code. + */ + public function withCount(int $count): self + { + $self = clone $this; + $self['count'] = $count; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Input.php b/src/Batch/BatchListResponse/Data/Input.php new file mode 100644 index 00000000..f9423b6f --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Input.php @@ -0,0 +1,134 @@ + */ + use SdkModel; + + /** + * Pages accepted, or the crawl page limit. Credits are reserved for this count. + */ + #[Required] + public int $accepted; + + /** + * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + */ + #[Required] + public int $duplicates; + + /** + * Pages rejected during validation. + */ + #[Required] + public int $invalid; + + /** + * Pages submitted before validation. For a crawl, the page limit. + */ + #[Required] + public int $submitted; + + /** + * `new Input()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Input) + * ->withAccepted(...) + * ->withDuplicates(...) + * ->withInvalid(...) + * ->withSubmitted(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $accepted, + int $duplicates, + int $invalid, + int $submitted + ): self { + $self = new self; + + $self['accepted'] = $accepted; + $self['duplicates'] = $duplicates; + $self['invalid'] = $invalid; + $self['submitted'] = $submitted; + + return $self; + } + + /** + * Pages accepted, or the crawl page limit. Credits are reserved for this count. + */ + public function withAccepted(int $accepted): self + { + $self = clone $this; + $self['accepted'] = $accepted; + + return $self; + } + + /** + * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. + */ + public function withDuplicates(int $duplicates): self + { + $self = clone $this; + $self['duplicates'] = $duplicates; + + return $self; + } + + /** + * Pages rejected during validation. + */ + public function withInvalid(int $invalid): self + { + $self = clone $this; + $self['invalid'] = $invalid; + + return $self; + } + + /** + * Pages submitted before validation. For a crawl, the page limit. + */ + public function withSubmitted(int $submitted): self + { + $self = clone $this; + $self['submitted'] = $submitted; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Mode.php b/src/Batch/BatchListResponse/Data/Mode.php new file mode 100644 index 00000000..d8a11a72 --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Mode.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * Pages that could not be scraped. + */ + #[Required] + public int $failed; + + /** + * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + */ + #[Required] + public int $pending; + + /** + * Pages scraped successfully. + */ + #[Required] + public int $succeeded; + + /** + * `new Progress()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Progress::with(failed: ..., pending: ..., succeeded: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Progress)->withFailed(...)->withPending(...)->withSucceeded(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $failed, int $pending, int $succeeded): self + { + $self = new self; + + $self['failed'] = $failed; + $self['pending'] = $pending; + $self['succeeded'] = $succeeded; + + return $self; + } + + /** + * Pages that could not be scraped. + */ + public function withFailed(int $failed): self + { + $self = clone $this; + $self['failed'] = $failed; + + return $self; + } + + /** + * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + */ + public function withPending(int $pending): self + { + $self = clone $this; + $self['pending'] = $pending; + + return $self; + } + + /** + * Pages scraped successfully. + */ + public function withSucceeded(int $succeeded): self + { + $self = clone $this; + $self['succeeded'] = $succeeded; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Results.php b/src/Batch/BatchListResponse/Data/Results.php new file mode 100644 index 00000000..8ebad631 --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Results.php @@ -0,0 +1,99 @@ + + * } + */ +final class Results implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * When the download URLs expire. + */ + #[Required('expires_at')] + public string $expiresAt; + + /** + * Result files. Order is not guaranteed. + * + * @var list $files + */ + #[Required(list: File::class)] + public array $files; + + /** + * `new Results()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Results::with(expiresAt: ..., files: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Results)->withExpiresAt(...)->withFiles(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $files + */ + public static function with(string $expiresAt, array $files): self + { + $self = new self; + + $self['expiresAt'] = $expiresAt; + $self['files'] = $files; + + return $self; + } + + /** + * When the download URLs expire. + */ + public function withExpiresAt(string $expiresAt): self + { + $self = clone $this; + $self['expiresAt'] = $expiresAt; + + return $self; + } + + /** + * Result files. Order is not guaranteed. + * + * @param list $files + */ + public function withFiles(array $files): self + { + $self = clone $this; + $self['files'] = $files; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Results/File.php b/src/Batch/BatchListResponse/Data/Results/File.php new file mode 100644 index 00000000..9e8b5385 --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Results/File.php @@ -0,0 +1,104 @@ + */ + use SdkModel; + + /** + * Compressed file size in bytes. + */ + #[Required] + public int $bytes; + + /** + * Results in this file. + */ + #[Required] + public int $items; + + /** + * Temporary URL for a gzipped NDJSON file. + */ + #[Required] + public string $url; + + /** + * `new File()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * File::with(bytes: ..., items: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new File)->withBytes(...)->withItems(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $bytes, int $items, string $url): self + { + $self = new self; + + $self['bytes'] = $bytes; + $self['items'] = $items; + $self['url'] = $url; + + return $self; + } + + /** + * Compressed file size in bytes. + */ + public function withBytes(int $bytes): self + { + $self = clone $this; + $self['bytes'] = $bytes; + + return $self; + } + + /** + * Results in this file. + */ + public function withItems(int $items): self + { + $self = clone $this; + $self['items'] = $items; + + return $self; + } + + /** + * Temporary URL for a gzipped NDJSON file. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Status.php b/src/Batch/BatchListResponse/Data/Status.php new file mode 100644 index 00000000..b937aada --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Status.php @@ -0,0 +1,23 @@ + */ + use SdkModel; + + /** + * When processing finished. Null while active. + */ + #[Required('completed_at')] + public ?string $completedAt; + + /** + * When the batch was created. + */ + #[Required('created_at')] + public string $createdAt; + + /** + * When processing started. Null while queued. + */ + #[Required('started_at')] + public ?string $startedAt; + + /** + * `new Timing()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Timing::with(completedAt: ..., createdAt: ..., startedAt: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Timing)->withCompletedAt(...)->withCreatedAt(...)->withStartedAt(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $completedAt, + string $createdAt, + ?string $startedAt + ): self { + $self = new self; + + $self['completedAt'] = $completedAt; + $self['createdAt'] = $createdAt; + $self['startedAt'] = $startedAt; + + return $self; + } + + /** + * When processing finished. Null while active. + */ + public function withCompletedAt(?string $completedAt): self + { + $self = clone $this; + $self['completedAt'] = $completedAt; + + return $self; + } + + /** + * When the batch was created. + */ + public function withCreatedAt(string $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * When processing started. Null while queued. + */ + public function withStartedAt(?string $startedAt): self + { + $self = clone $this; + $self['startedAt'] = $startedAt; + + return $self; + } +} diff --git a/src/Batch/BatchListResponse/Data/Type.php b/src/Batch/BatchListResponse/Data/Type.php new file mode 100644 index 00000000..b93f331a --- /dev/null +++ b/src/Batch/BatchListResponse/Data/Type.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Batch/BatchRetrieveParams.php b/src/Batch/BatchRetrieveParams.php new file mode 100644 index 00000000..298df4b1 --- /dev/null +++ b/src/Batch/BatchRetrieveParams.php @@ -0,0 +1,66 @@ +|null} + */ +final class BatchRetrieveParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags + */ + public static function with(?array $tags = null): self + { + $self = new self; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams.php b/src/Batch/BatchSubmitParams.php new file mode 100644 index 00000000..c1a94b35 --- /dev/null +++ b/src/Batch/BatchSubmitParams.php @@ -0,0 +1,131 @@ +|null, + * timeoutMs?: int|null, + * } + */ +final class BatchSubmitParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Known identifiers for the person. At least one identifier is required. + */ + #[Required] + public Identifiers $identifiers; + + /** + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + /** + * `new BatchSubmitParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BatchSubmitParams::with(identifiers: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BatchSubmitParams)->withIdentifiers(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Identifiers|IdentifiersShape $identifiers + * @param list|null $tags + */ + public static function with( + Identifiers|array $identifiers, + ?array $tags = null, + ?int $timeoutMs = null + ): self { + $self = new self; + + $self['identifiers'] = $identifiers; + + null !== $tags && $self['tags'] = $tags; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * Known identifiers for the person. At least one identifier is required. + * + * @param Identifiers|IdentifiersShape $identifiers + */ + public function withIdentifiers(Identifiers|array $identifiers): self + { + $self = clone $this; + $self['identifiers'] = $identifiers; + + return $self; + } + + /** + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Identifiers.php b/src/Batch/BatchSubmitParams/Identifiers.php new file mode 100644 index 00000000..5ceb6cb5 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Identifiers.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. + */ + #[Optional('linkedinUrl')] + public ?string $linkedinURL; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $linkedinURL = null): self + { + $self = new self; + + null !== $linkedinURL && $self['linkedinURL'] = $linkedinURL; + + return $self; + } + + /** + * LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. + */ + public function withLinkedinURL(string $linkedinURL): self + { + $self = clone $this; + $self['linkedinURL'] = $linkedinURL; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse.php b/src/Batch/BatchSubmitResponse.php new file mode 100644 index 00000000..dd7d5a6a --- /dev/null +++ b/src/Batch/BatchSubmitResponse.php @@ -0,0 +1,186 @@ +, + * metadata: Metadata|MetadataShape, + * person: Person|PersonShape, + * status: Status|value-of, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class BatchSubmitResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * HTTP status code. + * + * @var value-of $code + */ + #[Required(enum: Code::class)] + public int $code; + + /** + * Additional response details. + */ + #[Required] + public Metadata $metadata; + + /** + * Retrieved person profile. + */ + #[Required] + public Person $person; + + /** + * Response status. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new BatchSubmitResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BatchSubmitResponse::with(code: ..., metadata: ..., person: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BatchSubmitResponse) + * ->withCode(...) + * ->withMetadata(...) + * ->withPerson(...) + * ->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Code|value-of $code + * @param Metadata|MetadataShape $metadata + * @param Person|PersonShape $person + * @param Status|value-of $status + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + Code|int $code, + Metadata|array $metadata, + Person|array $person, + Status|string $status, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['code'] = $code; + $self['metadata'] = $metadata; + $self['person'] = $person; + $self['status'] = $status; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * HTTP status code. + * + * @param Code|value-of $code + */ + public function withCode(Code|int $code): self + { + $self = clone $this; + $self['code'] = $code; + + return $self; + } + + /** + * Additional response details. + * + * @param Metadata|MetadataShape $metadata + */ + public function withMetadata(Metadata|array $metadata): self + { + $self = clone $this; + $self['metadata'] = $metadata; + + return $self; + } + + /** + * Retrieved person profile. + * + * @param Person|PersonShape $person + */ + public function withPerson(Person|array $person): self + { + $self = clone $this; + $self['person'] = $person; + + return $self; + } + + /** + * Response status. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Code.php b/src/Batch/BatchSubmitResponse/Code.php new file mode 100644 index 00000000..5fa2c30a --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Code.php @@ -0,0 +1,13 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Metadata.php b/src/Batch/BatchSubmitResponse/Metadata.php new file mode 100644 index 00000000..b0fcfa2f --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Metadata.php @@ -0,0 +1,188 @@ +>, + * sourcesSucceeded: list>, + * urlsAnalyzed: list, + * personalWebsiteURL?: string|null, + * } + */ +final class Metadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Identifiers returned for the person. + */ + #[Required] + public Identifiers $identifiers; + + /** + * Source categories checked. + * + * @var list> $sourcesAttempted + */ + #[Required(list: SourcesAttempted::class)] + public array $sourcesAttempted; + + /** + * Source categories with data. + * + * @var list> $sourcesSucceeded + */ + #[Required(list: SourcesSucceeded::class)] + public array $sourcesSucceeded; + + /** + * URLs reviewed for this profile. + * + * @var list $urlsAnalyzed + */ + #[Required(list: 'string')] + public array $urlsAnalyzed; + + /** + * Personal website URL, when found. + */ + #[Optional('personalWebsiteUrl')] + public ?string $personalWebsiteURL; + + /** + * `new Metadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Metadata::with( + * identifiers: ..., + * sourcesAttempted: ..., + * sourcesSucceeded: ..., + * urlsAnalyzed: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Metadata) + * ->withIdentifiers(...) + * ->withSourcesAttempted(...) + * ->withSourcesSucceeded(...) + * ->withURLsAnalyzed(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Identifiers|IdentifiersShape $identifiers + * @param list> $sourcesAttempted + * @param list> $sourcesSucceeded + * @param list $urlsAnalyzed + */ + public static function with( + Identifiers|array $identifiers, + array $sourcesAttempted, + array $sourcesSucceeded, + array $urlsAnalyzed, + ?string $personalWebsiteURL = null, + ): self { + $self = new self; + + $self['identifiers'] = $identifiers; + $self['sourcesAttempted'] = $sourcesAttempted; + $self['sourcesSucceeded'] = $sourcesSucceeded; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + null !== $personalWebsiteURL && $self['personalWebsiteURL'] = $personalWebsiteURL; + + return $self; + } + + /** + * Identifiers returned for the person. + * + * @param Identifiers|IdentifiersShape $identifiers + */ + public function withIdentifiers(Identifiers|array $identifiers): self + { + $self = clone $this; + $self['identifiers'] = $identifiers; + + return $self; + } + + /** + * Source categories checked. + * + * @param list> $sourcesAttempted + */ + public function withSourcesAttempted(array $sourcesAttempted): self + { + $self = clone $this; + $self['sourcesAttempted'] = $sourcesAttempted; + + return $self; + } + + /** + * Source categories with data. + * + * @param list> $sourcesSucceeded + */ + public function withSourcesSucceeded(array $sourcesSucceeded): self + { + $self = clone $this; + $self['sourcesSucceeded'] = $sourcesSucceeded; + + return $self; + } + + /** + * URLs reviewed for this profile. + * + * @param list $urlsAnalyzed + */ + public function withURLsAnalyzed(array $urlsAnalyzed): self + { + $self = clone $this; + $self['urlsAnalyzed'] = $urlsAnalyzed; + + return $self; + } + + /** + * Personal website URL, when found. + */ + public function withPersonalWebsiteURL(string $personalWebsiteURL): self + { + $self = clone $this; + $self['personalWebsiteURL'] = $personalWebsiteURL; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Metadata/Identifiers.php b/src/Batch/BatchSubmitResponse/Metadata/Identifiers.php new file mode 100644 index 00000000..21ffd4d5 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Metadata/Identifiers.php @@ -0,0 +1,56 @@ + */ + use SdkModel; + + /** + * LinkedIn profile URL. + */ + #[Optional('linkedinUrl')] + public ?string $linkedinURL; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $linkedinURL = null): self + { + $self = new self; + + null !== $linkedinURL && $self['linkedinURL'] = $linkedinURL; + + return $self; + } + + /** + * LinkedIn profile URL. + */ + public function withLinkedinURL(string $linkedinURL): self + { + $self = clone $this; + $self['linkedinURL'] = $linkedinURL; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php b/src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php new file mode 100644 index 00000000..9b095926 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php @@ -0,0 +1,18 @@ +, + * experience: list, + * profile: Profile|ProfileShape, + * skills: list, + * } + */ +final class Person implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Education history. + * + * @var list $education + */ + #[Required(list: Education::class)] + public array $education; + + /** + * Work history. + * + * @var list $experience + */ + #[Required(list: Experience::class)] + public array $experience; + + /** + * Core profile details. + */ + #[Required] + public Profile $profile; + + /** + * Listed skills. + * + * @var list $skills + */ + #[Required(list: Skill::class)] + public array $skills; + + /** + * `new Person()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Person::with(education: ..., experience: ..., profile: ..., skills: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Person) + * ->withEducation(...) + * ->withExperience(...) + * ->withProfile(...) + * ->withSkills(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $education + * @param list $experience + * @param Profile|ProfileShape $profile + * @param list $skills + */ + public static function with( + array $education, + array $experience, + Profile|array $profile, + array $skills + ): self { + $self = new self; + + $self['education'] = $education; + $self['experience'] = $experience; + $self['profile'] = $profile; + $self['skills'] = $skills; + + return $self; + } + + /** + * Education history. + * + * @param list $education + */ + public function withEducation(array $education): self + { + $self = clone $this; + $self['education'] = $education; + + return $self; + } + + /** + * Work history. + * + * @param list $experience + */ + public function withExperience(array $experience): self + { + $self = clone $this; + $self['experience'] = $experience; + + return $self; + } + + /** + * Core profile details. + * + * @param Profile|ProfileShape $profile + */ + public function withProfile(Profile|array $profile): self + { + $self = clone $this; + $self['profile'] = $profile; + + return $self; + } + + /** + * Listed skills. + * + * @param list $skills + */ + public function withSkills(array $skills): self + { + $self = clone $this; + $self['skills'] = $skills; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Education.php b/src/Batch/BatchSubmitResponse/Person/Education.php new file mode 100644 index 00000000..d6d858df --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Education.php @@ -0,0 +1,165 @@ + */ + use SdkModel; + + /** + * School or institution name. + */ + #[Required] + public Institution $institution; + + /** + * Education dates. + */ + #[Optional] + public ?Dates $dates; + + /** + * Additional education details. + */ + #[Optional] + public ?string $description; + + /** + * Area of study. + */ + #[Optional] + public ?string $fieldOfStudy; + + /** + * Degree, certificate, or credential. + */ + #[Optional] + public ?string $qualification; + + /** + * `new Education()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Education::with(institution: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Education)->withInstitution(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Institution|InstitutionShape $institution + * @param Dates|DatesShape|null $dates + */ + public static function with( + Institution|array $institution, + Dates|array|null $dates = null, + ?string $description = null, + ?string $fieldOfStudy = null, + ?string $qualification = null, + ): self { + $self = new self; + + $self['institution'] = $institution; + + null !== $dates && $self['dates'] = $dates; + null !== $description && $self['description'] = $description; + null !== $fieldOfStudy && $self['fieldOfStudy'] = $fieldOfStudy; + null !== $qualification && $self['qualification'] = $qualification; + + return $self; + } + + /** + * School or institution name. + * + * @param Institution|InstitutionShape $institution + */ + public function withInstitution(Institution|array $institution): self + { + $self = clone $this; + $self['institution'] = $institution; + + return $self; + } + + /** + * Education dates. + * + * @param Dates|DatesShape $dates + */ + public function withDates(Dates|array $dates): self + { + $self = clone $this; + $self['dates'] = $dates; + + return $self; + } + + /** + * Additional education details. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * Area of study. + */ + public function withFieldOfStudy(string $fieldOfStudy): self + { + $self = clone $this; + $self['fieldOfStudy'] = $fieldOfStudy; + + return $self; + } + + /** + * Degree, certificate, or credential. + */ + public function withQualification(string $qualification): self + { + $self = clone $this; + $self['qualification'] = $qualification; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Dates.php b/src/Batch/BatchSubmitResponse/Person/Education/Dates.php new file mode 100644 index 00000000..64de5392 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Education/Dates.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * End date, when known. + */ + #[Optional] + public ?EndDate $endDate; + + /** + * Whether the entry is current. + */ + #[Optional] + public ?bool $isCurrent; + + /** + * Start date, when known. + */ + #[Optional] + public ?StartDate $startDate; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param EndDate|EndDateShape|null $endDate + * @param StartDate|StartDateShape|null $startDate + */ + public static function with( + EndDate|array|null $endDate = null, + ?bool $isCurrent = null, + StartDate|array|null $startDate = null, + ): self { + $self = new self; + + null !== $endDate && $self['endDate'] = $endDate; + null !== $isCurrent && $self['isCurrent'] = $isCurrent; + null !== $startDate && $self['startDate'] = $startDate; + + return $self; + } + + /** + * End date, when known. + * + * @param EndDate|EndDateShape $endDate + */ + public function withEndDate(EndDate|array $endDate): self + { + $self = clone $this; + $self['endDate'] = $endDate; + + return $self; + } + + /** + * Whether the entry is current. + */ + public function withIsCurrent(bool $isCurrent): self + { + $self = clone $this; + $self['isCurrent'] = $isCurrent; + + return $self; + } + + /** + * Start date, when known. + * + * @param StartDate|StartDateShape $startDate + */ + public function withStartDate(StartDate|array $startDate): self + { + $self = clone $this; + $self['startDate'] = $startDate; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Dates/EndDate.php b/src/Batch/BatchSubmitResponse/Person/Education/Dates/EndDate.php new file mode 100644 index 00000000..6abd73f3 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Education/Dates/EndDate.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Year value. + */ + #[Required] + public int $year; + + /** + * Day value, when known. + */ + #[Optional] + public ?int $day; + + /** + * Month value, when known. + */ + #[Optional] + public ?int $month; + + /** + * `new EndDate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * EndDate::with(year: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new EndDate)->withYear(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $year, + ?int $day = null, + ?int $month = null + ): self { + $self = new self; + + $self['year'] = $year; + + null !== $day && $self['day'] = $day; + null !== $month && $self['month'] = $month; + + return $self; + } + + /** + * Year value. + */ + public function withYear(int $year): self + { + $self = clone $this; + $self['year'] = $year; + + return $self; + } + + /** + * Day value, when known. + */ + public function withDay(int $day): self + { + $self = clone $this; + $self['day'] = $day; + + return $self; + } + + /** + * Month value, when known. + */ + public function withMonth(int $month): self + { + $self = clone $this; + $self['month'] = $month; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Dates/StartDate.php b/src/Batch/BatchSubmitResponse/Person/Education/Dates/StartDate.php new file mode 100644 index 00000000..356edb26 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Education/Dates/StartDate.php @@ -0,0 +1,113 @@ + */ + use SdkModel; + + /** + * Year value. + */ + #[Required] + public int $year; + + /** + * Day value, when known. + */ + #[Optional] + public ?int $day; + + /** + * Month value, when known. + */ + #[Optional] + public ?int $month; + + /** + * `new StartDate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * StartDate::with(year: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new StartDate)->withYear(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $year, + ?int $day = null, + ?int $month = null + ): self { + $self = new self; + + $self['year'] = $year; + + null !== $day && $self['day'] = $day; + null !== $month && $self['month'] = $month; + + return $self; + } + + /** + * Year value. + */ + public function withYear(int $year): self + { + $self = clone $this; + $self['year'] = $year; + + return $self; + } + + /** + * Day value, when known. + */ + public function withDay(int $day): self + { + $self = clone $this; + $self['day'] = $day; + + return $self; + } + + /** + * Month value, when known. + */ + public function withMonth(int $month): self + { + $self = clone $this; + $self['month'] = $month; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Institution.php b/src/Batch/BatchSubmitResponse/Person/Education/Institution.php new file mode 100644 index 00000000..55d16cfd --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Education/Institution.php @@ -0,0 +1,94 @@ + */ + use SdkModel; + + /** + * Display name. + */ + #[Required] + public string $display; + + /** + * Standardized name, when available. + */ + #[Optional] + public ?string $normalized; + + /** + * `new Institution()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Institution::with(display: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Institution)->withDisplay(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $display, + ?string $normalized = null + ): self { + $self = new self; + + $self['display'] = $display; + + null !== $normalized && $self['normalized'] = $normalized; + + return $self; + } + + /** + * Display name. + */ + public function withDisplay(string $display): self + { + $self = clone $this; + $self['display'] = $display; + + return $self; + } + + /** + * Standardized name, when available. + */ + public function withNormalized(string $normalized): self + { + $self = clone $this; + $self['normalized'] = $normalized; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience.php b/src/Batch/BatchSubmitResponse/Person/Experience.php new file mode 100644 index 00000000..b1a0e498 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Experience.php @@ -0,0 +1,145 @@ + */ + use SdkModel; + + /** + * Company or organization name. + */ + #[Required] + public Company $company; + + /** + * Role or job title. + */ + #[Required] + public string $title; + + /** + * Role dates. + */ + #[Optional] + public ?Dates $dates; + + /** + * Role description. + */ + #[Optional] + public ?string $description; + + /** + * `new Experience()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Experience::with(company: ..., title: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Experience)->withCompany(...)->withTitle(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Company|CompanyShape $company + * @param Dates|DatesShape|null $dates + */ + public static function with( + Company|array $company, + string $title, + Dates|array|null $dates = null, + ?string $description = null, + ): self { + $self = new self; + + $self['company'] = $company; + $self['title'] = $title; + + null !== $dates && $self['dates'] = $dates; + null !== $description && $self['description'] = $description; + + return $self; + } + + /** + * Company or organization name. + * + * @param Company|CompanyShape $company + */ + public function withCompany(Company|array $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * Role or job title. + */ + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * Role dates. + * + * @param Dates|DatesShape $dates + */ + public function withDates(Dates|array $dates): self + { + $self = clone $this; + $self['dates'] = $dates; + + return $self; + } + + /** + * Role description. + */ + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Company.php b/src/Batch/BatchSubmitResponse/Person/Experience/Company.php new file mode 100644 index 00000000..400e046c --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Experience/Company.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * Display name. + */ + #[Required] + public string $display; + + /** + * Standardized name, when available. + */ + #[Optional] + public ?string $normalized; + + /** + * `new Company()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Company::with(display: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Company)->withDisplay(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $display, + ?string $normalized = null + ): self { + $self = new self; + + $self['display'] = $display; + + null !== $normalized && $self['normalized'] = $normalized; + + return $self; + } + + /** + * Display name. + */ + public function withDisplay(string $display): self + { + $self = clone $this; + $self['display'] = $display; + + return $self; + } + + /** + * Standardized name, when available. + */ + public function withNormalized(string $normalized): self + { + $self = clone $this; + $self['normalized'] = $normalized; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Dates.php b/src/Batch/BatchSubmitResponse/Person/Experience/Dates.php new file mode 100644 index 00000000..3480d509 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Experience/Dates.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * End date, when known. + */ + #[Optional] + public ?EndDate $endDate; + + /** + * Whether the entry is current. + */ + #[Optional] + public ?bool $isCurrent; + + /** + * Start date, when known. + */ + #[Optional] + public ?StartDate $startDate; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param EndDate|EndDateShape|null $endDate + * @param StartDate|StartDateShape|null $startDate + */ + public static function with( + EndDate|array|null $endDate = null, + ?bool $isCurrent = null, + StartDate|array|null $startDate = null, + ): self { + $self = new self; + + null !== $endDate && $self['endDate'] = $endDate; + null !== $isCurrent && $self['isCurrent'] = $isCurrent; + null !== $startDate && $self['startDate'] = $startDate; + + return $self; + } + + /** + * End date, when known. + * + * @param EndDate|EndDateShape $endDate + */ + public function withEndDate(EndDate|array $endDate): self + { + $self = clone $this; + $self['endDate'] = $endDate; + + return $self; + } + + /** + * Whether the entry is current. + */ + public function withIsCurrent(bool $isCurrent): self + { + $self = clone $this; + $self['isCurrent'] = $isCurrent; + + return $self; + } + + /** + * Start date, when known. + * + * @param StartDate|StartDateShape $startDate + */ + public function withStartDate(StartDate|array $startDate): self + { + $self = clone $this; + $self['startDate'] = $startDate; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Dates/EndDate.php b/src/Batch/BatchSubmitResponse/Person/Experience/Dates/EndDate.php new file mode 100644 index 00000000..97231468 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Experience/Dates/EndDate.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Year value. + */ + #[Required] + public int $year; + + /** + * Day value, when known. + */ + #[Optional] + public ?int $day; + + /** + * Month value, when known. + */ + #[Optional] + public ?int $month; + + /** + * `new EndDate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * EndDate::with(year: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new EndDate)->withYear(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $year, + ?int $day = null, + ?int $month = null + ): self { + $self = new self; + + $self['year'] = $year; + + null !== $day && $self['day'] = $day; + null !== $month && $self['month'] = $month; + + return $self; + } + + /** + * Year value. + */ + public function withYear(int $year): self + { + $self = clone $this; + $self['year'] = $year; + + return $self; + } + + /** + * Day value, when known. + */ + public function withDay(int $day): self + { + $self = clone $this; + $self['day'] = $day; + + return $self; + } + + /** + * Month value, when known. + */ + public function withMonth(int $month): self + { + $self = clone $this; + $self['month'] = $month; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Dates/StartDate.php b/src/Batch/BatchSubmitResponse/Person/Experience/Dates/StartDate.php new file mode 100644 index 00000000..a8a241da --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Experience/Dates/StartDate.php @@ -0,0 +1,113 @@ + */ + use SdkModel; + + /** + * Year value. + */ + #[Required] + public int $year; + + /** + * Day value, when known. + */ + #[Optional] + public ?int $day; + + /** + * Month value, when known. + */ + #[Optional] + public ?int $month; + + /** + * `new StartDate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * StartDate::with(year: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new StartDate)->withYear(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $year, + ?int $day = null, + ?int $month = null + ): self { + $self = new self; + + $self['year'] = $year; + + null !== $day && $self['day'] = $day; + null !== $month && $self['month'] = $month; + + return $self; + } + + /** + * Year value. + */ + public function withYear(int $year): self + { + $self = clone $this; + $self['year'] = $year; + + return $self; + } + + /** + * Day value, when known. + */ + public function withDay(int $day): self + { + $self = clone $this; + $self['day'] = $day; + + return $self; + } + + /** + * Month value, when known. + */ + public function withMonth(int $month): self + { + $self = clone $this; + $self['month'] = $month; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Profile.php b/src/Batch/BatchSubmitResponse/Person/Profile.php new file mode 100644 index 00000000..fb6274e6 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Profile.php @@ -0,0 +1,139 @@ + */ + use SdkModel; + + /** + * Person's full name. + */ + #[Optional] + public ?string $fullName; + + /** + * Short professional headline. + */ + #[Optional] + public ?string $headline; + + /** + * Person's listed location. + */ + #[Optional] + public ?string $location; + + /** + * Profile image URL. + */ + #[Optional('profilePictureUrl')] + public ?string $profilePictureURL; + + /** + * Brief profile summary. + */ + #[Optional] + public ?string $summary; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $fullName = null, + ?string $headline = null, + ?string $location = null, + ?string $profilePictureURL = null, + ?string $summary = null, + ): self { + $self = new self; + + null !== $fullName && $self['fullName'] = $fullName; + null !== $headline && $self['headline'] = $headline; + null !== $location && $self['location'] = $location; + null !== $profilePictureURL && $self['profilePictureURL'] = $profilePictureURL; + null !== $summary && $self['summary'] = $summary; + + return $self; + } + + /** + * Person's full name. + */ + public function withFullName(string $fullName): self + { + $self = clone $this; + $self['fullName'] = $fullName; + + return $self; + } + + /** + * Short professional headline. + */ + public function withHeadline(string $headline): self + { + $self = clone $this; + $self['headline'] = $headline; + + return $self; + } + + /** + * Person's listed location. + */ + public function withLocation(string $location): self + { + $self = clone $this; + $self['location'] = $location; + + return $self; + } + + /** + * Profile image URL. + */ + public function withProfilePictureURL(string $profilePictureURL): self + { + $self = clone $this; + $self['profilePictureURL'] = $profilePictureURL; + + return $self; + } + + /** + * Brief profile summary. + */ + public function withSummary(string $summary): self + { + $self = clone $this; + $self['summary'] = $summary; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Skill.php b/src/Batch/BatchSubmitResponse/Person/Skill.php new file mode 100644 index 00000000..b5e9c82e --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Person/Skill.php @@ -0,0 +1,111 @@ + */ + use SdkModel; + + /** + * Skill name. + */ + #[Required] + public string $name; + + /** + * Standardized skill name, when available. + */ + #[Optional] + public ?string $normalized; + + /** + * Skill proficiency, when available. + */ + #[Optional] + public ?string $proficiency; + + /** + * `new Skill()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Skill::with(name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Skill)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $name, + ?string $normalized = null, + ?string $proficiency = null + ): self { + $self = new self; + + $self['name'] = $name; + + null !== $normalized && $self['normalized'] = $normalized; + null !== $proficiency && $self['proficiency'] = $proficiency; + + return $self; + } + + /** + * Skill name. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * Standardized skill name, when available. + */ + public function withNormalized(string $normalized): self + { + $self = clone $this; + $self['normalized'] = $normalized; + + return $self; + } + + /** + * Skill proficiency, when available. + */ + public function withProficiency(string $proficiency): self + { + $self = clone $this; + $self['proficiency'] = $proficiency; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Status.php b/src/Batch/BatchSubmitResponse/Status.php new file mode 100644 index 00000000..e71e05d5 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Status.php @@ -0,0 +1,13 @@ +industry = new IndustryService($this); $this->utility = new UtilityService($this); $this->monitors = new MonitorsService($this); + $this->batch = new BatchService($this); } /** @return array */ diff --git a/src/ServiceContracts/BatchContract.php b/src/ServiceContracts/BatchContract.php new file mode 100644 index 00000000..08d60d28 --- /dev/null +++ b/src/ServiceContracts/BatchContract.php @@ -0,0 +1,107 @@ + $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $batchID, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchGetResponse; + + /** + * @api + * + * @param string $cursor cursor from the previous page + * @param int $limit Batches per page. Defaults to 25. + * @param Status|value-of $status filter by status + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function list( + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchListResponse; + + /** + * @api + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function cancel( + string $batchID, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchCancelResponse; + + /** + * @api + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param string $cursor next_cursor from the previous page + * @param int $limit Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function getResults( + string $batchID, + ?string $cursor = null, + ?int $limit = null, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchGetResultsResponse; + + /** + * @api + * + * @param Identifiers|IdentifiersShape $identifiers Known identifiers for the person. At least one identifier is required. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function submit( + Identifiers|array $identifiers, + ?array $tags = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BatchSubmitResponse; +} diff --git a/src/ServiceContracts/BatchRawContract.php b/src/ServiceContracts/BatchRawContract.php new file mode 100644 index 00000000..caad131c --- /dev/null +++ b/src/ServiceContracts/BatchRawContract.php @@ -0,0 +1,106 @@ +|BatchRetrieveParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $batchID, + array|BatchRetrieveParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BatchListParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function list( + array|BatchListParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param array|BatchCancelParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function cancel( + string $batchID, + array|BatchCancelParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param array|BatchGetResultsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function getResults( + string $batchID, + array|BatchGetResultsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; + + /** + * @api + * + * @param array|BatchSubmitParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function submit( + array|BatchSubmitParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/Services/BatchRawService.php b/src/Services/BatchRawService.php new file mode 100644 index 00000000..5fde21b1 --- /dev/null +++ b/src/Services/BatchRawService.php @@ -0,0 +1,208 @@ +}|BatchRetrieveParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function retrieve( + string $batchID, + array|BatchRetrieveParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BatchRetrieveParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['batch/%1$s', $batchID], + query: $parsed, + options: $options, + convert: BatchGetResponse::class, + ); + } + + /** + * @api + * + * List your batches from newest to oldest. Filter by status or continue with a cursor. + * + * @param array{ + * cursor?: string, + * limit?: int, + * status?: Status|value-of, + * tags?: list, + * }|BatchListParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function list( + array|BatchListParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BatchListParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'batch/list', + query: $parsed, + options: $options, + convert: BatchListResponse::class, + ); + } + + /** + * @api + * + * Stop a batch from starting new pages. In-progress pages finish, and unused credits are refunded. + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param array{tags?: list}|BatchCancelParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function cancel( + string $batchID, + array|BatchCancelParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BatchCancelParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: ['batch/%1$s/cancel', $batchID], + query: $parsed, + options: $options, + convert: BatchCancelResponse::class, + ); + } + + /** + * @api + * + * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param array{ + * cursor?: string, limit?: int, tags?: list + * }|BatchGetResultsParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function getResults( + string $batchID, + array|BatchGetResultsParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BatchGetResultsParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: ['batch/%1$s/results', $batchID], + query: $parsed, + options: $options, + convert: BatchGetResultsResponse::class, + ); + } + + /** + * @api + * + * Retrieve and normalize a person profile from identifiers. + * + * @param array{ + * identifiers: Identifiers|IdentifiersShape, + * tags?: list, + * timeoutMs?: int, + * }|BatchSubmitParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function submit( + array|BatchSubmitParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BatchSubmitParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'people/retrieve', + body: (object) $parsed, + options: $options, + convert: BatchSubmitResponse::class, + ); + } +} diff --git a/src/Services/BatchService.php b/src/Services/BatchService.php new file mode 100644 index 00000000..b5c9c4bf --- /dev/null +++ b/src/Services/BatchService.php @@ -0,0 +1,183 @@ +raw = new BatchRawService($client); + } + + /** + * @api + * + * Check progress and get download links when the batch finishes. Also returns the rejected-URL list and webhook signing secret from submission, so nothing is lost if the submit response was dropped. + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function retrieve( + string $batchID, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchGetResponse { + $params = Util::removeNulls(['tags' => $tags]); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->retrieve($batchID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * List your batches from newest to oldest. Filter by status or continue with a cursor. + * + * @param string $cursor cursor from the previous page + * @param int $limit Batches per page. Defaults to 25. + * @param Status|value-of $status filter by status + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function list( + ?string $cursor = null, + ?int $limit = null, + Status|string|null $status = null, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchListResponse { + $params = Util::removeNulls( + [ + 'cursor' => $cursor, + 'limit' => $limit, + 'status' => $status, + 'tags' => $tags, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->list(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Stop a batch from starting new pages. In-progress pages finish, and unused credits are refunded. + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function cancel( + string $batchID, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchCancelResponse { + $params = Util::removeNulls(['tags' => $tags]); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->cancel($batchID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param string $cursor next_cursor from the previous page + * @param int $limit Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records. + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function getResults( + string $batchID, + ?string $cursor = null, + ?int $limit = null, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BatchGetResultsResponse { + $params = Util::removeNulls( + ['cursor' => $cursor, 'limit' => $limit, 'tags' => $tags] + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->getResults($batchID, params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } + + /** + * @api + * + * Retrieve and normalize a person profile from identifiers. + * + * @param Identifiers|IdentifiersShape $identifiers Known identifiers for the person. At least one identifier is required. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function submit( + Identifiers|array $identifiers, + ?array $tags = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): BatchSubmitResponse { + $params = Util::removeNulls( + [ + 'identifiers' => $identifiers, + 'tags' => $tags, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->submit(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/tests/Services/BatchTest.php b/tests/Services/BatchTest.php new file mode 100644 index 00000000..1da9404d --- /dev/null +++ b/tests/Services/BatchTest.php @@ -0,0 +1,118 @@ +client = $client; + } + + #[Test] + public function testRetrieve(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->batch->retrieve('batch_9f2c8a'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BatchGetResponse::class, $result); + } + + #[Test] + public function testList(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->batch->list(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BatchListResponse::class, $result); + } + + #[Test] + public function testCancel(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->batch->cancel('batch_9f2c8a'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BatchCancelResponse::class, $result); + } + + #[Test] + public function testGetResults(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->batch->getResults('batch_9f2c8a'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BatchGetResultsResponse::class, $result); + } + + #[Test] + public function testSubmit(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->batch->submit(identifiers: []); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BatchSubmitResponse::class, $result); + } + + #[Test] + public function testSubmitWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->batch->submit( + identifiers: [ + 'linkedinURL' => 'https://www.linkedin.com/in/yahia-bakour/', + ], + tags: ['production', 'team-alpha'], + timeoutMs: 1000, + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BatchSubmitResponse::class, $result); + } +} From 5b020ccdaab25548274e904d0699fba02f020be9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 21:32:26 +0000 Subject: [PATCH 071/130] feat(api): api update --- .stats.yml | 4 +- src/Batch/BatchCancelParams.php | 66 ----------------------- src/Batch/BatchCancelResponse.php | 27 ++++++++++ src/Batch/BatchGetResponse.php | 27 ++++++++++ src/Batch/BatchGetResultsParams.php | 33 ++---------- src/Batch/BatchListParams.php | 65 +++++++++++++++++----- src/Batch/BatchListParams/SearchType.php | 15 ++++++ src/Batch/BatchListResponse/Data.php | 27 ++++++++++ src/Batch/BatchRetrieveParams.php | 66 ----------------------- src/ServiceContracts/BatchContract.php | 19 ++++--- src/ServiceContracts/BatchRawContract.php | 10 +--- src/Services/BatchRawService.php | 41 +++++--------- src/Services/BatchService.php | 33 +++++------- 13 files changed, 193 insertions(+), 240 deletions(-) delete mode 100644 src/Batch/BatchCancelParams.php create mode 100644 src/Batch/BatchListParams/SearchType.php delete mode 100644 src/Batch/BatchRetrieveParams.php diff --git a/.stats.yml b/.stats.yml index a173ebea..86253ea2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-6dfc33639ef5ad1fd0fa05f9f00fcdd59940188ef625252c6ee9db85c6f8fc59.yml -openapi_spec_hash: fb66e1f80fb2aad8adc4ae37d69bdc02 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-cdff38301573d05fdad8416847402472ff6cb1ce75a9de9f99e8673ddec7c4a6.yml +openapi_spec_hash: 387fe6f53599abb0341764e00bcd0b26 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchCancelParams.php b/src/Batch/BatchCancelParams.php deleted file mode 100644 index e84b867a..00000000 --- a/src/Batch/BatchCancelParams.php +++ /dev/null @@ -1,66 +0,0 @@ -|null} - */ -final class BatchCancelParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $tags - */ - public static function with(?array $tags = null): self - { - $self = new self; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse.php b/src/Batch/BatchCancelResponse.php index ef75113d..32d5ff1d 100644 --- a/src/Batch/BatchCancelResponse.php +++ b/src/Batch/BatchCancelResponse.php @@ -40,6 +40,7 @@ * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, + * tags: list, * timing: Timing|TimingShape, * type: Type|value-of, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, @@ -110,6 +111,14 @@ final class BatchCancelResponse implements BaseModel #[Required(enum: Status::class)] public string $status; + /** + * Tags stored on the batch at submission. + * + * @var list $tags + */ + #[Required(list: 'string')] + public array $tags; + #[Required] public Timing $timing; @@ -142,6 +151,7 @@ final class BatchCancelResponse implements BaseModel * progress: ..., * results: ..., * status: ..., + * tags: ..., * timing: ..., * type: ..., * ) @@ -160,6 +170,7 @@ final class BatchCancelResponse implements BaseModel * ->withProgress(...) * ->withResults(...) * ->withStatus(...) + * ->withTags(...) * ->withTiming(...) * ->withType(...) * ``` @@ -182,6 +193,7 @@ public function __construct() * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status + * @param list $tags * @param Timing|TimingShape $timing * @param Type|value-of $type * @param KeyMetadata|KeyMetadataShape|null $keyMetadata @@ -196,6 +208,7 @@ public static function with( Progress|array $progress, Results|array|null $results, Status|string $status, + array $tags, Timing|array $timing, Type|string $type, KeyMetadata|array|null $keyMetadata = null, @@ -211,6 +224,7 @@ public static function with( $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; + $self['tags'] = $tags; $self['timing'] = $timing; $self['type'] = $type; @@ -334,6 +348,19 @@ public function withStatus(Status|string $status): self return $self; } + /** + * Tags stored on the batch at submission. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * @param Timing|TimingShape $timing */ diff --git a/src/Batch/BatchGetResponse.php b/src/Batch/BatchGetResponse.php index 48998a46..6510cd44 100644 --- a/src/Batch/BatchGetResponse.php +++ b/src/Batch/BatchGetResponse.php @@ -43,6 +43,7 @@ * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, + * tags: list, * timing: Timing|TimingShape, * type: Type|value-of, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, @@ -122,6 +123,14 @@ final class BatchGetResponse implements BaseModel #[Required(enum: Status::class)] public string $status; + /** + * Tags stored on the batch at submission. + * + * @var list $tags + */ + #[Required(list: 'string')] + public array $tags; + #[Required] public Timing $timing; @@ -161,6 +170,7 @@ final class BatchGetResponse implements BaseModel * progress: ..., * results: ..., * status: ..., + * tags: ..., * timing: ..., * type: ..., * ) @@ -180,6 +190,7 @@ final class BatchGetResponse implements BaseModel * ->withProgress(...) * ->withResults(...) * ->withStatus(...) + * ->withTags(...) * ->withTiming(...) * ->withType(...) * ``` @@ -203,6 +214,7 @@ public function __construct() * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status + * @param list $tags * @param Timing|TimingShape $timing * @param Type|value-of $type * @param KeyMetadata|KeyMetadataShape|null $keyMetadata @@ -218,6 +230,7 @@ public static function with( Progress|array $progress, Results|array|null $results, Status|string $status, + array $tags, Timing|array $timing, Type|string $type, KeyMetadata|array|null $keyMetadata = null, @@ -235,6 +248,7 @@ public static function with( $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; + $self['tags'] = $tags; $self['timing'] = $timing; $self['type'] = $type; @@ -372,6 +386,19 @@ public function withStatus(Status|string $status): self return $self; } + /** + * Tags stored on the batch at submission. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * @param Timing|TimingShape $timing */ diff --git a/src/Batch/BatchGetResultsParams.php b/src/Batch/BatchGetResultsParams.php index ef30a6a7..074f707c 100644 --- a/src/Batch/BatchGetResultsParams.php +++ b/src/Batch/BatchGetResultsParams.php @@ -15,7 +15,7 @@ * @see ContextDev\Services\BatchService::getResults() * * @phpstan-type BatchGetResultsParamsShape = array{ - * cursor?: string|null, limit?: int|null, tags?: list|null + * cursor?: string|null, limit?: int|null * } */ final class BatchGetResultsParams implements BaseModel @@ -36,14 +36,6 @@ final class BatchGetResultsParams implements BaseModel #[Optional] public ?int $limit; - /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - public function __construct() { $this->initialize(); @@ -53,19 +45,13 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $tags */ - public static function with( - ?string $cursor = null, - ?int $limit = null, - ?array $tags = null - ): self { + public static function with(?string $cursor = null, ?int $limit = null): self + { $self = new self; null !== $cursor && $self['cursor'] = $cursor; null !== $limit && $self['limit'] = $limit; - null !== $tags && $self['tags'] = $tags; return $self; } @@ -91,17 +77,4 @@ public function withLimit(int $limit): self return $self; } - - /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } } diff --git a/src/Batch/BatchListParams.php b/src/Batch/BatchListParams.php index 95cea08a..1cb99f16 100644 --- a/src/Batch/BatchListParams.php +++ b/src/Batch/BatchListParams.php @@ -4,6 +4,7 @@ namespace ContextDev\Batch; +use ContextDev\Batch\BatchListParams\SearchType; use ContextDev\Batch\BatchListParams\Status; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Concerns\SdkModel; @@ -18,8 +19,10 @@ * @phpstan-type BatchListParamsShape = array{ * cursor?: string|null, * limit?: int|null, + * q?: string|null, + * searchType?: null|SearchType|value-of, * status?: null|Status|value-of, - * tags?: list|null, + * tags?: string|null, * } */ final class BatchListParams implements BaseModel @@ -40,6 +43,20 @@ final class BatchListParams implements BaseModel #[Optional] public ?int $limit; + /** + * Free-text search term, matched against the batch id, crawl source (start URL or sitemap domain), and tags. + */ + #[Optional] + public ?string $q; + + /** + * `prefix` for as-you-type prefix matching (default), `exact` for full-token matching. + * + * @var value-of|null $searchType + */ + #[Optional(enum: SearchType::class)] + public ?string $searchType; + /** * Filter by status. * @@ -49,12 +66,10 @@ final class BatchListParams implements BaseModel public ?string $status; /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @var list|null $tags + * Comma-separated list of tags to filter by (matches batches having any of them). */ - #[Optional(list: 'string')] - public ?array $tags; + #[Optional] + public ?string $tags; public function __construct() { @@ -66,19 +81,23 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param SearchType|value-of|null $searchType * @param Status|value-of|null $status - * @param list|null $tags */ public static function with( ?string $cursor = null, ?int $limit = null, + ?string $q = null, + SearchType|string|null $searchType = null, Status|string|null $status = null, - ?array $tags = null, + ?string $tags = null, ): self { $self = new self; null !== $cursor && $self['cursor'] = $cursor; null !== $limit && $self['limit'] = $limit; + null !== $q && $self['q'] = $q; + null !== $searchType && $self['searchType'] = $searchType; null !== $status && $self['status'] = $status; null !== $tags && $self['tags'] = $tags; @@ -107,6 +126,30 @@ public function withLimit(int $limit): self return $self; } + /** + * Free-text search term, matched against the batch id, crawl source (start URL or sitemap domain), and tags. + */ + public function withQ(string $q): self + { + $self = clone $this; + $self['q'] = $q; + + return $self; + } + + /** + * `prefix` for as-you-type prefix matching (default), `exact` for full-token matching. + * + * @param SearchType|value-of $searchType + */ + public function withSearchType(SearchType|string $searchType): self + { + $self = clone $this; + $self['searchType'] = $searchType; + + return $self; + } + /** * Filter by status. * @@ -121,11 +164,9 @@ public function withStatus(Status|string $status): self } /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @param list $tags + * Comma-separated list of tags to filter by (matches batches having any of them). */ - public function withTags(array $tags): self + public function withTags(string $tags): self { $self = clone $this; $self['tags'] = $tags; diff --git a/src/Batch/BatchListParams/SearchType.php b/src/Batch/BatchListParams/SearchType.php new file mode 100644 index 00000000..3bf299ac --- /dev/null +++ b/src/Batch/BatchListParams/SearchType.php @@ -0,0 +1,15 @@ +, + * tags: list, * timing: Timing|TimingShape, * type: Type|value-of, * } @@ -108,6 +109,14 @@ final class Data implements BaseModel #[Required(enum: Status::class)] public string $status; + /** + * Tags stored on the batch at submission. + * + * @var list $tags + */ + #[Required(list: 'string')] + public array $tags; + #[Required] public Timing $timing; @@ -134,6 +143,7 @@ final class Data implements BaseModel * progress: ..., * results: ..., * status: ..., + * tags: ..., * timing: ..., * type: ..., * ) @@ -152,6 +162,7 @@ final class Data implements BaseModel * ->withProgress(...) * ->withResults(...) * ->withStatus(...) + * ->withTags(...) * ->withTiming(...) * ->withType(...) * ``` @@ -174,6 +185,7 @@ public function __construct() * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status + * @param list $tags * @param Timing|TimingShape $timing * @param Type|value-of $type */ @@ -187,6 +199,7 @@ public static function with( Progress|array $progress, Results|array|null $results, Status|string $status, + array $tags, Timing|array $timing, Type|string $type, ): self { @@ -201,6 +214,7 @@ public static function with( $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; + $self['tags'] = $tags; $self['timing'] = $timing; $self['type'] = $type; @@ -322,6 +336,19 @@ public function withStatus(Status|string $status): self return $self; } + /** + * Tags stored on the batch at submission. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + /** * @param Timing|TimingShape $timing */ diff --git a/src/Batch/BatchRetrieveParams.php b/src/Batch/BatchRetrieveParams.php deleted file mode 100644 index 298df4b1..00000000 --- a/src/Batch/BatchRetrieveParams.php +++ /dev/null @@ -1,66 +0,0 @@ -|null} - */ -final class BatchRetrieveParams implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - use SdkParams; - - /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @var list|null $tags - */ - #[Optional(list: 'string')] - public ?array $tags; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list|null $tags - */ - public static function with(?array $tags = null): self - { - $self = new self; - - null !== $tags && $self['tags'] = $tags; - - return $self; - } - - /** - * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * - * @param list $tags - */ - public function withTags(array $tags): self - { - $self = clone $this; - $self['tags'] = $tags; - - return $self; - } -} diff --git a/src/ServiceContracts/BatchContract.php b/src/ServiceContracts/BatchContract.php index 08d60d28..dd2416b2 100644 --- a/src/ServiceContracts/BatchContract.php +++ b/src/ServiceContracts/BatchContract.php @@ -7,6 +7,7 @@ use ContextDev\Batch\BatchCancelResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsResponse; +use ContextDev\Batch\BatchListParams\SearchType; use ContextDev\Batch\BatchListParams\Status; use ContextDev\Batch\BatchListResponse; use ContextDev\Batch\BatchSubmitParams\Identifiers; @@ -24,15 +25,13 @@ interface BatchContract * @api * * @param string $batchID ID of the batch to retrieve or cancel - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function retrieve( string $batchID, - ?array $tags = null, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BatchGetResponse; /** @@ -40,8 +39,10 @@ public function retrieve( * * @param string $cursor cursor from the previous page * @param int $limit Batches per page. Defaults to 25. + * @param string $q free-text search term, matched against the batch id, crawl source (start URL or sitemap domain), and tags + * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching * @param Status|value-of $status filter by status - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param string $tags comma-separated list of tags to filter by (matches batches having any of them) * @param RequestOpts|null $requestOptions * * @throws APIException @@ -49,8 +50,10 @@ public function retrieve( public function list( ?string $cursor = null, ?int $limit = null, + ?string $q = null, + SearchType|string|null $searchType = null, Status|string|null $status = null, - ?array $tags = null, + ?string $tags = null, RequestOptions|array|null $requestOptions = null, ): BatchListResponse; @@ -58,15 +61,13 @@ public function list( * @api * * @param string $batchID ID of the batch to retrieve or cancel - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function cancel( string $batchID, - ?array $tags = null, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BatchCancelResponse; /** @@ -75,7 +76,6 @@ public function cancel( * @param string $batchID ID of the batch to retrieve or cancel * @param string $cursor next_cursor from the previous page * @param int $limit Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records. - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -84,7 +84,6 @@ public function getResults( string $batchID, ?string $cursor = null, ?int $limit = null, - ?array $tags = null, RequestOptions|array|null $requestOptions = null, ): BatchGetResultsResponse; diff --git a/src/ServiceContracts/BatchRawContract.php b/src/ServiceContracts/BatchRawContract.php index caad131c..39e76737 100644 --- a/src/ServiceContracts/BatchRawContract.php +++ b/src/ServiceContracts/BatchRawContract.php @@ -4,14 +4,12 @@ namespace ContextDev\ServiceContracts; -use ContextDev\Batch\BatchCancelParams; use ContextDev\Batch\BatchCancelResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsParams; use ContextDev\Batch\BatchGetResultsResponse; use ContextDev\Batch\BatchListParams; use ContextDev\Batch\BatchListResponse; -use ContextDev\Batch\BatchRetrieveParams; use ContextDev\Batch\BatchSubmitParams; use ContextDev\Batch\BatchSubmitResponse; use ContextDev\Core\Contracts\BaseResponse; @@ -27,7 +25,6 @@ interface BatchRawContract * @api * * @param string $batchID ID of the batch to retrieve or cancel - * @param array|BatchRetrieveParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse @@ -36,8 +33,7 @@ interface BatchRawContract */ public function retrieve( string $batchID, - array|BatchRetrieveParams $params, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BaseResponse; /** @@ -59,7 +55,6 @@ public function list( * @api * * @param string $batchID ID of the batch to retrieve or cancel - * @param array|BatchCancelParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse @@ -68,8 +63,7 @@ public function list( */ public function cancel( string $batchID, - array|BatchCancelParams $params, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BaseResponse; /** diff --git a/src/Services/BatchRawService.php b/src/Services/BatchRawService.php index 5fde21b1..e3aa5f0d 100644 --- a/src/Services/BatchRawService.php +++ b/src/Services/BatchRawService.php @@ -4,21 +4,21 @@ namespace ContextDev\Services; -use ContextDev\Batch\BatchCancelParams; use ContextDev\Batch\BatchCancelResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsParams; use ContextDev\Batch\BatchGetResultsResponse; use ContextDev\Batch\BatchListParams; +use ContextDev\Batch\BatchListParams\SearchType; use ContextDev\Batch\BatchListParams\Status; use ContextDev\Batch\BatchListResponse; -use ContextDev\Batch\BatchRetrieveParams; use ContextDev\Batch\BatchSubmitParams; use ContextDev\Batch\BatchSubmitParams\Identifiers; use ContextDev\Batch\BatchSubmitResponse; use ContextDev\Client; use ContextDev\Core\Contracts\BaseResponse; use ContextDev\Core\Exceptions\APIException; +use ContextDev\Core\Util; use ContextDev\RequestOptions; use ContextDev\ServiceContracts\BatchRawContract; @@ -40,7 +40,6 @@ public function __construct(private Client $client) {} * Check progress and get download links when the batch finishes. Also returns the rejected-URL list and webhook signing secret from submission, so nothing is lost if the submit response was dropped. * * @param string $batchID ID of the batch to retrieve or cancel - * @param array{tags?: list}|BatchRetrieveParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse @@ -49,20 +48,13 @@ public function __construct(private Client $client) {} */ public function retrieve( string $batchID, - array|BatchRetrieveParams $params, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BaseResponse { - [$parsed, $options] = BatchRetrieveParams::parseRequest( - $params, - $requestOptions, - ); - // @phpstan-ignore-next-line return.type return $this->client->request( method: 'get', path: ['batch/%1$s', $batchID], - query: $parsed, - options: $options, + options: $requestOptions, convert: BatchGetResponse::class, ); } @@ -75,8 +67,10 @@ public function retrieve( * @param array{ * cursor?: string, * limit?: int, + * q?: string, + * searchType?: SearchType|value-of, * status?: Status|value-of, - * tags?: list, + * tags?: string, * }|BatchListParams $params * @param RequestOpts|null $requestOptions * @@ -97,7 +91,10 @@ public function list( return $this->client->request( method: 'get', path: 'batch/list', - query: $parsed, + query: Util::array_transform_keys( + $parsed, + ['searchType' => 'search_type'] + ), options: $options, convert: BatchListResponse::class, ); @@ -109,7 +106,6 @@ public function list( * Stop a batch from starting new pages. In-progress pages finish, and unused credits are refunded. * * @param string $batchID ID of the batch to retrieve or cancel - * @param array{tags?: list}|BatchCancelParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse @@ -118,20 +114,13 @@ public function list( */ public function cancel( string $batchID, - array|BatchCancelParams $params, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BaseResponse { - [$parsed, $options] = BatchCancelParams::parseRequest( - $params, - $requestOptions, - ); - // @phpstan-ignore-next-line return.type return $this->client->request( method: 'post', path: ['batch/%1$s/cancel', $batchID], - query: $parsed, - options: $options, + options: $requestOptions, convert: BatchCancelResponse::class, ); } @@ -142,9 +131,7 @@ public function cancel( * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. * * @param string $batchID ID of the batch to retrieve or cancel - * @param array{ - * cursor?: string, limit?: int, tags?: list - * }|BatchGetResultsParams $params + * @param array{cursor?: string, limit?: int}|BatchGetResultsParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse diff --git a/src/Services/BatchService.php b/src/Services/BatchService.php index b5c9c4bf..386c2283 100644 --- a/src/Services/BatchService.php +++ b/src/Services/BatchService.php @@ -7,6 +7,7 @@ use ContextDev\Batch\BatchCancelResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsResponse; +use ContextDev\Batch\BatchListParams\SearchType; use ContextDev\Batch\BatchListParams\Status; use ContextDev\Batch\BatchListResponse; use ContextDev\Batch\BatchSubmitParams\Identifiers; @@ -42,20 +43,16 @@ public function __construct(private Client $client) * Check progress and get download links when the batch finishes. Also returns the rejected-URL list and webhook signing secret from submission, so nothing is lost if the submit response was dropped. * * @param string $batchID ID of the batch to retrieve or cancel - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function retrieve( string $batchID, - ?array $tags = null, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BatchGetResponse { - $params = Util::removeNulls(['tags' => $tags]); - // @phpstan-ignore-next-line argument.type - $response = $this->raw->retrieve($batchID, params: $params, requestOptions: $requestOptions); + $response = $this->raw->retrieve($batchID, requestOptions: $requestOptions); return $response->parse(); } @@ -67,8 +64,10 @@ public function retrieve( * * @param string $cursor cursor from the previous page * @param int $limit Batches per page. Defaults to 25. + * @param string $q free-text search term, matched against the batch id, crawl source (start URL or sitemap domain), and tags + * @param SearchType|value-of $searchType `prefix` for as-you-type prefix matching (default), `exact` for full-token matching * @param Status|value-of $status filter by status - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param string $tags comma-separated list of tags to filter by (matches batches having any of them) * @param RequestOpts|null $requestOptions * * @throws APIException @@ -76,14 +75,18 @@ public function retrieve( public function list( ?string $cursor = null, ?int $limit = null, + ?string $q = null, + SearchType|string|null $searchType = null, Status|string|null $status = null, - ?array $tags = null, + ?string $tags = null, RequestOptions|array|null $requestOptions = null, ): BatchListResponse { $params = Util::removeNulls( [ 'cursor' => $cursor, 'limit' => $limit, + 'q' => $q, + 'searchType' => $searchType, 'status' => $status, 'tags' => $tags, ], @@ -101,20 +104,16 @@ public function list( * Stop a batch from starting new pages. In-progress pages finish, and unused credits are refunded. * * @param string $batchID ID of the batch to retrieve or cancel - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function cancel( string $batchID, - ?array $tags = null, - RequestOptions|array|null $requestOptions = null, + RequestOptions|array|null $requestOptions = null ): BatchCancelResponse { - $params = Util::removeNulls(['tags' => $tags]); - // @phpstan-ignore-next-line argument.type - $response = $this->raw->cancel($batchID, params: $params, requestOptions: $requestOptions); + $response = $this->raw->cancel($batchID, requestOptions: $requestOptions); return $response->parse(); } @@ -127,7 +126,6 @@ public function cancel( * @param string $batchID ID of the batch to retrieve or cancel * @param string $cursor next_cursor from the previous page * @param int $limit Records per page. Defaults to 25. A page can close early so its payload stays under ~8 MB; rely on next_cursor rather than counting records. - * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param RequestOpts|null $requestOptions * * @throws APIException @@ -136,12 +134,9 @@ public function getResults( string $batchID, ?string $cursor = null, ?int $limit = null, - ?array $tags = null, RequestOptions|array|null $requestOptions = null, ): BatchGetResultsResponse { - $params = Util::removeNulls( - ['cursor' => $cursor, 'limit' => $limit, 'tags' => $tags] - ); + $params = Util::removeNulls(['cursor' => $cursor, 'limit' => $limit]); // @phpstan-ignore-next-line argument.type $response = $this->raw->getResults($batchID, params: $params, requestOptions: $requestOptions); From 3e711558855b77c57fa377bb1709566a95b4af42 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 30 Jul 2026 23:26:14 +0000 Subject: [PATCH 072/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 86253ea2..eec42c92 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-cdff38301573d05fdad8416847402472ff6cb1ce75a9de9f99e8673ddec7c4a6.yml -openapi_spec_hash: 387fe6f53599abb0341764e00bcd0b26 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1b0d50368dea5273a516e385bba67202320cc9692bbeba21735cd615e380c375.yml +openapi_spec_hash: e55a3d1cc7217e874931a231d180c247 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 079f3760f47fb44f95704c97852d18d83ceb9016 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 05:56:51 +0000 Subject: [PATCH 073/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index eec42c92..e8bb28d0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1b0d50368dea5273a516e385bba67202320cc9692bbeba21735cd615e380c375.yml -openapi_spec_hash: e55a3d1cc7217e874931a231d180c247 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-31c3cdf42b1a2e726724539dd613d902c72afdf75fa8da028c79eee9d6d71ea4.yml +openapi_spec_hash: 409abf0799543827d54ea7293ffa5b74 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From fca0d45dd782d000c7bcce9a4834e82a62774836 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 06:35:07 +0000 Subject: [PATCH 074/130] feat(api): api update --- .stats.yml | 4 +- src/Web/WebWebScrapeHTMLResponse.php | 47 +++++ .../ActionsApplied.php | 170 ++++++++++++++++++ .../ActionsApplied/Status.php | 17 ++ src/Web/WebWebScrapeMdResponse.php | 47 +++++ .../WebWebScrapeMdResponse/ActionsApplied.php | 170 ++++++++++++++++++ .../ActionsApplied/Status.php | 17 ++ 7 files changed, 470 insertions(+), 2 deletions(-) create mode 100644 src/Web/WebWebScrapeHTMLResponse/ActionsApplied.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/ActionsApplied/Status.php create mode 100644 src/Web/WebWebScrapeMdResponse/ActionsApplied.php create mode 100644 src/Web/WebWebScrapeMdResponse/ActionsApplied/Status.php diff --git a/.stats.yml b/.stats.yml index e8bb28d0..75e4f88c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-31c3cdf42b1a2e726724539dd613d902c72afdf75fa8da028c79eee9d6d71ea4.yml -openapi_spec_hash: 409abf0799543827d54ea7293ffa5b74 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c7e18da06db76bc8a22f2466e13b1958aedf1791ae3310e289f4c5a3dd522936.yml +openapi_spec_hash: 17d1ac64568e4f0ef529692cd3667175 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Web/WebWebScrapeHTMLResponse.php b/src/Web/WebWebScrapeHTMLResponse.php index 12aab0e8..a1b31a69 100644 --- a/src/Web/WebWebScrapeHTMLResponse.php +++ b/src/Web/WebWebScrapeHTMLResponse.php @@ -8,12 +8,14 @@ use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebWebScrapeHTMLResponse\ActionsApplied; use ContextDev\Web\WebWebScrapeHTMLResponse\KeyMetadata; use ContextDev\Web\WebWebScrapeHTMLResponse\Metadata; use ContextDev\Web\WebWebScrapeHTMLResponse\Type; /** * @phpstan-import-type MetadataShape from \ContextDev\Web\WebWebScrapeHTMLResponse\Metadata + * @phpstan-import-type ActionsAppliedShape from \ContextDev\Web\WebWebScrapeHTMLResponse\ActionsApplied * @phpstan-import-type KeyMetadataShape from \ContextDev\Web\WebWebScrapeHTMLResponse\KeyMetadata * * @phpstan-type WebWebScrapeHTMLResponseShape = array{ @@ -22,6 +24,8 @@ * success: bool, * type: Type|value-of, * url: string, + * actionsApplied?: list|null, + * actionsHTMLStale?: bool|null, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * } */ @@ -62,6 +66,20 @@ final class WebWebScrapeHTMLResponse implements BaseModel #[Required] public string $url; + /** + * One verified outcome per requested browser action, in request order. + * + * @var list|null $actionsApplied + */ + #[Optional(list: ActionsApplied::class)] + public ?array $actionsApplied; + + /** + * True when an action was applied but the returned content could not be refreshed afterward. + */ + #[Optional('actionsHtmlStale')] + public ?bool $actionsHTMLStale; + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. */ @@ -101,6 +119,7 @@ public function __construct() * * @param Metadata|MetadataShape $metadata * @param Type|value-of $type + * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( @@ -109,6 +128,8 @@ public static function with( bool $success, Type|string $type, string $url, + ?array $actionsApplied = null, + ?bool $actionsHTMLStale = null, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; @@ -119,6 +140,8 @@ public static function with( $self['type'] = $type; $self['url'] = $url; + null !== $actionsApplied && $self['actionsApplied'] = $actionsApplied; + null !== $actionsHTMLStale && $self['actionsHTMLStale'] = $actionsHTMLStale; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; return $self; @@ -183,6 +206,30 @@ public function withURL(string $url): self return $self; } + /** + * One verified outcome per requested browser action, in request order. + * + * @param list $actionsApplied + */ + public function withActionsApplied(array $actionsApplied): self + { + $self = clone $this; + $self['actionsApplied'] = $actionsApplied; + + return $self; + } + + /** + * True when an action was applied but the returned content could not be refreshed afterward. + */ + public function withActionsHTMLStale(bool $actionsHTMLStale): self + { + $self = clone $this; + $self['actionsHTMLStale'] = $actionsHTMLStale; + + return $self; + } + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. * diff --git a/src/Web/WebWebScrapeHTMLResponse/ActionsApplied.php b/src/Web/WebWebScrapeHTMLResponse/ActionsApplied.php new file mode 100644 index 00000000..fa00ce35 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/ActionsApplied.php @@ -0,0 +1,170 @@ +, + * completionEvidence?: string|null, + * durationMs?: float|null, + * error?: string|null, + * method?: string|null, + * targetDescription?: string|null, + * } + */ +final class ActionsApplied implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $instruction; + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Visible page evidence used to verify an applied action. + */ + #[Optional] + public ?string $completionEvidence; + + #[Optional] + public ?float $durationMs; + + #[Optional] + public ?string $error; + + #[Optional] + public ?string $method; + + #[Optional] + public ?string $targetDescription; + + /** + * `new ActionsApplied()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ActionsApplied::with(instruction: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ActionsApplied)->withInstruction(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with( + string $instruction, + Status|string $status, + ?string $completionEvidence = null, + ?float $durationMs = null, + ?string $error = null, + ?string $method = null, + ?string $targetDescription = null, + ): self { + $self = new self; + + $self['instruction'] = $instruction; + $self['status'] = $status; + + null !== $completionEvidence && $self['completionEvidence'] = $completionEvidence; + null !== $durationMs && $self['durationMs'] = $durationMs; + null !== $error && $self['error'] = $error; + null !== $method && $self['method'] = $method; + null !== $targetDescription && $self['targetDescription'] = $targetDescription; + + return $self; + } + + public function withInstruction(string $instruction): self + { + $self = clone $this; + $self['instruction'] = $instruction; + + return $self; + } + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Visible page evidence used to verify an applied action. + */ + public function withCompletionEvidence(string $completionEvidence): self + { + $self = clone $this; + $self['completionEvidence'] = $completionEvidence; + + return $self; + } + + public function withDurationMs(float $durationMs): self + { + $self = clone $this; + $self['durationMs'] = $durationMs; + + return $self; + } + + public function withError(string $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + public function withMethod(string $method): self + { + $self = clone $this; + $self['method'] = $method; + + return $self; + } + + public function withTargetDescription(string $targetDescription): self + { + $self = clone $this; + $self['targetDescription'] = $targetDescription; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/ActionsApplied/Status.php b/src/Web/WebWebScrapeHTMLResponse/ActionsApplied/Status.php new file mode 100644 index 00000000..354d3ad0 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/ActionsApplied/Status.php @@ -0,0 +1,17 @@ +|null, + * actionsHTMLStale?: bool|null, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * } */ @@ -59,6 +63,20 @@ final class WebWebScrapeMdResponse implements BaseModel #[Required] public string $url; + /** + * One verified outcome per requested browser action, in request order. + * + * @var list|null $actionsApplied + */ + #[Optional(list: ActionsApplied::class)] + public ?array $actionsApplied; + + /** + * True when an action was applied but the returned content could not be refreshed afterward. + */ + #[Optional('actionsHtmlStale')] + public ?bool $actionsHTMLStale; + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. */ @@ -97,6 +115,7 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param Metadata|MetadataShape $metadata + * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( @@ -105,6 +124,8 @@ public static function with( Metadata|array $metadata, bool $success, string $url, + ?array $actionsApplied = null, + ?bool $actionsHTMLStale = null, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; @@ -115,6 +136,8 @@ public static function with( $self['success'] = $success; $self['url'] = $url; + null !== $actionsApplied && $self['actionsApplied'] = $actionsApplied; + null !== $actionsHTMLStale && $self['actionsHTMLStale'] = $actionsHTMLStale; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; return $self; @@ -177,6 +200,30 @@ public function withURL(string $url): self return $self; } + /** + * One verified outcome per requested browser action, in request order. + * + * @param list $actionsApplied + */ + public function withActionsApplied(array $actionsApplied): self + { + $self = clone $this; + $self['actionsApplied'] = $actionsApplied; + + return $self; + } + + /** + * True when an action was applied but the returned content could not be refreshed afterward. + */ + public function withActionsHTMLStale(bool $actionsHTMLStale): self + { + $self = clone $this; + $self['actionsHTMLStale'] = $actionsHTMLStale; + + return $self; + } + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. * diff --git a/src/Web/WebWebScrapeMdResponse/ActionsApplied.php b/src/Web/WebWebScrapeMdResponse/ActionsApplied.php new file mode 100644 index 00000000..18b886e0 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/ActionsApplied.php @@ -0,0 +1,170 @@ +, + * completionEvidence?: string|null, + * durationMs?: float|null, + * error?: string|null, + * method?: string|null, + * targetDescription?: string|null, + * } + */ +final class ActionsApplied implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $instruction; + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Visible page evidence used to verify an applied action. + */ + #[Optional] + public ?string $completionEvidence; + + #[Optional] + public ?float $durationMs; + + #[Optional] + public ?string $error; + + #[Optional] + public ?string $method; + + #[Optional] + public ?string $targetDescription; + + /** + * `new ActionsApplied()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ActionsApplied::with(instruction: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ActionsApplied)->withInstruction(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with( + string $instruction, + Status|string $status, + ?string $completionEvidence = null, + ?float $durationMs = null, + ?string $error = null, + ?string $method = null, + ?string $targetDescription = null, + ): self { + $self = new self; + + $self['instruction'] = $instruction; + $self['status'] = $status; + + null !== $completionEvidence && $self['completionEvidence'] = $completionEvidence; + null !== $durationMs && $self['durationMs'] = $durationMs; + null !== $error && $self['error'] = $error; + null !== $method && $self['method'] = $method; + null !== $targetDescription && $self['targetDescription'] = $targetDescription; + + return $self; + } + + public function withInstruction(string $instruction): self + { + $self = clone $this; + $self['instruction'] = $instruction; + + return $self; + } + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Visible page evidence used to verify an applied action. + */ + public function withCompletionEvidence(string $completionEvidence): self + { + $self = clone $this; + $self['completionEvidence'] = $completionEvidence; + + return $self; + } + + public function withDurationMs(float $durationMs): self + { + $self = clone $this; + $self['durationMs'] = $durationMs; + + return $self; + } + + public function withError(string $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + public function withMethod(string $method): self + { + $self = clone $this; + $self['method'] = $method; + + return $self; + } + + public function withTargetDescription(string $targetDescription): self + { + $self = clone $this; + $self['targetDescription'] = $targetDescription; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/ActionsApplied/Status.php b/src/Web/WebWebScrapeMdResponse/ActionsApplied/Status.php new file mode 100644 index 00000000..ad83f5d1 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/ActionsApplied/Status.php @@ -0,0 +1,17 @@ + Date: Fri, 31 Jul 2026 07:58:13 +0000 Subject: [PATCH 075/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 75e4f88c..b3a442f0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c7e18da06db76bc8a22f2466e13b1958aedf1791ae3310e289f4c5a3dd522936.yml -openapi_spec_hash: 17d1ac64568e4f0ef529692cd3667175 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-67d0edd5da21ac5e53c3d1f82d60e5f71a160938ed0e8f2e567b042978792405.yml +openapi_spec_hash: d52bec73da0d689ecce7b95235fc6846 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From eeb0c517fee24a5246319b743294f81925773b56 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 08:04:11 +0000 Subject: [PATCH 076/130] feat(api): api update --- .stats.yml | 4 +- src/Batch/BatchCancelResponse.php | 20 ++--- src/Batch/BatchCancelResponse/Error.php | 88 ------------------- src/Batch/BatchCancelResponse/Error1.php | 86 ------------------ src/Batch/BatchGetResponse.php | 20 ++--- src/Batch/BatchGetResponse/Error1.php | 86 ------------------ src/Batch/BatchListResponse/Data.php | 22 ++--- src/Batch/BatchListResponse/Data/Error.php | 88 ------------------- src/Batch/{BatchGetResponse => }/Error.php | 4 +- .../Data/Error1.php => ErrorCount.php} | 16 ++-- 10 files changed, 42 insertions(+), 392 deletions(-) delete mode 100644 src/Batch/BatchCancelResponse/Error.php delete mode 100644 src/Batch/BatchCancelResponse/Error1.php delete mode 100644 src/Batch/BatchGetResponse/Error1.php delete mode 100644 src/Batch/BatchListResponse/Data/Error.php rename src/Batch/{BatchGetResponse => }/Error.php (94%) rename src/Batch/{BatchListResponse/Data/Error1.php => ErrorCount.php} (77%) diff --git a/.stats.yml b/.stats.yml index b3a442f0..33b70809 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-67d0edd5da21ac5e53c3d1f82d60e5f71a160938ed0e8f2e567b042978792405.yml -openapi_spec_hash: d52bec73da0d689ecce7b95235fc6846 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-960cb623c7ec84bf4dc0f5945cbc19eec9cca48271071f400d96066eaa55dbd6.yml +openapi_spec_hash: 84fd39e3f4dc964bf0c32d4e95da1b34 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchCancelResponse.php b/src/Batch/BatchCancelResponse.php index 32d5ff1d..f0ea9e05 100644 --- a/src/Batch/BatchCancelResponse.php +++ b/src/Batch/BatchCancelResponse.php @@ -5,8 +5,6 @@ namespace ContextDev\Batch; use ContextDev\Batch\BatchCancelResponse\Credits; -use ContextDev\Batch\BatchCancelResponse\Error; -use ContextDev\Batch\BatchCancelResponse\Error1; use ContextDev\Batch\BatchCancelResponse\Input; use ContextDev\Batch\BatchCancelResponse\KeyMetadata; use ContextDev\Batch\BatchCancelResponse\Mode; @@ -22,8 +20,8 @@ /** * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchCancelResponse\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\BatchCancelResponse\Error - * @phpstan-import-type Error1Shape from \ContextDev\Batch\BatchCancelResponse\Error1 + * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error + * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount * @phpstan-import-type InputShape from \ContextDev\Batch\BatchCancelResponse\Input * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchCancelResponse\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchCancelResponse\Results @@ -34,7 +32,7 @@ * id: string, * credits: Credits|CreditsShape, * error: null|Error|ErrorShape, - * errors: list, + * errors: list, * input: Input|InputShape, * mode: Mode|value-of, * progress: Progress|ProgressShape, @@ -64,7 +62,7 @@ final class BatchCancelResponse implements BaseModel public Credits $credits; /** - * Batch-level error. Null unless `status` is `failed`. + * Why the batch failed. */ #[Required] public ?Error $error; @@ -72,9 +70,9 @@ final class BatchCancelResponse implements BaseModel /** * Page failures grouped by error code. * - * @var list $errors + * @var list $errors */ - #[Required(list: Error1::class)] + #[Required(list: ErrorCount::class)] public array $errors; /** @@ -187,7 +185,7 @@ public function __construct() * * @param Credits|CreditsShape $credits * @param Error|ErrorShape|null $error - * @param list $errors + * @param list $errors * @param Input|InputShape $input * @param Mode|value-of $mode * @param Progress|ProgressShape $progress @@ -258,7 +256,7 @@ public function withCredits(Credits|array $credits): self } /** - * Batch-level error. Null unless `status` is `failed`. + * Why the batch failed. * * @param Error|ErrorShape|null $error */ @@ -273,7 +271,7 @@ public function withError(Error|array|null $error): self /** * Page failures grouped by error code. * - * @param list $errors + * @param list $errors */ public function withErrors(array $errors): self { diff --git a/src/Batch/BatchCancelResponse/Error.php b/src/Batch/BatchCancelResponse/Error.php deleted file mode 100644 index bb27e9e7..00000000 --- a/src/Batch/BatchCancelResponse/Error.php +++ /dev/null @@ -1,88 +0,0 @@ - */ - use SdkModel; - - /** - * Batch error code. - */ - #[Required] - public string $code; - - /** - * Batch error message. - */ - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - /** - * Batch error code. - */ - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Batch error message. - */ - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse/Error1.php b/src/Batch/BatchCancelResponse/Error1.php deleted file mode 100644 index f447cf7c..00000000 --- a/src/Batch/BatchCancelResponse/Error1.php +++ /dev/null @@ -1,86 +0,0 @@ - */ - use SdkModel; - - /** - * Error code for these failures. - */ - #[Required] - public string $code; - - /** - * Pages that failed with this code. - */ - #[Required] - public int $count; - - /** - * `new Error1()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error1::with(code: ..., count: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error1)->withCode(...)->withCount(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, int $count): self - { - $self = new self; - - $self['code'] = $code; - $self['count'] = $count; - - return $self; - } - - /** - * Error code for these failures. - */ - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Pages that failed with this code. - */ - public function withCount(int $count): self - { - $self = clone $this; - $self['count'] = $count; - - return $self; - } -} diff --git a/src/Batch/BatchGetResponse.php b/src/Batch/BatchGetResponse.php index 6510cd44..b38d7dac 100644 --- a/src/Batch/BatchGetResponse.php +++ b/src/Batch/BatchGetResponse.php @@ -5,8 +5,6 @@ namespace ContextDev\Batch; use ContextDev\Batch\BatchGetResponse\Credits; -use ContextDev\Batch\BatchGetResponse\Error; -use ContextDev\Batch\BatchGetResponse\Error1; use ContextDev\Batch\BatchGetResponse\Input; use ContextDev\Batch\BatchGetResponse\InvalidURL; use ContextDev\Batch\BatchGetResponse\KeyMetadata; @@ -23,8 +21,8 @@ /** * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchGetResponse\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\BatchGetResponse\Error - * @phpstan-import-type Error1Shape from \ContextDev\Batch\BatchGetResponse\Error1 + * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error + * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount * @phpstan-import-type InputShape from \ContextDev\Batch\BatchGetResponse\Input * @phpstan-import-type InvalidURLShape from \ContextDev\Batch\BatchGetResponse\InvalidURL * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchGetResponse\Progress @@ -36,7 +34,7 @@ * id: string, * credits: Credits|CreditsShape, * error: null|Error|ErrorShape, - * errors: list, + * errors: list, * input: Input|InputShape, * invalidURLs: list, * mode: Mode|value-of, @@ -68,7 +66,7 @@ final class BatchGetResponse implements BaseModel public Credits $credits; /** - * Batch-level error. Null unless `status` is `failed`. + * Why the batch failed. */ #[Required] public ?Error $error; @@ -76,9 +74,9 @@ final class BatchGetResponse implements BaseModel /** * Page failures grouped by error code. * - * @var list $errors + * @var list $errors */ - #[Required(list: Error1::class)] + #[Required(list: ErrorCount::class)] public array $errors; /** @@ -207,7 +205,7 @@ public function __construct() * * @param Credits|CreditsShape $credits * @param Error|ErrorShape|null $error - * @param list $errors + * @param list $errors * @param Input|InputShape $input * @param list $invalidURLs * @param Mode|value-of $mode @@ -283,7 +281,7 @@ public function withCredits(Credits|array $credits): self } /** - * Batch-level error. Null unless `status` is `failed`. + * Why the batch failed. * * @param Error|ErrorShape|null $error */ @@ -298,7 +296,7 @@ public function withError(Error|array|null $error): self /** * Page failures grouped by error code. * - * @param list $errors + * @param list $errors */ public function withErrors(array $errors): self { diff --git a/src/Batch/BatchGetResponse/Error1.php b/src/Batch/BatchGetResponse/Error1.php deleted file mode 100644 index 2b58eae6..00000000 --- a/src/Batch/BatchGetResponse/Error1.php +++ /dev/null @@ -1,86 +0,0 @@ - */ - use SdkModel; - - /** - * Error code for these failures. - */ - #[Required] - public string $code; - - /** - * Pages that failed with this code. - */ - #[Required] - public int $count; - - /** - * `new Error1()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error1::with(code: ..., count: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error1)->withCode(...)->withCount(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, int $count): self - { - $self = new self; - - $self['code'] = $code; - $self['count'] = $count; - - return $self; - } - - /** - * Error code for these failures. - */ - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Pages that failed with this code. - */ - public function withCount(int $count): self - { - $self = clone $this; - $self['count'] = $count; - - return $self; - } -} diff --git a/src/Batch/BatchListResponse/Data.php b/src/Batch/BatchListResponse/Data.php index 1e1b74dd..71940da0 100644 --- a/src/Batch/BatchListResponse/Data.php +++ b/src/Batch/BatchListResponse/Data.php @@ -5,8 +5,6 @@ namespace ContextDev\Batch\BatchListResponse; use ContextDev\Batch\BatchListResponse\Data\Credits; -use ContextDev\Batch\BatchListResponse\Data\Error; -use ContextDev\Batch\BatchListResponse\Data\Error1; use ContextDev\Batch\BatchListResponse\Data\Input; use ContextDev\Batch\BatchListResponse\Data\Mode; use ContextDev\Batch\BatchListResponse\Data\Progress; @@ -14,6 +12,8 @@ use ContextDev\Batch\BatchListResponse\Data\Status; use ContextDev\Batch\BatchListResponse\Data\Timing; use ContextDev\Batch\BatchListResponse\Data\Type; +use ContextDev\Batch\Error; +use ContextDev\Batch\ErrorCount; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; @@ -22,8 +22,8 @@ * An asynchronous web scraping job. * * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchListResponse\Data\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\BatchListResponse\Data\Error - * @phpstan-import-type Error1Shape from \ContextDev\Batch\BatchListResponse\Data\Error1 + * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error + * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount * @phpstan-import-type InputShape from \ContextDev\Batch\BatchListResponse\Data\Input * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchListResponse\Data\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchListResponse\Data\Results @@ -33,7 +33,7 @@ * id: string, * credits: Credits|CreditsShape, * error: null|Error|ErrorShape, - * errors: list, + * errors: list, * input: Input|InputShape, * mode: Mode|value-of, * progress: Progress|ProgressShape, @@ -62,7 +62,7 @@ final class Data implements BaseModel public Credits $credits; /** - * Batch-level error. Null unless `status` is `failed`. + * Why the batch failed. */ #[Required] public ?Error $error; @@ -70,9 +70,9 @@ final class Data implements BaseModel /** * Page failures grouped by error code. * - * @var list $errors + * @var list $errors */ - #[Required(list: Error1::class)] + #[Required(list: ErrorCount::class)] public array $errors; /** @@ -179,7 +179,7 @@ public function __construct() * * @param Credits|CreditsShape $credits * @param Error|ErrorShape|null $error - * @param list $errors + * @param list $errors * @param Input|InputShape $input * @param Mode|value-of $mode * @param Progress|ProgressShape $progress @@ -246,7 +246,7 @@ public function withCredits(Credits|array $credits): self } /** - * Batch-level error. Null unless `status` is `failed`. + * Why the batch failed. * * @param Error|ErrorShape|null $error */ @@ -261,7 +261,7 @@ public function withError(Error|array|null $error): self /** * Page failures grouped by error code. * - * @param list $errors + * @param list $errors */ public function withErrors(array $errors): self { diff --git a/src/Batch/BatchListResponse/Data/Error.php b/src/Batch/BatchListResponse/Data/Error.php deleted file mode 100644 index 7ee624b1..00000000 --- a/src/Batch/BatchListResponse/Data/Error.php +++ /dev/null @@ -1,88 +0,0 @@ - */ - use SdkModel; - - /** - * Batch error code. - */ - #[Required] - public string $code; - - /** - * Batch error message. - */ - #[Required] - public string $message; - - /** - * `new Error()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Error::with(code: ..., message: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Error)->withCode(...)->withMessage(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(string $code, string $message): self - { - $self = new self; - - $self['code'] = $code; - $self['message'] = $message; - - return $self; - } - - /** - * Batch error code. - */ - public function withCode(string $code): self - { - $self = clone $this; - $self['code'] = $code; - - return $self; - } - - /** - * Batch error message. - */ - public function withMessage(string $message): self - { - $self = clone $this; - $self['message'] = $message; - - return $self; - } -} diff --git a/src/Batch/BatchGetResponse/Error.php b/src/Batch/Error.php similarity index 94% rename from src/Batch/BatchGetResponse/Error.php rename to src/Batch/Error.php index 3151f0ce..155483d4 100644 --- a/src/Batch/BatchGetResponse/Error.php +++ b/src/Batch/Error.php @@ -2,14 +2,14 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchGetResponse; +namespace ContextDev\Batch; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** - * Batch-level error. Null unless `status` is `failed`. + * Why the batch failed. * * @phpstan-type ErrorShape = array{code: string, message: string} */ diff --git a/src/Batch/BatchListResponse/Data/Error1.php b/src/Batch/ErrorCount.php similarity index 77% rename from src/Batch/BatchListResponse/Data/Error1.php rename to src/Batch/ErrorCount.php index 26d8dd81..3f34bb84 100644 --- a/src/Batch/BatchListResponse/Data/Error1.php +++ b/src/Batch/ErrorCount.php @@ -2,18 +2,20 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchListResponse\Data; +namespace ContextDev\Batch; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-type Error1Shape = array{code: string, count: int} + * Page failures sharing one error code. + * + * @phpstan-type ErrorCountShape = array{code: string, count: int} */ -final class Error1 implements BaseModel +final class ErrorCount implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; /** @@ -29,17 +31,17 @@ final class Error1 implements BaseModel public int $count; /** - * `new Error1()` is missing required properties by the API. + * `new ErrorCount()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Error1::with(code: ..., count: ...) + * ErrorCount::with(code: ..., count: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Error1)->withCode(...)->withCount(...) + * (new ErrorCount)->withCode(...)->withCount(...) * ``` */ public function __construct() From db0615a1289a86a8baa8e538b1d4cdbc201eaae8 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 08:30:42 +0000 Subject: [PATCH 077/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 4dedeaeb..511dd516 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.5.0" + ".": "2.6.0" } \ No newline at end of file diff --git a/README.md b/README.md index ca69c9f3..2f5e06ff 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.5.0" +composer require "context-dev/context-dev-php 2.6.0" ``` diff --git a/src/Client.php b/src/Client.php index 1e0e41ee..098d6293 100644 --- a/src/Client.php +++ b/src/Client.php @@ -101,7 +101,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.5.0', + 'X-Stainless-Package-Version' => '2.6.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 1c11a974..f690bfb0 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.5.0'; +const VERSION = '2.6.0'; // x-release-please-end From 802691fe75784d7693860f67a3ca7819f0eeeeea Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 22:16:41 +0000 Subject: [PATCH 078/130] feat(api): api update --- .stats.yml | 4 +- src/Batch/BatchCancelResponse.php | 173 +++++++++------- src/Batch/BatchCancelResponse/Credits.php | 52 +++-- .../{Type.php => Format.php} | 4 +- src/Batch/BatchCancelResponse/Input.php | 134 ------------ src/Batch/BatchCancelResponse/Mode.php | 2 +- src/Batch/BatchCancelResponse/Progress.php | 6 +- src/Batch/BatchCancelResponse/Results.php | 2 +- src/Batch/BatchGetResponse.php | 193 +++++++++--------- src/Batch/BatchGetResponse/Credits.php | 52 +++-- .../BatchGetResponse/{Type.php => Format.php} | 4 +- src/Batch/BatchGetResponse/Input.php | 134 ------------ src/Batch/BatchGetResponse/Mode.php | 2 +- src/Batch/BatchGetResponse/Progress.php | 6 +- src/Batch/BatchGetResponse/Results.php | 2 +- src/Batch/BatchListResponse/Data.php | 179 +++++++++------- src/Batch/BatchListResponse/Data/Credits.php | 52 +++-- .../Data/{Type.php => Format.php} | 4 +- src/Batch/BatchListResponse/Data/Input.php | 134 ------------ src/Batch/BatchListResponse/Data/Mode.php | 2 +- src/Batch/BatchListResponse/Data/Progress.php | 6 +- src/Batch/BatchListResponse/Data/Results.php | 2 +- src/Batch/CrawlControls.php | 175 ++++++++++++++++ src/Batch/CrawlControls/Source.php | 33 +++ .../CrawlControls/Source/UnionMember0.php | 87 ++++++++ .../Source/UnionMember0/Type.php | 10 + .../CrawlControls/Source/UnionMember1.php | 89 ++++++++ .../Source/UnionMember1/Type.php | 10 + src/Batch/{Error.php => Failure.php} | 22 +- src/Batch/Intake.php | 164 +++++++++++++++ .../{ErrorCount.php => PageErrorCount.php} | 12 +- src/Services/BatchRawService.php | 2 +- src/Services/BatchService.php | 2 +- 33 files changed, 1016 insertions(+), 739 deletions(-) rename src/Batch/BatchCancelResponse/{Type.php => Format.php} (58%) delete mode 100644 src/Batch/BatchCancelResponse/Input.php rename src/Batch/BatchGetResponse/{Type.php => Format.php} (58%) delete mode 100644 src/Batch/BatchGetResponse/Input.php rename src/Batch/BatchListResponse/Data/{Type.php => Format.php} (59%) delete mode 100644 src/Batch/BatchListResponse/Data/Input.php create mode 100644 src/Batch/CrawlControls.php create mode 100644 src/Batch/CrawlControls/Source.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember0.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember0/Type.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember1.php create mode 100644 src/Batch/CrawlControls/Source/UnionMember1/Type.php rename src/Batch/{Error.php => Failure.php} (70%) create mode 100644 src/Batch/Intake.php rename src/Batch/{ErrorCount.php => PageErrorCount.php} (80%) diff --git a/.stats.yml b/.stats.yml index 33b70809..963533f4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-960cb623c7ec84bf4dc0f5945cbc19eec9cca48271071f400d96066eaa55dbd6.yml -openapi_spec_hash: 84fd39e3f4dc964bf0c32d4e95da1b34 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-838f03b1c3584485eeded993459e6bbae058da9f6df16b7967980fbba98cc748.yml +openapi_spec_hash: 4a9db9cd9eac4ae4e2694b3d835a772f config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchCancelResponse.php b/src/Batch/BatchCancelResponse.php index f0ea9e05..cc1d61f4 100644 --- a/src/Batch/BatchCancelResponse.php +++ b/src/Batch/BatchCancelResponse.php @@ -5,24 +5,24 @@ namespace ContextDev\Batch; use ContextDev\Batch\BatchCancelResponse\Credits; -use ContextDev\Batch\BatchCancelResponse\Input; +use ContextDev\Batch\BatchCancelResponse\Format; use ContextDev\Batch\BatchCancelResponse\KeyMetadata; use ContextDev\Batch\BatchCancelResponse\Mode; use ContextDev\Batch\BatchCancelResponse\Progress; use ContextDev\Batch\BatchCancelResponse\Results; use ContextDev\Batch\BatchCancelResponse\Status; use ContextDev\Batch\BatchCancelResponse\Timing; -use ContextDev\Batch\BatchCancelResponse\Type; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** + * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchCancelResponse\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error - * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount - * @phpstan-import-type InputShape from \ContextDev\Batch\BatchCancelResponse\Input + * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure + * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake + * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchCancelResponse\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchCancelResponse\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchCancelResponse\Timing @@ -30,17 +30,18 @@ * * @phpstan-type BatchCancelResponseShape = array{ * id: string, + * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * error: null|Error|ErrorShape, - * errors: list, - * input: Input|InputShape, + * failure: null|Failure|FailureShape, + * format: Format|value-of, + * input: Intake|IntakeShape, * mode: Mode|value-of, + * pageErrors: list, * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, - * type: Type|value-of, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * } */ @@ -56,33 +57,39 @@ final class BatchCancelResponse implements BaseModel public string $id; /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + */ + #[Required] + public ?CrawlControls $crawl; + + /** + * What this batch has done to your credit balance. */ #[Required] public Credits $credits; /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. */ #[Required] - public ?Error $error; + public ?Failure $failure; /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @var list $errors + * @var value-of $format */ - #[Required(list: ErrorCount::class)] - public array $errors; + #[Required(enum: Format::class)] + public string $format; /** - * Submission counts. + * What submission took in, and what it charged for. */ #[Required] - public Input $input; + public Intake $input; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @var value-of $mode */ @@ -90,13 +97,21 @@ final class BatchCancelResponse implements BaseModel public string $mode; /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @var list $pageErrors + */ + #[Required('page_errors', list: PageErrorCount::class)] + public array $pageErrors; + + /** + * Pages attempted so far. Use `status` to check completion. */ #[Required] public Progress $progress; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. */ #[Required] public ?Results $results; @@ -120,14 +135,6 @@ final class BatchCancelResponse implements BaseModel #[Required] public Timing $timing; - /** - * Output format. - * - * @var value-of $type - */ - #[Required(enum: Type::class)] - public string $type; - /** * API key usage for this request. */ @@ -141,17 +148,18 @@ final class BatchCancelResponse implements BaseModel * ``` * BatchCancelResponse::with( * id: ..., + * crawl: ..., * credits: ..., - * error: ..., - * errors: ..., + * failure: ..., + * format: ..., * input: ..., * mode: ..., + * pageErrors: ..., * progress: ..., * results: ..., * status: ..., * tags: ..., * timing: ..., - * type: ..., * ) * ``` * @@ -160,17 +168,18 @@ final class BatchCancelResponse implements BaseModel * ``` * (new BatchCancelResponse) * ->withID(...) + * ->withCrawl(...) * ->withCredits(...) - * ->withError(...) - * ->withErrors(...) + * ->withFailure(...) + * ->withFormat(...) * ->withInput(...) * ->withMode(...) + * ->withPageErrors(...) * ->withProgress(...) * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) - * ->withType(...) * ``` */ public function __construct() @@ -183,48 +192,51 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Error|ErrorShape|null $error - * @param list $errors - * @param Input|InputShape $input + * @param Failure|FailureShape|null $failure + * @param Format|value-of $format + * @param Intake|IntakeShape $input * @param Mode|value-of $mode + * @param list $pageErrors * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing - * @param Type|value-of $type * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( string $id, + CrawlControls|array|null $crawl, Credits|array $credits, - Error|array|null $error, - array $errors, - Input|array $input, + Failure|array|null $failure, + Format|string $format, + Intake|array $input, Mode|string $mode, + array $pageErrors, Progress|array $progress, Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, - Type|string $type, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; $self['id'] = $id; + $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['error'] = $error; - $self['errors'] = $errors; + $self['failure'] = $failure; + $self['format'] = $format; $self['input'] = $input; $self['mode'] = $mode; + $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; - $self['type'] = $type; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -243,7 +255,20 @@ public function withID(string $id): self } /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + * + * @param CrawlControls|CrawlControlsShape|null $crawl + */ + public function withCrawl(CrawlControls|array|null $crawl): self + { + $self = clone $this; + $self['crawl'] = $crawl; + + return $self; + } + + /** + * What this batch has done to your credit balance. * * @param Credits|CreditsShape $credits */ @@ -256,37 +281,37 @@ public function withCredits(Credits|array $credits): self } /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. * - * @param Error|ErrorShape|null $error + * @param Failure|FailureShape|null $failure */ - public function withError(Error|array|null $error): self + public function withFailure(Failure|array|null $failure): self { $self = clone $this; - $self['error'] = $error; + $self['failure'] = $failure; return $self; } /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @param list $errors + * @param Format|value-of $format */ - public function withErrors(array $errors): self + public function withFormat(Format|string $format): self { $self = clone $this; - $self['errors'] = $errors; + $self['format'] = $format; return $self; } /** - * Submission counts. + * What submission took in, and what it charged for. * - * @param Input|InputShape $input + * @param Intake|IntakeShape $input */ - public function withInput(Input|array $input): self + public function withInput(Intake|array $input): self { $self = clone $this; $self['input'] = $input; @@ -295,7 +320,7 @@ public function withInput(Input|array $input): self } /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @param Mode|value-of $mode */ @@ -308,7 +333,20 @@ public function withMode(Mode|string $mode): self } /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @param list $pageErrors + */ + public function withPageErrors(array $pageErrors): self + { + $self = clone $this; + $self['pageErrors'] = $pageErrors; + + return $self; + } + + /** + * Pages attempted so far. Use `status` to check completion. * * @param Progress|ProgressShape $progress */ @@ -321,7 +359,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @param Results|ResultsShape|null $results */ @@ -370,19 +408,6 @@ public function withTiming(Timing|array $timing): self return $self; } - /** - * Output format. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - /** * API key usage for this request. * diff --git a/src/Batch/BatchCancelResponse/Credits.php b/src/Batch/BatchCancelResponse/Credits.php index 6484e733..4057c7e9 100644 --- a/src/Batch/BatchCancelResponse/Credits.php +++ b/src/Batch/BatchCancelResponse/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Reserved and used credits. + * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{charged: int, estimated: int} + * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} */ final class Credits implements BaseModel { @@ -19,29 +19,35 @@ final class Credits implements BaseModel use SdkModel; /** - * Credits used by successful pages. + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] - public int $charged; + public int $net; /** - * Credits reserved when the batch was accepted. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ #[Required] - public int $estimated; + public int $refunded; + + /** + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + */ + #[Required] + public int $reserved; /** * `new Credits()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Credits::with(charged: ..., estimated: ...) + * Credits::with(net: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withCharged(...)->withEstimated(...) + * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) * ``` */ public function __construct() @@ -54,34 +60,46 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $charged, int $estimated): self + public static function with(int $net, int $refunded, int $reserved): self { $self = new self; - $self['charged'] = $charged; - $self['estimated'] = $estimated; + $self['net'] = $net; + $self['refunded'] = $refunded; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + */ + public function withNet(int $net): self + { + $self = clone $this; + $self['net'] = $net; return $self; } /** - * Credits used by successful pages. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ - public function withCharged(int $charged): self + public function withRefunded(int $refunded): self { $self = clone $this; - $self['charged'] = $charged; + $self['refunded'] = $refunded; return $self; } /** - * Credits reserved when the batch was accepted. + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. */ - public function withEstimated(int $estimated): self + public function withReserved(int $reserved): self { $self = clone $this; - $self['estimated'] = $estimated; + $self['reserved'] = $reserved; return $self; } diff --git a/src/Batch/BatchCancelResponse/Type.php b/src/Batch/BatchCancelResponse/Format.php similarity index 58% rename from src/Batch/BatchCancelResponse/Type.php rename to src/Batch/BatchCancelResponse/Format.php index 30a60b2b..761672da 100644 --- a/src/Batch/BatchCancelResponse/Type.php +++ b/src/Batch/BatchCancelResponse/Format.php @@ -5,9 +5,9 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * Output format. + * What each page is returned as. Matches `input.data.format` on the submit request. */ -enum Type: string +enum Format: string { case MARKDOWN = 'markdown'; diff --git a/src/Batch/BatchCancelResponse/Input.php b/src/Batch/BatchCancelResponse/Input.php deleted file mode 100644 index 684dc94d..00000000 --- a/src/Batch/BatchCancelResponse/Input.php +++ /dev/null @@ -1,134 +0,0 @@ - */ - use SdkModel; - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - #[Required] - public int $accepted; - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - #[Required] - public int $duplicates; - - /** - * Pages rejected during validation. - */ - #[Required] - public int $invalid; - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - #[Required] - public int $submitted; - - /** - * `new Input()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Input) - * ->withAccepted(...) - * ->withDuplicates(...) - * ->withInvalid(...) - * ->withSubmitted(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $accepted, - int $duplicates, - int $invalid, - int $submitted - ): self { - $self = new self; - - $self['accepted'] = $accepted; - $self['duplicates'] = $duplicates; - $self['invalid'] = $invalid; - $self['submitted'] = $submitted; - - return $self; - } - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - public function withAccepted(int $accepted): self - { - $self = clone $this; - $self['accepted'] = $accepted; - - return $self; - } - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - public function withDuplicates(int $duplicates): self - { - $self = clone $this; - $self['duplicates'] = $duplicates; - - return $self; - } - - /** - * Pages rejected during validation. - */ - public function withInvalid(int $invalid): self - { - $self = clone $this; - $self['invalid'] = $invalid; - - return $self; - } - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - public function withSubmitted(int $submitted): self - { - $self = clone $this; - $self['submitted'] = $submitted; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse/Mode.php b/src/Batch/BatchCancelResponse/Mode.php index c530dfac..86127d23 100644 --- a/src/Batch/BatchCancelResponse/Mode.php +++ b/src/Batch/BatchCancelResponse/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. */ enum Mode: string { diff --git a/src/Batch/BatchCancelResponse/Progress.php b/src/Batch/BatchCancelResponse/Progress.php index b180dcaf..7026511e 100644 --- a/src/Batch/BatchCancelResponse/Progress.php +++ b/src/Batch/BatchCancelResponse/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current processing counts. Use `status` to check completion. + * Pages attempted so far. Use `status` to check completion. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -25,7 +25,7 @@ final class Progress implements BaseModel public int $failed; /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ #[Required] public int $pending; @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ public function withPending(int $pending): self { diff --git a/src/Batch/BatchCancelResponse/Results.php b/src/Batch/BatchCancelResponse/Results.php index f28b3d3a..b51cf9c2 100644 --- a/src/Batch/BatchCancelResponse/Results.php +++ b/src/Batch/BatchCancelResponse/Results.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @phpstan-import-type FileShape from \ContextDev\Batch\BatchCancelResponse\Results\File * diff --git a/src/Batch/BatchGetResponse.php b/src/Batch/BatchGetResponse.php index b38d7dac..cad57081 100644 --- a/src/Batch/BatchGetResponse.php +++ b/src/Batch/BatchGetResponse.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch; use ContextDev\Batch\BatchGetResponse\Credits; -use ContextDev\Batch\BatchGetResponse\Input; +use ContextDev\Batch\BatchGetResponse\Format; use ContextDev\Batch\BatchGetResponse\InvalidURL; use ContextDev\Batch\BatchGetResponse\KeyMetadata; use ContextDev\Batch\BatchGetResponse\Mode; @@ -13,18 +13,18 @@ use ContextDev\Batch\BatchGetResponse\Results; use ContextDev\Batch\BatchGetResponse\Status; use ContextDev\Batch\BatchGetResponse\Timing; -use ContextDev\Batch\BatchGetResponse\Type; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** + * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchGetResponse\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error - * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount - * @phpstan-import-type InputShape from \ContextDev\Batch\BatchGetResponse\Input + * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure + * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake * @phpstan-import-type InvalidURLShape from \ContextDev\Batch\BatchGetResponse\InvalidURL + * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchGetResponse\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchGetResponse\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchGetResponse\Timing @@ -32,20 +32,20 @@ * * @phpstan-type BatchGetResponseShape = array{ * id: string, + * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * error: null|Error|ErrorShape, - * errors: list, - * input: Input|InputShape, + * failure: null|Failure|FailureShape, + * format: Format|value-of, + * input: Intake|IntakeShape, * invalidURLs: list, * mode: Mode|value-of, + * pageErrors: list, * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, - * type: Type|value-of, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, - * webhookSecret?: string|null, * } */ final class BatchGetResponse implements BaseModel @@ -60,30 +60,36 @@ final class BatchGetResponse implements BaseModel public string $id; /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + */ + #[Required] + public ?CrawlControls $crawl; + + /** + * What this batch has done to your credit balance. */ #[Required] public Credits $credits; /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. */ #[Required] - public ?Error $error; + public ?Failure $failure; /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @var list $errors + * @var value-of $format */ - #[Required(list: ErrorCount::class)] - public array $errors; + #[Required(enum: Format::class)] + public string $format; /** - * Submission counts. + * What submission took in, and what it charged for. */ #[Required] - public Input $input; + public Intake $input; /** * Rejected URLs, up to 100. These are not charged. @@ -94,7 +100,7 @@ final class BatchGetResponse implements BaseModel public array $invalidURLs; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @var value-of $mode */ @@ -102,13 +108,21 @@ final class BatchGetResponse implements BaseModel public string $mode; /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @var list $pageErrors + */ + #[Required('page_errors', list: PageErrorCount::class)] + public array $pageErrors; + + /** + * Pages attempted so far. Use `status` to check completion. */ #[Required] public Progress $progress; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. */ #[Required] public ?Results $results; @@ -132,26 +146,12 @@ final class BatchGetResponse implements BaseModel #[Required] public Timing $timing; - /** - * Output format. - * - * @var value-of $type - */ - #[Required(enum: Type::class)] - public string $type; - /** * API key usage for this request. */ #[Optional('key_metadata')] public ?KeyMetadata $keyMetadata; - /** - * Webhook signing secret. Also returned by GET /batch/{batch_id}. - */ - #[Optional('webhook_secret')] - public ?string $webhookSecret; - /** * `new BatchGetResponse()` is missing required properties by the API. * @@ -159,18 +159,19 @@ final class BatchGetResponse implements BaseModel * ``` * BatchGetResponse::with( * id: ..., + * crawl: ..., * credits: ..., - * error: ..., - * errors: ..., + * failure: ..., + * format: ..., * input: ..., * invalidURLs: ..., * mode: ..., + * pageErrors: ..., * progress: ..., * results: ..., * status: ..., * tags: ..., * timing: ..., - * type: ..., * ) * ``` * @@ -179,18 +180,19 @@ final class BatchGetResponse implements BaseModel * ``` * (new BatchGetResponse) * ->withID(...) + * ->withCrawl(...) * ->withCredits(...) - * ->withError(...) - * ->withErrors(...) + * ->withFailure(...) + * ->withFormat(...) * ->withInput(...) * ->withInvalidURLs(...) * ->withMode(...) + * ->withPageErrors(...) * ->withProgress(...) * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) - * ->withType(...) * ``` */ public function __construct() @@ -203,55 +205,56 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Error|ErrorShape|null $error - * @param list $errors - * @param Input|InputShape $input + * @param Failure|FailureShape|null $failure + * @param Format|value-of $format + * @param Intake|IntakeShape $input * @param list $invalidURLs * @param Mode|value-of $mode + * @param list $pageErrors * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing - * @param Type|value-of $type * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( string $id, + CrawlControls|array|null $crawl, Credits|array $credits, - Error|array|null $error, - array $errors, - Input|array $input, + Failure|array|null $failure, + Format|string $format, + Intake|array $input, array $invalidURLs, Mode|string $mode, + array $pageErrors, Progress|array $progress, Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, - Type|string $type, KeyMetadata|array|null $keyMetadata = null, - ?string $webhookSecret = null, ): self { $self = new self; $self['id'] = $id; + $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['error'] = $error; - $self['errors'] = $errors; + $self['failure'] = $failure; + $self['format'] = $format; $self['input'] = $input; $self['invalidURLs'] = $invalidURLs; $self['mode'] = $mode; + $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; - $self['type'] = $type; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; - null !== $webhookSecret && $self['webhookSecret'] = $webhookSecret; return $self; } @@ -268,7 +271,20 @@ public function withID(string $id): self } /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + * + * @param CrawlControls|CrawlControlsShape|null $crawl + */ + public function withCrawl(CrawlControls|array|null $crawl): self + { + $self = clone $this; + $self['crawl'] = $crawl; + + return $self; + } + + /** + * What this batch has done to your credit balance. * * @param Credits|CreditsShape $credits */ @@ -281,37 +297,37 @@ public function withCredits(Credits|array $credits): self } /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. * - * @param Error|ErrorShape|null $error + * @param Failure|FailureShape|null $failure */ - public function withError(Error|array|null $error): self + public function withFailure(Failure|array|null $failure): self { $self = clone $this; - $self['error'] = $error; + $self['failure'] = $failure; return $self; } /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @param list $errors + * @param Format|value-of $format */ - public function withErrors(array $errors): self + public function withFormat(Format|string $format): self { $self = clone $this; - $self['errors'] = $errors; + $self['format'] = $format; return $self; } /** - * Submission counts. + * What submission took in, and what it charged for. * - * @param Input|InputShape $input + * @param Intake|IntakeShape $input */ - public function withInput(Input|array $input): self + public function withInput(Intake|array $input): self { $self = clone $this; $self['input'] = $input; @@ -333,7 +349,7 @@ public function withInvalidURLs(array $invalidURLs): self } /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @param Mode|value-of $mode */ @@ -346,7 +362,20 @@ public function withMode(Mode|string $mode): self } /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @param list $pageErrors + */ + public function withPageErrors(array $pageErrors): self + { + $self = clone $this; + $self['pageErrors'] = $pageErrors; + + return $self; + } + + /** + * Pages attempted so far. Use `status` to check completion. * * @param Progress|ProgressShape $progress */ @@ -359,7 +388,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @param Results|ResultsShape|null $results */ @@ -408,19 +437,6 @@ public function withTiming(Timing|array $timing): self return $self; } - /** - * Output format. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } - /** * API key usage for this request. * @@ -433,15 +449,4 @@ public function withKeyMetadata(KeyMetadata|array $keyMetadata): self return $self; } - - /** - * Webhook signing secret. Also returned by GET /batch/{batch_id}. - */ - public function withWebhookSecret(string $webhookSecret): self - { - $self = clone $this; - $self['webhookSecret'] = $webhookSecret; - - return $self; - } } diff --git a/src/Batch/BatchGetResponse/Credits.php b/src/Batch/BatchGetResponse/Credits.php index 5014503d..a4988429 100644 --- a/src/Batch/BatchGetResponse/Credits.php +++ b/src/Batch/BatchGetResponse/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Reserved and used credits. + * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{charged: int, estimated: int} + * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} */ final class Credits implements BaseModel { @@ -19,29 +19,35 @@ final class Credits implements BaseModel use SdkModel; /** - * Credits used by successful pages. + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] - public int $charged; + public int $net; /** - * Credits reserved when the batch was accepted. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ #[Required] - public int $estimated; + public int $refunded; + + /** + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + */ + #[Required] + public int $reserved; /** * `new Credits()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Credits::with(charged: ..., estimated: ...) + * Credits::with(net: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withCharged(...)->withEstimated(...) + * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) * ``` */ public function __construct() @@ -54,34 +60,46 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $charged, int $estimated): self + public static function with(int $net, int $refunded, int $reserved): self { $self = new self; - $self['charged'] = $charged; - $self['estimated'] = $estimated; + $self['net'] = $net; + $self['refunded'] = $refunded; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + */ + public function withNet(int $net): self + { + $self = clone $this; + $self['net'] = $net; return $self; } /** - * Credits used by successful pages. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ - public function withCharged(int $charged): self + public function withRefunded(int $refunded): self { $self = clone $this; - $self['charged'] = $charged; + $self['refunded'] = $refunded; return $self; } /** - * Credits reserved when the batch was accepted. + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. */ - public function withEstimated(int $estimated): self + public function withReserved(int $reserved): self { $self = clone $this; - $self['estimated'] = $estimated; + $self['reserved'] = $reserved; return $self; } diff --git a/src/Batch/BatchGetResponse/Type.php b/src/Batch/BatchGetResponse/Format.php similarity index 58% rename from src/Batch/BatchGetResponse/Type.php rename to src/Batch/BatchGetResponse/Format.php index def0a615..efc85e57 100644 --- a/src/Batch/BatchGetResponse/Type.php +++ b/src/Batch/BatchGetResponse/Format.php @@ -5,9 +5,9 @@ namespace ContextDev\Batch\BatchGetResponse; /** - * Output format. + * What each page is returned as. Matches `input.data.format` on the submit request. */ -enum Type: string +enum Format: string { case MARKDOWN = 'markdown'; diff --git a/src/Batch/BatchGetResponse/Input.php b/src/Batch/BatchGetResponse/Input.php deleted file mode 100644 index 84c30d0a..00000000 --- a/src/Batch/BatchGetResponse/Input.php +++ /dev/null @@ -1,134 +0,0 @@ - */ - use SdkModel; - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - #[Required] - public int $accepted; - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - #[Required] - public int $duplicates; - - /** - * Pages rejected during validation. - */ - #[Required] - public int $invalid; - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - #[Required] - public int $submitted; - - /** - * `new Input()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Input) - * ->withAccepted(...) - * ->withDuplicates(...) - * ->withInvalid(...) - * ->withSubmitted(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $accepted, - int $duplicates, - int $invalid, - int $submitted - ): self { - $self = new self; - - $self['accepted'] = $accepted; - $self['duplicates'] = $duplicates; - $self['invalid'] = $invalid; - $self['submitted'] = $submitted; - - return $self; - } - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - public function withAccepted(int $accepted): self - { - $self = clone $this; - $self['accepted'] = $accepted; - - return $self; - } - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - public function withDuplicates(int $duplicates): self - { - $self = clone $this; - $self['duplicates'] = $duplicates; - - return $self; - } - - /** - * Pages rejected during validation. - */ - public function withInvalid(int $invalid): self - { - $self = clone $this; - $self['invalid'] = $invalid; - - return $self; - } - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - public function withSubmitted(int $submitted): self - { - $self = clone $this; - $self['submitted'] = $submitted; - - return $self; - } -} diff --git a/src/Batch/BatchGetResponse/Mode.php b/src/Batch/BatchGetResponse/Mode.php index 78ded37b..4e90abb3 100644 --- a/src/Batch/BatchGetResponse/Mode.php +++ b/src/Batch/BatchGetResponse/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchGetResponse; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. */ enum Mode: string { diff --git a/src/Batch/BatchGetResponse/Progress.php b/src/Batch/BatchGetResponse/Progress.php index 4a999836..7041e101 100644 --- a/src/Batch/BatchGetResponse/Progress.php +++ b/src/Batch/BatchGetResponse/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current processing counts. Use `status` to check completion. + * Pages attempted so far. Use `status` to check completion. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -25,7 +25,7 @@ final class Progress implements BaseModel public int $failed; /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ #[Required] public int $pending; @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ public function withPending(int $pending): self { diff --git a/src/Batch/BatchGetResponse/Results.php b/src/Batch/BatchGetResponse/Results.php index a91153c0..a8b882f7 100644 --- a/src/Batch/BatchGetResponse/Results.php +++ b/src/Batch/BatchGetResponse/Results.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @phpstan-import-type FileShape from \ContextDev\Batch\BatchGetResponse\Results\File * diff --git a/src/Batch/BatchListResponse/Data.php b/src/Batch/BatchListResponse/Data.php index 71940da0..10df935c 100644 --- a/src/Batch/BatchListResponse/Data.php +++ b/src/Batch/BatchListResponse/Data.php @@ -5,15 +5,16 @@ namespace ContextDev\Batch\BatchListResponse; use ContextDev\Batch\BatchListResponse\Data\Credits; -use ContextDev\Batch\BatchListResponse\Data\Input; +use ContextDev\Batch\BatchListResponse\Data\Format; use ContextDev\Batch\BatchListResponse\Data\Mode; use ContextDev\Batch\BatchListResponse\Data\Progress; use ContextDev\Batch\BatchListResponse\Data\Results; use ContextDev\Batch\BatchListResponse\Data\Status; use ContextDev\Batch\BatchListResponse\Data\Timing; -use ContextDev\Batch\BatchListResponse\Data\Type; -use ContextDev\Batch\Error; -use ContextDev\Batch\ErrorCount; +use ContextDev\Batch\CrawlControls; +use ContextDev\Batch\Failure; +use ContextDev\Batch\Intake; +use ContextDev\Batch\PageErrorCount; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; @@ -21,27 +22,29 @@ /** * An asynchronous web scraping job. * + * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchListResponse\Data\Credits - * @phpstan-import-type ErrorShape from \ContextDev\Batch\Error - * @phpstan-import-type ErrorCountShape from \ContextDev\Batch\ErrorCount - * @phpstan-import-type InputShape from \ContextDev\Batch\BatchListResponse\Data\Input + * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure + * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake + * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchListResponse\Data\Progress * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchListResponse\Data\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchListResponse\Data\Timing * * @phpstan-type DataShape = array{ * id: string, + * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * error: null|Error|ErrorShape, - * errors: list, - * input: Input|InputShape, + * failure: null|Failure|FailureShape, + * format: Format|value-of, + * input: Intake|IntakeShape, * mode: Mode|value-of, + * pageErrors: list, * progress: Progress|ProgressShape, * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, - * type: Type|value-of, * } */ final class Data implements BaseModel @@ -56,33 +59,39 @@ final class Data implements BaseModel public string $id; /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + */ + #[Required] + public ?CrawlControls $crawl; + + /** + * What this batch has done to your credit balance. */ #[Required] public Credits $credits; /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. */ #[Required] - public ?Error $error; + public ?Failure $failure; /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @var list $errors + * @var value-of $format */ - #[Required(list: ErrorCount::class)] - public array $errors; + #[Required(enum: Format::class)] + public string $format; /** - * Submission counts. + * What submission took in, and what it charged for. */ #[Required] - public Input $input; + public Intake $input; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @var value-of $mode */ @@ -90,13 +99,21 @@ final class Data implements BaseModel public string $mode; /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @var list $pageErrors + */ + #[Required('page_errors', list: PageErrorCount::class)] + public array $pageErrors; + + /** + * Pages attempted so far. Use `status` to check completion. */ #[Required] public Progress $progress; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. */ #[Required] public ?Results $results; @@ -120,14 +137,6 @@ final class Data implements BaseModel #[Required] public Timing $timing; - /** - * Output format. - * - * @var value-of $type - */ - #[Required(enum: Type::class)] - public string $type; - /** * `new Data()` is missing required properties by the API. * @@ -135,17 +144,18 @@ final class Data implements BaseModel * ``` * Data::with( * id: ..., + * crawl: ..., * credits: ..., - * error: ..., - * errors: ..., + * failure: ..., + * format: ..., * input: ..., * mode: ..., + * pageErrors: ..., * progress: ..., * results: ..., * status: ..., * tags: ..., * timing: ..., - * type: ..., * ) * ``` * @@ -154,17 +164,18 @@ final class Data implements BaseModel * ``` * (new Data) * ->withID(...) + * ->withCrawl(...) * ->withCredits(...) - * ->withError(...) - * ->withErrors(...) + * ->withFailure(...) + * ->withFormat(...) * ->withInput(...) * ->withMode(...) + * ->withPageErrors(...) * ->withProgress(...) * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) - * ->withType(...) * ``` */ public function __construct() @@ -177,46 +188,49 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Error|ErrorShape|null $error - * @param list $errors - * @param Input|InputShape $input + * @param Failure|FailureShape|null $failure + * @param Format|value-of $format + * @param Intake|IntakeShape $input * @param Mode|value-of $mode + * @param list $pageErrors * @param Progress|ProgressShape $progress * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing - * @param Type|value-of $type */ public static function with( string $id, + CrawlControls|array|null $crawl, Credits|array $credits, - Error|array|null $error, - array $errors, - Input|array $input, + Failure|array|null $failure, + Format|string $format, + Intake|array $input, Mode|string $mode, + array $pageErrors, Progress|array $progress, Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, - Type|string $type, ): self { $self = new self; $self['id'] = $id; + $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['error'] = $error; - $self['errors'] = $errors; + $self['failure'] = $failure; + $self['format'] = $format; $self['input'] = $input; $self['mode'] = $mode; + $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; - $self['type'] = $type; return $self; } @@ -233,7 +247,20 @@ public function withID(string $id): self } /** - * Reserved and used credits. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + * + * @param CrawlControls|CrawlControlsShape|null $crawl + */ + public function withCrawl(CrawlControls|array|null $crawl): self + { + $self = clone $this; + $self['crawl'] = $crawl; + + return $self; + } + + /** + * What this batch has done to your credit balance. * * @param Credits|CreditsShape $credits */ @@ -246,37 +273,37 @@ public function withCredits(Credits|array $credits): self } /** - * Why the batch failed. + * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. * - * @param Error|ErrorShape|null $error + * @param Failure|FailureShape|null $failure */ - public function withError(Error|array|null $error): self + public function withFailure(Failure|array|null $failure): self { $self = clone $this; - $self['error'] = $error; + $self['failure'] = $failure; return $self; } /** - * Page failures grouped by error code. + * What each page is returned as. Matches `input.data.format` on the submit request. * - * @param list $errors + * @param Format|value-of $format */ - public function withErrors(array $errors): self + public function withFormat(Format|string $format): self { $self = clone $this; - $self['errors'] = $errors; + $self['format'] = $format; return $self; } /** - * Submission counts. + * What submission took in, and what it charged for. * - * @param Input|InputShape $input + * @param Intake|IntakeShape $input */ - public function withInput(Input|array $input): self + public function withInput(Intake|array $input): self { $self = clone $this; $self['input'] = $input; @@ -285,7 +312,7 @@ public function withInput(Input|array $input): self } /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. * * @param Mode|value-of $mode */ @@ -298,7 +325,20 @@ public function withMode(Mode|string $mode): self } /** - * Current processing counts. Use `status` to check completion. + * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * + * @param list $pageErrors + */ + public function withPageErrors(array $pageErrors): self + { + $self = clone $this; + $self['pageErrors'] = $pageErrors; + + return $self; + } + + /** + * Pages attempted so far. Use `status` to check completion. * * @param Progress|ProgressShape $progress */ @@ -311,7 +351,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @param Results|ResultsShape|null $results */ @@ -359,17 +399,4 @@ public function withTiming(Timing|array $timing): self return $self; } - - /** - * Output format. - * - * @param Type|value-of $type - */ - public function withType(Type|string $type): self - { - $self = clone $this; - $self['type'] = $type; - - return $self; - } } diff --git a/src/Batch/BatchListResponse/Data/Credits.php b/src/Batch/BatchListResponse/Data/Credits.php index 285e6042..cfb610dd 100644 --- a/src/Batch/BatchListResponse/Data/Credits.php +++ b/src/Batch/BatchListResponse/Data/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Reserved and used credits. + * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{charged: int, estimated: int} + * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} */ final class Credits implements BaseModel { @@ -19,29 +19,35 @@ final class Credits implements BaseModel use SdkModel; /** - * Credits used by successful pages. + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] - public int $charged; + public int $net; /** - * Credits reserved when the batch was accepted. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ #[Required] - public int $estimated; + public int $refunded; + + /** + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + */ + #[Required] + public int $reserved; /** * `new Credits()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Credits::with(charged: ..., estimated: ...) + * Credits::with(net: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withCharged(...)->withEstimated(...) + * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) * ``` */ public function __construct() @@ -54,34 +60,46 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $charged, int $estimated): self + public static function with(int $net, int $refunded, int $reserved): self { $self = new self; - $self['charged'] = $charged; - $self['estimated'] = $estimated; + $self['net'] = $net; + $self['refunded'] = $refunded; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + */ + public function withNet(int $net): self + { + $self = clone $this; + $self['net'] = $net; return $self; } /** - * Credits used by successful pages. + * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ - public function withCharged(int $charged): self + public function withRefunded(int $refunded): self { $self = clone $this; - $self['charged'] = $charged; + $self['refunded'] = $refunded; return $self; } /** - * Credits reserved when the batch was accepted. + * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. */ - public function withEstimated(int $estimated): self + public function withReserved(int $reserved): self { $self = clone $this; - $self['estimated'] = $estimated; + $self['reserved'] = $reserved; return $self; } diff --git a/src/Batch/BatchListResponse/Data/Type.php b/src/Batch/BatchListResponse/Data/Format.php similarity index 59% rename from src/Batch/BatchListResponse/Data/Type.php rename to src/Batch/BatchListResponse/Data/Format.php index b93f331a..d9b3c5cf 100644 --- a/src/Batch/BatchListResponse/Data/Type.php +++ b/src/Batch/BatchListResponse/Data/Format.php @@ -5,9 +5,9 @@ namespace ContextDev\Batch\BatchListResponse\Data; /** - * Output format. + * What each page is returned as. Matches `input.data.format` on the submit request. */ -enum Type: string +enum Format: string { case MARKDOWN = 'markdown'; diff --git a/src/Batch/BatchListResponse/Data/Input.php b/src/Batch/BatchListResponse/Data/Input.php deleted file mode 100644 index f9423b6f..00000000 --- a/src/Batch/BatchListResponse/Data/Input.php +++ /dev/null @@ -1,134 +0,0 @@ - */ - use SdkModel; - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - #[Required] - public int $accepted; - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - #[Required] - public int $duplicates; - - /** - * Pages rejected during validation. - */ - #[Required] - public int $invalid; - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - #[Required] - public int $submitted; - - /** - * `new Input()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Input::with(accepted: ..., duplicates: ..., invalid: ..., submitted: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Input) - * ->withAccepted(...) - * ->withDuplicates(...) - * ->withInvalid(...) - * ->withSubmitted(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - int $accepted, - int $duplicates, - int $invalid, - int $submitted - ): self { - $self = new self; - - $self['accepted'] = $accepted; - $self['duplicates'] = $duplicates; - $self['invalid'] = $invalid; - $self['submitted'] = $submitted; - - return $self; - } - - /** - * Pages accepted, or the crawl page limit. Credits are reserved for this count. - */ - public function withAccepted(int $accepted): self - { - $self = clone $this; - $self['accepted'] = $accepted; - - return $self; - } - - /** - * Duplicate URL and `itemId` pairs skipped. Always 0 for crawls. - */ - public function withDuplicates(int $duplicates): self - { - $self = clone $this; - $self['duplicates'] = $duplicates; - - return $self; - } - - /** - * Pages rejected during validation. - */ - public function withInvalid(int $invalid): self - { - $self = clone $this; - $self['invalid'] = $invalid; - - return $self; - } - - /** - * Pages submitted before validation. For a crawl, the page limit. - */ - public function withSubmitted(int $submitted): self - { - $self = clone $this; - $self['submitted'] = $submitted; - - return $self; - } -} diff --git a/src/Batch/BatchListResponse/Data/Mode.php b/src/Batch/BatchListResponse/Data/Mode.php index d8a11a72..87341663 100644 --- a/src/Batch/BatchListResponse/Data/Mode.php +++ b/src/Batch/BatchListResponse/Data/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchListResponse\Data; /** - * How pages are selected. + * How pages were selected. Matches `input.mode` on the submit request. */ enum Mode: string { diff --git a/src/Batch/BatchListResponse/Data/Progress.php b/src/Batch/BatchListResponse/Data/Progress.php index 6c4464dd..5f53887b 100644 --- a/src/Batch/BatchListResponse/Data/Progress.php +++ b/src/Batch/BatchListResponse/Data/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Current processing counts. Use `status` to check completion. + * Pages attempted so far. Use `status` to check completion. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -25,7 +25,7 @@ final class Progress implements BaseModel public int $failed; /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ #[Required] public int $pending; @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Accepted pages not yet attempted. Always 0 once the batch completes; a crawl can finish under its page limit when the site has no more reachable pages. + * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. */ public function withPending(int $pending): self { diff --git a/src/Batch/BatchListResponse/Data/Results.php b/src/Batch/BatchListResponse/Data/Results.php index 8ebad631..2ad188f1 100644 --- a/src/Batch/BatchListResponse/Data/Results.php +++ b/src/Batch/BatchListResponse/Data/Results.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Download links available when the batch finishes. GET /batch/{batch_id}/results serves the same records as paginated JSON. + * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. * * @phpstan-import-type FileShape from \ContextDev\Batch\BatchListResponse\Data\Results\File * diff --git a/src/Batch/CrawlControls.php b/src/Batch/CrawlControls.php new file mode 100644 index 00000000..ba5e8c96 --- /dev/null +++ b/src/Batch/CrawlControls.php @@ -0,0 +1,175 @@ + */ + use SdkModel; + + /** + * Whether links to subdomains were followed. Always false for a sitemap crawl. + */ + #[Required('follow_subdomains')] + public bool $followSubdomains; + + /** + * Link depth limit. Always 0 for a sitemap crawl, which never follows links off its URLs; null when a `start_url` crawl set no limit. + */ + #[Required('max_depth')] + public ?int $maxDepth; + + /** + * The `maxUrls` submitted with the crawl. A sitemap crawl scrapes only the URLs its sitemap actually lists, up to this many, so `input.reserved` is often lower. + */ + #[Required('max_pages')] + public int $maxPages; + + /** + * Where the crawl started. + * + * @var SourceVariants $source + */ + #[Required] + public UnionMember0|UnionMember1 $source; + + /** + * RE2 pattern URLs had to match to be crawled. Null when the crawl set none. + */ + #[Required('url_pattern')] + public ?string $urlPattern; + + /** + * `new CrawlControls()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CrawlControls::with( + * followSubdomains: ..., + * maxDepth: ..., + * maxPages: ..., + * source: ..., + * urlPattern: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CrawlControls) + * ->withFollowSubdomains(...) + * ->withMaxDepth(...) + * ->withMaxPages(...) + * ->withSource(...) + * ->withURLPattern(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param SourceShape $source + */ + public static function with( + bool $followSubdomains, + ?int $maxDepth, + int $maxPages, + UnionMember0|array|UnionMember1 $source, + ?string $urlPattern, + ): self { + $self = new self; + + $self['followSubdomains'] = $followSubdomains; + $self['maxDepth'] = $maxDepth; + $self['maxPages'] = $maxPages; + $self['source'] = $source; + $self['urlPattern'] = $urlPattern; + + return $self; + } + + /** + * Whether links to subdomains were followed. Always false for a sitemap crawl. + */ + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Link depth limit. Always 0 for a sitemap crawl, which never follows links off its URLs; null when a `start_url` crawl set no limit. + */ + public function withMaxDepth(?int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * The `maxUrls` submitted with the crawl. A sitemap crawl scrapes only the URLs its sitemap actually lists, up to this many, so `input.reserved` is often lower. + */ + public function withMaxPages(int $maxPages): self + { + $self = clone $this; + $self['maxPages'] = $maxPages; + + return $self; + } + + /** + * Where the crawl started. + * + * @param SourceShape $source + */ + public function withSource(UnionMember0|array|UnionMember1 $source): self + { + $self = clone $this; + $self['source'] = $source; + + return $self; + } + + /** + * RE2 pattern URLs had to match to be crawled. Null when the crawl set none. + */ + public function withURLPattern(?string $urlPattern): self + { + $self = clone $this; + $self['urlPattern'] = $urlPattern; + + return $self; + } +} diff --git a/src/Batch/CrawlControls/Source.php b/src/Batch/CrawlControls/Source.php new file mode 100644 index 00000000..83d9e9d2 --- /dev/null +++ b/src/Batch/CrawlControls/Source.php @@ -0,0 +1,33 @@ +|array + */ + public static function variants(): array + { + return [UnionMember0::class, UnionMember1::class]; + } +} diff --git a/src/Batch/CrawlControls/Source/UnionMember0.php b/src/Batch/CrawlControls/Source/UnionMember0.php new file mode 100644 index 00000000..80e86a2c --- /dev/null +++ b/src/Batch/CrawlControls/Source/UnionMember0.php @@ -0,0 +1,87 @@ +, url: string} + */ +final class UnionMember0 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * Page the crawl started from. + */ + #[Required] + public string $url; + + /** + * `new UnionMember0()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UnionMember0::with(type: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UnionMember0)->withType(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type, string $url): self + { + $self = new self; + + $self['type'] = $type; + $self['url'] = $url; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Page the crawl started from. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Batch/CrawlControls/Source/UnionMember0/Type.php b/src/Batch/CrawlControls/Source/UnionMember0/Type.php new file mode 100644 index 00000000..f8fa57a0 --- /dev/null +++ b/src/Batch/CrawlControls/Source/UnionMember0/Type.php @@ -0,0 +1,10 @@ + + * } + */ +final class UnionMember1 implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Domain whose sitemap supplied the pages. + */ + #[Required] + public string $domain; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new UnionMember1()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * UnionMember1::with(domain: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new UnionMember1)->withDomain(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(string $domain, Type|string $type): self + { + $self = new self; + + $self['domain'] = $domain; + $self['type'] = $type; + + return $self; + } + + /** + * Domain whose sitemap supplied the pages. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/Batch/CrawlControls/Source/UnionMember1/Type.php b/src/Batch/CrawlControls/Source/UnionMember1/Type.php new file mode 100644 index 00000000..55149338 --- /dev/null +++ b/src/Batch/CrawlControls/Source/UnionMember1/Type.php @@ -0,0 +1,10 @@ + */ + /** @use SdkModel */ use SdkModel; /** - * Batch error code. + * Why the batch itself stopped. */ #[Required] public string $code; /** - * Batch error message. + * Human-readable explanation. */ #[Required] public string $message; /** - * `new Error()` is missing required properties by the API. + * `new Failure()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Error::with(code: ..., message: ...) + * Failure::with(code: ..., message: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Error)->withCode(...)->withMessage(...) + * (new Failure)->withCode(...)->withMessage(...) * ``` */ public function __construct() @@ -65,7 +65,7 @@ public static function with(string $code, string $message): self } /** - * Batch error code. + * Why the batch itself stopped. */ public function withCode(string $code): self { @@ -76,7 +76,7 @@ public function withCode(string $code): self } /** - * Batch error message. + * Human-readable explanation. */ public function withMessage(string $message): self { diff --git a/src/Batch/Intake.php b/src/Batch/Intake.php new file mode 100644 index 00000000..838d25f7 --- /dev/null +++ b/src/Batch/Intake.php @@ -0,0 +1,164 @@ + */ + use SdkModel; + + /** + * URLs dropped before reserving because another entry resolved to the same page. Non-zero for sitemap crawls too, whose sitemaps routinely list a page more than once. + */ + #[Required] + public int $duplicates; + + /** + * URLs from your list rejected as unusable; the same ones are itemised in `invalid_urls` at submission. Null for a crawl — a crawl that resolves no usable page is rejected outright with a 400 rather than accepted with an empty list. + */ + #[Required] + public ?int $invalid; + + /** + * Pages credits were reserved for. Everything else — progress, the refund, the completion percentage — is measured against this. + */ + #[Required] + public int $reserved; + + /** + * Whether `reserved` is an upper bound the batch may finish under. True only for a crawl that follows links, whose reachable page count is unknowable until it runs. False for a scrape and for a sitemap crawl, where `reserved` is an exact page count. + */ + #[Required('reserved_is_ceiling')] + public bool $reservedIsCeiling; + + /** + * URLs in the list you sent, before validation and de-duplication. Null for a crawl, which is given a source rather than a list. + */ + #[Required] + public ?int $submitted; + + /** + * `new Intake()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Intake::with( + * duplicates: ..., + * invalid: ..., + * reserved: ..., + * reservedIsCeiling: ..., + * submitted: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Intake) + * ->withDuplicates(...) + * ->withInvalid(...) + * ->withReserved(...) + * ->withReservedIsCeiling(...) + * ->withSubmitted(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $duplicates, + ?int $invalid, + int $reserved, + bool $reservedIsCeiling, + ?int $submitted, + ): self { + $self = new self; + + $self['duplicates'] = $duplicates; + $self['invalid'] = $invalid; + $self['reserved'] = $reserved; + $self['reservedIsCeiling'] = $reservedIsCeiling; + $self['submitted'] = $submitted; + + return $self; + } + + /** + * URLs dropped before reserving because another entry resolved to the same page. Non-zero for sitemap crawls too, whose sitemaps routinely list a page more than once. + */ + public function withDuplicates(int $duplicates): self + { + $self = clone $this; + $self['duplicates'] = $duplicates; + + return $self; + } + + /** + * URLs from your list rejected as unusable; the same ones are itemised in `invalid_urls` at submission. Null for a crawl — a crawl that resolves no usable page is rejected outright with a 400 rather than accepted with an empty list. + */ + public function withInvalid(?int $invalid): self + { + $self = clone $this; + $self['invalid'] = $invalid; + + return $self; + } + + /** + * Pages credits were reserved for. Everything else — progress, the refund, the completion percentage — is measured against this. + */ + public function withReserved(int $reserved): self + { + $self = clone $this; + $self['reserved'] = $reserved; + + return $self; + } + + /** + * Whether `reserved` is an upper bound the batch may finish under. True only for a crawl that follows links, whose reachable page count is unknowable until it runs. False for a scrape and for a sitemap crawl, where `reserved` is an exact page count. + */ + public function withReservedIsCeiling(bool $reservedIsCeiling): self + { + $self = clone $this; + $self['reservedIsCeiling'] = $reservedIsCeiling; + + return $self; + } + + /** + * URLs in the list you sent, before validation and de-duplication. Null for a crawl, which is given a source rather than a list. + */ + public function withSubmitted(?int $submitted): self + { + $self = clone $this; + $self['submitted'] = $submitted; + + return $self; + } +} diff --git a/src/Batch/ErrorCount.php b/src/Batch/PageErrorCount.php similarity index 80% rename from src/Batch/ErrorCount.php rename to src/Batch/PageErrorCount.php index 3f34bb84..00af3a12 100644 --- a/src/Batch/ErrorCount.php +++ b/src/Batch/PageErrorCount.php @@ -11,11 +11,11 @@ /** * Page failures sharing one error code. * - * @phpstan-type ErrorCountShape = array{code: string, count: int} + * @phpstan-type PageErrorCountShape = array{code: string, count: int} */ -final class ErrorCount implements BaseModel +final class PageErrorCount implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; /** @@ -31,17 +31,17 @@ final class ErrorCount implements BaseModel public int $count; /** - * `new ErrorCount()` is missing required properties by the API. + * `new PageErrorCount()` is missing required properties by the API. * * To enforce required parameters use * ``` - * ErrorCount::with(code: ..., count: ...) + * PageErrorCount::with(code: ..., count: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new ErrorCount)->withCode(...)->withCount(...) + * (new PageErrorCount)->withCode(...)->withCount(...) * ``` */ public function __construct() diff --git a/src/Services/BatchRawService.php b/src/Services/BatchRawService.php index e3aa5f0d..b77f2bac 100644 --- a/src/Services/BatchRawService.php +++ b/src/Services/BatchRawService.php @@ -37,7 +37,7 @@ public function __construct(private Client $client) {} /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list and webhook signing secret from submission, so nothing is lost if the submit response was dropped. + * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions diff --git a/src/Services/BatchService.php b/src/Services/BatchService.php index 386c2283..cf5b9e03 100644 --- a/src/Services/BatchService.php +++ b/src/Services/BatchService.php @@ -40,7 +40,7 @@ public function __construct(private Client $client) /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list and webhook signing secret from submission, so nothing is lost if the submit response was dropped. + * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions From f711c66657a0a08156c71e21f241b4701bdc228a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 22:45:49 +0000 Subject: [PATCH 079/130] feat(api): api update --- .stats.yml | 4 +- src/Batch/BatchCancelResponse.php | 86 ++++----------- src/Batch/BatchCancelResponse/Credits.php | 50 ++------- src/Batch/BatchCancelResponse/Format.php | 2 +- src/Batch/BatchCancelResponse/Mode.php | 2 +- src/Batch/BatchCancelResponse/Progress.php | 14 +-- src/Batch/BatchCancelResponse/Results.php | 99 ----------------- .../BatchCancelResponse/Results/File.php | 104 ------------------ src/Batch/BatchCancelResponse/Status.php | 12 +- src/Batch/BatchCancelResponse/Timing.php | 39 ++----- 10 files changed, 47 insertions(+), 365 deletions(-) delete mode 100644 src/Batch/BatchCancelResponse/Results.php delete mode 100644 src/Batch/BatchCancelResponse/Results/File.php diff --git a/.stats.yml b/.stats.yml index 963533f4..06846fb4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-838f03b1c3584485eeded993459e6bbae058da9f6df16b7967980fbba98cc748.yml -openapi_spec_hash: 4a9db9cd9eac4ae4e2694b3d835a772f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21a0195dcea548066fd6c227d634217b897900a6732a688e41c83344c2e92c94.yml +openapi_spec_hash: 388f5780dc9bf205c04b6a6214e4fafc config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchCancelResponse.php b/src/Batch/BatchCancelResponse.php index cc1d61f4..9b72a461 100644 --- a/src/Batch/BatchCancelResponse.php +++ b/src/Batch/BatchCancelResponse.php @@ -9,7 +9,6 @@ use ContextDev\Batch\BatchCancelResponse\KeyMetadata; use ContextDev\Batch\BatchCancelResponse\Mode; use ContextDev\Batch\BatchCancelResponse\Progress; -use ContextDev\Batch\BatchCancelResponse\Results; use ContextDev\Batch\BatchCancelResponse\Status; use ContextDev\Batch\BatchCancelResponse\Timing; use ContextDev\Core\Attributes\Optional; @@ -20,11 +19,9 @@ /** * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchCancelResponse\Credits - * @phpstan-import-type FailureShape from \ContextDev\Batch\Failure * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake * @phpstan-import-type PageErrorCountShape from \ContextDev\Batch\PageErrorCount * @phpstan-import-type ProgressShape from \ContextDev\Batch\BatchCancelResponse\Progress - * @phpstan-import-type ResultsShape from \ContextDev\Batch\BatchCancelResponse\Results * @phpstan-import-type TimingShape from \ContextDev\Batch\BatchCancelResponse\Timing * @phpstan-import-type KeyMetadataShape from \ContextDev\Batch\BatchCancelResponse\KeyMetadata * @@ -32,13 +29,11 @@ * id: string, * crawl: null|CrawlControls|CrawlControlsShape, * credits: Credits|CreditsShape, - * failure: null|Failure|FailureShape, * format: Format|value-of, * input: Intake|IntakeShape, * mode: Mode|value-of, * pageErrors: list, * progress: Progress|ProgressShape, - * results: null|Results|ResultsShape, * status: Status|value-of, * tags: list, * timing: Timing|TimingShape, @@ -51,7 +46,7 @@ final class BatchCancelResponse implements BaseModel use SdkModel; /** - * Batch ID used to retrieve or cancel the job. + * Batch ID. */ #[Required] public string $id; @@ -63,19 +58,13 @@ final class BatchCancelResponse implements BaseModel public ?CrawlControls $crawl; /** - * What this batch has done to your credit balance. + * What this batch cost so far. */ #[Required] public Credits $credits; /** - * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. - */ - #[Required] - public ?Failure $failure; - - /** - * What each page is returned as. Matches `input.data.format` on the submit request. + * What each page is returned as. * * @var value-of $format */ @@ -89,7 +78,7 @@ final class BatchCancelResponse implements BaseModel public Intake $input; /** - * How pages were selected. Matches `input.mode` on the submit request. + * How pages were selected. * * @var value-of $mode */ @@ -97,7 +86,7 @@ final class BatchCancelResponse implements BaseModel public string $mode; /** - * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * Page failures so far, grouped by error code and sorted by count. * * @var list $pageErrors */ @@ -105,19 +94,13 @@ final class BatchCancelResponse implements BaseModel public array $pageErrors; /** - * Pages attempted so far. Use `status` to check completion. + * How far the batch got before cancellation. */ #[Required] public Progress $progress; /** - * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. - */ - #[Required] - public ?Results $results; - - /** - * Current state. `completed`, `cancelled`, and `failed` are final. + * Always `cancelling`. Work already in flight finishes; the batch reaches `cancelled` shortly after. * * @var value-of $status */ @@ -132,6 +115,9 @@ final class BatchCancelResponse implements BaseModel #[Required(list: 'string')] public array $tags; + /** + * There is no finish time yet — the batch is still winding down. + */ #[Required] public Timing $timing; @@ -150,13 +136,11 @@ final class BatchCancelResponse implements BaseModel * id: ..., * crawl: ..., * credits: ..., - * failure: ..., * format: ..., * input: ..., * mode: ..., * pageErrors: ..., * progress: ..., - * results: ..., * status: ..., * tags: ..., * timing: ..., @@ -170,13 +154,11 @@ final class BatchCancelResponse implements BaseModel * ->withID(...) * ->withCrawl(...) * ->withCredits(...) - * ->withFailure(...) * ->withFormat(...) * ->withInput(...) * ->withMode(...) * ->withPageErrors(...) * ->withProgress(...) - * ->withResults(...) * ->withStatus(...) * ->withTags(...) * ->withTiming(...) @@ -194,13 +176,11 @@ public function __construct() * * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits - * @param Failure|FailureShape|null $failure * @param Format|value-of $format * @param Intake|IntakeShape $input * @param Mode|value-of $mode * @param list $pageErrors * @param Progress|ProgressShape $progress - * @param Results|ResultsShape|null $results * @param Status|value-of $status * @param list $tags * @param Timing|TimingShape $timing @@ -210,13 +190,11 @@ public static function with( string $id, CrawlControls|array|null $crawl, Credits|array $credits, - Failure|array|null $failure, Format|string $format, Intake|array $input, Mode|string $mode, array $pageErrors, Progress|array $progress, - Results|array|null $results, Status|string $status, array $tags, Timing|array $timing, @@ -227,13 +205,11 @@ public static function with( $self['id'] = $id; $self['crawl'] = $crawl; $self['credits'] = $credits; - $self['failure'] = $failure; $self['format'] = $format; $self['input'] = $input; $self['mode'] = $mode; $self['pageErrors'] = $pageErrors; $self['progress'] = $progress; - $self['results'] = $results; $self['status'] = $status; $self['tags'] = $tags; $self['timing'] = $timing; @@ -244,7 +220,7 @@ public static function with( } /** - * Batch ID used to retrieve or cancel the job. + * Batch ID. */ public function withID(string $id): self { @@ -268,7 +244,7 @@ public function withCrawl(CrawlControls|array|null $crawl): self } /** - * What this batch has done to your credit balance. + * What this batch cost so far. * * @param Credits|CreditsShape $credits */ @@ -281,20 +257,7 @@ public function withCredits(Credits|array $credits): self } /** - * A failure of the batch as a whole, distinct from the per-page failures in `page_errors`. - * - * @param Failure|FailureShape|null $failure - */ - public function withFailure(Failure|array|null $failure): self - { - $self = clone $this; - $self['failure'] = $failure; - - return $self; - } - - /** - * What each page is returned as. Matches `input.data.format` on the submit request. + * What each page is returned as. * * @param Format|value-of $format */ @@ -320,7 +283,7 @@ public function withInput(Intake|array $input): self } /** - * How pages were selected. Matches `input.mode` on the submit request. + * How pages were selected. * * @param Mode|value-of $mode */ @@ -333,7 +296,7 @@ public function withMode(Mode|string $mode): self } /** - * Individual page failures grouped by error code, sorted by count. Unrelated to `failure`, which is the batch itself failing. + * Page failures so far, grouped by error code and sorted by count. * * @param list $pageErrors */ @@ -346,7 +309,7 @@ public function withPageErrors(array $pageErrors): self } /** - * Pages attempted so far. Use `status` to check completion. + * How far the batch got before cancellation. * * @param Progress|ProgressShape $progress */ @@ -359,20 +322,7 @@ public function withProgress(Progress|array $progress): self } /** - * Download links, available once the batch reaches a final status and null before then. GET /batch/{batch_id}/results serves the same records as paginated JSON. - * - * @param Results|ResultsShape|null $results - */ - public function withResults(Results|array|null $results): self - { - $self = clone $this; - $self['results'] = $results; - - return $self; - } - - /** - * Current state. `completed`, `cancelled`, and `failed` are final. + * Always `cancelling`. Work already in flight finishes; the batch reaches `cancelled` shortly after. * * @param Status|value-of $status */ @@ -398,6 +348,8 @@ public function withTags(array $tags): self } /** + * There is no finish time yet — the batch is still winding down. + * * @param Timing|TimingShape $timing */ public function withTiming(Timing|array $timing): self diff --git a/src/Batch/BatchCancelResponse/Credits.php b/src/Batch/BatchCancelResponse/Credits.php index 4057c7e9..9d9349c6 100644 --- a/src/Batch/BatchCancelResponse/Credits.php +++ b/src/Batch/BatchCancelResponse/Credits.php @@ -9,9 +9,9 @@ use ContextDev\Core\Contracts\BaseModel; /** - * What this batch has done to your credit balance. + * What this batch cost so far. * - * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} + * @phpstan-type CreditsShape = array{reserved: int} */ final class Credits implements BaseModel { @@ -19,19 +19,7 @@ final class Credits implements BaseModel use SdkModel; /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. - */ - #[Required] - public int $net; - - /** - * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. - */ - #[Required] - public int $refunded; - - /** - * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + * Credits debited at submission. The unspent remainder is refunded once the batch settles — read `credits.refunded` from GET /batch/{batch_id} then. */ #[Required] public int $reserved; @@ -41,13 +29,13 @@ final class Credits implements BaseModel * * To enforce required parameters use * ``` - * Credits::with(net: ..., refunded: ..., reserved: ...) + * Credits::with(reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) + * (new Credits)->withReserved(...) * ``` */ public function __construct() @@ -60,41 +48,17 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $net, int $refunded, int $reserved): self + public static function with(int $reserved): self { $self = new self; - $self['net'] = $net; - $self['refunded'] = $refunded; $self['reserved'] = $reserved; return $self; } /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. - */ - public function withNet(int $net): self - { - $self = clone $this; - $self['net'] = $net; - - return $self; - } - - /** - * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. - */ - public function withRefunded(int $refunded): self - { - $self = clone $this; - $self['refunded'] = $refunded; - - return $self; - } - - /** - * Credits debited from your balance the moment the batch was accepted. This is a charge, not a forecast — the whole amount leaves the balance up front. + * Credits debited at submission. The unspent remainder is refunded once the batch settles — read `credits.refunded` from GET /batch/{batch_id} then. */ public function withReserved(int $reserved): self { diff --git a/src/Batch/BatchCancelResponse/Format.php b/src/Batch/BatchCancelResponse/Format.php index 761672da..43755fa8 100644 --- a/src/Batch/BatchCancelResponse/Format.php +++ b/src/Batch/BatchCancelResponse/Format.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * What each page is returned as. Matches `input.data.format` on the submit request. + * What each page is returned as. */ enum Format: string { diff --git a/src/Batch/BatchCancelResponse/Mode.php b/src/Batch/BatchCancelResponse/Mode.php index 86127d23..87b5eb61 100644 --- a/src/Batch/BatchCancelResponse/Mode.php +++ b/src/Batch/BatchCancelResponse/Mode.php @@ -5,7 +5,7 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * How pages were selected. Matches `input.mode` on the submit request. + * How pages were selected. */ enum Mode: string { diff --git a/src/Batch/BatchCancelResponse/Progress.php b/src/Batch/BatchCancelResponse/Progress.php index 7026511e..49d71b80 100644 --- a/src/Batch/BatchCancelResponse/Progress.php +++ b/src/Batch/BatchCancelResponse/Progress.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Pages attempted so far. Use `status` to check completion. + * How far the batch got before cancellation. * * @phpstan-type ProgressShape = array{failed: int, pending: int, succeeded: int} */ @@ -19,19 +19,19 @@ final class Progress implements BaseModel use SdkModel; /** - * Pages that could not be scraped. + * Pages that could not be scraped before the request landed. */ #[Required] public int $failed; /** - * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. + * Reserved pages that will now be skipped, and refunded when the batch settles. */ #[Required] public int $pending; /** - * Pages scraped successfully. + * Pages scraped successfully before the request landed. */ #[Required] public int $succeeded; @@ -72,7 +72,7 @@ public static function with(int $failed, int $pending, int $succeeded): self } /** - * Pages that could not be scraped. + * Pages that could not be scraped before the request landed. */ public function withFailed(int $failed): self { @@ -83,7 +83,7 @@ public function withFailed(int $failed): self } /** - * Reserved pages not yet attempted. A cancelled batch keeps reporting the URLs it never reached; a crawl whose `input.reserved_is_ceiling` is true reports 0 once final, because its unspent budget was never real pages. + * Reserved pages that will now be skipped, and refunded when the batch settles. */ public function withPending(int $pending): self { @@ -94,7 +94,7 @@ public function withPending(int $pending): self } /** - * Pages scraped successfully. + * Pages scraped successfully before the request landed. */ public function withSucceeded(int $succeeded): self { diff --git a/src/Batch/BatchCancelResponse/Results.php b/src/Batch/BatchCancelResponse/Results.php deleted file mode 100644 index b51cf9c2..00000000 --- a/src/Batch/BatchCancelResponse/Results.php +++ /dev/null @@ -1,99 +0,0 @@ - - * } - */ -final class Results implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * When the download URLs expire. - */ - #[Required('expires_at')] - public string $expiresAt; - - /** - * Result files. Order is not guaranteed. - * - * @var list $files - */ - #[Required(list: File::class)] - public array $files; - - /** - * `new Results()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Results::with(expiresAt: ..., files: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Results)->withExpiresAt(...)->withFiles(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list $files - */ - public static function with(string $expiresAt, array $files): self - { - $self = new self; - - $self['expiresAt'] = $expiresAt; - $self['files'] = $files; - - return $self; - } - - /** - * When the download URLs expire. - */ - public function withExpiresAt(string $expiresAt): self - { - $self = clone $this; - $self['expiresAt'] = $expiresAt; - - return $self; - } - - /** - * Result files. Order is not guaranteed. - * - * @param list $files - */ - public function withFiles(array $files): self - { - $self = clone $this; - $self['files'] = $files; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse/Results/File.php b/src/Batch/BatchCancelResponse/Results/File.php deleted file mode 100644 index 0867a930..00000000 --- a/src/Batch/BatchCancelResponse/Results/File.php +++ /dev/null @@ -1,104 +0,0 @@ - */ - use SdkModel; - - /** - * Compressed file size in bytes. - */ - #[Required] - public int $bytes; - - /** - * Results in this file. - */ - #[Required] - public int $items; - - /** - * Temporary URL for a gzipped NDJSON file. - */ - #[Required] - public string $url; - - /** - * `new File()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * File::with(bytes: ..., items: ..., url: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new File)->withBytes(...)->withItems(...)->withURL(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(int $bytes, int $items, string $url): self - { - $self = new self; - - $self['bytes'] = $bytes; - $self['items'] = $items; - $self['url'] = $url; - - return $self; - } - - /** - * Compressed file size in bytes. - */ - public function withBytes(int $bytes): self - { - $self = clone $this; - $self['bytes'] = $bytes; - - return $self; - } - - /** - * Results in this file. - */ - public function withItems(int $items): self - { - $self = clone $this; - $self['items'] = $items; - - return $self; - } - - /** - * Temporary URL for a gzipped NDJSON file. - */ - public function withURL(string $url): self - { - $self = clone $this; - $self['url'] = $url; - - return $self; - } -} diff --git a/src/Batch/BatchCancelResponse/Status.php b/src/Batch/BatchCancelResponse/Status.php index 01a1e5ae..0f838b13 100644 --- a/src/Batch/BatchCancelResponse/Status.php +++ b/src/Batch/BatchCancelResponse/Status.php @@ -5,19 +5,9 @@ namespace ContextDev\Batch\BatchCancelResponse; /** - * Current state. `completed`, `cancelled`, and `failed` are final. + * Always `cancelling`. Work already in flight finishes; the batch reaches `cancelled` shortly after. */ enum Status: string { - case QUEUED = 'queued'; - - case RUNNING = 'running'; - case CANCELLING = 'cancelling'; - - case COMPLETED = 'completed'; - - case CANCELLED = 'cancelled'; - - case FAILED = 'failed'; } diff --git a/src/Batch/BatchCancelResponse/Timing.php b/src/Batch/BatchCancelResponse/Timing.php index 1e208047..ac27536a 100644 --- a/src/Batch/BatchCancelResponse/Timing.php +++ b/src/Batch/BatchCancelResponse/Timing.php @@ -9,21 +9,15 @@ use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-type TimingShape = array{ - * completedAt: string|null, createdAt: string, startedAt: string|null - * } + * There is no finish time yet — the batch is still winding down. + * + * @phpstan-type TimingShape = array{createdAt: string, startedAt: string|null} */ final class Timing implements BaseModel { /** @use SdkModel */ use SdkModel; - /** - * When processing finished. Null while active. - */ - #[Required('completed_at')] - public ?string $completedAt; - /** * When the batch was created. */ @@ -31,7 +25,7 @@ final class Timing implements BaseModel public string $createdAt; /** - * When processing started. Null while queued. + * When processing started. Null if it was cancelled while still queued. */ #[Required('started_at')] public ?string $startedAt; @@ -41,13 +35,13 @@ final class Timing implements BaseModel * * To enforce required parameters use * ``` - * Timing::with(completedAt: ..., createdAt: ..., startedAt: ...) + * Timing::with(createdAt: ..., startedAt: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Timing)->withCompletedAt(...)->withCreatedAt(...)->withStartedAt(...) + * (new Timing)->withCreatedAt(...)->withStartedAt(...) * ``` */ public function __construct() @@ -60,31 +54,16 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - ?string $completedAt, - string $createdAt, - ?string $startedAt - ): self { + public static function with(string $createdAt, ?string $startedAt): self + { $self = new self; - $self['completedAt'] = $completedAt; $self['createdAt'] = $createdAt; $self['startedAt'] = $startedAt; return $self; } - /** - * When processing finished. Null while active. - */ - public function withCompletedAt(?string $completedAt): self - { - $self = clone $this; - $self['completedAt'] = $completedAt; - - return $self; - } - /** * When the batch was created. */ @@ -97,7 +76,7 @@ public function withCreatedAt(string $createdAt): self } /** - * When processing started. Null while queued. + * When processing started. Null if it was cancelled while still queued. */ public function withStartedAt(?string $startedAt): self { From 1a7046cb5e55edaf40793d432fdfd0cb61a1c8bf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 00:42:57 +0000 Subject: [PATCH 080/130] feat(api): api update --- .stats.yml | 4 ++-- src/Batch/BatchGetResultsParams.php | 2 +- src/ServiceContracts/WebContract.php | 8 ++++---- src/Services/BatchRawService.php | 4 ++-- src/Services/BatchService.php | 4 ++-- src/Services/WebService.php | 8 ++++---- src/Web/WebScreenshotParams.php | 4 ++-- src/Web/WebScreenshotParams/Country.php | 2 +- src/Web/WebWebCrawlMdParams.php | 4 ++-- src/Web/WebWebCrawlMdParams/Country.php | 2 +- src/Web/WebWebScrapeHTMLParams.php | 4 ++-- src/Web/WebWebScrapeHTMLParams/Country.php | 2 +- src/Web/WebWebScrapeMdParams.php | 4 ++-- src/Web/WebWebScrapeMdParams/Country.php | 2 +- 14 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.stats.yml b/.stats.yml index 06846fb4..3b484e38 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-21a0195dcea548066fd6c227d634217b897900a6732a688e41c83344c2e92c94.yml -openapi_spec_hash: 388f5780dc9bf205c04b6a6214e4fafc +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-758c3a2fbd5b7be61c8e6e0ad2e6a5ec30695747bb675960d888c497647d13d7.yml +openapi_spec_hash: 00002d90bde02f67e174368ae470c597 config_hash: 2bea1743c84d63bd61f8501a6ea63065 diff --git a/src/Batch/BatchGetResultsParams.php b/src/Batch/BatchGetResultsParams.php index 074f707c..ca82a536 100644 --- a/src/Batch/BatchGetResultsParams.php +++ b/src/Batch/BatchGetResultsParams.php @@ -10,7 +10,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * Page through a finished batch's results as JSON instead of downloading the NDJSON files. * * @see ContextDev\Services\BatchService::getResults() * diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 42edb5d9..575855f0 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -163,7 +163,7 @@ public function extractStyleguide( * @api * * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. - * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param Country|value-of $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). @@ -233,7 +233,7 @@ public function search( * @api * * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page @@ -289,7 +289,7 @@ public function webCrawlMd( * * @param string $url Full URL to scrape (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML @@ -361,7 +361,7 @@ public function webScrapeImages( * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown diff --git a/src/Services/BatchRawService.php b/src/Services/BatchRawService.php index b77f2bac..c2088aaa 100644 --- a/src/Services/BatchRawService.php +++ b/src/Services/BatchRawService.php @@ -37,7 +37,7 @@ public function __construct(private Client $client) {} /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. + * Check progress, and get download links once the batch finishes. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions @@ -128,7 +128,7 @@ public function cancel( /** * @api * - * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * Page through a finished batch's results as JSON instead of downloading the NDJSON files. * * @param string $batchID ID of the batch to retrieve or cancel * @param array{cursor?: string, limit?: int}|BatchGetResultsParams $params diff --git a/src/Services/BatchService.php b/src/Services/BatchService.php index cf5b9e03..4e6cbe61 100644 --- a/src/Services/BatchService.php +++ b/src/Services/BatchService.php @@ -40,7 +40,7 @@ public function __construct(private Client $client) /** * @api * - * Check progress and get download links when the batch finishes. Also returns the rejected-URL list from submission. The webhook signing secret is not repeated here — it is returned once, by the submit response. + * Check progress, and get download links once the batch finishes. * * @param string $batchID ID of the batch to retrieve or cancel * @param RequestOpts|null $requestOptions @@ -121,7 +121,7 @@ public function cancel( /** * @api * - * Page through the result records of a finished batch as JSON, in the same order as the downloadable result files. Use this instead of downloading and parsing the NDJSON files yourself. + * Page through a finished batch's results as JSON instead of downloading the NDJSON files. * * @param string $batchID ID of the batch to retrieve or cancel * @param string $cursor next_cursor from the previous page diff --git a/src/Services/WebService.php b/src/Services/WebService.php index a4a17995..30d0899b 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -259,7 +259,7 @@ public function extractStyleguide( * Capture a screenshot of a website. * * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. - * @param Country|value-of $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param Country|value-of $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). @@ -377,7 +377,7 @@ public function search( * Performs a crawl starting from a given URL, extracts page content as Markdown, and returns results for all crawled pages. * * @param string $url The starting URL for the crawl (must include http:// or https:// protocol) - * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebCrawlMdParams\Country|value-of<\ContextDev\Web\WebWebCrawlMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list $excludeSelectors CSS selectors to remove before each crawled page is converted to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param bool $followSubdomains When true, follow links on subdomains of the starting URL's domain (e.g. docs.example.com when starting from example.com). www and apex are always treated as equivalent. * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown for each crawled page @@ -466,7 +466,7 @@ public function webCrawlMd( * * @param string $url Full URL to scrape (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML @@ -599,7 +599,7 @@ public function webScrapeImages( * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index bf56e01a..0ed6482e 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -58,7 +58,7 @@ final class WebScreenshotParams implements BaseModel public ?string $colorScheme; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -216,7 +216,7 @@ public function withColorScheme(ColorScheme|string $colorScheme): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebScreenshotParams/Country.php b/src/Web/WebScreenshotParams/Country.php index 9715cfcb..05fbffdb 100644 --- a/src/Web/WebScreenshotParams/Country.php +++ b/src/Web/WebScreenshotParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebScreenshotParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index 89a59a0b..316c3e52 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -57,7 +57,7 @@ final class WebWebCrawlMdParams implements BaseModel public string $url; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -280,7 +280,7 @@ public function withURL(string $url): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebWebCrawlMdParams/Country.php b/src/Web/WebWebCrawlMdParams/Country.php index e3c0594d..e372d751 100644 --- a/src/Web/WebWebCrawlMdParams/Country.php +++ b/src/Web/WebWebCrawlMdParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebCrawlMdParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { diff --git a/src/Web/WebWebScrapeHTMLParams.php b/src/Web/WebWebScrapeHTMLParams.php index de09678d..d58f4e23 100644 --- a/src/Web/WebWebScrapeHTMLParams.php +++ b/src/Web/WebWebScrapeHTMLParams.php @@ -72,7 +72,7 @@ final class WebWebScrapeHTMLParams implements BaseModel public ?array $actions; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -267,7 +267,7 @@ public function withActions(?array $actions): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebWebScrapeHTMLParams/Country.php b/src/Web/WebWebScrapeHTMLParams/Country.php index 5588f0a9..f8b1c6c3 100644 --- a/src/Web/WebWebScrapeHTMLParams/Country.php +++ b/src/Web/WebWebScrapeHTMLParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeHTMLParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index 63fb55c3..8c654975 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -97,7 +97,7 @@ final class WebWebScrapeMdParams implements BaseModel public ?array $actions; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @var value-of|null $country */ @@ -325,7 +325,7 @@ public function withActions(?array $actions): self } /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). * * @param Country|value-of $country */ diff --git a/src/Web/WebWebScrapeMdParams/Country.php b/src/Web/WebWebScrapeMdParams/Country.php index 97005342..91fa2f00 100644 --- a/src/Web/WebWebScrapeMdParams/Country.php +++ b/src/Web/WebWebScrapeMdParams/Country.php @@ -5,7 +5,7 @@ namespace ContextDev\Web\WebWebScrapeMdParams; /** - * Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev residential proxy exit location. Must be one of Context.dev's supported countries. When provided, Context.dev fetches the target page from that country. + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). */ enum Country: string { From f1d4b14cb69ab53615d95aafea0178d8c5824e9d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 01:03:09 +0000 Subject: [PATCH 081/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 511dd516..d1328ca9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.6.0" + ".": "2.7.0" } \ No newline at end of file diff --git a/README.md b/README.md index 2f5e06ff..ecf5ee44 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.6.0" +composer require "context-dev/context-dev-php 2.7.0" ``` diff --git a/src/Client.php b/src/Client.php index 098d6293..28f08d70 100644 --- a/src/Client.php +++ b/src/Client.php @@ -101,7 +101,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.6.0', + 'X-Stainless-Package-Version' => '2.7.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index f690bfb0..5d54e5fd 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.6.0'; +const VERSION = '2.7.0'; // x-release-please-end From 498d613d1998f9479cf908b859ff92880b888e6d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 1 Aug 2026 23:38:44 +0000 Subject: [PATCH 082/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3b484e38..2aeac55b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-758c3a2fbd5b7be61c8e6e0ad2e6a5ec30695747bb675960d888c497647d13d7.yml -openapi_spec_hash: 00002d90bde02f67e174368ae470c597 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-85694668707cde32f7d8472660bc5760a2f369751d8cf19690778ffad767b0fa.yml +openapi_spec_hash: 5b688312bf5e9a5468a83618ec635ada config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 0899d550ee8373f70310cd57ee596641ecac2c9d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 2 Aug 2026 08:32:28 +0000 Subject: [PATCH 083/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2aeac55b..490472d2 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-85694668707cde32f7d8472660bc5760a2f369751d8cf19690778ffad767b0fa.yml -openapi_spec_hash: 5b688312bf5e9a5468a83618ec635ada +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-386f0ec51516e1f060c82287c99be4ecdee9eb4753e1375b6c5b27488e63d4c7.yml +openapi_spec_hash: b514ae48cf1c7bcb2ed3a4d7853cbfb5 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 3af66774147af88fb64defdf200748a3d890e7a9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 3 Aug 2026 03:23:42 +0000 Subject: [PATCH 084/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 490472d2..790f64f8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-386f0ec51516e1f060c82287c99be4ecdee9eb4753e1375b6c5b27488e63d4c7.yml -openapi_spec_hash: b514ae48cf1c7bcb2ed3a4d7853cbfb5 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-0c273d87106b3f8920d529d9964d7be6a23613c7553f48d67732e24571fbbf7b.yml +openapi_spec_hash: f1fb4082f153c9195fee451ebf5d46ba config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 3143de483049a07ae570cc494b456a1c8db5ffa5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 08:40:59 +0000 Subject: [PATCH 085/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 790f64f8..29f15de4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-0c273d87106b3f8920d529d9964d7be6a23613c7553f48d67732e24571fbbf7b.yml -openapi_spec_hash: f1fb4082f153c9195fee451ebf5d46ba +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-f2101addc171cf732a879e4bcad5bc6cfe8cec4349c62617c12c09331a883a22.yml +openapi_spec_hash: a143e7e4842279a61807b433ef17e261 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 58c5f2e8a0cafe0dddf083d86da3ce3e9e66cf1b Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 09:40:40 +0000 Subject: [PATCH 086/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 29f15de4..8e459864 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-f2101addc171cf732a879e4bcad5bc6cfe8cec4349c62617c12c09331a883a22.yml -openapi_spec_hash: a143e7e4842279a61807b433ef17e261 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-eac90d0a78d6166dc64c49ad4cd44883ab0bd357063ff09e60ed78085e2bde3c.yml +openapi_spec_hash: ab91f77e7c9d992400cbc7fc8a9e76c1 config_hash: 2bea1743c84d63bd61f8501a6ea63065 From 5f5b0399068b62039bbde07642fa96c50c996e97 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 10:12:41 +0000 Subject: [PATCH 087/130] feat(api): manual updates --- .stats.yml | 6 +- src/Brand/BrandSearchParams.php | 102 +++++++++++++++++ src/Brand/BrandSearchResponse.php | 107 ++++++++++++++++++ src/Brand/BrandSearchResponse/KeyMetadata.php | 92 +++++++++++++++ src/Brand/BrandSearchResponse/Result.php | 107 ++++++++++++++++++ src/ServiceContracts/BrandContract.php | 16 +++ src/ServiceContracts/BrandRawContract.php | 17 +++ src/Services/BrandRawService.php | 33 ++++++ src/Services/BrandService.php | 25 ++++ tests/Services/BrandTest.php | 30 +++++ 10 files changed, 532 insertions(+), 3 deletions(-) create mode 100644 src/Brand/BrandSearchParams.php create mode 100644 src/Brand/BrandSearchResponse.php create mode 100644 src/Brand/BrandSearchResponse/KeyMetadata.php create mode 100644 src/Brand/BrandSearchResponse/Result.php diff --git a/.stats.yml b/.stats.yml index 8e459864..74e73bcf 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 37 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-eac90d0a78d6166dc64c49ad4cd44883ab0bd357063ff09e60ed78085e2bde3c.yml +configured_endpoints: 38 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-155e4761d62255841349c0f8a01b0a9c463ea1d1f2d6c4fd8d1a75c8bef6f226.yml openapi_spec_hash: ab91f77e7c9d992400cbc7fc8a9e76c1 -config_hash: 2bea1743c84d63bd61f8501a6ea63065 +config_hash: bff282047fafdad771fb7ec685f56944 diff --git a/src/Brand/BrandSearchParams.php b/src/Brand/BrandSearchParams.php new file mode 100644 index 00000000..30c360b3 --- /dev/null +++ b/src/Brand/BrandSearchParams.php @@ -0,0 +1,102 @@ +|null + * } + */ +final class BrandSearchParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). + */ + #[Required] + public string $query; + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new BrandSearchParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandSearchParams::with(query: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandSearchParams)->withQuery(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $tags + */ + public static function with(string $query, ?array $tags = null): self + { + $self = new self; + + $self['query'] = $query; + + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + /** + * Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). + */ + public function withQuery(string $query): self + { + $self = clone $this; + $self['query'] = $query; + + return $self; + } + + /** + * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/Brand/BrandSearchResponse.php b/src/Brand/BrandSearchResponse.php new file mode 100644 index 00000000..24d1cd5a --- /dev/null +++ b/src/Brand/BrandSearchResponse.php @@ -0,0 +1,107 @@ +, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class BrandSearchResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Up to 10 matching brands, most popular first. Empty when nothing matches. + * + * @var list $results + */ + #[Required(list: Result::class)] + public array $results; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new BrandSearchResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandSearchResponse::with(results: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandSearchResponse)->withResults(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $results + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + array $results, + KeyMetadata|array|null $keyMetadata = null + ): self { + $self = new self; + + $self['results'] = $results; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * Up to 10 matching brands, most popular first. Empty when nothing matches. + * + * @param list $results + */ + public function withResults(array $results): self + { + $self = clone $this; + $self['results'] = $results; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Brand/BrandSearchResponse/KeyMetadata.php b/src/Brand/BrandSearchResponse/KeyMetadata.php new file mode 100644 index 00000000..aee2ec5a --- /dev/null +++ b/src/Brand/BrandSearchResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Brand/BrandSearchResponse/Result.php b/src/Brand/BrandSearchResponse/Result.php new file mode 100644 index 00000000..347d6b82 --- /dev/null +++ b/src/Brand/BrandSearchResponse/Result.php @@ -0,0 +1,107 @@ + */ + use SdkModel; + + /** + * The brand's domain. + */ + #[Required] + public string $domain; + + /** + * Logo link URL that serves the brand's logo, generated per request for the calling organization. + */ + #[Required] + public string $logo; + + /** + * The brand's name. Empty string when unknown. + */ + #[Required] + public string $name; + + /** + * `new Result()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Result::with(domain: ..., logo: ..., name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Result)->withDomain(...)->withLogo(...)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + string $domain, + string $logo, + string $name + ): self { + $self = new self; + + $self['domain'] = $domain; + $self['logo'] = $logo; + $self['name'] = $name; + + return $self; + } + + /** + * The brand's domain. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Logo link URL that serves the brand's logo, generated per request for the calling organization. + */ + public function withLogo(string $logo): self + { + $self = clone $this; + $self['logo'] = $logo; + + return $self; + } + + /** + * The brand's name. Empty string when unknown. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/ServiceContracts/BrandContract.php b/src/ServiceContracts/BrandContract.php index ce818d87..406ec4d3 100644 --- a/src/ServiceContracts/BrandContract.php +++ b/src/ServiceContracts/BrandContract.php @@ -9,6 +9,7 @@ use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; +use ContextDev\Brand\BrandSearchResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; @@ -86,4 +87,19 @@ public function retrieveSimplified( ?int $timeoutMs = null, RequestOptions|array|null $requestOptions = null, ): BrandGetSimplifiedResponse; + + /** + * @api + * + * @param string $query Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function search( + string $query, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BrandSearchResponse; } diff --git a/src/ServiceContracts/BrandRawContract.php b/src/ServiceContracts/BrandRawContract.php index 784eff79..0f747ffd 100644 --- a/src/ServiceContracts/BrandRawContract.php +++ b/src/ServiceContracts/BrandRawContract.php @@ -8,6 +8,8 @@ use ContextDev\Brand\BrandGetSimplifiedResponse; use ContextDev\Brand\BrandRetrieveParams; use ContextDev\Brand\BrandRetrieveSimplifiedParams; +use ContextDev\Brand\BrandSearchParams; +use ContextDev\Brand\BrandSearchResponse; use ContextDev\Core\Contracts\BaseResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; @@ -46,4 +48,19 @@ public function retrieveSimplified( array|BrandRetrieveSimplifiedParams $params, RequestOptions|array|null $requestOptions = null, ): BaseResponse; + + /** + * @api + * + * @param array|BrandSearchParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function search( + array|BrandSearchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; } diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index 7796a7dc..fdb05fdc 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -11,6 +11,8 @@ use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Brand\BrandRetrieveSimplifiedParams; use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; +use ContextDev\Brand\BrandSearchParams; +use ContextDev\Brand\BrandSearchResponse; use ContextDev\Client; use ContextDev\Core\Contracts\BaseResponse; use ContextDev\Core\Exceptions\APIException; @@ -117,4 +119,35 @@ public function retrieveSimplified( convert: BrandGetSimplifiedResponse::class, ); } + + /** + * @api + * + * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo), most popular first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. + * + * @param array{query: string, tags?: list}|BrandSearchParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function search( + array|BrandSearchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = BrandSearchParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'get', + path: 'brand/search', + query: $parsed, + options: $options, + convert: BrandSearchResponse::class, + ); + } } diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index 0ab38c56..fc9c8eec 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -9,6 +9,7 @@ use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; +use ContextDev\Brand\BrandSearchResponse; use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; use ContextDev\Core\Util; @@ -149,4 +150,28 @@ public function retrieveSimplified( return $response->parse(); } + + /** + * @api + * + * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo), most popular first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. + * + * @param string $query Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). + * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function search( + string $query, + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): BrandSearchResponse { + $params = Util::removeNulls(['query' => $query, 'tags' => $tags]); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->search(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } } diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index b5ab8fc6..e59d2194 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -4,6 +4,7 @@ use ContextDev\Brand\BrandGetResponse; use ContextDev\Brand\BrandGetSimplifiedResponse; +use ContextDev\Brand\BrandSearchResponse; use ContextDev\Client; use ContextDev\Core\Util; use PHPUnit\Framework\Attributes\CoversNothing; @@ -113,4 +114,33 @@ public function testRetrieveSimplifiedWithOptionalParams(): void // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(BrandGetSimplifiedResponse::class, $result); } + + #[Test] + public function testSearch(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->search(query: 'x'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandSearchResponse::class, $result); + } + + #[Test] + public function testSearchWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->brand->search( + query: 'x', + tags: ['production', 'team-alpha'] + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BrandSearchResponse::class, $result); + } } From f229a5d1c6b00775cf6eb8b6a1816c974d158da9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 10:21:31 +0000 Subject: [PATCH 088/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d1328ca9..64f9ff41 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.7.0" + ".": "2.8.0" } \ No newline at end of file diff --git a/README.md b/README.md index ecf5ee44..3f9ffb28 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.7.0" +composer require "context-dev/context-dev-php 2.8.0" ``` diff --git a/src/Client.php b/src/Client.php index 28f08d70..2bcbdc21 100644 --- a/src/Client.php +++ b/src/Client.php @@ -101,7 +101,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.7.0', + 'X-Stainless-Package-Version' => '2.8.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 5d54e5fd..9050d10b 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.7.0'; +const VERSION = '2.8.0'; // x-release-please-end From dea27052dddc590263db5b8ec604ae6a667c7b45 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 5 Aug 2026 18:49:15 +0000 Subject: [PATCH 089/130] feat(api): api update --- .stats.yml | 4 ++-- src/Services/WebRawService.php | 1 + src/Services/WebService.php | 1 + src/Web/WebWebScrapeMdParams.php | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 74e73bcf..9ea03e08 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-155e4761d62255841349c0f8a01b0a9c463ea1d1f2d6c4fd8d1a75c8bef6f226.yml -openapi_spec_hash: ab91f77e7c9d992400cbc7fc8a9e76c1 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8a92cb064637006331b2910caedca8512290c1d8cc75eb91218393cc1581e59c.yml +openapi_spec_hash: c811ec47143ad01cdbcbd8324caa4eda config_hash: bff282047fafdad771fb7ec685f56944 diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 3a1a7f40..07d658e9 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -482,6 +482,7 @@ public function webScrapeImages( * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | * | 408 | No | Request timed out | + * | 413 | No | Target content exceeds the maximum supported size (20 MB) | * | 415 | No | Unsupported content type | * | 429 | No | Per-minute rate limit exceeded; honor Retry-After | * | 500 | No | Internal error | diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 30d0899b..97a91e11 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -593,6 +593,7 @@ public function webScrapeImages( * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | * | 408 | No | Request timed out | + * | 413 | No | Target content exceeds the maximum supported size (20 MB) | * | 415 | No | Unsupported content type | * | 429 | No | Per-minute rate limit exceeded; honor Retry-After | * | 500 | No | Internal error | diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index 8c654975..da7c946f 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -33,6 +33,7 @@ * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | * | 408 | No | Request timed out | + * | 413 | No | Target content exceeds the maximum supported size (20 MB) | * | 415 | No | Unsupported content type | * | 429 | No | Per-minute rate limit exceeded; honor Retry-After | * | 500 | No | Internal error | From 00ffdfbb21a86177c8125ca9071378cc2a25de45 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 03:09:03 +0000 Subject: [PATCH 090/130] feat(api): api update --- .stats.yml | 4 ++-- src/Web/WebWebScrapeHTMLParams/Pdf.php | 4 ++-- src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse.php | 2 +- src/Web/WebWebScrapeMdParams/Pdf.php | 4 ++-- src/Web/WebWebScrapeMdParams/Pdf/ShouldParse.php | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9ea03e08..9a1a53da 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8a92cb064637006331b2910caedca8512290c1d8cc75eb91218393cc1581e59c.yml -openapi_spec_hash: c811ec47143ad01cdbcbd8324caa4eda +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e6a3365124af52952a85c8af5a09d6fdc02a686db7949985d0a6313dfad8dee5.yml +openapi_spec_hash: d7d0e17252f6f5665fb1698e37e09fe2 config_hash: bff282047fafdad771fb7ec685f56944 diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf.php b/src/Web/WebWebScrapeHTMLParams/Pdf.php index 4bea0c5d..90573f22 100644 --- a/src/Web/WebWebScrapeHTMLParams/Pdf.php +++ b/src/Web/WebWebScrapeHTMLParams/Pdf.php @@ -46,7 +46,7 @@ final class Pdf implements BaseModel public bool|string|null $ocr; /** - * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. * * @var ShouldParseVariants|null $shouldParse */ @@ -113,7 +113,7 @@ public function withOcr(bool|UnionMember1|string $ocr): self } /** - * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. * * @param ShouldParseShape $shouldParse */ diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse.php b/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse.php index 22883a02..ea0a236b 100644 --- a/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse.php +++ b/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse.php @@ -10,7 +10,7 @@ use ContextDev\Web\WebWebScrapeHTMLParams\Pdf\ShouldParse\UnionMember1; /** - * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. * * @phpstan-type ShouldParseVariants = bool|value-of * @phpstan-type ShouldParseShape = ShouldParseVariants diff --git a/src/Web/WebWebScrapeMdParams/Pdf.php b/src/Web/WebWebScrapeMdParams/Pdf.php index 701103de..39d4f361 100644 --- a/src/Web/WebWebScrapeMdParams/Pdf.php +++ b/src/Web/WebWebScrapeMdParams/Pdf.php @@ -46,7 +46,7 @@ final class Pdf implements BaseModel public bool|string|null $ocr; /** - * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. * * @var ShouldParseVariants|null $shouldParse */ @@ -113,7 +113,7 @@ public function withOcr(bool|UnionMember1|string $ocr): self } /** - * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. * * @param ShouldParseShape $shouldParse */ diff --git a/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse.php b/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse.php index 0e052734..1d639152 100644 --- a/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse.php +++ b/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse.php @@ -10,7 +10,7 @@ use ContextDev\Web\WebWebScrapeMdParams\Pdf\ShouldParse\UnionMember1; /** - * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 WEBSITE_ACCESS_ERROR is returned. + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. * * @phpstan-type ShouldParseVariants = bool|value-of * @phpstan-type ShouldParseShape = ShouldParseVariants From cc5fb31e8e301e635b7cb3065b13fbfd3e5a1237 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 05:46:09 +0000 Subject: [PATCH 091/130] feat(api): api update --- .stats.yml | 4 ++-- src/Parse/ParseHandleParams.php | 4 ++-- src/Parse/ParseHandleParams/Ocr.php | 2 +- src/ServiceContracts/ParseContract.php | 2 +- src/Services/ParseService.php | 2 +- src/Web/WebWebScrapeHTMLParams/Pdf.php | 4 ++-- src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php | 2 +- src/Web/WebWebScrapeMdParams/Pdf.php | 4 ++-- src/Web/WebWebScrapeMdParams/Pdf/Ocr.php | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9a1a53da..f57748b1 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e6a3365124af52952a85c8af5a09d6fdc02a686db7949985d0a6313dfad8dee5.yml -openapi_spec_hash: d7d0e17252f6f5665fb1698e37e09fe2 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b73de7a5f87b3bed7d9e4259bd109cd62f4eb5f61fa082f31fc22d5bf8e69bcc.yml +openapi_spec_hash: 5dcb5ba9b8487329adc2f89eeb4df7c4 config_hash: bff282047fafdad771fb7ec685f56944 diff --git a/src/Parse/ParseHandleParams.php b/src/Parse/ParseHandleParams.php index 7e18b75a..763ca0d6 100644 --- a/src/Parse/ParseHandleParams.php +++ b/src/Parse/ParseHandleParams.php @@ -85,7 +85,7 @@ final class ParseHandleParams implements BaseModel public bool|string|null $includeLinks; /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. * * @var OcrVariants|null $ocr */ @@ -231,7 +231,7 @@ public function withIncludeLinks( } /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. * * @param OcrShape $ocr */ diff --git a/src/Parse/ParseHandleParams/Ocr.php b/src/Parse/ParseHandleParams/Ocr.php index 24559880..ab764b50 100644 --- a/src/Parse/ParseHandleParams/Ocr.php +++ b/src/Parse/ParseHandleParams/Ocr.php @@ -10,7 +10,7 @@ use ContextDev\Parse\ParseHandleParams\Ocr\UnionMember1; /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. * * @phpstan-type OcrVariants = bool|value-of * @phpstan-type OcrShape = OcrVariants diff --git a/src/ServiceContracts/ParseContract.php b/src/ServiceContracts/ParseContract.php index c724b434..4b6bc024 100644 --- a/src/ServiceContracts/ParseContract.php +++ b/src/ServiceContracts/ParseContract.php @@ -32,7 +32,7 @@ interface ParseContract * @param Extension|value-of $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php index 8d6df770..74e05608 100644 --- a/src/Services/ParseService.php +++ b/src/Services/ParseService.php @@ -50,7 +50,7 @@ public function __construct(private Client $client) * @param Extension|value-of $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, all OCR is disabled, including the automatic scanned-PDF fallback. + * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf.php b/src/Web/WebWebScrapeHTMLParams/Pdf.php index 90573f22..7184db48 100644 --- a/src/Web/WebWebScrapeHTMLParams/Pdf.php +++ b/src/Web/WebWebScrapeHTMLParams/Pdf.php @@ -38,7 +38,7 @@ final class Pdf implements BaseModel public ?int $end; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. * * @var OcrVariants|null $ocr */ @@ -100,7 +100,7 @@ public function withEnd(int $end): self } /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. * * @param OcrShape $ocr */ diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php b/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php index 43dc6596..48f4ecaf 100644 --- a/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php +++ b/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php @@ -10,7 +10,7 @@ use ContextDev\Web\WebWebScrapeHTMLParams\Pdf\Ocr\UnionMember1; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. * * @phpstan-type OcrVariants = bool|value-of * @phpstan-type OcrShape = OcrVariants diff --git a/src/Web/WebWebScrapeMdParams/Pdf.php b/src/Web/WebWebScrapeMdParams/Pdf.php index 39d4f361..012e10d9 100644 --- a/src/Web/WebWebScrapeMdParams/Pdf.php +++ b/src/Web/WebWebScrapeMdParams/Pdf.php @@ -38,7 +38,7 @@ final class Pdf implements BaseModel public ?int $end; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. * * @var OcrVariants|null $ocr */ @@ -100,7 +100,7 @@ public function withEnd(int $end): self } /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. * * @param OcrShape $ocr */ diff --git a/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php b/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php index b7b34fa8..b90a4729 100644 --- a/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php +++ b/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php @@ -10,7 +10,7 @@ use ContextDev\Web\WebWebScrapeMdParams\Pdf\Ocr\UnionMember1; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. * * @phpstan-type OcrVariants = bool|value-of * @phpstan-type OcrShape = OcrVariants From c9139c5d26c713b355e0694a82c43efadca78941 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 07:45:47 +0000 Subject: [PATCH 092/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 2 ++ src/Services/WebRawService.php | 3 ++- src/Services/WebService.php | 5 ++++- src/Web/WebWebScrapeSitemapParams.php | 22 +++++++++++++++++++++- src/Web/WebWebScrapeSitemapResponse.php | 4 ++-- tests/Services/WebTest.php | 1 + 7 files changed, 34 insertions(+), 7 deletions(-) diff --git a/.stats.yml b/.stats.yml index f57748b1..15a26730 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b73de7a5f87b3bed7d9e4259bd109cd62f4eb5f61fa082f31fc22d5bf8e69bcc.yml -openapi_spec_hash: 5dcb5ba9b8487329adc2f89eeb4df7c4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b5a46cf886759797353b250da971e46cf66804b825ded9c51609f34d72d1169c.yml +openapi_spec_hash: 1947de2a731ddab05bfb781f37cd42b6 config_hash: bff282047fafdad771fb7ec685f56944 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 575855f0..beefa33a 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -411,6 +411,7 @@ public function webScrapeMd( * @param string $domain Domain to build a sitemap for * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param string $search Optional search phrase. When provided, the crawled sitemap is filtered to the pages whose URLs are about that phrase, most relevant first, and the request costs 2 credits instead of 1. * @param string $sitemapURL Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -424,6 +425,7 @@ public function webScrapeSitemap( string $domain, ?array $headers = null, int $maxLinks = 10000, + ?string $search = null, ?string $sitemapURL = null, ?array $tags = null, ?int $timeoutMs = null, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 07d658e9..635b101e 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -535,12 +535,13 @@ public function webScrapeMd( /** * @api * - * Crawl an entire website's sitemap and return all discovered page URLs. + * Crawl an entire website's sitemap and return all discovered page URLs. Pass `search` to have the crawled sitemap filtered down to the pages about a phrase (for example `pricing and plans` or `api authentication docs`), most relevant first — a searched crawl scans the whole sitemap and costs 2 credits instead of 1. * * @param array{ * domain: string, * headers?: array, * maxLinks?: int, + * search?: string, * sitemapURL?: string, * tags?: list, * timeoutMs?: int, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 97a91e11..cac1a34d 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -675,11 +675,12 @@ public function webScrapeMd( /** * @api * - * Crawl an entire website's sitemap and return all discovered page URLs. + * Crawl an entire website's sitemap and return all discovered page URLs. Pass `search` to have the crawled sitemap filtered down to the pages about a phrase (for example `pricing and plans` or `api authentication docs`), most relevant first — a searched crawl scans the whole sitemap and costs 2 credits instead of 1. * * @param string $domain Domain to build a sitemap for * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int $maxLinks Maximum number of links to return from the sitemap crawl. Defaults to 10,000. Minimum is 1, maximum is 100,000. + * @param string $search Optional search phrase. When provided, the crawled sitemap is filtered to the pages whose URLs are about that phrase, most relevant first, and the request costs 2 credits instead of 1. * @param string $sitemapURL Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). @@ -693,6 +694,7 @@ public function webScrapeSitemap( string $domain, ?array $headers = null, int $maxLinks = 10000, + ?string $search = null, ?string $sitemapURL = null, ?array $tags = null, ?int $timeoutMs = null, @@ -705,6 +707,7 @@ public function webScrapeSitemap( 'domain' => $domain, 'headers' => $headers, 'maxLinks' => $maxLinks, + 'search' => $search, 'sitemapURL' => $sitemapURL, 'tags' => $tags, 'timeoutMs' => $timeoutMs, diff --git a/src/Web/WebWebScrapeSitemapParams.php b/src/Web/WebWebScrapeSitemapParams.php index 05d8790a..0ce72733 100644 --- a/src/Web/WebWebScrapeSitemapParams.php +++ b/src/Web/WebWebScrapeSitemapParams.php @@ -12,7 +12,7 @@ use ContextDev\Web\WebWebScrapeSitemapParams\Zdr; /** - * Crawl an entire website's sitemap and return all discovered page URLs. + * Crawl an entire website's sitemap and return all discovered page URLs. Pass `search` to have the crawled sitemap filtered down to the pages about a phrase (for example `pricing and plans` or `api authentication docs`), most relevant first — a searched crawl scans the whole sitemap and costs 2 credits instead of 1. * * @see ContextDev\Services\WebService::webScrapeSitemap() * @@ -20,6 +20,7 @@ * domain: string, * headers?: array|null, * maxLinks?: int|null, + * search?: string|null, * sitemapURL?: string|null, * tags?: list|null, * timeoutMs?: int|null, @@ -53,6 +54,12 @@ final class WebWebScrapeSitemapParams implements BaseModel #[Optional] public ?int $maxLinks; + /** + * Optional search phrase. When provided, the crawled sitemap is filtered to the pages whose URLs are about that phrase, most relevant first, and the request costs 2 credits instead of 1. + */ + #[Optional] + public ?string $search; + /** * Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. */ @@ -119,6 +126,7 @@ public static function with( string $domain, ?array $headers = null, ?int $maxLinks = null, + ?string $search = null, ?string $sitemapURL = null, ?array $tags = null, ?int $timeoutMs = null, @@ -131,6 +139,7 @@ public static function with( null !== $headers && $self['headers'] = $headers; null !== $maxLinks && $self['maxLinks'] = $maxLinks; + null !== $search && $self['search'] = $search; null !== $sitemapURL && $self['sitemapURL'] = $sitemapURL; null !== $tags && $self['tags'] = $tags; null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; @@ -175,6 +184,17 @@ public function withMaxLinks(int $maxLinks): self return $self; } + /** + * Optional search phrase. When provided, the crawled sitemap is filtered to the pages whose URLs are about that phrase, most relevant first, and the request costs 2 credits instead of 1. + */ + public function withSearch(string $search): self + { + $self = clone $this; + $self['search'] = $search; + + return $self; + } + /** * Optional explicit sitemap URL. When provided, exactly this sitemap is crawled instead of discovering the domain's sitemaps. */ diff --git a/src/Web/WebWebScrapeSitemapResponse.php b/src/Web/WebWebScrapeSitemapResponse.php index 4d606f4b..ea97f613 100644 --- a/src/Web/WebWebScrapeSitemapResponse.php +++ b/src/Web/WebWebScrapeSitemapResponse.php @@ -47,7 +47,7 @@ final class WebWebScrapeSitemapResponse implements BaseModel public bool $success; /** - * Array of discovered page URLs from the sitemap (max 500). + * Discovered page URLs from the sitemap, up to `maxLinks`. When `search` is set these are only the matching pages, most relevant first. * * @var list $urls */ @@ -149,7 +149,7 @@ public function withSuccess(bool $success): self } /** - * Array of discovered page URLs from the sitemap (max 500). + * Discovered page URLs from the sitemap, up to `maxLinks`. When `search` is set these are only the matching pages, most relevant first. * * @param list $urls */ diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index c0febb04..eb41d56e 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -411,6 +411,7 @@ public function testWebScrapeSitemapWithOptionalParams(): void domain: 'xxx', headers: ['foo' => 'J!'], maxLinks: 1, + search: 'help center and troubleshooting articles', sitemapURL: 'https://example.com', tags: ['production', 'team-alpha'], timeoutMs: 1, From 37806940137f69e31f81e760b8f5092c46ba486a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 20:23:10 +0000 Subject: [PATCH 093/130] feat(api): api update --- .stats.yml | 4 +- src/Batch/BatchGetResponse/Credits.php | 42 +++++++-- .../Data/ScrapedPage.php | 20 +++++ src/Batch/BatchListResponse/Data/Credits.php | 42 +++++++-- src/Brand/BrandGetResponse/Brand.php | 25 ++++++ .../BrandGetResponse/Brand/Employees.php | 85 +++++++++++++++++++ .../Brand/Employees/Range.php | 27 ++++++ src/Brand/BrandSearchParams.php | 2 +- src/Brand/BrandSearchResponse.php | 4 +- src/Parse/ParseHandleParams.php | 4 +- src/Parse/ParseHandleParams/Ocr.php | 2 +- src/ServiceContracts/ParseContract.php | 2 +- src/Services/BrandRawService.php | 2 +- src/Services/BrandService.php | 2 +- src/Services/ParseService.php | 2 +- src/Web/WebWebCrawlMdParams/Pdf.php | 4 +- src/Web/WebWebScrapeHTMLParams/Pdf.php | 4 +- src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php | 2 +- src/Web/WebWebScrapeMdParams/Pdf.php | 4 +- src/Web/WebWebScrapeMdParams/Pdf/Ocr.php | 2 +- 20 files changed, 247 insertions(+), 34 deletions(-) create mode 100644 src/Brand/BrandGetResponse/Brand/Employees.php create mode 100644 src/Brand/BrandGetResponse/Brand/Employees/Range.php diff --git a/.stats.yml b/.stats.yml index 15a26730..3eddd36e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b5a46cf886759797353b250da971e46cf66804b825ded9c51609f34d72d1169c.yml -openapi_spec_hash: 1947de2a731ddab05bfb781f37cd42b6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-3ecc6285243f60f7619d543cac59991015fbb0a156648741e7e42e619e0cbc5c.yml +openapi_spec_hash: 0130f29a501366c63cbd3a446c5eb109 config_hash: bff282047fafdad771fb7ec685f56944 diff --git a/src/Batch/BatchGetResponse/Credits.php b/src/Batch/BatchGetResponse/Credits.php index a4988429..39696c60 100644 --- a/src/Batch/BatchGetResponse/Credits.php +++ b/src/Batch/BatchGetResponse/Credits.php @@ -11,7 +11,9 @@ /** * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} + * @phpstan-type CreditsShape = array{ + * net: int, ocrCharged: int, refunded: int, reserved: int + * } */ final class Credits implements BaseModel { @@ -19,11 +21,17 @@ final class Credits implements BaseModel use SdkModel; /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + * `reserved` minus `refunded` plus `ocr_charged` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] public int $net; + /** + * Credits charged for PDF pages recovered by OCR (pdf.ocr=true), 1 per recovered page, on top of `reserved`. Stays 0 until the batch settles. + */ + #[Required('ocr_charged')] + public int $ocrCharged; + /** * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ @@ -41,13 +49,17 @@ final class Credits implements BaseModel * * To enforce required parameters use * ``` - * Credits::with(net: ..., refunded: ..., reserved: ...) + * Credits::with(net: ..., ocrCharged: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) + * (new Credits) + * ->withNet(...) + * ->withOcrCharged(...) + * ->withRefunded(...) + * ->withReserved(...) * ``` */ public function __construct() @@ -60,11 +72,16 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $net, int $refunded, int $reserved): self - { + public static function with( + int $net, + int $ocrCharged, + int $refunded, + int $reserved + ): self { $self = new self; $self['net'] = $net; + $self['ocrCharged'] = $ocrCharged; $self['refunded'] = $refunded; $self['reserved'] = $reserved; @@ -72,7 +89,7 @@ public static function with(int $net, int $refunded, int $reserved): self } /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + * `reserved` minus `refunded` plus `ocr_charged` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ public function withNet(int $net): self { @@ -82,6 +99,17 @@ public function withNet(int $net): self return $self; } + /** + * Credits charged for PDF pages recovered by OCR (pdf.ocr=true), 1 per recovered page, on top of `reserved`. Stays 0 until the batch settles. + */ + public function withOcrCharged(int $ocrCharged): self + { + $self = clone $this; + $self['ocrCharged'] = $ocrCharged; + + return $self; + } + /** * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php index aafb7cf3..d5c7edda 100644 --- a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php @@ -25,6 +25,7 @@ * itemID?: string|null, * markdown?: string|null, * meta?: array|null, + * ocrPages?: int|null, * } */ final class ScrapedPage implements BaseModel @@ -90,6 +91,12 @@ final class ScrapedPage implements BaseModel #[Optional(map: 'mixed')] public ?array $meta; + /** + * PDF pages of this document recovered by OCR (pdf.ocr=true). Each recovered page bills 1 credit on top of the page base credit; absent when no OCR ran. + */ + #[Optional('ocr_pages')] + public ?int $ocrPages; + /** * `new ScrapedPage()` is missing required properties by the API. * @@ -130,6 +137,7 @@ public static function with( ?string $itemID = null, ?string $markdown = null, ?array $meta = null, + ?int $ocrPages = null, ): self { $self = new self; @@ -142,6 +150,7 @@ public static function with( null !== $itemID && $self['itemID'] = $itemID; null !== $markdown && $self['markdown'] = $markdown; null !== $meta && $self['meta'] = $meta; + null !== $ocrPages && $self['ocrPages'] = $ocrPages; return $self; } @@ -250,4 +259,15 @@ public function withMeta(array $meta): self return $self; } + + /** + * PDF pages of this document recovered by OCR (pdf.ocr=true). Each recovered page bills 1 credit on top of the page base credit; absent when no OCR ran. + */ + public function withOcrPages(int $ocrPages): self + { + $self = clone $this; + $self['ocrPages'] = $ocrPages; + + return $self; + } } diff --git a/src/Batch/BatchListResponse/Data/Credits.php b/src/Batch/BatchListResponse/Data/Credits.php index cfb610dd..37c7deb2 100644 --- a/src/Batch/BatchListResponse/Data/Credits.php +++ b/src/Batch/BatchListResponse/Data/Credits.php @@ -11,7 +11,9 @@ /** * What this batch has done to your credit balance. * - * @phpstan-type CreditsShape = array{net: int, refunded: int, reserved: int} + * @phpstan-type CreditsShape = array{ + * net: int, ocrCharged: int, refunded: int, reserved: int + * } */ final class Credits implements BaseModel { @@ -19,11 +21,17 @@ final class Credits implements BaseModel use SdkModel; /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + * `reserved` minus `refunded` plus `ocr_charged` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ #[Required] public int $net; + /** + * Credits charged for PDF pages recovered by OCR (pdf.ocr=true), 1 per recovered page, on top of `reserved`. Stays 0 until the batch settles. + */ + #[Required('ocr_charged')] + public int $ocrCharged; + /** * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ @@ -41,13 +49,17 @@ final class Credits implements BaseModel * * To enforce required parameters use * ``` - * Credits::with(net: ..., refunded: ..., reserved: ...) + * Credits::with(net: ..., ocrCharged: ..., refunded: ..., reserved: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Credits)->withNet(...)->withRefunded(...)->withReserved(...) + * (new Credits) + * ->withNet(...) + * ->withOcrCharged(...) + * ->withRefunded(...) + * ->withReserved(...) * ``` */ public function __construct() @@ -60,11 +72,16 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with(int $net, int $refunded, int $reserved): self - { + public static function with( + int $net, + int $ocrCharged, + int $refunded, + int $reserved + ): self { $self = new self; $self['net'] = $net; + $self['ocrCharged'] = $ocrCharged; $self['refunded'] = $refunded; $self['reserved'] = $reserved; @@ -72,7 +89,7 @@ public static function with(int $net, int $refunded, int $reserved): self } /** - * `reserved` minus `refunded` — what the batch has cost so far. Equal to `reserved` until the batch settles. + * `reserved` minus `refunded` plus `ocr_charged` — what the batch has cost so far. Equal to `reserved` until the batch settles. */ public function withNet(int $net): self { @@ -82,6 +99,17 @@ public function withNet(int $net): self return $self; } + /** + * Credits charged for PDF pages recovered by OCR (pdf.ocr=true), 1 per recovered page, on top of `reserved`. Stays 0 until the batch settles. + */ + public function withOcrCharged(int $ocrCharged): self + { + $self = clone $this; + $self['ocrCharged'] = $ocrCharged; + + return $self; + } + /** * Credits returned for pages that did not succeed. Stays 0 until the batch reaches a final status, then settles in one movement. */ diff --git a/src/Brand/BrandGetResponse/Brand.php b/src/Brand/BrandGetResponse/Brand.php index 23527d66..a540ecfb 100644 --- a/src/Brand/BrandGetResponse/Brand.php +++ b/src/Brand/BrandGetResponse/Brand.php @@ -7,6 +7,7 @@ use ContextDev\Brand\BrandGetResponse\Brand\Address; use ContextDev\Brand\BrandGetResponse\Brand\Backdrop; use ContextDev\Brand\BrandGetResponse\Brand\Color; +use ContextDev\Brand\BrandGetResponse\Brand\Employees; use ContextDev\Brand\BrandGetResponse\Brand\Industries; use ContextDev\Brand\BrandGetResponse\Brand\Links; use ContextDev\Brand\BrandGetResponse\Brand\Logo; @@ -23,6 +24,7 @@ * @phpstan-import-type AddressShape from \ContextDev\Brand\BrandGetResponse\Brand\Address * @phpstan-import-type BackdropShape from \ContextDev\Brand\BrandGetResponse\Brand\Backdrop * @phpstan-import-type ColorShape from \ContextDev\Brand\BrandGetResponse\Brand\Color + * @phpstan-import-type EmployeesShape from \ContextDev\Brand\BrandGetResponse\Brand\Employees * @phpstan-import-type IndustriesShape from \ContextDev\Brand\BrandGetResponse\Brand\Industries * @phpstan-import-type LinksShape from \ContextDev\Brand\BrandGetResponse\Brand\Links * @phpstan-import-type LogoShape from \ContextDev\Brand\BrandGetResponse\Brand\Logo @@ -36,6 +38,7 @@ * description?: string|null, * domain?: string|null, * email?: string|null, + * employees?: null|Employees|EmployeesShape, * industries?: null|Industries|IndustriesShape, * isNsfw?: bool|null, * links?: null|Links|LinksShape, @@ -93,6 +96,12 @@ final class Brand implements BaseModel #[Optional] public ?string $email; + /** + * Employee headcount information for the brand (will be null if unknown). + */ + #[Optional] + public ?Employees $employees; + /** * Industry classification information for the brand. */ @@ -172,6 +181,7 @@ public function __construct() * @param Address|AddressShape|null $address * @param list|null $backdrops * @param list|null $colors + * @param Employees|EmployeesShape|null $employees * @param Industries|IndustriesShape|null $industries * @param Links|LinksShape|null $links * @param list|null $logos @@ -186,6 +196,7 @@ public static function with( ?string $description = null, ?string $domain = null, ?string $email = null, + Employees|array|null $employees = null, Industries|array|null $industries = null, ?bool $isNsfw = null, Links|array|null $links = null, @@ -205,6 +216,7 @@ public static function with( null !== $description && $self['description'] = $description; null !== $domain && $self['domain'] = $domain; null !== $email && $self['email'] = $email; + null !== $employees && $self['employees'] = $employees; null !== $industries && $self['industries'] = $industries; null !== $isNsfw && $self['isNsfw'] = $isNsfw; null !== $links && $self['links'] = $links; @@ -291,6 +303,19 @@ public function withEmail(string $email): self return $self; } + /** + * Employee headcount information for the brand (will be null if unknown). + * + * @param Employees|EmployeesShape $employees + */ + public function withEmployees(Employees|array $employees): self + { + $self = clone $this; + $self['employees'] = $employees; + + return $self; + } + /** * Industry classification information for the brand. * diff --git a/src/Brand/BrandGetResponse/Brand/Employees.php b/src/Brand/BrandGetResponse/Brand/Employees.php new file mode 100644 index 00000000..e9eba506 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Employees.php @@ -0,0 +1,85 @@ + + * } + */ +final class Employees implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Exact employee count when a precise headcount is known. + */ + #[Optional] + public ?int $exact; + + /** + * Employee count range for the brand (e.g. '11 to 50'). + * + * @var value-of|null $range + */ + #[Optional(enum: Range::class)] + public ?string $range; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Range|value-of|null $range + */ + public static function with( + ?int $exact = null, + Range|string|null $range = null + ): self { + $self = new self; + + null !== $exact && $self['exact'] = $exact; + null !== $range && $self['range'] = $range; + + return $self; + } + + /** + * Exact employee count when a precise headcount is known. + */ + public function withExact(int $exact): self + { + $self = clone $this; + $self['exact'] = $exact; + + return $self; + } + + /** + * Employee count range for the brand (e.g. '11 to 50'). + * + * @param Range|value-of $range + */ + public function withRange(Range|string $range): self + { + $self = clone $this; + $self['range'] = $range; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/Brand/Employees/Range.php b/src/Brand/BrandGetResponse/Brand/Employees/Range.php new file mode 100644 index 00000000..ef6a6f24 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Employees/Range.php @@ -0,0 +1,27 @@ + $results */ @@ -80,7 +80,7 @@ public static function with( } /** - * Up to 10 matching brands, most popular first. Empty when nothing matches. + * Up to 10 matching brands, name matches first, then domain matches, most popular first within each group. Empty when nothing matches. * * @param list $results */ diff --git a/src/Parse/ParseHandleParams.php b/src/Parse/ParseHandleParams.php index 763ca0d6..4c7b150f 100644 --- a/src/Parse/ParseHandleParams.php +++ b/src/Parse/ParseHandleParams.php @@ -85,7 +85,7 @@ final class ParseHandleParams implements BaseModel public bool|string|null $includeLinks; /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. + * When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @var OcrVariants|null $ocr */ @@ -231,7 +231,7 @@ public function withIncludeLinks( } /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. + * When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @param OcrShape $ocr */ diff --git a/src/Parse/ParseHandleParams/Ocr.php b/src/Parse/ParseHandleParams/Ocr.php index ab764b50..6f68b5ef 100644 --- a/src/Parse/ParseHandleParams/Ocr.php +++ b/src/Parse/ParseHandleParams/Ocr.php @@ -10,7 +10,7 @@ use ContextDev\Parse\ParseHandleParams\Ocr\UnionMember1; /** - * When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. + * When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @phpstan-type OcrVariants = bool|value-of * @phpstan-type OcrShape = OcrVariants diff --git a/src/ServiceContracts/ParseContract.php b/src/ServiceContracts/ParseContract.php index 4b6bc024..77448f02 100644 --- a/src/ServiceContracts/ParseContract.php +++ b/src/ServiceContracts/ParseContract.php @@ -32,7 +32,7 @@ interface ParseContract * @param Extension|value-of $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. + * @param OcrShape $ocr Query param: When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index fdb05fdc..46c72922 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -123,7 +123,7 @@ public function retrieveSimplified( /** * @api * - * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo), most popular first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. + * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo). Name matches rank ahead of domain matches; within each group the most popular brands come first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. * * @param array{query: string, tags?: list}|BrandSearchParams $params * @param RequestOpts|null $requestOptions diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index fc9c8eec..d9d72a42 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -154,7 +154,7 @@ public function retrieveSimplified( /** * @api * - * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo), most popular first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. + * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo). Name matches rank ahead of domain matches; within each group the most popular brands come first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. * * @param string $query Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php index 74e05608..545b7b72 100644 --- a/src/Services/ParseService.php +++ b/src/Services/ParseService.php @@ -50,7 +50,7 @@ public function __construct(private Client $client) * @param Extension|value-of $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param OcrShape $ocr Query param: When true for PDF inputs, detect and OCR images embedded in the selected pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. pdf.start/pdf.end limit the inclusive page range. When false, no OCR runs. + * @param OcrShape $ocr Query param: When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. diff --git a/src/Web/WebWebCrawlMdParams/Pdf.php b/src/Web/WebWebCrawlMdParams/Pdf.php index d412e2eb..443d177f 100644 --- a/src/Web/WebWebCrawlMdParams/Pdf.php +++ b/src/Web/WebWebCrawlMdParams/Pdf.php @@ -27,7 +27,7 @@ final class Pdf implements BaseModel public ?int $end; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. */ #[Optional] public ?bool $ocr; @@ -82,7 +82,7 @@ public function withEnd(int $end): self } /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. This is separate from automatic scanned-PDF OCR fallback. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. */ public function withOcr(bool $ocr): self { diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf.php b/src/Web/WebWebScrapeHTMLParams/Pdf.php index 7184db48..0523390c 100644 --- a/src/Web/WebWebScrapeHTMLParams/Pdf.php +++ b/src/Web/WebWebScrapeHTMLParams/Pdf.php @@ -38,7 +38,7 @@ final class Pdf implements BaseModel public ?int $end; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @var OcrVariants|null $ocr */ @@ -100,7 +100,7 @@ public function withEnd(int $end): self } /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @param OcrShape $ocr */ diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php b/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php index 48f4ecaf..074bc18b 100644 --- a/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php +++ b/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php @@ -10,7 +10,7 @@ use ContextDev\Web\WebWebScrapeHTMLParams\Pdf\Ocr\UnionMember1; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @phpstan-type OcrVariants = bool|value-of * @phpstan-type OcrShape = OcrVariants diff --git a/src/Web/WebWebScrapeMdParams/Pdf.php b/src/Web/WebWebScrapeMdParams/Pdf.php index 012e10d9..a712278f 100644 --- a/src/Web/WebWebScrapeMdParams/Pdf.php +++ b/src/Web/WebWebScrapeMdParams/Pdf.php @@ -38,7 +38,7 @@ final class Pdf implements BaseModel public ?int $end; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @var OcrVariants|null $ocr */ @@ -100,7 +100,7 @@ public function withEnd(int $end): self } /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @param OcrShape $ocr */ diff --git a/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php b/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php index b90a4729..d88785e8 100644 --- a/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php +++ b/src/Web/WebWebScrapeMdParams/Pdf/Ocr.php @@ -10,7 +10,7 @@ use ContextDev\Web\WebWebScrapeMdParams\Pdf\Ocr\UnionMember1; /** - * When true, detect and OCR images embedded in the selected PDF pages, inserting recognized text at each image's position in page reading order while preserving the PDF text layer. When false, no OCR runs. + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * * @phpstan-type OcrVariants = bool|value-of * @phpstan-type OcrShape = OcrVariants From c8dab90a9f5b935e2ca5055a19687ec0a1d9d97e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 23:35:47 +0000 Subject: [PATCH 094/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 3eddd36e..2c6e57ff 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-3ecc6285243f60f7619d543cac59991015fbb0a156648741e7e42e619e0cbc5c.yml -openapi_spec_hash: 0130f29a501366c63cbd3a446c5eb109 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2f28cd1bf5b88305989d68dc55037fe25bdba2800d61c071a848cc1eb1ccb225.yml +openapi_spec_hash: 6dd2807c7804e08c1d49479c0ff82e47 config_hash: bff282047fafdad771fb7ec685f56944 From a110cb49325ea25373efc1bd3e49b4d605ef309f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 6 Aug 2026 23:45:41 +0000 Subject: [PATCH 095/130] feat(api): api update --- .stats.yml | 4 ++-- src/Services/WebRawService.php | 4 ++++ src/Services/WebService.php | 4 ++++ src/Web/WebSearchResponse/Result/Markdown/Code.php | 2 ++ src/Web/WebWebScrapeMdParams.php | 4 ++++ 5 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 2c6e57ff..b90c8da4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2f28cd1bf5b88305989d68dc55037fe25bdba2800d61c071a848cc1eb1ccb225.yml -openapi_spec_hash: 6dd2807c7804e08c1d49479c0ff82e47 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c1b6ca84f9bec1b1936cebb61f058924c3d7a5f6977e4cd76cf0544c4c7d8737.yml +openapi_spec_hash: 141bfa8430ddccfb5a37c4bd703d163b config_hash: bff282047fafdad771fb7ec685f56944 diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 635b101e..953b50d6 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -473,6 +473,10 @@ public function webScrapeImages( * * Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON responses from a recognized API key; use error_code to distinguish stable failure categories. * + * ### YouTube + * + * YouTube URLs return the video or channel itself rather than the surrounding player and navigation chrome. A URL addressing a single video (`/watch`, `youtu.be`, `/shorts`, `/embed`, `/live`) returns its title, channel, duration, view count, keywords, full description, and the transcript when the video has captions that can be retrieved; videos without captions return everything except the transcript. A channel URL (`/channel/UC…`, `/@handle`, `/c/…`, `/user/…`) returns its name, handle, subscriber count, video count, and full description. When `includeImages=true`, video responses also include the thumbnail and channel responses include the avatar. Costs the same as any other scrape. + * * ### Billing & errors * * | HTTP status | Billed? | Meaning | diff --git a/src/Services/WebService.php b/src/Services/WebService.php index cac1a34d..27e6e7e4 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -584,6 +584,10 @@ public function webScrapeImages( * * Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON responses from a recognized API key; use error_code to distinguish stable failure categories. * + * ### YouTube + * + * YouTube URLs return the video or channel itself rather than the surrounding player and navigation chrome. A URL addressing a single video (`/watch`, `youtu.be`, `/shorts`, `/embed`, `/live`) returns its title, channel, duration, view count, keywords, full description, and the transcript when the video has captions that can be retrieved; videos without captions return everything except the transcript. A channel URL (`/channel/UC…`, `/@handle`, `/c/…`, `/user/…`) returns its name, handle, subscriber count, video count, and full description. When `includeImages=true`, video responses also include the thumbnail and channel responses include the avatar. Costs the same as any other scrape. + * * ### Billing & errors * * | HTTP status | Billed? | Meaning | diff --git a/src/Web/WebSearchResponse/Result/Markdown/Code.php b/src/Web/WebSearchResponse/Result/Markdown/Code.php index 38dfcb4b..688183ff 100644 --- a/src/Web/WebSearchResponse/Result/Markdown/Code.php +++ b/src/Web/WebSearchResponse/Result/Markdown/Code.php @@ -15,6 +15,8 @@ enum Code: string case TIMEOUT = 'TIMEOUT'; + case CONTENT_TOO_LARGE = 'CONTENT_TOO_LARGE'; + case WEBSITE_ACCESS_ERROR = 'WEBSITE_ACCESS_ERROR'; case ERROR = 'ERROR'; diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index da7c946f..99db8512 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -24,6 +24,10 @@ /** * Scrapes the given URL into LLM usable Markdown. Inspect key_metadata on JSON responses from a recognized API key; use error_code to distinguish stable failure categories. * + * ### YouTube + * + * YouTube URLs return the video or channel itself rather than the surrounding player and navigation chrome. A URL addressing a single video (`/watch`, `youtu.be`, `/shorts`, `/embed`, `/live`) returns its title, channel, duration, view count, keywords, full description, and the transcript when the video has captions that can be retrieved; videos without captions return everything except the transcript. A channel URL (`/channel/UC…`, `/@handle`, `/c/…`, `/user/…`) returns its name, handle, subscriber count, video count, and full description. When `includeImages=true`, video responses also include the thumbnail and channel responses include the avatar. Costs the same as any other scrape. + * * ### Billing & errors * * | HTTP status | Billed? | Meaning | From d1d44477fdf353b5388c1358d0b2447c4fa6056e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 00:28:22 +0000 Subject: [PATCH 096/130] feat(api): manual updates --- .stats.yml | 6 +- src/Batch/BatchDeleteResponse.php | 104 +++++ src/Batch/BatchDeleteResponse/KeyMetadata.php | 92 ++++ src/Batch/BatchSubmitParams.php | 79 ++-- src/Batch/BatchSubmitParams/Identifiers.php | 56 --- src/Batch/BatchSubmitParams/Input.php | 38 ++ src/Batch/BatchSubmitParams/Input/Crawl.php | 103 +++++ .../BatchSubmitParams/Input/Crawl/Data.php | 38 ++ .../Input/Crawl/Data/HTML.php | 132 ++++++ .../Input/Crawl/Data/HTML/Options.php | 222 ++++++++++ .../Input/Crawl/Data/HTML/Options/Country.php | 419 ++++++++++++++++++ .../Input/Crawl/Data/HTML/Options/Pdf.php | 139 ++++++ .../Input/Crawl/Data/HTML/Options/Pdf/Ocr.php | 29 ++ .../HTML/Options/Pdf/Ocr/UnionMember1.php | 12 + .../Data/HTML/Options/Pdf/ShouldParse.php | 29 ++ .../Options/Pdf/ShouldParse/UnionMember1.php | 12 + .../Input/Crawl/Data/HTML/Source.php | 38 ++ .../Input/Crawl/Data/HTML/Source/Sitemap.php | 122 +++++ .../Data/HTML/Source/Sitemap/Controls.php | 74 ++++ .../Input/Crawl/Data/HTML/Source/StartURL.php | 122 +++++ .../Data/HTML/Source/StartURL/Controls.php | 119 +++++ .../Input/Crawl/Data/Markdown.php | 132 ++++++ .../Input/Crawl/Data/Markdown/Options.php | 282 ++++++++++++ .../Crawl/Data/Markdown/Options/Country.php | 419 ++++++++++++++++++ .../Input/Crawl/Data/Markdown/Options/Pdf.php | 139 ++++++ .../Crawl/Data/Markdown/Options/Pdf/Ocr.php | 29 ++ .../Markdown/Options/Pdf/Ocr/UnionMember1.php | 12 + .../Data/Markdown/Options/Pdf/ShouldParse.php | 29 ++ .../Options/Pdf/ShouldParse/UnionMember1.php | 12 + .../Input/Crawl/Data/Markdown/Source.php | 38 ++ .../Crawl/Data/Markdown/Source/Sitemap.php | 122 +++++ .../Data/Markdown/Source/Sitemap/Controls.php | 74 ++++ .../Crawl/Data/Markdown/Source/StartURL.php | 122 +++++ .../Markdown/Source/StartURL/Controls.php | 119 +++++ src/Batch/BatchSubmitParams/Input/Scrape.php | 103 +++++ .../BatchSubmitParams/Input/Scrape/Data.php | 38 ++ .../Input/Scrape/Data/HTML.php | 129 ++++++ .../Input/Scrape/Data/HTML/Options.php | 222 ++++++++++ .../Scrape/Data/HTML/Options/Country.php | 419 ++++++++++++++++++ .../Input/Scrape/Data/HTML/Options/Pdf.php | 139 ++++++ .../Scrape/Data/HTML/Options/Pdf/Ocr.php | 29 ++ .../HTML/Options/Pdf/Ocr/UnionMember1.php | 12 + .../Data/HTML/Options/Pdf/ShouldParse.php | 29 ++ .../Options/Pdf/ShouldParse/UnionMember1.php | 12 + .../Input/Scrape/Data/HTML/URL.php | 119 +++++ .../Input/Scrape/Data/Markdown.php | 131 ++++++ .../Input/Scrape/Data/Markdown/Options.php | 282 ++++++++++++ .../Scrape/Data/Markdown/Options/Country.php | 419 ++++++++++++++++++ .../Scrape/Data/Markdown/Options/Pdf.php | 139 ++++++ .../Scrape/Data/Markdown/Options/Pdf/Ocr.php | 29 ++ .../Markdown/Options/Pdf/Ocr/UnionMember1.php | 12 + .../Data/Markdown/Options/Pdf/ShouldParse.php | 29 ++ .../Options/Pdf/ShouldParse/UnionMember1.php | 12 + .../Input/Scrape/Data/Markdown/URL.php | 119 +++++ src/Batch/BatchSubmitResponse.php | 270 +++++++++-- src/Batch/BatchSubmitResponse/Code.php | 13 - src/Batch/BatchSubmitResponse/Credits.php | 70 +++ src/Batch/BatchSubmitResponse/Format.php | 15 + src/Batch/BatchSubmitResponse/InvalidURL.php | 86 ++++ src/Batch/BatchSubmitResponse/KeyMetadata.php | 2 +- src/Batch/BatchSubmitResponse/Metadata.php | 188 -------- .../Metadata/Identifiers.php | 56 --- .../Metadata/SourcesAttempted.php | 18 - .../Metadata/SourcesSucceeded.php | 18 - src/Batch/BatchSubmitResponse/Mode.php | 15 + src/Batch/BatchSubmitResponse/Person.php | 165 ------- .../Person/Education/Dates.php | 111 ----- .../BatchSubmitResponse/Person/Experience.php | 145 ------ .../Person/Experience/Company.php | 92 ---- .../Person/Experience/Dates.php | 111 ----- .../BatchSubmitResponse/Person/Profile.php | 139 ------ .../BatchSubmitResponse/Person/Skill.php | 111 ----- src/Batch/BatchSubmitResponse/Status.php | 4 +- src/Client.php | 7 + src/People/PersonEnrichParams.php | 204 +++++++++ src/People/PersonEnrichParams/Company.php | 62 +++ src/People/PersonEnrichParams/Education.php | 101 +++++ .../Education/Institution.php | 62 +++ src/People/PersonEnrichParams/Location.php | 77 ++++ src/People/PersonEnrichParams/Name.php | 60 +++ src/People/PersonEnrichResponse.php | 110 +++++ .../PersonEnrichResponse/KeyMetadata.php | 92 ++++ src/People/PersonEnrichResponse/Match_.php | 41 ++ .../Match_/PersonEnrichmentCandidateMatch.php | 101 +++++ .../PersonEnrichmentCandidateMatch/Person.php | 267 +++++++++++ .../Person/CurrentRole.php | 171 +++++++ .../Person/CurrentRole}/EndDate.php | 22 +- .../Person/CurrentRole/Organization.php | 76 ++++ .../Person/CurrentRole}/StartDate.php | 22 +- .../Person/Education.php | 86 ++-- .../Person/Education}/EndDate.php | 22 +- .../Person/Education/Institution.php | 46 +- .../Person/Education}/StartDate.php | 22 +- .../Person/Experience.php | 171 +++++++ .../Person/Experience/EndDate.php | 91 ++++ .../Person/Experience/Organization.php | 76 ++++ .../Person/Experience/StartDate.php | 93 ++++ .../Person/Location.php | 107 +++++ .../Person/Name.php | 77 ++++ .../Match_/PersonEnrichmentNotFoundMatch.php | 104 +++++ src/ServiceContracts/BatchContract.php | 31 +- src/ServiceContracts/BatchRawContract.php | 16 + src/ServiceContracts/PeopleContract.php | 49 ++ src/ServiceContracts/PeopleRawContract.php | 32 ++ src/Services/BatchRawService.php | 50 ++- src/Services/BatchService.php | 47 +- src/Services/PeopleRawService.php | 73 +++ src/Services/PeopleService.php | 85 ++++ tests/Services/BatchTest.php | 66 ++- tests/Services/PeopleTest.php | 43 ++ 110 files changed, 8934 insertions(+), 1494 deletions(-) create mode 100644 src/Batch/BatchDeleteResponse.php create mode 100644 src/Batch/BatchDeleteResponse/KeyMetadata.php delete mode 100644 src/Batch/BatchSubmitParams/Identifiers.php create mode 100644 src/Batch/BatchSubmitParams/Input.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Country.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap/Controls.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL/Controls.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Country.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap/Controls.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL.php create mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL/Controls.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Country.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/URL.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Country.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php create mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/URL.php delete mode 100644 src/Batch/BatchSubmitResponse/Code.php create mode 100644 src/Batch/BatchSubmitResponse/Credits.php create mode 100644 src/Batch/BatchSubmitResponse/Format.php create mode 100644 src/Batch/BatchSubmitResponse/InvalidURL.php delete mode 100644 src/Batch/BatchSubmitResponse/Metadata.php delete mode 100644 src/Batch/BatchSubmitResponse/Metadata/Identifiers.php delete mode 100644 src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php delete mode 100644 src/Batch/BatchSubmitResponse/Metadata/SourcesSucceeded.php create mode 100644 src/Batch/BatchSubmitResponse/Mode.php delete mode 100644 src/Batch/BatchSubmitResponse/Person.php delete mode 100644 src/Batch/BatchSubmitResponse/Person/Education/Dates.php delete mode 100644 src/Batch/BatchSubmitResponse/Person/Experience.php delete mode 100644 src/Batch/BatchSubmitResponse/Person/Experience/Company.php delete mode 100644 src/Batch/BatchSubmitResponse/Person/Experience/Dates.php delete mode 100644 src/Batch/BatchSubmitResponse/Person/Profile.php delete mode 100644 src/Batch/BatchSubmitResponse/Person/Skill.php create mode 100644 src/People/PersonEnrichParams.php create mode 100644 src/People/PersonEnrichParams/Company.php create mode 100644 src/People/PersonEnrichParams/Education.php create mode 100644 src/People/PersonEnrichParams/Education/Institution.php create mode 100644 src/People/PersonEnrichParams/Location.php create mode 100644 src/People/PersonEnrichParams/Name.php create mode 100644 src/People/PersonEnrichResponse.php create mode 100644 src/People/PersonEnrichResponse/KeyMetadata.php create mode 100644 src/People/PersonEnrichResponse/Match_.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole.php rename src/{Batch/BatchSubmitResponse/Person/Education/Dates => People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole}/EndDate.php (83%) create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/Organization.php rename src/{Batch/BatchSubmitResponse/Person/Education/Dates => People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole}/StartDate.php (83%) rename src/{Batch/BatchSubmitResponse => People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch}/Person/Education.php (54%) rename src/{Batch/BatchSubmitResponse/Person/Experience/Dates => People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education}/EndDate.php (83%) rename src/{Batch/BatchSubmitResponse => People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch}/Person/Education/Institution.php (52%) rename src/{Batch/BatchSubmitResponse/Person/Experience/Dates => People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education}/StartDate.php (83%) create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/EndDate.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/Organization.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/StartDate.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Location.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Name.php create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentNotFoundMatch.php create mode 100644 src/ServiceContracts/PeopleContract.php create mode 100644 src/ServiceContracts/PeopleRawContract.php create mode 100644 src/Services/PeopleRawService.php create mode 100644 src/Services/PeopleService.php create mode 100644 tests/Services/PeopleTest.php diff --git a/.stats.yml b/.stats.yml index b90c8da4..ca578228 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 38 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c1b6ca84f9bec1b1936cebb61f058924c3d7a5f6977e4cd76cf0544c4c7d8737.yml +configured_endpoints: 40 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e2ba5381de3010ee53f27388aa6727ad567eb18e4b0b4eb1c4c66402bfea64cc.yml openapi_spec_hash: 141bfa8430ddccfb5a37c4bd703d163b -config_hash: bff282047fafdad771fb7ec685f56944 +config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/src/Batch/BatchDeleteResponse.php b/src/Batch/BatchDeleteResponse.php new file mode 100644 index 00000000..d7f89aa1 --- /dev/null +++ b/src/Batch/BatchDeleteResponse.php @@ -0,0 +1,104 @@ + */ + use SdkModel; + + /** + * ID of the deleted batch. + */ + #[Optional] + public ?string $id; + + /** + * Always true on success. + */ + #[Optional] + public ?bool $deleted; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + ?string $id = null, + ?bool $deleted = null, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + null !== $id && $self['id'] = $id; + null !== $deleted && $self['deleted'] = $deleted; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * ID of the deleted batch. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * Always true on success. + */ + public function withDeleted(bool $deleted): self + { + $self = clone $this; + $self['deleted'] = $deleted; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/Batch/BatchDeleteResponse/KeyMetadata.php b/src/Batch/BatchDeleteResponse/KeyMetadata.php new file mode 100644 index 00000000..47664586 --- /dev/null +++ b/src/Batch/BatchDeleteResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams.php b/src/Batch/BatchSubmitParams.php index c1a94b35..f231ee45 100644 --- a/src/Batch/BatchSubmitParams.php +++ b/src/Batch/BatchSubmitParams.php @@ -4,7 +4,9 @@ namespace ContextDev\Batch; -use ContextDev\Batch\BatchSubmitParams\Identifiers; +use ContextDev\Batch\BatchSubmitParams\Input; +use ContextDev\Batch\BatchSubmitParams\Input\Crawl; +use ContextDev\Batch\BatchSubmitParams\Input\Scrape; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; @@ -12,16 +14,18 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Retrieve and normalize a person profile from identifiers. + * Scrape 25K URLs or crawl large websites asynchronously. * * @see ContextDev\Services\BatchService::submit() * - * @phpstan-import-type IdentifiersShape from \ContextDev\Batch\BatchSubmitParams\Identifiers + * @phpstan-import-type InputVariants from \ContextDev\Batch\BatchSubmitParams\Input + * @phpstan-import-type InputShape from \ContextDev\Batch\BatchSubmitParams\Input * * @phpstan-type BatchSubmitParamsShape = array{ - * identifiers: Identifiers|IdentifiersShape, + * input: InputShape, * tags?: list|null, - * timeoutMs?: int|null, + * webhookURL?: string|null, + * idempotencyKey?: string|null, * } */ final class BatchSubmitParams implements BaseModel @@ -31,13 +35,15 @@ final class BatchSubmitParams implements BaseModel use SdkParams; /** - * Known identifiers for the person. At least one identifier is required. + * Choose a URL list or a site crawl. + * + * @var InputVariants $input */ - #[Required] - public Identifiers $identifiers; + #[Required(union: Input::class)] + public Scrape|Crawl $input; /** - * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * Tags stored on the batch. Filter the batch list by them later. * * @var list|null $tags */ @@ -45,23 +51,29 @@ final class BatchSubmitParams implements BaseModel public ?array $tags; /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * URL notified when the batch finishes. + */ + #[Optional('webhookUrl')] + public ?string $webhookURL; + + /** + * Any string unique to this submission. Retries with the same key return the original batch. */ - #[Optional('timeoutMS')] - public ?int $timeoutMs; + #[Optional] + public ?string $idempotencyKey; /** * `new BatchSubmitParams()` is missing required properties by the API. * * To enforce required parameters use * ``` - * BatchSubmitParams::with(identifiers: ...) + * BatchSubmitParams::with(input: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new BatchSubmitParams)->withIdentifiers(...) + * (new BatchSubmitParams)->withInput(...) * ``` */ public function __construct() @@ -74,39 +86,41 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Identifiers|IdentifiersShape $identifiers + * @param InputShape $input * @param list|null $tags */ public static function with( - Identifiers|array $identifiers, + Scrape|array|Crawl $input, ?array $tags = null, - ?int $timeoutMs = null + ?string $webhookURL = null, + ?string $idempotencyKey = null, ): self { $self = new self; - $self['identifiers'] = $identifiers; + $self['input'] = $input; null !== $tags && $self['tags'] = $tags; - null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + null !== $webhookURL && $self['webhookURL'] = $webhookURL; + null !== $idempotencyKey && $self['idempotencyKey'] = $idempotencyKey; return $self; } /** - * Known identifiers for the person. At least one identifier is required. + * Choose a URL list or a site crawl. * - * @param Identifiers|IdentifiersShape $identifiers + * @param InputShape $input */ - public function withIdentifiers(Identifiers|array $identifiers): self + public function withInput(Scrape|array|Crawl $input): self { $self = clone $this; - $self['identifiers'] = $identifiers; + $self['input'] = $input; return $self; } /** - * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * Tags stored on the batch. Filter the batch list by them later. * * @param list $tags */ @@ -119,12 +133,23 @@ public function withTags(array $tags): self } /** - * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * URL notified when the batch finishes. + */ + public function withWebhookURL(string $webhookURL): self + { + $self = clone $this; + $self['webhookURL'] = $webhookURL; + + return $self; + } + + /** + * Any string unique to this submission. Retries with the same key return the original batch. */ - public function withTimeoutMs(int $timeoutMs): self + public function withIdempotencyKey(string $idempotencyKey): self { $self = clone $this; - $self['timeoutMs'] = $timeoutMs; + $self['idempotencyKey'] = $idempotencyKey; return $self; } diff --git a/src/Batch/BatchSubmitParams/Identifiers.php b/src/Batch/BatchSubmitParams/Identifiers.php deleted file mode 100644 index 5ceb6cb5..00000000 --- a/src/Batch/BatchSubmitParams/Identifiers.php +++ /dev/null @@ -1,56 +0,0 @@ - */ - use SdkModel; - - /** - * LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. - */ - #[Optional('linkedinUrl')] - public ?string $linkedinURL; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $linkedinURL = null): self - { - $self = new self; - - null !== $linkedinURL && $self['linkedinURL'] = $linkedinURL; - - return $self; - } - - /** - * LinkedIn profile URL, e.g. https://www.linkedin.com/in/yahia-bakour/. - */ - public function withLinkedinURL(string $linkedinURL): self - { - $self = clone $this; - $self['linkedinURL'] = $linkedinURL; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitParams/Input.php b/src/Batch/BatchSubmitParams/Input.php new file mode 100644 index 00000000..995acfce --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input.php @@ -0,0 +1,38 @@ +|array + */ + public static function variants(): array + { + return ['scrape' => Scrape::class, 'crawl' => Crawl::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl.php b/src/Batch/BatchSubmitParams/Input/Crawl.php new file mode 100644 index 00000000..f785a5c4 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** + * Discover and scrape pages from `data.source`. + * + * @var 'crawl' $mode + */ + #[Required] + public string $mode = 'crawl'; + + /** + * Crawl source and output format. + * + * @var DataVariants $data + */ + #[Required(union: Data::class)] + public Markdown|HTML $data; + + /** + * `new Crawl()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Crawl::with(data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Crawl)->withData(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param DataShape $data + */ + public static function with(Markdown|array|HTML $data): self + { + $self = new self; + + $self['data'] = $data; + + return $self; + } + + /** + * Crawl source and output format. + * + * @param DataShape $data + */ + public function withData(Markdown|array|HTML $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * Discover and scrape pages from `data.source`. + * + * @param 'crawl' $mode + */ + public function withMode(string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data.php new file mode 100644 index 00000000..2e5d21fb --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data.php @@ -0,0 +1,38 @@ +|array + */ + public static function variants(): array + { + return ['markdown' => Markdown::class, 'html' => HTML::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML.php new file mode 100644 index 00000000..73d2736e --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML.php @@ -0,0 +1,132 @@ + */ + use SdkModel; + + /** + * Return page content as HTML. + * + * @var 'html' $format + */ + #[Required] + public string $format = 'html'; + + /** + * How to find pages to crawl. + * + * @var SourceVariants $source + */ + #[Required(union: Source::class)] + public StartURL|Sitemap $source; + + /** + * Options for HTML output. + */ + #[Optional] + public ?Options $options; + + /** + * `new HTML()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * HTML::with(source: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new HTML)->withSource(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param SourceShape $source + * @param Options|OptionsShape|null $options + */ + public static function with( + StartURL|array|Sitemap $source, + Options|array|null $options = null + ): self { + $self = new self; + + $self['source'] = $source; + + null !== $options && $self['options'] = $options; + + return $self; + } + + /** + * Return page content as HTML. + * + * @param 'html' $format + */ + public function withFormat(string $format): self + { + $self = clone $this; + $self['format'] = $format; + + return $self; + } + + /** + * How to find pages to crawl. + * + * @param SourceShape $source + */ + public function withSource(StartURL|array|Sitemap $source): self + { + $self = clone $this; + $self['source'] = $source; + + return $self; + } + + /** + * Options for HTML output. + * + * @param Options|OptionsShape $options + */ + public function withOptions(Options|array $options): self + { + $self = clone $this; + $self['options'] = $options; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options.php new file mode 100644 index 00000000..823d3a27 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options.php @@ -0,0 +1,222 @@ +, + * excludeSelectors?: list|null, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, + * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, + * useMainContentOnly?: bool|null, + * waitForMs?: int|null, + * } + */ +final class Options implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @var list|null $excludeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $excludeSelectors; + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @var list|null $includeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $includeSelectors; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional(nullable: true)] + public ?int $maxAgeMs; + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + #[Optional] + public ?bool $settleAnimations; + + /** + * Return the main content without navigation or footers. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + #[Optional] + public ?int $waitForMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Country|value-of|null $country + * @param list|null $excludeSelectors + * @param list|null $includeSelectors + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + Country|string|null $country = null, + ?array $excludeSelectors = null, + ?array $includeSelectors = null, + ?int $maxAgeMs = null, + Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + null !== $country && $self['country'] = $country; + null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @param list|null $excludeSelectors + */ + public function withExcludeSelectors(?array $excludeSelectors): self + { + $self = clone $this; + $self['excludeSelectors'] = $excludeSelectors; + + return $self; + } + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @param list|null $includeSelectors + */ + public function withIncludeSelectors(?array $includeSelectors): self + { + $self = clone $this; + $self['includeSelectors'] = $includeSelectors; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(?int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + + /** + * Return the main content without navigation or footers. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Country.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Country.php new file mode 100644 index 00000000..30da4366 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Country.php @@ -0,0 +1,419 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @var OcrVariants|null $ocr + */ + #[Optional(union: Ocr::class)] + public bool|string|null $ocr; + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @var ShouldParseVariants|null $shouldParse + */ + #[Optional(union: ShouldParse::class)] + public bool|string|null $shouldParse; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param OcrShape|null $ocr + * @param ShouldParseShape|null $shouldParse + */ + public static function with( + ?int $end = null, + bool|UnionMember1|string|null $ocr = null, + bool|ShouldParse\UnionMember1|string|null $shouldParse = null, + ?int $start = null, + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $ocr && $self['ocr'] = $ocr; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @param OcrShape $ocr + */ + public function withOcr(bool|UnionMember1|string $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @param ShouldParseShape $shouldParse + */ + public function withShouldParse( + bool|ShouldParse\UnionMember1|string $shouldParse, + ): self { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php new file mode 100644 index 00000000..f6b7285a --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php @@ -0,0 +1,29 @@ + + * @phpstan-type OcrShape = OcrVariants + */ +final class Ocr implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php new file mode 100644 index 00000000..8fa36356 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShouldParseShape = ShouldParseVariants + */ +final class ShouldParse implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php new file mode 100644 index 00000000..7150ad66 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php @@ -0,0 +1,12 @@ +|array + */ + public static function variants(): array + { + return ['start_url' => StartURL::class, 'sitemap' => Sitemap::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap.php new file mode 100644 index 00000000..88b7b489 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap.php @@ -0,0 +1,122 @@ + */ + use SdkModel; + + /** + * Scrape the URLs in the domain's sitemap. + * + * @var 'sitemap' $type + */ + #[Required] + public string $type = 'sitemap'; + + /** + * Domain whose sitemap lists the pages to scrape. A full URL is reduced to its domain. + */ + #[Required] + public string $domain; + + /** + * Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those URLs and never follows links off them, so there is no crawl depth here. + */ + #[Optional] + public ?Controls $controls; + + /** + * `new Sitemap()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Sitemap::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Sitemap)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Controls|ControlsShape|null $controls + */ + public static function with( + string $domain, + Controls|array|null $controls = null + ): self { + $self = new self; + + $self['domain'] = $domain; + + null !== $controls && $self['controls'] = $controls; + + return $self; + } + + /** + * Domain whose sitemap lists the pages to scrape. A full URL is reduced to its domain. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Scrape the URLs in the domain's sitemap. + * + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those URLs and never follows links off them, so there is no crawl depth here. + * + * @param Controls|ControlsShape $controls + */ + public function withControls(Controls|array $controls): self + { + $self = clone $this; + $self['controls'] = $controls; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap/Controls.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap/Controls.php new file mode 100644 index 00000000..1868bf79 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/Sitemap/Controls.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + #[Optional('maxUrls')] + public ?int $maxURLs; + + /** + * RE2 pattern; only sitemap URLs matching it are scraped. + */ + #[Optional] + public ?string $regex; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?int $maxURLs = null, ?string $regex = null): self + { + $self = new self; + + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + null !== $regex && $self['regex'] = $regex; + + return $self; + } + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * RE2 pattern; only sitemap URLs matching it are scraped. + */ + public function withRegex(string $regex): self + { + $self = clone $this; + $self['regex'] = $regex; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL.php new file mode 100644 index 00000000..944bb153 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL.php @@ -0,0 +1,122 @@ + */ + use SdkModel; + + /** + * Start from one page. + * + * @var 'start_url' $type + */ + #[Required] + public string $type = 'start_url'; + + /** + * Page where crawling begins. A URL without a scheme is read as https://. + */ + #[Required] + public string $url; + + /** + * Limits and filters for page discovery. + */ + #[Optional] + public ?Controls $controls; + + /** + * `new StartURL()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * StartURL::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new StartURL)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Controls|ControlsShape|null $controls + */ + public static function with( + string $url, + Controls|array|null $controls = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $controls && $self['controls'] = $controls; + + return $self; + } + + /** + * Start from one page. + * + * @param 'start_url' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Page where crawling begins. A URL without a scheme is read as https://. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Limits and filters for page discovery. + * + * @param Controls|ControlsShape $controls + */ + public function withControls(Controls|array $controls): self + { + $self = clone $this; + $self['controls'] = $controls; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL/Controls.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL/Controls.php new file mode 100644 index 00000000..29fe8f0a --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Source/StartURL/Controls.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Follow links to subdomains. + */ + #[Optional] + public ?bool $followSubdomains; + + /** + * Maximum link depth. Source pages are depth 0. No limit when omitted. + */ + #[Optional] + public ?int $maxDepth; + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + #[Optional('maxUrls')] + public ?int $maxURLs; + + /** + * RE2 pattern for URLs to include. The `start_url` itself is always included. + */ + #[Optional] + public ?string $regex; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?bool $followSubdomains = null, + ?int $maxDepth = null, + ?int $maxURLs = null, + ?string $regex = null, + ): self { + $self = new self; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + null !== $regex && $self['regex'] = $regex; + + return $self; + } + + /** + * Follow links to subdomains. + */ + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Maximum link depth. Source pages are depth 0. No limit when omitted. + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * RE2 pattern for URLs to include. The `start_url` itself is always included. + */ + public function withRegex(string $regex): self + { + $self = clone $this; + $self['regex'] = $regex; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown.php new file mode 100644 index 00000000..3fcbde06 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown.php @@ -0,0 +1,132 @@ + */ + use SdkModel; + + /** + * Return page content as Markdown. + * + * @var 'markdown' $format + */ + #[Required] + public string $format = 'markdown'; + + /** + * How to find pages to crawl. + * + * @var SourceVariants $source + */ + #[Required(union: Source::class)] + public StartURL|Sitemap $source; + + /** + * Options for Markdown output. + */ + #[Optional] + public ?Options $options; + + /** + * `new Markdown()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Markdown::with(source: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Markdown)->withSource(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param SourceShape $source + * @param Options|OptionsShape|null $options + */ + public static function with( + StartURL|array|Sitemap $source, + Options|array|null $options = null + ): self { + $self = new self; + + $self['source'] = $source; + + null !== $options && $self['options'] = $options; + + return $self; + } + + /** + * Return page content as Markdown. + * + * @param 'markdown' $format + */ + public function withFormat(string $format): self + { + $self = clone $this; + $self['format'] = $format; + + return $self; + } + + /** + * How to find pages to crawl. + * + * @param SourceShape $source + */ + public function withSource(StartURL|array|Sitemap $source): self + { + $self = clone $this; + $self['source'] = $source; + + return $self; + } + + /** + * Options for Markdown output. + * + * @param Options|OptionsShape $options + */ + public function withOptions(Options|array $options): self + { + $self = clone $this; + $self['options'] = $options; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php new file mode 100644 index 00000000..20e33f69 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php @@ -0,0 +1,282 @@ +, + * excludeSelectors?: list|null, + * includeImages?: bool|null, + * includeLinks?: bool|null, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, + * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, + * shortenBase64Images?: bool|null, + * useMainContentOnly?: bool|null, + * waitForMs?: int|null, + * } + */ +final class Options implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @var list|null $excludeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $excludeSelectors; + + /** + * Include image references in the Markdown. + */ + #[Optional] + public ?bool $includeImages; + + /** + * Include links in the Markdown. + */ + #[Optional] + public ?bool $includeLinks; + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @var list|null $includeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $includeSelectors; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional(nullable: true)] + public ?int $maxAgeMs; + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + #[Optional] + public ?bool $settleAnimations; + + /** + * Shorten inline base64 image data. + */ + #[Optional] + public ?bool $shortenBase64Images; + + /** + * Return the main content without navigation or footers. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + #[Optional] + public ?int $waitForMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Country|value-of|null $country + * @param list|null $excludeSelectors + * @param list|null $includeSelectors + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + Country|string|null $country = null, + ?array $excludeSelectors = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, + ?array $includeSelectors = null, + ?int $maxAgeMs = null, + Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, + ?bool $shortenBase64Images = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + null !== $country && $self['country'] = $country; + null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $includeImages && $self['includeImages'] = $includeImages; + null !== $includeLinks && $self['includeLinks'] = $includeLinks; + null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; + null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @param list|null $excludeSelectors + */ + public function withExcludeSelectors(?array $excludeSelectors): self + { + $self = clone $this; + $self['excludeSelectors'] = $excludeSelectors; + + return $self; + } + + /** + * Include image references in the Markdown. + */ + public function withIncludeImages(bool $includeImages): self + { + $self = clone $this; + $self['includeImages'] = $includeImages; + + return $self; + } + + /** + * Include links in the Markdown. + */ + public function withIncludeLinks(bool $includeLinks): self + { + $self = clone $this; + $self['includeLinks'] = $includeLinks; + + return $self; + } + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @param list|null $includeSelectors + */ + public function withIncludeSelectors(?array $includeSelectors): self + { + $self = clone $this; + $self['includeSelectors'] = $includeSelectors; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(?int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + + /** + * Shorten inline base64 image data. + */ + public function withShortenBase64Images(bool $shortenBase64Images): self + { + $self = clone $this; + $self['shortenBase64Images'] = $shortenBase64Images; + + return $self; + } + + /** + * Return the main content without navigation or footers. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Country.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Country.php new file mode 100644 index 00000000..f16f355f --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Country.php @@ -0,0 +1,419 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @var OcrVariants|null $ocr + */ + #[Optional(union: Ocr::class)] + public bool|string|null $ocr; + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @var ShouldParseVariants|null $shouldParse + */ + #[Optional(union: ShouldParse::class)] + public bool|string|null $shouldParse; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param OcrShape|null $ocr + * @param ShouldParseShape|null $shouldParse + */ + public static function with( + ?int $end = null, + bool|UnionMember1|string|null $ocr = null, + bool|ShouldParse\UnionMember1|string|null $shouldParse = null, + ?int $start = null, + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $ocr && $self['ocr'] = $ocr; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @param OcrShape $ocr + */ + public function withOcr(bool|UnionMember1|string $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @param ShouldParseShape $shouldParse + */ + public function withShouldParse( + bool|ShouldParse\UnionMember1|string $shouldParse, + ): self { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr.php new file mode 100644 index 00000000..5ec1a5c3 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr.php @@ -0,0 +1,29 @@ + + * @phpstan-type OcrShape = OcrVariants + */ +final class Ocr implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php new file mode 100644 index 00000000..eeaff6f3 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShouldParseShape = ShouldParseVariants + */ +final class ShouldParse implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php new file mode 100644 index 00000000..c33e42df --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php @@ -0,0 +1,12 @@ +|array + */ + public static function variants(): array + { + return ['start_url' => StartURL::class, 'sitemap' => Sitemap::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap.php new file mode 100644 index 00000000..d7c860a9 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap.php @@ -0,0 +1,122 @@ + */ + use SdkModel; + + /** + * Scrape the URLs in the domain's sitemap. + * + * @var 'sitemap' $type + */ + #[Required] + public string $type = 'sitemap'; + + /** + * Domain whose sitemap lists the pages to scrape. A full URL is reduced to its domain. + */ + #[Required] + public string $domain; + + /** + * Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those URLs and never follows links off them, so there is no crawl depth here. + */ + #[Optional] + public ?Controls $controls; + + /** + * `new Sitemap()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Sitemap::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Sitemap)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Controls|ControlsShape|null $controls + */ + public static function with( + string $domain, + Controls|array|null $controls = null + ): self { + $self = new self; + + $self['domain'] = $domain; + + null !== $controls && $self['controls'] = $controls; + + return $self; + } + + /** + * Domain whose sitemap lists the pages to scrape. A full URL is reduced to its domain. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * Scrape the URLs in the domain's sitemap. + * + * @param 'sitemap' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Limits and filters for the sitemap URLs. A sitemap batch scrapes exactly those URLs and never follows links off them, so there is no crawl depth here. + * + * @param Controls|ControlsShape $controls + */ + public function withControls(Controls|array $controls): self + { + $self = clone $this; + $self['controls'] = $controls; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap/Controls.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap/Controls.php new file mode 100644 index 00000000..0b3de547 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/Sitemap/Controls.php @@ -0,0 +1,74 @@ + */ + use SdkModel; + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + #[Optional('maxUrls')] + public ?int $maxURLs; + + /** + * RE2 pattern; only sitemap URLs matching it are scraped. + */ + #[Optional] + public ?string $regex; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?int $maxURLs = null, ?string $regex = null): self + { + $self = new self; + + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + null !== $regex && $self['regex'] = $regex; + + return $self; + } + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * RE2 pattern; only sitemap URLs matching it are scraped. + */ + public function withRegex(string $regex): self + { + $self = clone $this; + $self['regex'] = $regex; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL.php new file mode 100644 index 00000000..7af4bc40 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL.php @@ -0,0 +1,122 @@ + */ + use SdkModel; + + /** + * Start from one page. + * + * @var 'start_url' $type + */ + #[Required] + public string $type = 'start_url'; + + /** + * Page where crawling begins. A URL without a scheme is read as https://. + */ + #[Required] + public string $url; + + /** + * Limits and filters for page discovery. + */ + #[Optional] + public ?Controls $controls; + + /** + * `new StartURL()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * StartURL::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new StartURL)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Controls|ControlsShape|null $controls + */ + public static function with( + string $url, + Controls|array|null $controls = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $controls && $self['controls'] = $controls; + + return $self; + } + + /** + * Start from one page. + * + * @param 'start_url' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Page where crawling begins. A URL without a scheme is read as https://. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Limits and filters for page discovery. + * + * @param Controls|ControlsShape $controls + */ + public function withControls(Controls|array $controls): self + { + $self = clone $this; + $self['controls'] = $controls; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL/Controls.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL/Controls.php new file mode 100644 index 00000000..44880f71 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Source/StartURL/Controls.php @@ -0,0 +1,119 @@ + */ + use SdkModel; + + /** + * Follow links to subdomains. + */ + #[Optional] + public ?bool $followSubdomains; + + /** + * Maximum link depth. Source pages are depth 0. No limit when omitted. + */ + #[Optional] + public ?int $maxDepth; + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + #[Optional('maxUrls')] + public ?int $maxURLs; + + /** + * RE2 pattern for URLs to include. The `start_url` itself is always included. + */ + #[Optional] + public ?string $regex; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?bool $followSubdomains = null, + ?int $maxDepth = null, + ?int $maxURLs = null, + ?string $regex = null, + ): self { + $self = new self; + + null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; + null !== $maxDepth && $self['maxDepth'] = $maxDepth; + null !== $maxURLs && $self['maxURLs'] = $maxURLs; + null !== $regex && $self['regex'] = $regex; + + return $self; + } + + /** + * Follow links to subdomains. + */ + public function withFollowSubdomains(bool $followSubdomains): self + { + $self = clone $this; + $self['followSubdomains'] = $followSubdomains; + + return $self; + } + + /** + * Maximum link depth. Source pages are depth 0. No limit when omitted. + */ + public function withMaxDepth(int $maxDepth): self + { + $self = clone $this; + $self['maxDepth'] = $maxDepth; + + return $self; + } + + /** + * Maximum pages to fetch. Unused reserved credits are refunded. Maximum 25000. + */ + public function withMaxURLs(int $maxURLs): self + { + $self = clone $this; + $self['maxURLs'] = $maxURLs; + + return $self; + } + + /** + * RE2 pattern for URLs to include. The `start_url` itself is always included. + */ + public function withRegex(string $regex): self + { + $self = clone $this; + $self['regex'] = $regex; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape.php b/src/Batch/BatchSubmitParams/Input/Scrape.php new file mode 100644 index 00000000..18425474 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape.php @@ -0,0 +1,103 @@ + */ + use SdkModel; + + /** + * Scrape the pages in `data.urls`. + * + * @var 'scrape' $mode + */ + #[Required] + public string $mode = 'scrape'; + + /** + * Pages to scrape and their output format. + * + * @var DataVariants $data + */ + #[Required(union: Data::class)] + public Markdown|HTML $data; + + /** + * `new Scrape()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Scrape::with(data: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Scrape)->withData(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param DataShape $data + */ + public static function with(Markdown|array|HTML $data): self + { + $self = new self; + + $self['data'] = $data; + + return $self; + } + + /** + * Pages to scrape and their output format. + * + * @param DataShape $data + */ + public function withData(Markdown|array|HTML $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + /** + * Scrape the pages in `data.urls`. + * + * @param 'scrape' $mode + */ + public function withMode(string $mode): self + { + $self = clone $this; + $self['mode'] = $mode; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data.php new file mode 100644 index 00000000..37e5c052 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data.php @@ -0,0 +1,38 @@ +|array + */ + public static function variants(): array + { + return ['markdown' => Markdown::class, 'html' => HTML::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML.php new file mode 100644 index 00000000..cf0ae5c5 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML.php @@ -0,0 +1,129 @@ +, options?: null|Options|OptionsShape + * } + */ +final class HTML implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Return page content as HTML. + * + * @var 'html' $format + */ + #[Required] + public string $format = 'html'; + + /** + * Pages to scrape. Maximum 25000. + * + * @var list $urls + */ + #[Required(list: URL::class)] + public array $urls; + + /** + * Options for HTML output. + */ + #[Optional] + public ?Options $options; + + /** + * `new HTML()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * HTML::with(urls: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new HTML)->withURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urls + * @param Options|OptionsShape|null $options + */ + public static function with( + array $urls, + Options|array|null $options = null + ): self { + $self = new self; + + $self['urls'] = $urls; + + null !== $options && $self['options'] = $options; + + return $self; + } + + /** + * Return page content as HTML. + * + * @param 'html' $format + */ + public function withFormat(string $format): self + { + $self = clone $this; + $self['format'] = $format; + + return $self; + } + + /** + * Pages to scrape. Maximum 25000. + * + * @param list $urls + */ + public function withURLs(array $urls): self + { + $self = clone $this; + $self['urls'] = $urls; + + return $self; + } + + /** + * Options for HTML output. + * + * @param Options|OptionsShape $options + */ + public function withOptions(Options|array $options): self + { + $self = clone $this; + $self['options'] = $options; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options.php new file mode 100644 index 00000000..83d4ac36 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options.php @@ -0,0 +1,222 @@ +, + * excludeSelectors?: list|null, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, + * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, + * useMainContentOnly?: bool|null, + * waitForMs?: int|null, + * } + */ +final class Options implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @var list|null $excludeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $excludeSelectors; + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @var list|null $includeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $includeSelectors; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional(nullable: true)] + public ?int $maxAgeMs; + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + #[Optional] + public ?bool $settleAnimations; + + /** + * Return the main content without navigation or footers. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + #[Optional] + public ?int $waitForMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Country|value-of|null $country + * @param list|null $excludeSelectors + * @param list|null $includeSelectors + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + Country|string|null $country = null, + ?array $excludeSelectors = null, + ?array $includeSelectors = null, + ?int $maxAgeMs = null, + Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + null !== $country && $self['country'] = $country; + null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @param list|null $excludeSelectors + */ + public function withExcludeSelectors(?array $excludeSelectors): self + { + $self = clone $this; + $self['excludeSelectors'] = $excludeSelectors; + + return $self; + } + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @param list|null $includeSelectors + */ + public function withIncludeSelectors(?array $includeSelectors): self + { + $self = clone $this; + $self['includeSelectors'] = $includeSelectors; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(?int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + + /** + * Return the main content without navigation or footers. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Country.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Country.php new file mode 100644 index 00000000..733da41b --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Country.php @@ -0,0 +1,419 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @var OcrVariants|null $ocr + */ + #[Optional(union: Ocr::class)] + public bool|string|null $ocr; + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @var ShouldParseVariants|null $shouldParse + */ + #[Optional(union: ShouldParse::class)] + public bool|string|null $shouldParse; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param OcrShape|null $ocr + * @param ShouldParseShape|null $shouldParse + */ + public static function with( + ?int $end = null, + bool|UnionMember1|string|null $ocr = null, + bool|ShouldParse\UnionMember1|string|null $shouldParse = null, + ?int $start = null, + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $ocr && $self['ocr'] = $ocr; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @param OcrShape $ocr + */ + public function withOcr(bool|UnionMember1|string $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @param ShouldParseShape $shouldParse + */ + public function withShouldParse( + bool|ShouldParse\UnionMember1|string $shouldParse, + ): self { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr.php new file mode 100644 index 00000000..71e76918 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr.php @@ -0,0 +1,29 @@ + + * @phpstan-type OcrShape = OcrVariants + */ +final class Ocr implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php new file mode 100644 index 00000000..afe8fdaf --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShouldParseShape = ShouldParseVariants + */ +final class ShouldParse implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php new file mode 100644 index 00000000..53f4ef0e --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php @@ -0,0 +1,12 @@ +|null + * } + */ +final class URL implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Page URL to scrape. + */ + #[Required] + public string $url; + + /** + * Your ID for this page, returned with its result. The same URL can use different IDs. + */ + #[Optional('itemId')] + public ?string $itemID; + + /** + * Custom JSON returned unchanged with this page result. + * + * @var array|null $meta + */ + #[Optional(map: 'mixed')] + public ?array $meta; + + /** + * `new URL()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * URL::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new URL)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $meta + */ + public static function with( + string $url, + ?string $itemID = null, + ?array $meta = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $itemID && $self['itemID'] = $itemID; + null !== $meta && $self['meta'] = $meta; + + return $self; + } + + /** + * Page URL to scrape. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Your ID for this page, returned with its result. The same URL can use different IDs. + */ + public function withItemID(string $itemID): self + { + $self = clone $this; + $self['itemID'] = $itemID; + + return $self; + } + + /** + * Custom JSON returned unchanged with this page result. + * + * @param array $meta + */ + public function withMeta(array $meta): self + { + $self = clone $this; + $self['meta'] = $meta; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown.php new file mode 100644 index 00000000..be4ccdac --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown.php @@ -0,0 +1,131 @@ +, + * options?: null|Options|OptionsShape, + * } + */ +final class Markdown implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Return page content as Markdown. + * + * @var 'markdown' $format + */ + #[Required] + public string $format = 'markdown'; + + /** + * Pages to scrape. Maximum 25000. + * + * @var list $urls + */ + #[Required(list: URL::class)] + public array $urls; + + /** + * Options for Markdown output. + */ + #[Optional] + public ?Options $options; + + /** + * `new Markdown()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Markdown::with(urls: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Markdown)->withURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $urls + * @param Options|OptionsShape|null $options + */ + public static function with( + array $urls, + Options|array|null $options = null + ): self { + $self = new self; + + $self['urls'] = $urls; + + null !== $options && $self['options'] = $options; + + return $self; + } + + /** + * Return page content as Markdown. + * + * @param 'markdown' $format + */ + public function withFormat(string $format): self + { + $self = clone $this; + $self['format'] = $format; + + return $self; + } + + /** + * Pages to scrape. Maximum 25000. + * + * @param list $urls + */ + public function withURLs(array $urls): self + { + $self = clone $this; + $self['urls'] = $urls; + + return $self; + } + + /** + * Options for Markdown output. + * + * @param Options|OptionsShape $options + */ + public function withOptions(Options|array $options): self + { + $self = clone $this; + $self['options'] = $options; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php new file mode 100644 index 00000000..b734ecf3 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php @@ -0,0 +1,282 @@ +, + * excludeSelectors?: list|null, + * includeImages?: bool|null, + * includeLinks?: bool|null, + * includeSelectors?: list|null, + * maxAgeMs?: int|null, + * pdf?: null|Pdf|PdfShape, + * settleAnimations?: bool|null, + * shortenBase64Images?: bool|null, + * useMainContentOnly?: bool|null, + * waitForMs?: int|null, + * } + */ +final class Options implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @var value-of|null $country + */ + #[Optional(enum: Country::class)] + public ?string $country; + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @var list|null $excludeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $excludeSelectors; + + /** + * Include image references in the Markdown. + */ + #[Optional] + public ?bool $includeImages; + + /** + * Include links in the Markdown. + */ + #[Optional] + public ?bool $includeLinks; + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @var list|null $includeSelectors + */ + #[Optional(list: 'string', nullable: true)] + public ?array $includeSelectors; + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + #[Optional(nullable: true)] + public ?int $maxAgeMs; + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + */ + #[Optional] + public ?Pdf $pdf; + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + #[Optional] + public ?bool $settleAnimations; + + /** + * Shorten inline base64 image data. + */ + #[Optional] + public ?bool $shortenBase64Images; + + /** + * Return the main content without navigation or footers. + */ + #[Optional] + public ?bool $useMainContentOnly; + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + #[Optional] + public ?int $waitForMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Country|value-of|null $country + * @param list|null $excludeSelectors + * @param list|null $includeSelectors + * @param Pdf|PdfShape|null $pdf + */ + public static function with( + Country|string|null $country = null, + ?array $excludeSelectors = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, + ?array $includeSelectors = null, + ?int $maxAgeMs = null, + Pdf|array|null $pdf = null, + ?bool $settleAnimations = null, + ?bool $shortenBase64Images = null, + ?bool $useMainContentOnly = null, + ?int $waitForMs = null, + ): self { + $self = new self; + + null !== $country && $self['country'] = $country; + null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $includeImages && $self['includeImages'] = $includeImages; + null !== $includeLinks && $self['includeLinks'] = $includeLinks; + null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; + null !== $maxAgeMs && $self['maxAgeMs'] = $maxAgeMs; + null !== $pdf && $self['pdf'] = $pdf; + null !== $settleAnimations && $self['settleAnimations'] = $settleAnimations; + null !== $shortenBase64Images && $self['shortenBase64Images'] = $shortenBase64Images; + null !== $useMainContentOnly && $self['useMainContentOnly'] = $useMainContentOnly; + null !== $waitForMs && $self['waitForMs'] = $waitForMs; + + return $self; + } + + /** + * Fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2). + * + * @param Country|value-of $country + */ + public function withCountry(Country|string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + /** + * Remove elements matching these CSS selectors. Applied after `includeSelectors`, so an element matching both is removed. + * + * @param list|null $excludeSelectors + */ + public function withExcludeSelectors(?array $excludeSelectors): self + { + $self = clone $this; + $self['excludeSelectors'] = $excludeSelectors; + + return $self; + } + + /** + * Include image references in the Markdown. + */ + public function withIncludeImages(bool $includeImages): self + { + $self = clone $this; + $self['includeImages'] = $includeImages; + + return $self; + } + + /** + * Include links in the Markdown. + */ + public function withIncludeLinks(bool $includeLinks): self + { + $self = clone $this; + $self['includeLinks'] = $includeLinks; + + return $self; + } + + /** + * Keep only the subtrees matching these CSS selectors. Filtered pages are always fetched fresh, ignoring `maxAgeMs`. + * + * @param list|null $includeSelectors + */ + public function withIncludeSelectors(?array $includeSelectors): self + { + $self = clone $this; + $self['includeSelectors'] = $includeSelectors; + + return $self; + } + + /** + * Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. + */ + public function withMaxAgeMs(?int $maxAgeMs): self + { + $self = clone $this; + $self['maxAgeMs'] = $maxAgeMs; + + return $self; + } + + /** + * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. + * + * @param Pdf|PdfShape $pdf + */ + public function withPdf(Pdf|array $pdf): self + { + $self = clone $this; + $self['pdf'] = $pdf; + + return $self; + } + + /** + * Wait briefly for CSS and transition animations to settle before extraction, on pages that render in a browser. + */ + public function withSettleAnimations(bool $settleAnimations): self + { + $self = clone $this; + $self['settleAnimations'] = $settleAnimations; + + return $self; + } + + /** + * Shorten inline base64 image data. + */ + public function withShortenBase64Images(bool $shortenBase64Images): self + { + $self = clone $this; + $self['shortenBase64Images'] = $shortenBase64Images; + + return $self; + } + + /** + * Return the main content without navigation or footers. + */ + public function withUseMainContentOnly(bool $useMainContentOnly): self + { + $self = clone $this; + $self['useMainContentOnly'] = $useMainContentOnly; + + return $self; + } + + /** + * How long to wait after initial page load, in milliseconds. `0` waits 500 ms. + */ + public function withWaitForMs(int $waitForMs): self + { + $self = clone $this; + $self['waitForMs'] = $waitForMs; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Country.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Country.php new file mode 100644 index 00000000..9afbe125 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Country.php @@ -0,0 +1,419 @@ + */ + use SdkModel; + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + #[Optional] + public ?int $end; + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @var OcrVariants|null $ocr + */ + #[Optional(union: Ocr::class)] + public bool|string|null $ocr; + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @var ShouldParseVariants|null $shouldParse + */ + #[Optional(union: ShouldParse::class)] + public bool|string|null $shouldParse; + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + #[Optional] + public ?int $start; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param OcrShape|null $ocr + * @param ShouldParseShape|null $shouldParse + */ + public static function with( + ?int $end = null, + bool|UnionMember1|string|null $ocr = null, + bool|ShouldParse\UnionMember1|string|null $shouldParse = null, + ?int $start = null, + ): self { + $self = new self; + + null !== $end && $self['end'] = $end; + null !== $ocr && $self['ocr'] = $ocr; + null !== $shouldParse && $self['shouldParse'] = $shouldParse; + null !== $start && $self['start'] = $start; + + return $self; + } + + /** + * Last 1-based PDF page to parse. When omitted, parsing ends at the last page. Must be greater than or equal to start when both are provided. + */ + public function withEnd(int $end): self + { + $self = clone $this; + $self['end'] = $end; + + return $self; + } + + /** + * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * + * @param OcrShape $ocr + */ + public function withOcr(bool|UnionMember1|string $ocr): self + { + $self = clone $this; + $self['ocr'] = $ocr; + + return $self; + } + + /** + * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. + * + * @param ShouldParseShape $shouldParse + */ + public function withShouldParse( + bool|ShouldParse\UnionMember1|string $shouldParse, + ): self { + $self = clone $this; + $self['shouldParse'] = $shouldParse; + + return $self; + } + + /** + * First 1-based PDF page to parse. When omitted, parsing starts at the first page. + */ + public function withStart(int $start): self + { + $self = clone $this; + $self['start'] = $start; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr.php new file mode 100644 index 00000000..ace72dc2 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr.php @@ -0,0 +1,29 @@ + + * @phpstan-type OcrShape = OcrVariants + */ +final class Ocr implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php new file mode 100644 index 00000000..b1c5bb86 --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php @@ -0,0 +1,12 @@ + + * @phpstan-type ShouldParseShape = ShouldParseVariants + */ +final class ShouldParse implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php new file mode 100644 index 00000000..d212a3ff --- /dev/null +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php @@ -0,0 +1,12 @@ +|null + * } + */ +final class URL implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Page URL to scrape. + */ + #[Required] + public string $url; + + /** + * Your ID for this page, returned with its result. The same URL can use different IDs. + */ + #[Optional('itemId')] + public ?string $itemID; + + /** + * Custom JSON returned unchanged with this page result. + * + * @var array|null $meta + */ + #[Optional(map: 'mixed')] + public ?array $meta; + + /** + * `new URL()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * URL::with(url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new URL)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param array|null $meta + */ + public static function with( + string $url, + ?string $itemID = null, + ?array $meta = null + ): self { + $self = new self; + + $self['url'] = $url; + + null !== $itemID && $self['itemID'] = $itemID; + null !== $meta && $self['meta'] = $meta; + + return $self; + } + + /** + * Page URL to scrape. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } + + /** + * Your ID for this page, returned with its result. The same URL can use different IDs. + */ + public function withItemID(string $itemID): self + { + $self = clone $this; + $self['itemID'] = $itemID; + + return $self; + } + + /** + * Custom JSON returned unchanged with this page result. + * + * @param array $meta + */ + public function withMeta(array $meta): self + { + $self = clone $this; + $self['meta'] = $meta; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse.php b/src/Batch/BatchSubmitResponse.php index dd7d5a6a..0082a4a5 100644 --- a/src/Batch/BatchSubmitResponse.php +++ b/src/Batch/BatchSubmitResponse.php @@ -4,10 +4,11 @@ namespace ContextDev\Batch; -use ContextDev\Batch\BatchSubmitResponse\Code; +use ContextDev\Batch\BatchSubmitResponse\Credits; +use ContextDev\Batch\BatchSubmitResponse\Format; +use ContextDev\Batch\BatchSubmitResponse\InvalidURL; use ContextDev\Batch\BatchSubmitResponse\KeyMetadata; -use ContextDev\Batch\BatchSubmitResponse\Metadata; -use ContextDev\Batch\BatchSubmitResponse\Person; +use ContextDev\Batch\BatchSubmitResponse\Mode; use ContextDev\Batch\BatchSubmitResponse\Status; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; @@ -15,16 +16,25 @@ use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-import-type MetadataShape from \ContextDev\Batch\BatchSubmitResponse\Metadata - * @phpstan-import-type PersonShape from \ContextDev\Batch\BatchSubmitResponse\Person + * @phpstan-import-type CrawlControlsShape from \ContextDev\Batch\CrawlControls + * @phpstan-import-type CreditsShape from \ContextDev\Batch\BatchSubmitResponse\Credits + * @phpstan-import-type IntakeShape from \ContextDev\Batch\Intake + * @phpstan-import-type InvalidURLShape from \ContextDev\Batch\BatchSubmitResponse\InvalidURL * @phpstan-import-type KeyMetadataShape from \ContextDev\Batch\BatchSubmitResponse\KeyMetadata * * @phpstan-type BatchSubmitResponseShape = array{ - * code: Code|value-of, - * metadata: Metadata|MetadataShape, - * person: Person|PersonShape, + * id: string, + * crawl: null|CrawlControls|CrawlControlsShape, + * createdAt: string, + * credits: Credits|CreditsShape, + * format: Format|value-of, + * input: Intake|IntakeShape, + * invalidURLs: list, + * mode: Mode|value-of, * status: Status|value-of, + * tags: list, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * webhookSecret?: string|null, * } */ final class BatchSubmitResponse implements BaseModel @@ -33,27 +43,61 @@ final class BatchSubmitResponse implements BaseModel use SdkModel; /** - * HTTP status code. - * - * @var value-of $code + * Batch ID. Poll GET /batch/{batch_id} with it. */ - #[Required(enum: Code::class)] - public int $code; + #[Required] + public string $id; /** - * Additional response details. + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. */ #[Required] - public Metadata $metadata; + public ?CrawlControls $crawl; + + /** + * When the batch was created. + */ + #[Required('created_at')] + public string $createdAt; + + /** + * What accepting this batch cost. + */ + #[Required] + public Credits $credits; + + /** + * What each page will be returned as. + * + * @var value-of $format + */ + #[Required(enum: Format::class)] + public string $format; /** - * Retrieved person profile. + * What submission took in, and what it charged for. */ #[Required] - public Person $person; + public Intake $input; + + /** + * Rejected URLs, up to 100. These are not charged. + * + * @var list $invalidURLs + */ + #[Required('invalid_urls', list: InvalidURL::class)] + public array $invalidURLs; /** - * Response status. + * How pages will be selected. + * + * @var value-of $mode + */ + #[Required(enum: Mode::class)] + public string $mode; + + /** + * Always `queued`. An accepted batch has not started yet. * * @var value-of $status */ @@ -61,27 +105,58 @@ final class BatchSubmitResponse implements BaseModel public string $status; /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * Tags stored on the batch. + * + * @var list $tags + */ + #[Required(list: 'string')] + public array $tags; + + /** + * API key usage for this request. */ #[Optional('key_metadata')] public ?KeyMetadata $keyMetadata; + /** + * Signing secret for the completion webhook, returned only here and never again. Store it now; it is not repeated by GET /batch/{batch_id}. + */ + #[Optional('webhook_secret')] + public ?string $webhookSecret; + /** * `new BatchSubmitResponse()` is missing required properties by the API. * * To enforce required parameters use * ``` - * BatchSubmitResponse::with(code: ..., metadata: ..., person: ..., status: ...) + * BatchSubmitResponse::with( + * id: ..., + * crawl: ..., + * createdAt: ..., + * credits: ..., + * format: ..., + * input: ..., + * invalidURLs: ..., + * mode: ..., + * status: ..., + * tags: ..., + * ) * ``` * * Otherwise ensure the following setters are called * * ``` * (new BatchSubmitResponse) - * ->withCode(...) - * ->withMetadata(...) - * ->withPerson(...) + * ->withID(...) + * ->withCrawl(...) + * ->withCreatedAt(...) + * ->withCredits(...) + * ->withFormat(...) + * ->withInput(...) + * ->withInvalidURLs(...) + * ->withMode(...) * ->withStatus(...) + * ->withTags(...) * ``` */ public function __construct() @@ -94,72 +169,151 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * - * @param Code|value-of $code - * @param Metadata|MetadataShape $metadata - * @param Person|PersonShape $person + * @param CrawlControls|CrawlControlsShape|null $crawl + * @param Credits|CreditsShape $credits + * @param Format|value-of $format + * @param Intake|IntakeShape $input + * @param list $invalidURLs + * @param Mode|value-of $mode * @param Status|value-of $status + * @param list $tags * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( - Code|int $code, - Metadata|array $metadata, - Person|array $person, + string $id, + CrawlControls|array|null $crawl, + string $createdAt, + Credits|array $credits, + Format|string $format, + Intake|array $input, + array $invalidURLs, + Mode|string $mode, Status|string $status, + array $tags, KeyMetadata|array|null $keyMetadata = null, + ?string $webhookSecret = null, ): self { $self = new self; - $self['code'] = $code; - $self['metadata'] = $metadata; - $self['person'] = $person; + $self['id'] = $id; + $self['crawl'] = $crawl; + $self['createdAt'] = $createdAt; + $self['credits'] = $credits; + $self['format'] = $format; + $self['input'] = $input; + $self['invalidURLs'] = $invalidURLs; + $self['mode'] = $mode; $self['status'] = $status; + $self['tags'] = $tags; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + null !== $webhookSecret && $self['webhookSecret'] = $webhookSecret; + + return $self; + } + + /** + * Batch ID. Poll GET /batch/{batch_id} with it. + */ + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. + * + * @param CrawlControls|CrawlControlsShape|null $crawl + */ + public function withCrawl(CrawlControls|array|null $crawl): self + { + $self = clone $this; + $self['crawl'] = $crawl; + + return $self; + } + + /** + * When the batch was created. + */ + public function withCreatedAt(string $createdAt): self + { + $self = clone $this; + $self['createdAt'] = $createdAt; + + return $self; + } + + /** + * What accepting this batch cost. + * + * @param Credits|CreditsShape $credits + */ + public function withCredits(Credits|array $credits): self + { + $self = clone $this; + $self['credits'] = $credits; + + return $self; + } + + /** + * What each page will be returned as. + * + * @param Format|value-of $format + */ + public function withFormat(Format|string $format): self + { + $self = clone $this; + $self['format'] = $format; return $self; } /** - * HTTP status code. + * What submission took in, and what it charged for. * - * @param Code|value-of $code + * @param Intake|IntakeShape $input */ - public function withCode(Code|int $code): self + public function withInput(Intake|array $input): self { $self = clone $this; - $self['code'] = $code; + $self['input'] = $input; return $self; } /** - * Additional response details. + * Rejected URLs, up to 100. These are not charged. * - * @param Metadata|MetadataShape $metadata + * @param list $invalidURLs */ - public function withMetadata(Metadata|array $metadata): self + public function withInvalidURLs(array $invalidURLs): self { $self = clone $this; - $self['metadata'] = $metadata; + $self['invalidURLs'] = $invalidURLs; return $self; } /** - * Retrieved person profile. + * How pages will be selected. * - * @param Person|PersonShape $person + * @param Mode|value-of $mode */ - public function withPerson(Person|array $person): self + public function withMode(Mode|string $mode): self { $self = clone $this; - $self['person'] = $person; + $self['mode'] = $mode; return $self; } /** - * Response status. + * Always `queued`. An accepted batch has not started yet. * * @param Status|value-of $status */ @@ -172,7 +326,20 @@ public function withStatus(Status|string $status): self } /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * Tags stored on the batch. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * API key usage for this request. * * @param KeyMetadata|KeyMetadataShape $keyMetadata */ @@ -183,4 +350,15 @@ public function withKeyMetadata(KeyMetadata|array $keyMetadata): self return $self; } + + /** + * Signing secret for the completion webhook, returned only here and never again. Store it now; it is not repeated by GET /batch/{batch_id}. + */ + public function withWebhookSecret(string $webhookSecret): self + { + $self = clone $this; + $self['webhookSecret'] = $webhookSecret; + + return $self; + } } diff --git a/src/Batch/BatchSubmitResponse/Code.php b/src/Batch/BatchSubmitResponse/Code.php deleted file mode 100644 index 5fa2c30a..00000000 --- a/src/Batch/BatchSubmitResponse/Code.php +++ /dev/null @@ -1,13 +0,0 @@ - */ + use SdkModel; + + /** + * Credits just debited from your balance. Whatever the batch does not spend is refunded when it settles. + */ + #[Required] + public int $reserved; + + /** + * `new Credits()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Credits::with(reserved: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Credits)->withReserved(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $reserved): self + { + $self = new self; + + $self['reserved'] = $reserved; + + return $self; + } + + /** + * Credits just debited from your balance. Whatever the batch does not spend is refunded when it settles. + */ + public function withReserved(int $reserved): self + { + $self = clone $this; + $self['reserved'] = $reserved; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Format.php b/src/Batch/BatchSubmitResponse/Format.php new file mode 100644 index 00000000..863387f3 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/Format.php @@ -0,0 +1,15 @@ + */ + use SdkModel; + + /** + * Why it was rejected. + */ + #[Required] + public string $reason; + + /** + * Rejected URL. + */ + #[Required] + public string $url; + + /** + * `new InvalidURL()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * InvalidURL::with(reason: ..., url: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new InvalidURL)->withReason(...)->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $reason, string $url): self + { + $self = new self; + + $self['reason'] = $reason; + $self['url'] = $url; + + return $self; + } + + /** + * Why it was rejected. + */ + public function withReason(string $reason): self + { + $self = clone $this; + $self['reason'] = $reason; + + return $self; + } + + /** + * Rejected URL. + */ + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/KeyMetadata.php b/src/Batch/BatchSubmitResponse/KeyMetadata.php index 16473979..d02f3486 100644 --- a/src/Batch/BatchSubmitResponse/KeyMetadata.php +++ b/src/Batch/BatchSubmitResponse/KeyMetadata.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * API key usage for this request. * * @phpstan-type KeyMetadataShape = array{ * creditsConsumed: int, creditsRemaining: int diff --git a/src/Batch/BatchSubmitResponse/Metadata.php b/src/Batch/BatchSubmitResponse/Metadata.php deleted file mode 100644 index b0fcfa2f..00000000 --- a/src/Batch/BatchSubmitResponse/Metadata.php +++ /dev/null @@ -1,188 +0,0 @@ ->, - * sourcesSucceeded: list>, - * urlsAnalyzed: list, - * personalWebsiteURL?: string|null, - * } - */ -final class Metadata implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Identifiers returned for the person. - */ - #[Required] - public Identifiers $identifiers; - - /** - * Source categories checked. - * - * @var list> $sourcesAttempted - */ - #[Required(list: SourcesAttempted::class)] - public array $sourcesAttempted; - - /** - * Source categories with data. - * - * @var list> $sourcesSucceeded - */ - #[Required(list: SourcesSucceeded::class)] - public array $sourcesSucceeded; - - /** - * URLs reviewed for this profile. - * - * @var list $urlsAnalyzed - */ - #[Required(list: 'string')] - public array $urlsAnalyzed; - - /** - * Personal website URL, when found. - */ - #[Optional('personalWebsiteUrl')] - public ?string $personalWebsiteURL; - - /** - * `new Metadata()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Metadata::with( - * identifiers: ..., - * sourcesAttempted: ..., - * sourcesSucceeded: ..., - * urlsAnalyzed: ..., - * ) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Metadata) - * ->withIdentifiers(...) - * ->withSourcesAttempted(...) - * ->withSourcesSucceeded(...) - * ->withURLsAnalyzed(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Identifiers|IdentifiersShape $identifiers - * @param list> $sourcesAttempted - * @param list> $sourcesSucceeded - * @param list $urlsAnalyzed - */ - public static function with( - Identifiers|array $identifiers, - array $sourcesAttempted, - array $sourcesSucceeded, - array $urlsAnalyzed, - ?string $personalWebsiteURL = null, - ): self { - $self = new self; - - $self['identifiers'] = $identifiers; - $self['sourcesAttempted'] = $sourcesAttempted; - $self['sourcesSucceeded'] = $sourcesSucceeded; - $self['urlsAnalyzed'] = $urlsAnalyzed; - - null !== $personalWebsiteURL && $self['personalWebsiteURL'] = $personalWebsiteURL; - - return $self; - } - - /** - * Identifiers returned for the person. - * - * @param Identifiers|IdentifiersShape $identifiers - */ - public function withIdentifiers(Identifiers|array $identifiers): self - { - $self = clone $this; - $self['identifiers'] = $identifiers; - - return $self; - } - - /** - * Source categories checked. - * - * @param list> $sourcesAttempted - */ - public function withSourcesAttempted(array $sourcesAttempted): self - { - $self = clone $this; - $self['sourcesAttempted'] = $sourcesAttempted; - - return $self; - } - - /** - * Source categories with data. - * - * @param list> $sourcesSucceeded - */ - public function withSourcesSucceeded(array $sourcesSucceeded): self - { - $self = clone $this; - $self['sourcesSucceeded'] = $sourcesSucceeded; - - return $self; - } - - /** - * URLs reviewed for this profile. - * - * @param list $urlsAnalyzed - */ - public function withURLsAnalyzed(array $urlsAnalyzed): self - { - $self = clone $this; - $self['urlsAnalyzed'] = $urlsAnalyzed; - - return $self; - } - - /** - * Personal website URL, when found. - */ - public function withPersonalWebsiteURL(string $personalWebsiteURL): self - { - $self = clone $this; - $self['personalWebsiteURL'] = $personalWebsiteURL; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Metadata/Identifiers.php b/src/Batch/BatchSubmitResponse/Metadata/Identifiers.php deleted file mode 100644 index 21ffd4d5..00000000 --- a/src/Batch/BatchSubmitResponse/Metadata/Identifiers.php +++ /dev/null @@ -1,56 +0,0 @@ - */ - use SdkModel; - - /** - * LinkedIn profile URL. - */ - #[Optional('linkedinUrl')] - public ?string $linkedinURL; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with(?string $linkedinURL = null): self - { - $self = new self; - - null !== $linkedinURL && $self['linkedinURL'] = $linkedinURL; - - return $self; - } - - /** - * LinkedIn profile URL. - */ - public function withLinkedinURL(string $linkedinURL): self - { - $self = clone $this; - $self['linkedinURL'] = $linkedinURL; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php b/src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php deleted file mode 100644 index 9b095926..00000000 --- a/src/Batch/BatchSubmitResponse/Metadata/SourcesAttempted.php +++ /dev/null @@ -1,18 +0,0 @@ -, - * experience: list, - * profile: Profile|ProfileShape, - * skills: list, - * } - */ -final class Person implements BaseModel -{ - /** @use SdkModel */ - use SdkModel; - - /** - * Education history. - * - * @var list $education - */ - #[Required(list: Education::class)] - public array $education; - - /** - * Work history. - * - * @var list $experience - */ - #[Required(list: Experience::class)] - public array $experience; - - /** - * Core profile details. - */ - #[Required] - public Profile $profile; - - /** - * Listed skills. - * - * @var list $skills - */ - #[Required(list: Skill::class)] - public array $skills; - - /** - * `new Person()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Person::with(education: ..., experience: ..., profile: ..., skills: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Person) - * ->withEducation(...) - * ->withExperience(...) - * ->withProfile(...) - * ->withSkills(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param list $education - * @param list $experience - * @param Profile|ProfileShape $profile - * @param list $skills - */ - public static function with( - array $education, - array $experience, - Profile|array $profile, - array $skills - ): self { - $self = new self; - - $self['education'] = $education; - $self['experience'] = $experience; - $self['profile'] = $profile; - $self['skills'] = $skills; - - return $self; - } - - /** - * Education history. - * - * @param list $education - */ - public function withEducation(array $education): self - { - $self = clone $this; - $self['education'] = $education; - - return $self; - } - - /** - * Work history. - * - * @param list $experience - */ - public function withExperience(array $experience): self - { - $self = clone $this; - $self['experience'] = $experience; - - return $self; - } - - /** - * Core profile details. - * - * @param Profile|ProfileShape $profile - */ - public function withProfile(Profile|array $profile): self - { - $self = clone $this; - $self['profile'] = $profile; - - return $self; - } - - /** - * Listed skills. - * - * @param list $skills - */ - public function withSkills(array $skills): self - { - $self = clone $this; - $self['skills'] = $skills; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Dates.php b/src/Batch/BatchSubmitResponse/Person/Education/Dates.php deleted file mode 100644 index 64de5392..00000000 --- a/src/Batch/BatchSubmitResponse/Person/Education/Dates.php +++ /dev/null @@ -1,111 +0,0 @@ - */ - use SdkModel; - - /** - * End date, when known. - */ - #[Optional] - public ?EndDate $endDate; - - /** - * Whether the entry is current. - */ - #[Optional] - public ?bool $isCurrent; - - /** - * Start date, when known. - */ - #[Optional] - public ?StartDate $startDate; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param EndDate|EndDateShape|null $endDate - * @param StartDate|StartDateShape|null $startDate - */ - public static function with( - EndDate|array|null $endDate = null, - ?bool $isCurrent = null, - StartDate|array|null $startDate = null, - ): self { - $self = new self; - - null !== $endDate && $self['endDate'] = $endDate; - null !== $isCurrent && $self['isCurrent'] = $isCurrent; - null !== $startDate && $self['startDate'] = $startDate; - - return $self; - } - - /** - * End date, when known. - * - * @param EndDate|EndDateShape $endDate - */ - public function withEndDate(EndDate|array $endDate): self - { - $self = clone $this; - $self['endDate'] = $endDate; - - return $self; - } - - /** - * Whether the entry is current. - */ - public function withIsCurrent(bool $isCurrent): self - { - $self = clone $this; - $self['isCurrent'] = $isCurrent; - - return $self; - } - - /** - * Start date, when known. - * - * @param StartDate|StartDateShape $startDate - */ - public function withStartDate(StartDate|array $startDate): self - { - $self = clone $this; - $self['startDate'] = $startDate; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience.php b/src/Batch/BatchSubmitResponse/Person/Experience.php deleted file mode 100644 index b1a0e498..00000000 --- a/src/Batch/BatchSubmitResponse/Person/Experience.php +++ /dev/null @@ -1,145 +0,0 @@ - */ - use SdkModel; - - /** - * Company or organization name. - */ - #[Required] - public Company $company; - - /** - * Role or job title. - */ - #[Required] - public string $title; - - /** - * Role dates. - */ - #[Optional] - public ?Dates $dates; - - /** - * Role description. - */ - #[Optional] - public ?string $description; - - /** - * `new Experience()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Experience::with(company: ..., title: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Experience)->withCompany(...)->withTitle(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param Company|CompanyShape $company - * @param Dates|DatesShape|null $dates - */ - public static function with( - Company|array $company, - string $title, - Dates|array|null $dates = null, - ?string $description = null, - ): self { - $self = new self; - - $self['company'] = $company; - $self['title'] = $title; - - null !== $dates && $self['dates'] = $dates; - null !== $description && $self['description'] = $description; - - return $self; - } - - /** - * Company or organization name. - * - * @param Company|CompanyShape $company - */ - public function withCompany(Company|array $company): self - { - $self = clone $this; - $self['company'] = $company; - - return $self; - } - - /** - * Role or job title. - */ - public function withTitle(string $title): self - { - $self = clone $this; - $self['title'] = $title; - - return $self; - } - - /** - * Role dates. - * - * @param Dates|DatesShape $dates - */ - public function withDates(Dates|array $dates): self - { - $self = clone $this; - $self['dates'] = $dates; - - return $self; - } - - /** - * Role description. - */ - public function withDescription(string $description): self - { - $self = clone $this; - $self['description'] = $description; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Company.php b/src/Batch/BatchSubmitResponse/Person/Experience/Company.php deleted file mode 100644 index 400e046c..00000000 --- a/src/Batch/BatchSubmitResponse/Person/Experience/Company.php +++ /dev/null @@ -1,92 +0,0 @@ - */ - use SdkModel; - - /** - * Display name. - */ - #[Required] - public string $display; - - /** - * Standardized name, when available. - */ - #[Optional] - public ?string $normalized; - - /** - * `new Company()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Company::with(display: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Company)->withDisplay(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - string $display, - ?string $normalized = null - ): self { - $self = new self; - - $self['display'] = $display; - - null !== $normalized && $self['normalized'] = $normalized; - - return $self; - } - - /** - * Display name. - */ - public function withDisplay(string $display): self - { - $self = clone $this; - $self['display'] = $display; - - return $self; - } - - /** - * Standardized name, when available. - */ - public function withNormalized(string $normalized): self - { - $self = clone $this; - $self['normalized'] = $normalized; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Dates.php b/src/Batch/BatchSubmitResponse/Person/Experience/Dates.php deleted file mode 100644 index 3480d509..00000000 --- a/src/Batch/BatchSubmitResponse/Person/Experience/Dates.php +++ /dev/null @@ -1,111 +0,0 @@ - */ - use SdkModel; - - /** - * End date, when known. - */ - #[Optional] - public ?EndDate $endDate; - - /** - * Whether the entry is current. - */ - #[Optional] - public ?bool $isCurrent; - - /** - * Start date, when known. - */ - #[Optional] - public ?StartDate $startDate; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - * - * @param EndDate|EndDateShape|null $endDate - * @param StartDate|StartDateShape|null $startDate - */ - public static function with( - EndDate|array|null $endDate = null, - ?bool $isCurrent = null, - StartDate|array|null $startDate = null, - ): self { - $self = new self; - - null !== $endDate && $self['endDate'] = $endDate; - null !== $isCurrent && $self['isCurrent'] = $isCurrent; - null !== $startDate && $self['startDate'] = $startDate; - - return $self; - } - - /** - * End date, when known. - * - * @param EndDate|EndDateShape $endDate - */ - public function withEndDate(EndDate|array $endDate): self - { - $self = clone $this; - $self['endDate'] = $endDate; - - return $self; - } - - /** - * Whether the entry is current. - */ - public function withIsCurrent(bool $isCurrent): self - { - $self = clone $this; - $self['isCurrent'] = $isCurrent; - - return $self; - } - - /** - * Start date, when known. - * - * @param StartDate|StartDateShape $startDate - */ - public function withStartDate(StartDate|array $startDate): self - { - $self = clone $this; - $self['startDate'] = $startDate; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Person/Profile.php b/src/Batch/BatchSubmitResponse/Person/Profile.php deleted file mode 100644 index fb6274e6..00000000 --- a/src/Batch/BatchSubmitResponse/Person/Profile.php +++ /dev/null @@ -1,139 +0,0 @@ - */ - use SdkModel; - - /** - * Person's full name. - */ - #[Optional] - public ?string $fullName; - - /** - * Short professional headline. - */ - #[Optional] - public ?string $headline; - - /** - * Person's listed location. - */ - #[Optional] - public ?string $location; - - /** - * Profile image URL. - */ - #[Optional('profilePictureUrl')] - public ?string $profilePictureURL; - - /** - * Brief profile summary. - */ - #[Optional] - public ?string $summary; - - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - ?string $fullName = null, - ?string $headline = null, - ?string $location = null, - ?string $profilePictureURL = null, - ?string $summary = null, - ): self { - $self = new self; - - null !== $fullName && $self['fullName'] = $fullName; - null !== $headline && $self['headline'] = $headline; - null !== $location && $self['location'] = $location; - null !== $profilePictureURL && $self['profilePictureURL'] = $profilePictureURL; - null !== $summary && $self['summary'] = $summary; - - return $self; - } - - /** - * Person's full name. - */ - public function withFullName(string $fullName): self - { - $self = clone $this; - $self['fullName'] = $fullName; - - return $self; - } - - /** - * Short professional headline. - */ - public function withHeadline(string $headline): self - { - $self = clone $this; - $self['headline'] = $headline; - - return $self; - } - - /** - * Person's listed location. - */ - public function withLocation(string $location): self - { - $self = clone $this; - $self['location'] = $location; - - return $self; - } - - /** - * Profile image URL. - */ - public function withProfilePictureURL(string $profilePictureURL): self - { - $self = clone $this; - $self['profilePictureURL'] = $profilePictureURL; - - return $self; - } - - /** - * Brief profile summary. - */ - public function withSummary(string $summary): self - { - $self = clone $this; - $self['summary'] = $summary; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Person/Skill.php b/src/Batch/BatchSubmitResponse/Person/Skill.php deleted file mode 100644 index b5e9c82e..00000000 --- a/src/Batch/BatchSubmitResponse/Person/Skill.php +++ /dev/null @@ -1,111 +0,0 @@ - */ - use SdkModel; - - /** - * Skill name. - */ - #[Required] - public string $name; - - /** - * Standardized skill name, when available. - */ - #[Optional] - public ?string $normalized; - - /** - * Skill proficiency, when available. - */ - #[Optional] - public ?string $proficiency; - - /** - * `new Skill()` is missing required properties by the API. - * - * To enforce required parameters use - * ``` - * Skill::with(name: ...) - * ``` - * - * Otherwise ensure the following setters are called - * - * ``` - * (new Skill)->withName(...) - * ``` - */ - public function __construct() - { - $this->initialize(); - } - - /** - * Construct an instance from the required parameters. - * - * You must use named parameters to construct any parameters with a default value. - */ - public static function with( - string $name, - ?string $normalized = null, - ?string $proficiency = null - ): self { - $self = new self; - - $self['name'] = $name; - - null !== $normalized && $self['normalized'] = $normalized; - null !== $proficiency && $self['proficiency'] = $proficiency; - - return $self; - } - - /** - * Skill name. - */ - public function withName(string $name): self - { - $self = clone $this; - $self['name'] = $name; - - return $self; - } - - /** - * Standardized skill name, when available. - */ - public function withNormalized(string $normalized): self - { - $self = clone $this; - $self['normalized'] = $normalized; - - return $self; - } - - /** - * Skill proficiency, when available. - */ - public function withProficiency(string $proficiency): self - { - $self = clone $this; - $self['proficiency'] = $proficiency; - - return $self; - } -} diff --git a/src/Batch/BatchSubmitResponse/Status.php b/src/Batch/BatchSubmitResponse/Status.php index e71e05d5..8247e87b 100644 --- a/src/Batch/BatchSubmitResponse/Status.php +++ b/src/Batch/BatchSubmitResponse/Status.php @@ -5,9 +5,9 @@ namespace ContextDev\Batch\BatchSubmitResponse; /** - * Response status. + * Always `queued`. An accepted batch has not started yet. */ enum Status: string { - case OK = 'ok'; + case QUEUED = 'queued'; } diff --git a/src/Client.php b/src/Client.php index 2bcbdc21..097e2522 100644 --- a/src/Client.php +++ b/src/Client.php @@ -13,6 +13,7 @@ use ContextDev\Services\IndustryService; use ContextDev\Services\MonitorsService; use ContextDev\Services\ParseService; +use ContextDev\Services\PeopleService; use ContextDev\Services\UtilityService; use ContextDev\Services\WebService; use Http\Discovery\Psr17FactoryDiscovery; @@ -66,6 +67,11 @@ class Client extends BaseClient */ public BatchService $batch; + /** + * @api + */ + public PeopleService $people; + /** * @param RequestOpts|null $requestOptions */ @@ -132,6 +138,7 @@ public function __construct( $this->utility = new UtilityService($this); $this->monitors = new MonitorsService($this); $this->batch = new BatchService($this); + $this->people = new PeopleService($this); } /** @return array */ diff --git a/src/People/PersonEnrichParams.php b/src/People/PersonEnrichParams.php new file mode 100644 index 00000000..5fe2a5a5 --- /dev/null +++ b/src/People/PersonEnrichParams.php @@ -0,0 +1,204 @@ +|null, + * email?: string|null, + * location?: null|Location|LocationShape, + * name?: null|Name|NameShape, + * socialURLs?: list|null, + * tags?: list|null, + * timeoutMs?: int|null, + * } + */ +final class PersonEnrichParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + #[Optional] + public ?Company $company; + + /** @var list|null $education */ + #[Optional(list: Education::class)] + public ?array $education; + + #[Optional] + public ?string $email; + + #[Optional] + public ?Location $location; + + #[Optional] + public ?Name $name; + + /** @var list|null $socialURLs */ + #[Optional('social_urls', list: 'string')] + public ?array $socialURLs; + + /** + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + #[Optional('timeoutMS')] + public ?int $timeoutMs; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Company|CompanyShape|null $company + * @param list|null $education + * @param Location|LocationShape|null $location + * @param Name|NameShape|null $name + * @param list|null $socialURLs + * @param list|null $tags + */ + public static function with( + Company|array|null $company = null, + ?array $education = null, + ?string $email = null, + Location|array|null $location = null, + Name|array|null $name = null, + ?array $socialURLs = null, + ?array $tags = null, + ?int $timeoutMs = null, + ): self { + $self = new self; + + null !== $company && $self['company'] = $company; + null !== $education && $self['education'] = $education; + null !== $email && $self['email'] = $email; + null !== $location && $self['location'] = $location; + null !== $name && $self['name'] = $name; + null !== $socialURLs && $self['socialURLs'] = $socialURLs; + null !== $tags && $self['tags'] = $tags; + null !== $timeoutMs && $self['timeoutMs'] = $timeoutMs; + + return $self; + } + + /** + * @param Company|CompanyShape $company + */ + public function withCompany(Company|array $company): self + { + $self = clone $this; + $self['company'] = $company; + + return $self; + } + + /** + * @param list $education + */ + public function withEducation(array $education): self + { + $self = clone $this; + $self['education'] = $education; + + return $self; + } + + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * @param Location|LocationShape $location + */ + public function withLocation(Location|array $location): self + { + $self = clone $this; + $self['location'] = $location; + + return $self; + } + + /** + * @param Name|NameShape $name + */ + public function withName(Name|array $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * @param list $socialURLs + */ + public function withSocialURLs(array $socialURLs): self + { + $self = clone $this; + $self['socialURLs'] = $socialURLs; + + return $self; + } + + /** + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } + + /** + * Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + */ + public function withTimeoutMs(int $timeoutMs): self + { + $self = clone $this; + $self['timeoutMs'] = $timeoutMs; + + return $self; + } +} diff --git a/src/People/PersonEnrichParams/Company.php b/src/People/PersonEnrichParams/Company.php new file mode 100644 index 00000000..3f57a088 --- /dev/null +++ b/src/People/PersonEnrichParams/Company.php @@ -0,0 +1,62 @@ + */ + use SdkModel; + + #[Optional] + public ?string $domain; + + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $domain = null, + ?string $name = null + ): self { + $self = new self; + + null !== $domain && $self['domain'] = $domain; + null !== $name && $self['name'] = $name; + + return $self; + } + + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/People/PersonEnrichParams/Education.php b/src/People/PersonEnrichParams/Education.php new file mode 100644 index 00000000..a1e26830 --- /dev/null +++ b/src/People/PersonEnrichParams/Education.php @@ -0,0 +1,101 @@ + */ + use SdkModel; + + #[Optional] + public ?string $degree; + + #[Optional('field_of_study')] + public ?string $fieldOfStudy; + + #[Optional('graduation_year')] + public ?int $graduationYear; + + #[Optional] + public ?Institution $institution; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Institution|InstitutionShape|null $institution + */ + public static function with( + ?string $degree = null, + ?string $fieldOfStudy = null, + ?int $graduationYear = null, + Institution|array|null $institution = null, + ): self { + $self = new self; + + null !== $degree && $self['degree'] = $degree; + null !== $fieldOfStudy && $self['fieldOfStudy'] = $fieldOfStudy; + null !== $graduationYear && $self['graduationYear'] = $graduationYear; + null !== $institution && $self['institution'] = $institution; + + return $self; + } + + public function withDegree(string $degree): self + { + $self = clone $this; + $self['degree'] = $degree; + + return $self; + } + + public function withFieldOfStudy(string $fieldOfStudy): self + { + $self = clone $this; + $self['fieldOfStudy'] = $fieldOfStudy; + + return $self; + } + + public function withGraduationYear(int $graduationYear): self + { + $self = clone $this; + $self['graduationYear'] = $graduationYear; + + return $self; + } + + /** + * @param Institution|InstitutionShape $institution + */ + public function withInstitution(Institution|array $institution): self + { + $self = clone $this; + $self['institution'] = $institution; + + return $self; + } +} diff --git a/src/People/PersonEnrichParams/Education/Institution.php b/src/People/PersonEnrichParams/Education/Institution.php new file mode 100644 index 00000000..aaae682f --- /dev/null +++ b/src/People/PersonEnrichParams/Education/Institution.php @@ -0,0 +1,62 @@ + */ + use SdkModel; + + #[Optional] + public ?string $domain; + + #[Optional] + public ?string $name; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $domain = null, + ?string $name = null + ): self { + $self = new self; + + null !== $domain && $self['domain'] = $domain; + null !== $name && $self['name'] = $name; + + return $self; + } + + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/People/PersonEnrichParams/Location.php b/src/People/PersonEnrichParams/Location.php new file mode 100644 index 00000000..c45ef6e9 --- /dev/null +++ b/src/People/PersonEnrichParams/Location.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + #[Optional] + public ?string $city; + + #[Optional] + public ?string $country; + + #[Optional] + public ?string $region; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $region = null + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $region && $self['region'] = $region; + + return $self; + } + + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + public function withRegion(string $region): self + { + $self = clone $this; + $self['region'] = $region; + + return $self; + } +} diff --git a/src/People/PersonEnrichParams/Name.php b/src/People/PersonEnrichParams/Name.php new file mode 100644 index 00000000..df93ca2a --- /dev/null +++ b/src/People/PersonEnrichParams/Name.php @@ -0,0 +1,60 @@ + */ + use SdkModel; + + #[Optional] + public ?string $first; + + #[Optional] + public ?string $last; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?string $first = null, ?string $last = null): self + { + $self = new self; + + null !== $first && $self['first'] = $first; + null !== $last && $self['last'] = $last; + + return $self; + } + + public function withFirst(string $first): self + { + $self = clone $this; + $self['first'] = $first; + + return $self; + } + + public function withLast(string $last): self + { + $self = clone $this; + $self['last'] = $last; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse.php b/src/People/PersonEnrichResponse.php new file mode 100644 index 00000000..7d9db405 --- /dev/null +++ b/src/People/PersonEnrichResponse.php @@ -0,0 +1,110 @@ + */ + use SdkModel; + + /** + * The highest-scoring person candidate. + * + * @var MatchVariants $match + */ + #[Required(union: Match_::class)] + public PersonEnrichmentCandidateMatch|PersonEnrichmentNotFoundMatch $match; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new PersonEnrichResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * PersonEnrichResponse::with(match: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new PersonEnrichResponse)->withMatch(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param MatchShape $match + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + PersonEnrichmentCandidateMatch|array|PersonEnrichmentNotFoundMatch $match, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['match'] = $match; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * The highest-scoring person candidate. + * + * @param MatchShape $match + */ + public function withMatch( + PersonEnrichmentCandidateMatch|array|PersonEnrichmentNotFoundMatch $match + ): self { + $self = clone $this; + $self['match'] = $match; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/KeyMetadata.php b/src/People/PersonEnrichResponse/KeyMetadata.php new file mode 100644 index 00000000..e86d4461 --- /dev/null +++ b/src/People/PersonEnrichResponse/KeyMetadata.php @@ -0,0 +1,92 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_.php b/src/People/PersonEnrichResponse/Match_.php new file mode 100644 index 00000000..9fa31beb --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'candidate' => PersonEnrichmentCandidateMatch::class, + 'not_found' => PersonEnrichmentNotFoundMatch::class, + ]; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch.php new file mode 100644 index 00000000..0bb60189 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch.php @@ -0,0 +1,101 @@ + */ + use SdkModel; + + /** @var 'candidate' $status */ + #[Required] + public string $status = 'candidate'; + + #[Required] + public Person $person; + + #[Required] + public int $score; + + /** + * `new PersonEnrichmentCandidateMatch()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * PersonEnrichmentCandidateMatch::with(person: ..., score: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new PersonEnrichmentCandidateMatch)->withPerson(...)->withScore(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Person|PersonShape $person + */ + public static function with(Person|array $person, int $score): self + { + $self = new self; + + $self['person'] = $person; + $self['score'] = $score; + + return $self; + } + + /** + * @param Person|PersonShape $person + */ + public function withPerson(Person|array $person): self + { + $self = clone $this; + $self['person'] = $person; + + return $self; + } + + public function withScore(int $score): self + { + $self = clone $this; + $self['score'] = $score; + + return $self; + } + + /** + * @param 'candidate' $status + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php new file mode 100644 index 00000000..eff38453 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php @@ -0,0 +1,267 @@ +, + * experience: list, + * skills: list, + * socialURLs: list, + * websiteURLs: list, + * avatarURL?: string|null, + * bio?: string|null, + * currentRole?: null|CurrentRole|CurrentRoleShape, + * email?: string|null, + * location?: null|Location|LocationShape, + * name?: null|Name|NameShape, + * } + */ +final class Person implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $education */ + #[Required(list: Education::class)] + public array $education; + + /** @var list $experience */ + #[Required(list: Experience::class)] + public array $experience; + + /** @var list $skills */ + #[Required(list: 'string')] + public array $skills; + + /** @var list $socialURLs */ + #[Required('social_urls', list: 'string')] + public array $socialURLs; + + /** @var list $websiteURLs */ + #[Required('website_urls', list: 'string')] + public array $websiteURLs; + + #[Optional('avatar_url')] + public ?string $avatarURL; + + #[Optional] + public ?string $bio; + + #[Optional('current_role')] + public ?CurrentRole $currentRole; + + #[Optional] + public ?string $email; + + #[Optional] + public ?Location $location; + + #[Optional] + public ?Name $name; + + /** + * `new Person()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Person::with( + * education: ..., + * experience: ..., + * skills: ..., + * socialURLs: ..., + * websiteURLs: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Person) + * ->withEducation(...) + * ->withExperience(...) + * ->withSkills(...) + * ->withSocialURLs(...) + * ->withWebsiteURLs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $education + * @param list $experience + * @param list $skills + * @param list $socialURLs + * @param list $websiteURLs + * @param CurrentRole|CurrentRoleShape|null $currentRole + * @param Location|LocationShape|null $location + * @param Name|NameShape|null $name + */ + public static function with( + array $education, + array $experience, + array $skills, + array $socialURLs, + array $websiteURLs, + ?string $avatarURL = null, + ?string $bio = null, + CurrentRole|array|null $currentRole = null, + ?string $email = null, + Location|array|null $location = null, + Name|array|null $name = null, + ): self { + $self = new self; + + $self['education'] = $education; + $self['experience'] = $experience; + $self['skills'] = $skills; + $self['socialURLs'] = $socialURLs; + $self['websiteURLs'] = $websiteURLs; + + null !== $avatarURL && $self['avatarURL'] = $avatarURL; + null !== $bio && $self['bio'] = $bio; + null !== $currentRole && $self['currentRole'] = $currentRole; + null !== $email && $self['email'] = $email; + null !== $location && $self['location'] = $location; + null !== $name && $self['name'] = $name; + + return $self; + } + + /** + * @param list $education + */ + public function withEducation(array $education): self + { + $self = clone $this; + $self['education'] = $education; + + return $self; + } + + /** + * @param list $experience + */ + public function withExperience(array $experience): self + { + $self = clone $this; + $self['experience'] = $experience; + + return $self; + } + + /** + * @param list $skills + */ + public function withSkills(array $skills): self + { + $self = clone $this; + $self['skills'] = $skills; + + return $self; + } + + /** + * @param list $socialURLs + */ + public function withSocialURLs(array $socialURLs): self + { + $self = clone $this; + $self['socialURLs'] = $socialURLs; + + return $self; + } + + /** + * @param list $websiteURLs + */ + public function withWebsiteURLs(array $websiteURLs): self + { + $self = clone $this; + $self['websiteURLs'] = $websiteURLs; + + return $self; + } + + public function withAvatarURL(string $avatarURL): self + { + $self = clone $this; + $self['avatarURL'] = $avatarURL; + + return $self; + } + + public function withBio(string $bio): self + { + $self = clone $this; + $self['bio'] = $bio; + + return $self; + } + + /** + * @param CurrentRole|CurrentRoleShape $currentRole + */ + public function withCurrentRole(CurrentRole|array $currentRole): self + { + $self = clone $this; + $self['currentRole'] = $currentRole; + + return $self; + } + + public function withEmail(string $email): self + { + $self = clone $this; + $self['email'] = $email; + + return $self; + } + + /** + * @param Location|LocationShape $location + */ + public function withLocation(Location|array $location): self + { + $self = clone $this; + $self['location'] = $location; + + return $self; + } + + /** + * @param Name|NameShape $name + */ + public function withName(Name|array $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole.php new file mode 100644 index 00000000..58005ce8 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole.php @@ -0,0 +1,171 @@ + */ + use SdkModel; + + #[Required] + public Organization $organization; + + #[Required] + public string $title; + + #[Optional] + public ?string $description; + + #[Optional('end_date')] + public ?EndDate $endDate; + + #[Optional('is_current')] + public ?bool $isCurrent; + + #[Optional] + public ?string $location; + + #[Optional('start_date')] + public ?StartDate $startDate; + + /** + * `new CurrentRole()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CurrentRole::with(organization: ..., title: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CurrentRole)->withOrganization(...)->withTitle(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Organization|OrganizationShape $organization + * @param EndDate|EndDateShape|null $endDate + * @param StartDate|StartDateShape|null $startDate + */ + public static function with( + Organization|array $organization, + string $title, + ?string $description = null, + EndDate|array|null $endDate = null, + ?bool $isCurrent = null, + ?string $location = null, + StartDate|array|null $startDate = null, + ): self { + $self = new self; + + $self['organization'] = $organization; + $self['title'] = $title; + + null !== $description && $self['description'] = $description; + null !== $endDate && $self['endDate'] = $endDate; + null !== $isCurrent && $self['isCurrent'] = $isCurrent; + null !== $location && $self['location'] = $location; + null !== $startDate && $self['startDate'] = $startDate; + + return $self; + } + + /** + * @param Organization|OrganizationShape $organization + */ + public function withOrganization(Organization|array $organization): self + { + $self = clone $this; + $self['organization'] = $organization; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * @param EndDate|EndDateShape $endDate + */ + public function withEndDate(EndDate|array $endDate): self + { + $self = clone $this; + $self['endDate'] = $endDate; + + return $self; + } + + public function withIsCurrent(bool $isCurrent): self + { + $self = clone $this; + $self['isCurrent'] = $isCurrent; + + return $self; + } + + public function withLocation(string $location): self + { + $self = clone $this; + $self['location'] = $location; + + return $self; + } + + /** + * @param StartDate|StartDateShape $startDate + */ + public function withStartDate(StartDate|array $startDate): self + { + $self = clone $this; + $self['startDate'] = $startDate; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Dates/EndDate.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/EndDate.php similarity index 83% rename from src/Batch/BatchSubmitResponse/Person/Education/Dates/EndDate.php rename to src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/EndDate.php index 6abd73f3..9016819a 100644 --- a/src/Batch/BatchSubmitResponse/Person/Education/Dates/EndDate.php +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/EndDate.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchSubmitResponse\Person\Education\Dates; +namespace ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\CurrentRole; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; @@ -10,8 +10,6 @@ use ContextDev\Core\Contracts\BaseModel; /** - * End date, when known. - * * @phpstan-type EndDateShape = array{year: int, day?: int|null, month?: int|null} */ final class EndDate implements BaseModel @@ -19,21 +17,12 @@ final class EndDate implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * Year value. - */ #[Required] public int $year; - /** - * Day value, when known. - */ #[Optional] public ?int $day; - /** - * Month value, when known. - */ #[Optional] public ?int $month; @@ -76,9 +65,6 @@ public static function with( return $self; } - /** - * Year value. - */ public function withYear(int $year): self { $self = clone $this; @@ -87,9 +73,6 @@ public function withYear(int $year): self return $self; } - /** - * Day value, when known. - */ public function withDay(int $day): self { $self = clone $this; @@ -98,9 +81,6 @@ public function withDay(int $day): self return $self; } - /** - * Month value, when known. - */ public function withMonth(int $month): self { $self = clone $this; diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/Organization.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/Organization.php new file mode 100644 index 00000000..4cb9738c --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/Organization.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $name; + + #[Optional] + public ?string $domain; + + /** + * `new Organization()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Organization::with(name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Organization)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $name, ?string $domain = null): self + { + $self = new self; + + $self['name'] = $name; + + null !== $domain && $self['domain'] = $domain; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Dates/StartDate.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/StartDate.php similarity index 83% rename from src/Batch/BatchSubmitResponse/Person/Education/Dates/StartDate.php rename to src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/StartDate.php index 356edb26..f9d07d46 100644 --- a/src/Batch/BatchSubmitResponse/Person/Education/Dates/StartDate.php +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRole/StartDate.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchSubmitResponse\Person\Education\Dates; +namespace ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\CurrentRole; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; @@ -10,8 +10,6 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Start date, when known. - * * @phpstan-type StartDateShape = array{ * year: int, day?: int|null, month?: int|null * } @@ -21,21 +19,12 @@ final class StartDate implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * Year value. - */ #[Required] public int $year; - /** - * Day value, when known. - */ #[Optional] public ?int $day; - /** - * Month value, when known. - */ #[Optional] public ?int $month; @@ -78,9 +67,6 @@ public static function with( return $self; } - /** - * Year value. - */ public function withYear(int $year): self { $self = clone $this; @@ -89,9 +75,6 @@ public function withYear(int $year): self return $self; } - /** - * Day value, when known. - */ public function withDay(int $day): self { $self = clone $this; @@ -100,9 +83,6 @@ public function withDay(int $day): self return $self; } - /** - * Month value, when known. - */ public function withMonth(int $month): self { $self = clone $this; diff --git a/src/Batch/BatchSubmitResponse/Person/Education.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education.php similarity index 54% rename from src/Batch/BatchSubmitResponse/Person/Education.php rename to src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education.php index d6d858df..da1996c0 100644 --- a/src/Batch/BatchSubmitResponse/Person/Education.php +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education.php @@ -2,25 +2,28 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchSubmitResponse\Person; +namespace ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person; -use ContextDev\Batch\BatchSubmitResponse\Person\Education\Dates; -use ContextDev\Batch\BatchSubmitResponse\Person\Education\Institution; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education\EndDate; +use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education\Institution; +use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education\StartDate; /** - * @phpstan-import-type InstitutionShape from \ContextDev\Batch\BatchSubmitResponse\Person\Education\Institution - * @phpstan-import-type DatesShape from \ContextDev\Batch\BatchSubmitResponse\Person\Education\Dates + * @phpstan-import-type InstitutionShape from \ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education\Institution + * @phpstan-import-type EndDateShape from \ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education\EndDate + * @phpstan-import-type StartDateShape from \ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education\StartDate * * @phpstan-type EducationShape = array{ * institution: Institution|InstitutionShape, - * dates?: null|Dates|DatesShape, + * degree?: string|null, * description?: string|null, + * endDate?: null|EndDate|EndDateShape, * fieldOfStudy?: string|null, - * qualification?: string|null, + * startDate?: null|StartDate|StartDateShape, * } */ final class Education implements BaseModel @@ -28,35 +31,23 @@ final class Education implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * School or institution name. - */ #[Required] public Institution $institution; - /** - * Education dates. - */ #[Optional] - public ?Dates $dates; + public ?string $degree; - /** - * Additional education details. - */ #[Optional] public ?string $description; - /** - * Area of study. - */ - #[Optional] + #[Optional('end_date')] + public ?EndDate $endDate; + + #[Optional('field_of_study')] public ?string $fieldOfStudy; - /** - * Degree, certificate, or credential. - */ - #[Optional] - public ?string $qualification; + #[Optional('start_date')] + public ?StartDate $startDate; /** * `new Education()` is missing required properties by the API. @@ -83,30 +74,31 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param Institution|InstitutionShape $institution - * @param Dates|DatesShape|null $dates + * @param EndDate|EndDateShape|null $endDate + * @param StartDate|StartDateShape|null $startDate */ public static function with( Institution|array $institution, - Dates|array|null $dates = null, + ?string $degree = null, ?string $description = null, + EndDate|array|null $endDate = null, ?string $fieldOfStudy = null, - ?string $qualification = null, + StartDate|array|null $startDate = null, ): self { $self = new self; $self['institution'] = $institution; - null !== $dates && $self['dates'] = $dates; + null !== $degree && $self['degree'] = $degree; null !== $description && $self['description'] = $description; + null !== $endDate && $self['endDate'] = $endDate; null !== $fieldOfStudy && $self['fieldOfStudy'] = $fieldOfStudy; - null !== $qualification && $self['qualification'] = $qualification; + null !== $startDate && $self['startDate'] = $startDate; return $self; } /** - * School or institution name. - * * @param Institution|InstitutionShape $institution */ public function withInstitution(Institution|array $institution): self @@ -117,22 +109,14 @@ public function withInstitution(Institution|array $institution): self return $self; } - /** - * Education dates. - * - * @param Dates|DatesShape $dates - */ - public function withDates(Dates|array $dates): self + public function withDegree(string $degree): self { $self = clone $this; - $self['dates'] = $dates; + $self['degree'] = $degree; return $self; } - /** - * Additional education details. - */ public function withDescription(string $description): self { $self = clone $this; @@ -142,8 +126,16 @@ public function withDescription(string $description): self } /** - * Area of study. + * @param EndDate|EndDateShape $endDate */ + public function withEndDate(EndDate|array $endDate): self + { + $self = clone $this; + $self['endDate'] = $endDate; + + return $self; + } + public function withFieldOfStudy(string $fieldOfStudy): self { $self = clone $this; @@ -153,12 +145,12 @@ public function withFieldOfStudy(string $fieldOfStudy): self } /** - * Degree, certificate, or credential. + * @param StartDate|StartDateShape $startDate */ - public function withQualification(string $qualification): self + public function withStartDate(StartDate|array $startDate): self { $self = clone $this; - $self['qualification'] = $qualification; + $self['startDate'] = $startDate; return $self; } diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Dates/EndDate.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/EndDate.php similarity index 83% rename from src/Batch/BatchSubmitResponse/Person/Experience/Dates/EndDate.php rename to src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/EndDate.php index 97231468..499e2454 100644 --- a/src/Batch/BatchSubmitResponse/Person/Experience/Dates/EndDate.php +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/EndDate.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchSubmitResponse\Person\Experience\Dates; +namespace ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; @@ -10,8 +10,6 @@ use ContextDev\Core\Contracts\BaseModel; /** - * End date, when known. - * * @phpstan-type EndDateShape = array{year: int, day?: int|null, month?: int|null} */ final class EndDate implements BaseModel @@ -19,21 +17,12 @@ final class EndDate implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * Year value. - */ #[Required] public int $year; - /** - * Day value, when known. - */ #[Optional] public ?int $day; - /** - * Month value, when known. - */ #[Optional] public ?int $month; @@ -76,9 +65,6 @@ public static function with( return $self; } - /** - * Year value. - */ public function withYear(int $year): self { $self = clone $this; @@ -87,9 +73,6 @@ public function withYear(int $year): self return $self; } - /** - * Day value, when known. - */ public function withDay(int $day): self { $self = clone $this; @@ -98,9 +81,6 @@ public function withDay(int $day): self return $self; } - /** - * Month value, when known. - */ public function withMonth(int $month): self { $self = clone $this; diff --git a/src/Batch/BatchSubmitResponse/Person/Education/Institution.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/Institution.php similarity index 52% rename from src/Batch/BatchSubmitResponse/Person/Education/Institution.php rename to src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/Institution.php index 55d16cfd..06d45945 100644 --- a/src/Batch/BatchSubmitResponse/Person/Education/Institution.php +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/Institution.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchSubmitResponse\Person\Education; +namespace ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; @@ -10,41 +10,31 @@ use ContextDev\Core\Contracts\BaseModel; /** - * School or institution name. - * - * @phpstan-type InstitutionShape = array{ - * display: string, normalized?: string|null - * } + * @phpstan-type InstitutionShape = array{name: string, domain?: string|null} */ final class Institution implements BaseModel { /** @use SdkModel */ use SdkModel; - /** - * Display name. - */ #[Required] - public string $display; + public string $name; - /** - * Standardized name, when available. - */ #[Optional] - public ?string $normalized; + public ?string $domain; /** * `new Institution()` is missing required properties by the API. * * To enforce required parameters use * ``` - * Institution::with(display: ...) + * Institution::with(name: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new Institution)->withDisplay(...) + * (new Institution)->withName(...) * ``` */ public function __construct() @@ -57,37 +47,29 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. */ - public static function with( - string $display, - ?string $normalized = null - ): self { + public static function with(string $name, ?string $domain = null): self + { $self = new self; - $self['display'] = $display; + $self['name'] = $name; - null !== $normalized && $self['normalized'] = $normalized; + null !== $domain && $self['domain'] = $domain; return $self; } - /** - * Display name. - */ - public function withDisplay(string $display): self + public function withName(string $name): self { $self = clone $this; - $self['display'] = $display; + $self['name'] = $name; return $self; } - /** - * Standardized name, when available. - */ - public function withNormalized(string $normalized): self + public function withDomain(string $domain): self { $self = clone $this; - $self['normalized'] = $normalized; + $self['domain'] = $domain; return $self; } diff --git a/src/Batch/BatchSubmitResponse/Person/Experience/Dates/StartDate.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/StartDate.php similarity index 83% rename from src/Batch/BatchSubmitResponse/Person/Experience/Dates/StartDate.php rename to src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/StartDate.php index a8a241da..b639ff26 100644 --- a/src/Batch/BatchSubmitResponse/Person/Experience/Dates/StartDate.php +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Education/StartDate.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Batch\BatchSubmitResponse\Person\Experience\Dates; +namespace ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; @@ -10,8 +10,6 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Start date, when known. - * * @phpstan-type StartDateShape = array{ * year: int, day?: int|null, month?: int|null * } @@ -21,21 +19,12 @@ final class StartDate implements BaseModel /** @use SdkModel */ use SdkModel; - /** - * Year value. - */ #[Required] public int $year; - /** - * Day value, when known. - */ #[Optional] public ?int $day; - /** - * Month value, when known. - */ #[Optional] public ?int $month; @@ -78,9 +67,6 @@ public static function with( return $self; } - /** - * Year value. - */ public function withYear(int $year): self { $self = clone $this; @@ -89,9 +75,6 @@ public function withYear(int $year): self return $self; } - /** - * Day value, when known. - */ public function withDay(int $day): self { $self = clone $this; @@ -100,9 +83,6 @@ public function withDay(int $day): self return $self; } - /** - * Month value, when known. - */ public function withMonth(int $month): self { $self = clone $this; diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience.php new file mode 100644 index 00000000..8ec6b856 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience.php @@ -0,0 +1,171 @@ + */ + use SdkModel; + + #[Required] + public Organization $organization; + + #[Required] + public string $title; + + #[Optional] + public ?string $description; + + #[Optional('end_date')] + public ?EndDate $endDate; + + #[Optional('is_current')] + public ?bool $isCurrent; + + #[Optional] + public ?string $location; + + #[Optional('start_date')] + public ?StartDate $startDate; + + /** + * `new Experience()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Experience::with(organization: ..., title: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Experience)->withOrganization(...)->withTitle(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Organization|OrganizationShape $organization + * @param EndDate|EndDateShape|null $endDate + * @param StartDate|StartDateShape|null $startDate + */ + public static function with( + Organization|array $organization, + string $title, + ?string $description = null, + EndDate|array|null $endDate = null, + ?bool $isCurrent = null, + ?string $location = null, + StartDate|array|null $startDate = null, + ): self { + $self = new self; + + $self['organization'] = $organization; + $self['title'] = $title; + + null !== $description && $self['description'] = $description; + null !== $endDate && $self['endDate'] = $endDate; + null !== $isCurrent && $self['isCurrent'] = $isCurrent; + null !== $location && $self['location'] = $location; + null !== $startDate && $self['startDate'] = $startDate; + + return $self; + } + + /** + * @param Organization|OrganizationShape $organization + */ + public function withOrganization(Organization|array $organization): self + { + $self = clone $this; + $self['organization'] = $organization; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + public function withDescription(string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + /** + * @param EndDate|EndDateShape $endDate + */ + public function withEndDate(EndDate|array $endDate): self + { + $self = clone $this; + $self['endDate'] = $endDate; + + return $self; + } + + public function withIsCurrent(bool $isCurrent): self + { + $self = clone $this; + $self['isCurrent'] = $isCurrent; + + return $self; + } + + public function withLocation(string $location): self + { + $self = clone $this; + $self['location'] = $location; + + return $self; + } + + /** + * @param StartDate|StartDateShape $startDate + */ + public function withStartDate(StartDate|array $startDate): self + { + $self = clone $this; + $self['startDate'] = $startDate; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/EndDate.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/EndDate.php new file mode 100644 index 00000000..2b28b48f --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/EndDate.php @@ -0,0 +1,91 @@ + */ + use SdkModel; + + #[Required] + public int $year; + + #[Optional] + public ?int $day; + + #[Optional] + public ?int $month; + + /** + * `new EndDate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * EndDate::with(year: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new EndDate)->withYear(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $year, + ?int $day = null, + ?int $month = null + ): self { + $self = new self; + + $self['year'] = $year; + + null !== $day && $self['day'] = $day; + null !== $month && $self['month'] = $month; + + return $self; + } + + public function withYear(int $year): self + { + $self = clone $this; + $self['year'] = $year; + + return $self; + } + + public function withDay(int $day): self + { + $self = clone $this; + $self['day'] = $day; + + return $self; + } + + public function withMonth(int $month): self + { + $self = clone $this; + $self['month'] = $month; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/Organization.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/Organization.php new file mode 100644 index 00000000..e73034f5 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/Organization.php @@ -0,0 +1,76 @@ + */ + use SdkModel; + + #[Required] + public string $name; + + #[Optional] + public ?string $domain; + + /** + * `new Organization()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Organization::with(name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Organization)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $name, ?string $domain = null): self + { + $self = new self; + + $self['name'] = $name; + + null !== $domain && $self['domain'] = $domain; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/StartDate.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/StartDate.php new file mode 100644 index 00000000..db6ac57c --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Experience/StartDate.php @@ -0,0 +1,93 @@ + */ + use SdkModel; + + #[Required] + public int $year; + + #[Optional] + public ?int $day; + + #[Optional] + public ?int $month; + + /** + * `new StartDate()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * StartDate::with(year: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new StartDate)->withYear(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $year, + ?int $day = null, + ?int $month = null + ): self { + $self = new self; + + $self['year'] = $year; + + null !== $day && $self['day'] = $day; + null !== $month && $self['month'] = $month; + + return $self; + } + + public function withYear(int $year): self + { + $self = clone $this; + $self['year'] = $year; + + return $self; + } + + public function withDay(int $day): self + { + $self = clone $this; + $self['day'] = $day; + + return $self; + } + + public function withMonth(int $month): self + { + $self = clone $this; + $self['month'] = $month; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Location.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Location.php new file mode 100644 index 00000000..f237b488 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Location.php @@ -0,0 +1,107 @@ + */ + use SdkModel; + + #[Optional] + public ?string $city; + + #[Optional] + public ?string $country; + + #[Optional('country_code')] + public ?string $countryCode; + + #[Optional] + public ?string $display; + + #[Optional] + public ?string $region; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $city = null, + ?string $country = null, + ?string $countryCode = null, + ?string $display = null, + ?string $region = null, + ): self { + $self = new self; + + null !== $city && $self['city'] = $city; + null !== $country && $self['country'] = $country; + null !== $countryCode && $self['countryCode'] = $countryCode; + null !== $display && $self['display'] = $display; + null !== $region && $self['region'] = $region; + + return $self; + } + + public function withCity(string $city): self + { + $self = clone $this; + $self['city'] = $city; + + return $self; + } + + public function withCountry(string $country): self + { + $self = clone $this; + $self['country'] = $country; + + return $self; + } + + public function withCountryCode(string $countryCode): self + { + $self = clone $this; + $self['countryCode'] = $countryCode; + + return $self; + } + + public function withDisplay(string $display): self + { + $self = clone $this; + $self['display'] = $display; + + return $self; + } + + public function withRegion(string $region): self + { + $self = clone $this; + $self['region'] = $region; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Name.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Name.php new file mode 100644 index 00000000..5b552b04 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/Name.php @@ -0,0 +1,77 @@ + */ + use SdkModel; + + #[Optional] + public ?string $first; + + #[Optional] + public ?string $full; + + #[Optional] + public ?string $last; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + ?string $first = null, + ?string $full = null, + ?string $last = null + ): self { + $self = new self; + + null !== $first && $self['first'] = $first; + null !== $full && $self['full'] = $full; + null !== $last && $self['last'] = $last; + + return $self; + } + + public function withFirst(string $first): self + { + $self = clone $this; + $self['first'] = $first; + + return $self; + } + + public function withFull(string $full): self + { + $self = clone $this; + $self['full'] = $full; + + return $self; + } + + public function withLast(string $last): self + { + $self = clone $this; + $self['last'] = $last; + + return $self; + } +} diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentNotFoundMatch.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentNotFoundMatch.php new file mode 100644 index 00000000..720b91ab --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentNotFoundMatch.php @@ -0,0 +1,104 @@ + */ + use SdkModel; + + /** @var 'not_found' $status */ + #[Required] + public string $status = 'not_found'; + + /** @var null|null $person */ + #[Required] + public null $person; + + /** @var null|null $score */ + #[Required] + public null $score; + + /** + * `new PersonEnrichmentNotFoundMatch()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * PersonEnrichmentNotFoundMatch::with(person: ..., score: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new PersonEnrichmentNotFoundMatch)->withPerson(...)->withScore(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param null|null $person + * @param null|null $score + */ + public static function with(null $person, null $score): self + { + $self = new self; + + $self['person'] = $person; + $self['score'] = $score; + + return $self; + } + + /** + * @param null|null $person + */ + public function withPerson(null $person): self + { + $self = clone $this; + $self['person'] = $person; + + return $self; + } + + /** + * @param null|null $score + */ + public function withScore(null $score): self + { + $self = clone $this; + $self['score'] = $score; + + return $self; + } + + /** + * @param 'not_found' $status + */ + public function withStatus(string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/ServiceContracts/BatchContract.php b/src/ServiceContracts/BatchContract.php index dd2416b2..60b8484d 100644 --- a/src/ServiceContracts/BatchContract.php +++ b/src/ServiceContracts/BatchContract.php @@ -5,18 +5,20 @@ namespace ContextDev\ServiceContracts; use ContextDev\Batch\BatchCancelResponse; +use ContextDev\Batch\BatchDeleteResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsResponse; use ContextDev\Batch\BatchListParams\SearchType; use ContextDev\Batch\BatchListParams\Status; use ContextDev\Batch\BatchListResponse; -use ContextDev\Batch\BatchSubmitParams\Identifiers; +use ContextDev\Batch\BatchSubmitParams\Input\Crawl; +use ContextDev\Batch\BatchSubmitParams\Input\Scrape; use ContextDev\Batch\BatchSubmitResponse; use ContextDev\Core\Exceptions\APIException; use ContextDev\RequestOptions; /** - * @phpstan-import-type IdentifiersShape from \ContextDev\Batch\BatchSubmitParams\Identifiers + * @phpstan-import-type InputShape from \ContextDev\Batch\BatchSubmitParams\Input * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface BatchContract @@ -57,6 +59,19 @@ public function list( RequestOptions|array|null $requestOptions = null, ): BatchListResponse; + /** + * @api + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function delete( + string $batchID, + RequestOptions|array|null $requestOptions = null + ): BatchDeleteResponse; + /** * @api * @@ -90,17 +105,19 @@ public function getResults( /** * @api * - * @param Identifiers|IdentifiersShape $identifiers Known identifiers for the person. At least one identifier is required. - * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param InputShape $input body param: Choose a URL list or a site crawl + * @param list $tags Body param: Tags stored on the batch. Filter the batch list by them later. + * @param string $webhookURL body param: URL notified when the batch finishes + * @param string $idempotencyKey Header param: Any string unique to this submission. Retries with the same key return the original batch. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function submit( - Identifiers|array $identifiers, + Scrape|array|Crawl $input, ?array $tags = null, - ?int $timeoutMs = null, + ?string $webhookURL = null, + ?string $idempotencyKey = null, RequestOptions|array|null $requestOptions = null, ): BatchSubmitResponse; } diff --git a/src/ServiceContracts/BatchRawContract.php b/src/ServiceContracts/BatchRawContract.php index 39e76737..435e8845 100644 --- a/src/ServiceContracts/BatchRawContract.php +++ b/src/ServiceContracts/BatchRawContract.php @@ -5,6 +5,7 @@ namespace ContextDev\ServiceContracts; use ContextDev\Batch\BatchCancelResponse; +use ContextDev\Batch\BatchDeleteResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsParams; use ContextDev\Batch\BatchGetResultsResponse; @@ -51,6 +52,21 @@ public function list( RequestOptions|array|null $requestOptions = null, ): BaseResponse; + /** + * @api + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $batchID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse; + /** * @api * diff --git a/src/ServiceContracts/PeopleContract.php b/src/ServiceContracts/PeopleContract.php new file mode 100644 index 00000000..68d1b1f4 --- /dev/null +++ b/src/ServiceContracts/PeopleContract.php @@ -0,0 +1,49 @@ + $education + * @param Location|LocationShape $location + * @param Name|NameShape $name + * @param list $socialURLs + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function enrich( + Company|array|null $company = null, + ?array $education = null, + ?string $email = null, + Location|array|null $location = null, + Name|array|null $name = null, + ?array $socialURLs = null, + ?array $tags = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): PersonEnrichResponse; +} diff --git a/src/ServiceContracts/PeopleRawContract.php b/src/ServiceContracts/PeopleRawContract.php new file mode 100644 index 00000000..15b65a58 --- /dev/null +++ b/src/ServiceContracts/PeopleRawContract.php @@ -0,0 +1,32 @@ +|PersonEnrichParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function enrich( + array|PersonEnrichParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/Services/BatchRawService.php b/src/Services/BatchRawService.php index c2088aaa..d3f4c6d8 100644 --- a/src/Services/BatchRawService.php +++ b/src/Services/BatchRawService.php @@ -5,6 +5,7 @@ namespace ContextDev\Services; use ContextDev\Batch\BatchCancelResponse; +use ContextDev\Batch\BatchDeleteResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsParams; use ContextDev\Batch\BatchGetResultsResponse; @@ -13,7 +14,6 @@ use ContextDev\Batch\BatchListParams\Status; use ContextDev\Batch\BatchListResponse; use ContextDev\Batch\BatchSubmitParams; -use ContextDev\Batch\BatchSubmitParams\Identifiers; use ContextDev\Batch\BatchSubmitResponse; use ContextDev\Client; use ContextDev\Core\Contracts\BaseResponse; @@ -23,7 +23,9 @@ use ContextDev\ServiceContracts\BatchRawContract; /** - * @phpstan-import-type IdentifiersShape from \ContextDev\Batch\BatchSubmitParams\Identifiers + * Scrape many pages or crawl a site asynchronously. + * + * @phpstan-import-type InputShape from \ContextDev\Batch\BatchSubmitParams\Input * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class BatchRawService implements BatchRawContract @@ -100,6 +102,31 @@ public function list( ); } + /** + * @api + * + * Permanently delete a finished batch and its stored results. Active batches must settle first. + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function delete( + string $batchID, + RequestOptions|array|null $requestOptions = null + ): BaseResponse { + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'delete', + path: ['batch/%1$s', $batchID], + options: $requestOptions, + convert: BatchDeleteResponse::class, + ); + } + /** * @api * @@ -161,12 +188,13 @@ public function getResults( /** * @api * - * Retrieve and normalize a person profile from identifiers. + * Scrape 25K URLs or crawl large websites asynchronously. * * @param array{ - * identifiers: Identifiers|IdentifiersShape, + * input: InputShape, * tags?: list, - * timeoutMs?: int, + * webhookURL?: string, + * idempotencyKey?: string, * }|BatchSubmitParams $params * @param RequestOpts|null $requestOptions * @@ -182,12 +210,20 @@ public function submit( $params, $requestOptions, ); + $header_params = ['idempotencyKey' => 'Idempotency-Key']; // @phpstan-ignore-next-line return.type return $this->client->request( method: 'post', - path: 'people/retrieve', - body: (object) $parsed, + path: 'batch/submit', + headers: Util::array_transform_keys( + array_intersect_key($parsed, array_flip(array_keys($header_params))), + $header_params, + ), + body: (object) array_diff_key( + $parsed, + array_flip(array_keys($header_params)) + ), options: $options, convert: BatchSubmitResponse::class, ); diff --git a/src/Services/BatchService.php b/src/Services/BatchService.php index 4e6cbe61..6d56fd9a 100644 --- a/src/Services/BatchService.php +++ b/src/Services/BatchService.php @@ -5,12 +5,14 @@ namespace ContextDev\Services; use ContextDev\Batch\BatchCancelResponse; +use ContextDev\Batch\BatchDeleteResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsResponse; use ContextDev\Batch\BatchListParams\SearchType; use ContextDev\Batch\BatchListParams\Status; use ContextDev\Batch\BatchListResponse; -use ContextDev\Batch\BatchSubmitParams\Identifiers; +use ContextDev\Batch\BatchSubmitParams\Input\Crawl; +use ContextDev\Batch\BatchSubmitParams\Input\Scrape; use ContextDev\Batch\BatchSubmitResponse; use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; @@ -19,7 +21,9 @@ use ContextDev\ServiceContracts\BatchContract; /** - * @phpstan-import-type IdentifiersShape from \ContextDev\Batch\BatchSubmitParams\Identifiers + * Scrape many pages or crawl a site asynchronously. + * + * @phpstan-import-type InputShape from \ContextDev\Batch\BatchSubmitParams\Input * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class BatchService implements BatchContract @@ -98,6 +102,26 @@ public function list( return $response->parse(); } + /** + * @api + * + * Permanently delete a finished batch and its stored results. Active batches must settle first. + * + * @param string $batchID ID of the batch to retrieve or cancel + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function delete( + string $batchID, + RequestOptions|array|null $requestOptions = null + ): BatchDeleteResponse { + // @phpstan-ignore-next-line argument.type + $response = $this->raw->delete($batchID, requestOptions: $requestOptions); + + return $response->parse(); + } + /** * @api * @@ -147,26 +171,29 @@ public function getResults( /** * @api * - * Retrieve and normalize a person profile from identifiers. + * Scrape 25K URLs or crawl large websites asynchronously. * - * @param Identifiers|IdentifiersShape $identifiers Known identifiers for the person. At least one identifier is required. - * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. - * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param InputShape $input body param: Choose a URL list or a site crawl + * @param list $tags Body param: Tags stored on the batch. Filter the batch list by them later. + * @param string $webhookURL body param: URL notified when the batch finishes + * @param string $idempotencyKey Header param: Any string unique to this submission. Retries with the same key return the original batch. * @param RequestOpts|null $requestOptions * * @throws APIException */ public function submit( - Identifiers|array $identifiers, + Scrape|array|Crawl $input, ?array $tags = null, - ?int $timeoutMs = null, + ?string $webhookURL = null, + ?string $idempotencyKey = null, RequestOptions|array|null $requestOptions = null, ): BatchSubmitResponse { $params = Util::removeNulls( [ - 'identifiers' => $identifiers, + 'input' => $input, 'tags' => $tags, - 'timeoutMs' => $timeoutMs, + 'webhookURL' => $webhookURL, + 'idempotencyKey' => $idempotencyKey, ], ); diff --git a/src/Services/PeopleRawService.php b/src/Services/PeopleRawService.php new file mode 100644 index 00000000..be492172 --- /dev/null +++ b/src/Services/PeopleRawService.php @@ -0,0 +1,73 @@ +, + * email?: string, + * location?: Location|LocationShape, + * name?: Name|NameShape, + * socialURLs?: list, + * tags?: list, + * timeoutMs?: int, + * }|PersonEnrichParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function enrich( + array|PersonEnrichParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = PersonEnrichParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'people/enrich', + body: (object) $parsed, + options: $options, + convert: PersonEnrichResponse::class, + ); + } +} diff --git a/src/Services/PeopleService.php b/src/Services/PeopleService.php new file mode 100644 index 00000000..572bd369 --- /dev/null +++ b/src/Services/PeopleService.php @@ -0,0 +1,85 @@ +raw = new PeopleRawService($client); + } + + /** + * @api + * + * Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on Pro and Scale plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. + * + * @param Company|CompanyShape $company + * @param list $education + * @param Location|LocationShape $location + * @param Name|NameShape $name + * @param list $socialURLs + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function enrich( + Company|array|null $company = null, + ?array $education = null, + ?string $email = null, + Location|array|null $location = null, + Name|array|null $name = null, + ?array $socialURLs = null, + ?array $tags = null, + ?int $timeoutMs = null, + RequestOptions|array|null $requestOptions = null, + ): PersonEnrichResponse { + $params = Util::removeNulls( + [ + 'company' => $company, + 'education' => $education, + 'email' => $email, + 'location' => $location, + 'name' => $name, + 'socialURLs' => $socialURLs, + 'tags' => $tags, + 'timeoutMs' => $timeoutMs, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->enrich(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/tests/Services/BatchTest.php b/tests/Services/BatchTest.php index 1da9404d..e2155462 100644 --- a/tests/Services/BatchTest.php +++ b/tests/Services/BatchTest.php @@ -3,6 +3,7 @@ namespace Tests\Services; use ContextDev\Batch\BatchCancelResponse; +use ContextDev\Batch\BatchDeleteResponse; use ContextDev\Batch\BatchGetResponse; use ContextDev\Batch\BatchGetResultsResponse; use ContextDev\Batch\BatchListResponse; @@ -58,6 +59,19 @@ public function testList(): void $this->assertInstanceOf(BatchListResponse::class, $result); } + #[Test] + public function testDelete(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->batch->delete('batch_9f2c8a'); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(BatchDeleteResponse::class, $result); + } + #[Test] public function testCancel(): void { @@ -91,7 +105,18 @@ public function testSubmit(): void $this->markTestSkipped('Mock server tests are disabled'); } - $result = $this->client->batch->submit(identifiers: []); + $result = $this->client->batch->submit( + input: [ + 'data' => [ + 'format' => 'markdown', + 'urls' => [ + ['url' => 'https://example.com/products/anvil'], + ['url' => 'https://example.com/products/hammer'], + ], + ], + 'mode' => 'scrape', + ], + ); // @phpstan-ignore-next-line method.alreadyNarrowedType $this->assertInstanceOf(BatchSubmitResponse::class, $result); @@ -105,11 +130,42 @@ public function testSubmitWithOptionalParams(): void } $result = $this->client->batch->submit( - identifiers: [ - 'linkedinURL' => 'https://www.linkedin.com/in/yahia-bakour/', + input: [ + 'data' => [ + 'format' => 'markdown', + 'urls' => [ + [ + 'url' => 'https://example.com/products/anvil', + 'itemID' => 'sku-1', + 'meta' => ['category' => 'bar'], + ], + [ + 'url' => 'https://example.com/products/hammer', + 'itemID' => 'sku-2', + 'meta' => ['foo' => 'bar'], + ], + ], + 'options' => [ + 'country' => 'de', + 'excludeSelectors' => ['x'], + 'includeImages' => true, + 'includeLinks' => true, + 'includeSelectors' => ['x'], + 'maxAgeMs' => 0, + 'pdf' => [ + 'end' => 1, 'ocr' => 'true', 'shouldParse' => 'true', 'start' => 1, + ], + 'settleAnimations' => true, + 'shortenBase64Images' => true, + 'useMainContentOnly' => true, + 'waitForMs' => 0, + ], + ], + 'mode' => 'scrape', ], - tags: ['production', 'team-alpha'], - timeoutMs: 1000, + tags: ['docs', 'competitor'], + webhookURL: 'webhookUrl', + idempotencyKey: 'Idempotency-Key', ); // @phpstan-ignore-next-line method.alreadyNarrowedType diff --git a/tests/Services/PeopleTest.php b/tests/Services/PeopleTest.php new file mode 100644 index 00000000..42724a9f --- /dev/null +++ b/tests/Services/PeopleTest.php @@ -0,0 +1,43 @@ +client = $client; + } + + #[Test] + public function testEnrich(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->people->enrich(); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(PersonEnrichResponse::class, $result); + } +} From 5d31702a721a1d69d464026aa369773c5d5d0f0f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 01:03:07 +0000 Subject: [PATCH 097/130] feat(api): api update --- .stats.yml | 4 ++-- src/Batch/CrawlControls.php | 10 +++++----- src/Batch/CrawlControls/Source.php | 14 +++++++------- .../Source/{UnionMember1.php => Sitemap.php} | 18 +++++++++--------- .../Source/{UnionMember1 => Sitemap}/Type.php | 2 +- .../Source/{UnionMember0.php => StartURL.php} | 16 +++++++++------- .../Source/{UnionMember0 => StartURL}/Type.php | 2 +- src/People/PersonEnrichParams.php | 2 +- src/Services/PeopleRawService.php | 2 +- src/Services/PeopleService.php | 2 +- 10 files changed, 37 insertions(+), 35 deletions(-) rename src/Batch/CrawlControls/Source/{UnionMember1.php => Sitemap.php} (77%) rename src/Batch/CrawlControls/Source/{UnionMember1 => Sitemap}/Type.php (58%) rename src/Batch/CrawlControls/Source/{UnionMember0.php => StartURL.php} (77%) rename src/Batch/CrawlControls/Source/{UnionMember0 => StartURL}/Type.php (59%) diff --git a/.stats.yml b/.stats.yml index ca578228..97db86d5 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-e2ba5381de3010ee53f27388aa6727ad567eb18e4b0b4eb1c4c66402bfea64cc.yml -openapi_spec_hash: 141bfa8430ddccfb5a37c4bd703d163b +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0dda03bbb600917cfb9add468cc4c8c84351a8dbbf61644dbc353263ca1748f.yml +openapi_spec_hash: c24264f32a46d9317aac5af9d6a396f7 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/src/Batch/CrawlControls.php b/src/Batch/CrawlControls.php index ba5e8c96..6852de2d 100644 --- a/src/Batch/CrawlControls.php +++ b/src/Batch/CrawlControls.php @@ -4,8 +4,8 @@ namespace ContextDev\Batch; -use ContextDev\Batch\CrawlControls\Source\UnionMember0; -use ContextDev\Batch\CrawlControls\Source\UnionMember1; +use ContextDev\Batch\CrawlControls\Source\Sitemap; +use ContextDev\Batch\CrawlControls\Source\StartURL; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; @@ -53,7 +53,7 @@ final class CrawlControls implements BaseModel * @var SourceVariants $source */ #[Required] - public UnionMember0|UnionMember1 $source; + public StartURL|Sitemap $source; /** * RE2 pattern URLs had to match to be crawled. Null when the crawl set none. @@ -102,7 +102,7 @@ public static function with( bool $followSubdomains, ?int $maxDepth, int $maxPages, - UnionMember0|array|UnionMember1 $source, + StartURL|array|Sitemap $source, ?string $urlPattern, ): self { $self = new self; @@ -154,7 +154,7 @@ public function withMaxPages(int $maxPages): self * * @param SourceShape $source */ - public function withSource(UnionMember0|array|UnionMember1 $source): self + public function withSource(StartURL|array|Sitemap $source): self { $self = clone $this; $self['source'] = $source; diff --git a/src/Batch/CrawlControls/Source.php b/src/Batch/CrawlControls/Source.php index 83d9e9d2..1ddf36ff 100644 --- a/src/Batch/CrawlControls/Source.php +++ b/src/Batch/CrawlControls/Source.php @@ -4,8 +4,8 @@ namespace ContextDev\Batch\CrawlControls; -use ContextDev\Batch\CrawlControls\Source\UnionMember0; -use ContextDev\Batch\CrawlControls\Source\UnionMember1; +use ContextDev\Batch\CrawlControls\Source\Sitemap; +use ContextDev\Batch\CrawlControls\Source\StartURL; use ContextDev\Core\Concerns\SdkUnion; use ContextDev\Core\Conversion\Contracts\Converter; use ContextDev\Core\Conversion\Contracts\ConverterSource; @@ -13,11 +13,11 @@ /** * Where the crawl started. * - * @phpstan-import-type UnionMember0Shape from \ContextDev\Batch\CrawlControls\Source\UnionMember0 - * @phpstan-import-type UnionMember1Shape from \ContextDev\Batch\CrawlControls\Source\UnionMember1 + * @phpstan-import-type StartURLShape from \ContextDev\Batch\CrawlControls\Source\StartURL + * @phpstan-import-type SitemapShape from \ContextDev\Batch\CrawlControls\Source\Sitemap * - * @phpstan-type SourceVariants = UnionMember0|UnionMember1 - * @phpstan-type SourceShape = SourceVariants|UnionMember0Shape|UnionMember1Shape + * @phpstan-type SourceVariants = StartURL|Sitemap + * @phpstan-type SourceShape = SourceVariants|StartURLShape|SitemapShape */ final class Source implements ConverterSource { @@ -28,6 +28,6 @@ final class Source implements ConverterSource */ public static function variants(): array { - return [UnionMember0::class, UnionMember1::class]; + return [StartURL::class, Sitemap::class]; } } diff --git a/src/Batch/CrawlControls/Source/UnionMember1.php b/src/Batch/CrawlControls/Source/Sitemap.php similarity index 77% rename from src/Batch/CrawlControls/Source/UnionMember1.php rename to src/Batch/CrawlControls/Source/Sitemap.php index 7d10636e..a1c30de6 100644 --- a/src/Batch/CrawlControls/Source/UnionMember1.php +++ b/src/Batch/CrawlControls/Source/Sitemap.php @@ -4,19 +4,19 @@ namespace ContextDev\Batch\CrawlControls\Source; -use ContextDev\Batch\CrawlControls\Source\UnionMember1\Type; +use ContextDev\Batch\CrawlControls\Source\Sitemap\Type; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-type UnionMember1Shape = array{ - * domain: string, type: Type|value-of - * } + * The crawl scraped the pages listed in the domain's sitemap. + * + * @phpstan-type SitemapShape = array{domain: string, type: Type|value-of} */ -final class UnionMember1 implements BaseModel +final class Sitemap implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; /** @@ -30,17 +30,17 @@ final class UnionMember1 implements BaseModel public string $type; /** - * `new UnionMember1()` is missing required properties by the API. + * `new Sitemap()` is missing required properties by the API. * * To enforce required parameters use * ``` - * UnionMember1::with(domain: ..., type: ...) + * Sitemap::with(domain: ..., type: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new UnionMember1)->withDomain(...)->withType(...) + * (new Sitemap)->withDomain(...)->withType(...) * ``` */ public function __construct() diff --git a/src/Batch/CrawlControls/Source/UnionMember1/Type.php b/src/Batch/CrawlControls/Source/Sitemap/Type.php similarity index 58% rename from src/Batch/CrawlControls/Source/UnionMember1/Type.php rename to src/Batch/CrawlControls/Source/Sitemap/Type.php index 55149338..edde8e68 100644 --- a/src/Batch/CrawlControls/Source/UnionMember1/Type.php +++ b/src/Batch/CrawlControls/Source/Sitemap/Type.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Batch\CrawlControls\Source\UnionMember1; +namespace ContextDev\Batch\CrawlControls\Source\Sitemap; enum Type: string { diff --git a/src/Batch/CrawlControls/Source/UnionMember0.php b/src/Batch/CrawlControls/Source/StartURL.php similarity index 77% rename from src/Batch/CrawlControls/Source/UnionMember0.php rename to src/Batch/CrawlControls/Source/StartURL.php index 80e86a2c..bd79a138 100644 --- a/src/Batch/CrawlControls/Source/UnionMember0.php +++ b/src/Batch/CrawlControls/Source/StartURL.php @@ -4,17 +4,19 @@ namespace ContextDev\Batch\CrawlControls\Source; -use ContextDev\Batch\CrawlControls\Source\UnionMember0\Type; +use ContextDev\Batch\CrawlControls\Source\StartURL\Type; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-type UnionMember0Shape = array{type: Type|value-of, url: string} + * The crawl discovered pages by following links from one URL. + * + * @phpstan-type StartURLShape = array{type: Type|value-of, url: string} */ -final class UnionMember0 implements BaseModel +final class StartURL implements BaseModel { - /** @use SdkModel */ + /** @use SdkModel */ use SdkModel; /** @var value-of $type */ @@ -28,17 +30,17 @@ final class UnionMember0 implements BaseModel public string $url; /** - * `new UnionMember0()` is missing required properties by the API. + * `new StartURL()` is missing required properties by the API. * * To enforce required parameters use * ``` - * UnionMember0::with(type: ..., url: ...) + * StartURL::with(type: ..., url: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new UnionMember0)->withType(...)->withURL(...) + * (new StartURL)->withType(...)->withURL(...) * ``` */ public function __construct() diff --git a/src/Batch/CrawlControls/Source/UnionMember0/Type.php b/src/Batch/CrawlControls/Source/StartURL/Type.php similarity index 59% rename from src/Batch/CrawlControls/Source/UnionMember0/Type.php rename to src/Batch/CrawlControls/Source/StartURL/Type.php index f8fa57a0..ea4ecba0 100644 --- a/src/Batch/CrawlControls/Source/UnionMember0/Type.php +++ b/src/Batch/CrawlControls/Source/StartURL/Type.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ContextDev\Batch\CrawlControls\Source\UnionMember0; +namespace ContextDev\Batch\CrawlControls\Source\StartURL; enum Type: string { diff --git a/src/People/PersonEnrichParams.php b/src/People/PersonEnrichParams.php index 5fe2a5a5..637e5789 100644 --- a/src/People/PersonEnrichParams.php +++ b/src/People/PersonEnrichParams.php @@ -14,7 +14,7 @@ use ContextDev\People\PersonEnrichParams\Name; /** - * Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on Pro and Scale plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. + * Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on all paid plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. * * @see ContextDev\Services\PeopleService::enrich() * diff --git a/src/Services/PeopleRawService.php b/src/Services/PeopleRawService.php index be492172..14b280f3 100644 --- a/src/Services/PeopleRawService.php +++ b/src/Services/PeopleRawService.php @@ -34,7 +34,7 @@ public function __construct(private Client $client) {} /** * @api * - * Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on Pro and Scale plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. + * Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on all paid plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. * * @param array{ * company?: Company|CompanyShape, diff --git a/src/Services/PeopleService.php b/src/Services/PeopleService.php index 572bd369..90519178 100644 --- a/src/Services/PeopleService.php +++ b/src/Services/PeopleService.php @@ -40,7 +40,7 @@ public function __construct(private Client $client) /** * @api * - * Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on Pro and Scale plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. + * Finds and normalizes the best available person candidate from additive identity clues, then assigns an identity match score from 0 to 100. Available on all paid plans. Successful requests cost 20 credits. Disposable and free email addresses (like gmail.com, yahoo.com) will throw a 422 error. * * @param Company|CompanyShape $company * @param list $education From 0c086a1553e60179a5c4712a684ea15e0d5a3d56 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 7 Aug 2026 01:15:57 +0000 Subject: [PATCH 098/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 64f9ff41..427b8ec4 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.8.0" + ".": "2.9.0" } \ No newline at end of file diff --git a/README.md b/README.md index 3f9ffb28..8272f7d4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.8.0" +composer require "context-dev/context-dev-php 2.9.0" ``` diff --git a/src/Client.php b/src/Client.php index 097e2522..638c88c7 100644 --- a/src/Client.php +++ b/src/Client.php @@ -107,7 +107,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.8.0', + 'X-Stainless-Package-Version' => '2.9.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 9050d10b..fc116866 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.8.0'; +const VERSION = '2.9.0'; // x-release-please-end From cd23b469f08c821ccfb13f5f2c0fb559124c65dd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sat, 8 Aug 2026 06:56:59 +0000 Subject: [PATCH 099/130] feat(api): api update --- .stats.yml | 4 +- .../Data/ScrapedPage/Metadata.php | 27 ++++++ .../Data/ScrapedPage/Metadata/Heading.php | 86 +++++++++++++++++++ src/Services/WebRawService.php | 2 +- src/Services/WebService.php | 2 +- .../WebWebCrawlMdResponse/Result/Metadata.php | 27 ++++++ .../Result/Metadata/Heading.php | 86 +++++++++++++++++++ src/Web/WebWebScrapeHTMLResponse/Metadata.php | 27 ++++++ .../Metadata/Heading.php | 86 +++++++++++++++++++ src/Web/WebWebScrapeMdParams.php | 2 +- src/Web/WebWebScrapeMdResponse/Metadata.php | 27 ++++++ .../Metadata/Heading.php | 86 +++++++++++++++++++ 12 files changed, 457 insertions(+), 5 deletions(-) create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Heading.php create mode 100644 src/Web/WebWebCrawlMdResponse/Result/Metadata/Heading.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/Metadata/Heading.php create mode 100644 src/Web/WebWebScrapeMdResponse/Metadata/Heading.php diff --git a/.stats.yml b/.stats.yml index 97db86d5..90b5514e 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0dda03bbb600917cfb9add468cc4c8c84351a8dbbf61644dbc353263ca1748f.yml -openapi_spec_hash: c24264f32a46d9317aac5af9d6a396f7 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1c93116e47cab52ea63490f5bca186ed3acda8bbd7f0ce5a320effb9f5b72b1f.yml +openapi_spec_hash: f56204d55bd4bffb6e4d50d6a5d9471a config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php index d3619e88..db6b2172 100644 --- a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata.php @@ -6,6 +6,7 @@ use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\AdditionalMeta; use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Alternate; +use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Heading; use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\OpenGraph; use ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Twitter; use ContextDev\Core\Attributes\Optional; @@ -22,6 +23,7 @@ * @phpstan-import-type TwitterVariants from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Twitter * @phpstan-import-type AdditionalMetaShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\AdditionalMeta * @phpstan-import-type AlternateShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Alternate + * @phpstan-import-type HeadingShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Heading * @phpstan-import-type OpenGraphShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\OpenGraph * @phpstan-import-type TwitterShape from \ContextDev\Batch\BatchGetResultsResponse\Data\ScrapedPage\Metadata\Twitter * @@ -34,6 +36,7 @@ * canonicalURL?: string|null, * description?: string|null, * favicon?: string|null, + * headings?: list|null, * image?: string|null, * jsonLd?: list>|null, * keywords?: list|null, @@ -104,6 +107,14 @@ final class Metadata implements BaseModel #[Optional] public ?string $favicon; + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @var list|null $headings + */ + #[Optional(list: Heading::class)] + public ?array $headings; + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ @@ -204,6 +215,7 @@ public function __construct() * * @param array|null $additionalMeta * @param list|null $alternates + * @param list|null $headings * @param list>|null $jsonLd * @param list|null $keywords * @param array|null $openGraph @@ -218,6 +230,7 @@ public static function with( ?string $canonicalURL = null, ?string $description = null, ?string $favicon = null, + ?array $headings = null, ?string $image = null, ?array $jsonLd = null, ?array $keywords = null, @@ -241,6 +254,7 @@ public static function with( null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; null !== $description && $self['description'] = $description; null !== $favicon && $self['favicon'] = $favicon; + null !== $headings && $self['headings'] = $headings; null !== $image && $self['image'] = $image; null !== $jsonLd && $self['jsonLd'] = $jsonLd; null !== $keywords && $self['keywords'] = $keywords; @@ -348,6 +362,19 @@ public function withFavicon(string $favicon): self return $self; } + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @param list $headings + */ + public function withHeadings(array $headings): self + { + $self = clone $this; + $self['headings'] = $headings; + + return $self; + } + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Heading.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Heading.php new file mode 100644 index 00000000..f6e9aa2d --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/Metadata/Heading.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Heading level, 1–6 (from h1–h6). + */ + #[Required] + public int $level; + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + #[Required] + public string $text; + + /** + * `new Heading()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Heading::with(level: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Heading)->withLevel(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $level, string $text): self + { + $self = new self; + + $self['level'] = $level; + $self['text'] = $text; + + return $self; + } + + /** + * Heading level, 1–6 (from h1–h6). + */ + public function withLevel(int $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 953b50d6..f472881f 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -482,7 +482,7 @@ public function webScrapeImages( * | HTTP status | Billed? | Meaning | * | --- | --- | --- | * | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | - * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | + * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds | * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | * | 408 | No | Request timed out | diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 27e6e7e4..f6cc793a 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -593,7 +593,7 @@ public function webScrapeImages( * | HTTP status | Billed? | Meaning | * | --- | --- | --- | * | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | - * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | + * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds | * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | * | 408 | No | Request timed out | diff --git a/src/Web/WebWebCrawlMdResponse/Result/Metadata.php b/src/Web/WebWebCrawlMdResponse/Result/Metadata.php index 6da696ce..26e7d76c 100644 --- a/src/Web/WebWebCrawlMdResponse/Result/Metadata.php +++ b/src/Web/WebWebCrawlMdResponse/Result/Metadata.php @@ -11,6 +11,7 @@ use ContextDev\Core\Conversion\MapOf; use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\AdditionalMeta; use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Alternate; +use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Heading; use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\OpenGraph; use ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Twitter; @@ -20,6 +21,7 @@ * @phpstan-import-type TwitterVariants from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Twitter * @phpstan-import-type AdditionalMetaShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\AdditionalMeta * @phpstan-import-type AlternateShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Alternate + * @phpstan-import-type HeadingShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Heading * @phpstan-import-type OpenGraphShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\OpenGraph * @phpstan-import-type TwitterShape from \ContextDev\Web\WebWebCrawlMdResponse\Result\Metadata\Twitter * @@ -37,6 +39,7 @@ * canonicalURL?: string|null, * description?: string|null, * favicon?: string|null, + * headings?: list|null, * image?: string|null, * jsonLd?: list>|null, * keywords?: list|null, @@ -136,6 +139,14 @@ final class Metadata implements BaseModel #[Optional] public ?string $favicon; + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @var list|null $headings + */ + #[Optional(list: Heading::class)] + public ?array $headings; + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ @@ -245,6 +256,7 @@ public function __construct() * * @param array|null $additionalMeta * @param list|null $alternates + * @param list|null $headings * @param list>|null $jsonLd * @param list|null $keywords * @param array|null $openGraph @@ -264,6 +276,7 @@ public static function with( ?string $canonicalURL = null, ?string $description = null, ?string $favicon = null, + ?array $headings = null, ?string $image = null, ?array $jsonLd = null, ?array $keywords = null, @@ -291,6 +304,7 @@ public static function with( null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; null !== $description && $self['description'] = $description; null !== $favicon && $self['favicon'] = $favicon; + null !== $headings && $self['headings'] = $headings; null !== $image && $self['image'] = $image; null !== $jsonLd && $self['jsonLd'] = $jsonLd; null !== $keywords && $self['keywords'] = $keywords; @@ -452,6 +466,19 @@ public function withFavicon(string $favicon): self return $self; } + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @param list $headings + */ + public function withHeadings(array $headings): self + { + $self = clone $this; + $self['headings'] = $headings; + + return $self; + } + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ diff --git a/src/Web/WebWebCrawlMdResponse/Result/Metadata/Heading.php b/src/Web/WebWebCrawlMdResponse/Result/Metadata/Heading.php new file mode 100644 index 00000000..560f6f5b --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/Result/Metadata/Heading.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Heading level, 1–6 (from h1–h6). + */ + #[Required] + public int $level; + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + #[Required] + public string $text; + + /** + * `new Heading()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Heading::with(level: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Heading)->withLevel(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $level, string $text): self + { + $self = new self; + + $self['level'] = $level; + $self['text'] = $text; + + return $self; + } + + /** + * Heading level, 1–6 (from h1–h6). + */ + public function withLevel(int $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/Metadata.php b/src/Web/WebWebScrapeHTMLResponse/Metadata.php index 23b827a3..13f3662e 100644 --- a/src/Web/WebWebScrapeHTMLResponse/Metadata.php +++ b/src/Web/WebWebScrapeHTMLResponse/Metadata.php @@ -11,6 +11,7 @@ use ContextDev\Core\Conversion\MapOf; use ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\AdditionalMeta; use ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\Alternate; +use ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\Heading; use ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\OpenGraph; use ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\Twitter; @@ -22,6 +23,7 @@ * @phpstan-import-type TwitterVariants from \ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\Twitter * @phpstan-import-type AdditionalMetaShape from \ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\AdditionalMeta * @phpstan-import-type AlternateShape from \ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\Alternate + * @phpstan-import-type HeadingShape from \ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\Heading * @phpstan-import-type OpenGraphShape from \ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\OpenGraph * @phpstan-import-type TwitterShape from \ContextDev\Web\WebWebScrapeHTMLResponse\Metadata\Twitter * @@ -34,6 +36,7 @@ * canonicalURL?: string|null, * description?: string|null, * favicon?: string|null, + * headings?: list|null, * image?: string|null, * jsonLd?: list>|null, * keywords?: list|null, @@ -104,6 +107,14 @@ final class Metadata implements BaseModel #[Optional] public ?string $favicon; + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @var list|null $headings + */ + #[Optional(list: Heading::class)] + public ?array $headings; + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ @@ -204,6 +215,7 @@ public function __construct() * * @param array|null $additionalMeta * @param list|null $alternates + * @param list|null $headings * @param list>|null $jsonLd * @param list|null $keywords * @param array|null $openGraph @@ -218,6 +230,7 @@ public static function with( ?string $canonicalURL = null, ?string $description = null, ?string $favicon = null, + ?array $headings = null, ?string $image = null, ?array $jsonLd = null, ?array $keywords = null, @@ -241,6 +254,7 @@ public static function with( null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; null !== $description && $self['description'] = $description; null !== $favicon && $self['favicon'] = $favicon; + null !== $headings && $self['headings'] = $headings; null !== $image && $self['image'] = $image; null !== $jsonLd && $self['jsonLd'] = $jsonLd; null !== $keywords && $self['keywords'] = $keywords; @@ -348,6 +362,19 @@ public function withFavicon(string $favicon): self return $self; } + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @param list $headings + */ + public function withHeadings(array $headings): self + { + $self = clone $this; + $self['headings'] = $headings; + + return $self; + } + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ diff --git a/src/Web/WebWebScrapeHTMLResponse/Metadata/Heading.php b/src/Web/WebWebScrapeHTMLResponse/Metadata/Heading.php new file mode 100644 index 00000000..08aa555b --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/Metadata/Heading.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Heading level, 1–6 (from h1–h6). + */ + #[Required] + public int $level; + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + #[Required] + public string $text; + + /** + * `new Heading()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Heading::with(level: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Heading)->withLevel(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $level, string $text): self + { + $self = new self; + + $self['level'] = $level; + $self['text'] = $text; + + return $self; + } + + /** + * Heading level, 1–6 (from h1–h6). + */ + public function withLevel(int $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index 99db8512..f08a7a69 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -33,7 +33,7 @@ * | HTTP status | Billed? | Meaning | * | --- | --- | --- | * | 200 | Yes — 1 credit, or 2 credits with actions | Successful scrape, including a zero-length result when includeSelectors matched nothing | - * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped | + * | 400 | No | Invalid input, skipped PDF, or the page could not be scraped. error_code WEBSITE_BLOCKED specifically means the site answered with an anti-bot challenge, CAPTCHA wall, or login shell instead of the page (even when the site returned HTTP 200) — retrying later or from another country sometimes succeeds | * | 401 / 403 | No | Invalid/disabled key, insufficient permissions, or credits exhausted; inspect error_code | * | 404 | No | Target page returned or fingerprinted as not found | * | 408 | No | Request timed out | diff --git a/src/Web/WebWebScrapeMdResponse/Metadata.php b/src/Web/WebWebScrapeMdResponse/Metadata.php index b7e67b79..2d332885 100644 --- a/src/Web/WebWebScrapeMdResponse/Metadata.php +++ b/src/Web/WebWebScrapeMdResponse/Metadata.php @@ -11,6 +11,7 @@ use ContextDev\Core\Conversion\MapOf; use ContextDev\Web\WebWebScrapeMdResponse\Metadata\AdditionalMeta; use ContextDev\Web\WebWebScrapeMdResponse\Metadata\Alternate; +use ContextDev\Web\WebWebScrapeMdResponse\Metadata\Heading; use ContextDev\Web\WebWebScrapeMdResponse\Metadata\OpenGraph; use ContextDev\Web\WebWebScrapeMdResponse\Metadata\Twitter; @@ -22,6 +23,7 @@ * @phpstan-import-type TwitterVariants from \ContextDev\Web\WebWebScrapeMdResponse\Metadata\Twitter * @phpstan-import-type AdditionalMetaShape from \ContextDev\Web\WebWebScrapeMdResponse\Metadata\AdditionalMeta * @phpstan-import-type AlternateShape from \ContextDev\Web\WebWebScrapeMdResponse\Metadata\Alternate + * @phpstan-import-type HeadingShape from \ContextDev\Web\WebWebScrapeMdResponse\Metadata\Heading * @phpstan-import-type OpenGraphShape from \ContextDev\Web\WebWebScrapeMdResponse\Metadata\OpenGraph * @phpstan-import-type TwitterShape from \ContextDev\Web\WebWebScrapeMdResponse\Metadata\Twitter * @@ -34,6 +36,7 @@ * canonicalURL?: string|null, * description?: string|null, * favicon?: string|null, + * headings?: list|null, * image?: string|null, * jsonLd?: list>|null, * keywords?: list|null, @@ -104,6 +107,14 @@ final class Metadata implements BaseModel #[Optional] public ?string $favicon; + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @var list|null $headings + */ + #[Optional(list: Heading::class)] + public ?array $headings; + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ @@ -204,6 +215,7 @@ public function __construct() * * @param array|null $additionalMeta * @param list|null $alternates + * @param list|null $headings * @param list>|null $jsonLd * @param list|null $keywords * @param array|null $openGraph @@ -218,6 +230,7 @@ public static function with( ?string $canonicalURL = null, ?string $description = null, ?string $favicon = null, + ?array $headings = null, ?string $image = null, ?array $jsonLd = null, ?array $keywords = null, @@ -241,6 +254,7 @@ public static function with( null !== $canonicalURL && $self['canonicalURL'] = $canonicalURL; null !== $description && $self['description'] = $description; null !== $favicon && $self['favicon'] = $favicon; + null !== $headings && $self['headings'] = $headings; null !== $image && $self['image'] = $image; null !== $jsonLd && $self['jsonLd'] = $jsonLd; null !== $keywords && $self['keywords'] = $keywords; @@ -348,6 +362,19 @@ public function withFavicon(string $favicon): self return $self; } + /** + * Page headings (h1–h6) in document order, extracted from the unfiltered document. Capped at the first 500 headings. Omitted when the page has none. + * + * @param list $headings + */ + public function withHeadings(array $headings): self + { + $self = clone $this; + $self['headings'] = $headings; + + return $self; + } + /** * Primary resolved preview image from Open Graph, Twitter, or image metadata. */ diff --git a/src/Web/WebWebScrapeMdResponse/Metadata/Heading.php b/src/Web/WebWebScrapeMdResponse/Metadata/Heading.php new file mode 100644 index 00000000..0d6516c8 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/Metadata/Heading.php @@ -0,0 +1,86 @@ + */ + use SdkModel; + + /** + * Heading level, 1–6 (from h1–h6). + */ + #[Required] + public int $level; + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + #[Required] + public string $text; + + /** + * `new Heading()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Heading::with(level: ..., text: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Heading)->withLevel(...)->withText(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $level, string $text): self + { + $self = new self; + + $self['level'] = $level; + $self['text'] = $text; + + return $self; + } + + /** + * Heading level, 1–6 (from h1–h6). + */ + public function withLevel(int $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } + + /** + * Heading text with whitespace collapsed, truncated to 1000 characters. + */ + public function withText(string $text): self + { + $self = clone $this; + $self['text'] = $text; + + return $self; + } +} From 3b2c798a33acc8acd6ff29e0fd40d43446088a0f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 10 Aug 2026 09:04:23 +0000 Subject: [PATCH 100/130] feat(api): api update --- .stats.yml | 4 +-- .../Data/ScrapedPage.php | 4 +-- .../Input/Crawl/Data/Markdown/Options.php | 20 +++++++++++++ .../Input/Scrape/Data/Markdown/Options.php | 20 +++++++++++++ src/ServiceContracts/UtilityContract.php | 4 +-- src/ServiceContracts/WebContract.php | 3 ++ src/Services/UtilityRawService.php | 2 +- src/Services/UtilityService.php | 6 ++-- src/Services/WebRawService.php | 2 ++ src/Services/WebService.php | 4 +++ src/Utility/UtilityPrefetchParams.php | 10 +++---- .../UtilityPrefetchParams/Identifier.php | 2 +- .../UtilityPrefetchDomainIdentifier.php | 6 ++-- .../UtilityPrefetchEmailIdentifier.php | 6 ++-- src/Utility/UtilityPrefetchParams/Type.php | 4 ++- src/Utility/UtilityPrefetchResponse.php | 4 +-- src/Utility/UtilityPrefetchResponse/Type.php | 4 ++- src/Web/WebWebScrapeMdParams.php | 29 +++++++++++++++++++ src/Web/WebWebScrapeMdParams/IncludeHTML.php | 29 +++++++++++++++++++ .../IncludeHTML/UnionMember1.php | 12 ++++++++ src/Web/WebWebScrapeMdResponse.php | 20 +++++++++++++ tests/Services/BatchTest.php | 1 + tests/Services/WebTest.php | 1 + 23 files changed, 171 insertions(+), 26 deletions(-) create mode 100644 src/Web/WebWebScrapeMdParams/IncludeHTML.php create mode 100644 src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php diff --git a/.stats.yml b/.stats.yml index 90b5514e..f9b95cb4 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-1c93116e47cab52ea63490f5bca186ed3acda8bbd7f0ce5a320effb9f5b72b1f.yml -openapi_spec_hash: f56204d55bd4bffb6e4d50d6a5d9471a +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7f75f39699c1298d16691b5a58b1312a229b78288fba6e2de4040ba1422e530f.yml +openapi_spec_hash: b3ad781596e4c52fde918cfaae54a5d4 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php index d5c7edda..c8c21cf0 100644 --- a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage.php @@ -66,7 +66,7 @@ final class ScrapedPage implements BaseModel public string $url; /** - * Raw page HTML. Present on html batches. + * Page HTML. Present on html batches, and on markdown batches submitted with `options.includeHTML`. */ #[Optional] public ?string $html; @@ -215,7 +215,7 @@ public function withURL(string $url): self } /** - * Raw page HTML. Present on html batches. + * Page HTML. Present on html batches, and on markdown batches submitted with `options.includeHTML`. */ public function withHTML(string $html): self { diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php index 20e33f69..a62dc972 100644 --- a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options.php @@ -18,6 +18,7 @@ * @phpstan-type OptionsShape = array{ * country?: null|Country|value-of, * excludeSelectors?: list|null, + * includeHTML?: bool|null, * includeImages?: bool|null, * includeLinks?: bool|null, * includeSelectors?: list|null, @@ -50,6 +51,12 @@ final class Options implements BaseModel #[Optional(list: 'string', nullable: true)] public ?array $excludeSelectors; + /** + * Also include each page's HTML in its result record, as an `html` field alongside the Markdown. + */ + #[Optional] + public ?bool $includeHTML; + /** * Include image references in the Markdown. */ @@ -124,6 +131,7 @@ public function __construct() public static function with( Country|string|null $country = null, ?array $excludeSelectors = null, + ?bool $includeHTML = null, ?bool $includeImages = null, ?bool $includeLinks = null, ?array $includeSelectors = null, @@ -138,6 +146,7 @@ public static function with( null !== $country && $self['country'] = $country; null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $includeHTML && $self['includeHTML'] = $includeHTML; null !== $includeImages && $self['includeImages'] = $includeImages; null !== $includeLinks && $self['includeLinks'] = $includeLinks; null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; @@ -177,6 +186,17 @@ public function withExcludeSelectors(?array $excludeSelectors): self return $self; } + /** + * Also include each page's HTML in its result record, as an `html` field alongside the Markdown. + */ + public function withIncludeHTML(bool $includeHTML): self + { + $self = clone $this; + $self['includeHTML'] = $includeHTML; + + return $self; + } + /** * Include image references in the Markdown. */ diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php index b734ecf3..d2cb2ccb 100644 --- a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php +++ b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options.php @@ -18,6 +18,7 @@ * @phpstan-type OptionsShape = array{ * country?: null|Country|value-of, * excludeSelectors?: list|null, + * includeHTML?: bool|null, * includeImages?: bool|null, * includeLinks?: bool|null, * includeSelectors?: list|null, @@ -50,6 +51,12 @@ final class Options implements BaseModel #[Optional(list: 'string', nullable: true)] public ?array $excludeSelectors; + /** + * Also include each page's HTML in its result record, as an `html` field alongside the Markdown. + */ + #[Optional] + public ?bool $includeHTML; + /** * Include image references in the Markdown. */ @@ -124,6 +131,7 @@ public function __construct() public static function with( Country|string|null $country = null, ?array $excludeSelectors = null, + ?bool $includeHTML = null, ?bool $includeImages = null, ?bool $includeLinks = null, ?array $includeSelectors = null, @@ -138,6 +146,7 @@ public static function with( null !== $country && $self['country'] = $country; null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; + null !== $includeHTML && $self['includeHTML'] = $includeHTML; null !== $includeImages && $self['includeImages'] = $includeImages; null !== $includeLinks && $self['includeLinks'] = $includeLinks; null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; @@ -177,6 +186,17 @@ public function withExcludeSelectors(?array $excludeSelectors): self return $self; } + /** + * Also include each page's HTML in its result record, as an `html` field alongside the Markdown. + */ + public function withIncludeHTML(bool $includeHTML): self + { + $self = clone $this; + $self['includeHTML'] = $includeHTML; + + return $self; + } + /** * Include image references in the Markdown. */ diff --git a/src/ServiceContracts/UtilityContract.php b/src/ServiceContracts/UtilityContract.php index eebf6f16..ad22f2de 100644 --- a/src/ServiceContracts/UtilityContract.php +++ b/src/ServiceContracts/UtilityContract.php @@ -20,8 +20,8 @@ interface UtilityContract /** * @api * - * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. - * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. + * @param IdentifierShape $identifier Identifier of the target to prefetch. Provide exactly one of domain or email. + * @param Type|value-of $type what to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index beefa33a..ca76efa5 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -45,6 +45,7 @@ * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 + * @phpstan-import-type IncludeHTMLShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 @@ -365,6 +366,7 @@ public function webScrapeImages( * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown + * @param IncludeHTMLShape $includeHTML when true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request * @param IncludeImagesShape $includeImages Include image references in Markdown output * @param IncludeLinksShape $includeLinks Preserve hyperlinks in Markdown output * @param list|null $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". @@ -388,6 +390,7 @@ public function webScrapeMd( ?array $excludeSelectors = null, ?array $headers = null, bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1|string $includeFrames = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeHTML\UnionMember1|string $includeHTML = false, bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeImages\UnionMember1|string $includeImages = false, bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeLinks\UnionMember1|string $includeLinks = true, ?array $includeSelectors = null, diff --git a/src/Services/UtilityRawService.php b/src/Services/UtilityRawService.php index 1b10d93c..84b0c87d 100644 --- a/src/Services/UtilityRawService.php +++ b/src/Services/UtilityRawService.php @@ -28,7 +28,7 @@ public function __construct(private Client $client) {} /** * @api * - * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). + * Signal that you may fetch data soon to improve latency. The type field selects what to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a styleguide extraction) and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * * @param array{ * identifier: IdentifierShape, diff --git a/src/Services/UtilityService.php b/src/Services/UtilityService.php index 3ba999f0..6afb2132 100644 --- a/src/Services/UtilityService.php +++ b/src/Services/UtilityService.php @@ -36,10 +36,10 @@ public function __construct(private Client $client) /** * @api * - * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). + * Signal that you may fetch data soon to improve latency. The type field selects what to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a styleguide extraction) and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * - * @param IdentifierShape $identifier Identifier of the brand to prefetch. Provide exactly one of domain or email. - * @param Type|value-of $type What to prefetch. Currently only 'brand' is supported. + * @param IdentifierShape $identifier Identifier of the target to prefetch. Provide exactly one of domain or email. + * @param Type|value-of $type what to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param RequestOpts|null $requestOptions diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index f472881f..ebf47214 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -59,6 +59,7 @@ * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 + * @phpstan-import-type IncludeHTMLShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 @@ -498,6 +499,7 @@ public function webScrapeImages( * excludeSelectors?: list|null, * headers?: array, * includeFrames?: IncludeFramesShape1, + * includeHTML?: IncludeHTMLShape, * includeImages?: IncludeImagesShape, * includeLinks?: IncludeLinksShape, * includeSelectors?: list|null, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index f6cc793a..61798e6d 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -48,6 +48,7 @@ * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 + * @phpstan-import-type IncludeHTMLShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 @@ -608,6 +609,7 @@ public function webScrapeImages( * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown + * @param IncludeHTMLShape $includeHTML when true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request * @param IncludeImagesShape $includeImages Include image references in Markdown output * @param IncludeLinksShape $includeLinks Preserve hyperlinks in Markdown output * @param list|null $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". @@ -631,6 +633,7 @@ public function webScrapeMd( ?array $excludeSelectors = null, ?array $headers = null, bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1|string $includeFrames = false, + bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeHTML\UnionMember1|string $includeHTML = false, bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeImages\UnionMember1|string $includeImages = false, bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeLinks\UnionMember1|string $includeLinks = true, ?array $includeSelectors = null, @@ -655,6 +658,7 @@ public function webScrapeMd( 'excludeSelectors' => $excludeSelectors, 'headers' => $headers, 'includeFrames' => $includeFrames, + 'includeHTML' => $includeHTML, 'includeImages' => $includeImages, 'includeLinks' => $includeLinks, 'includeSelectors' => $includeSelectors, diff --git a/src/Utility/UtilityPrefetchParams.php b/src/Utility/UtilityPrefetchParams.php index 2025df68..6fa96809 100644 --- a/src/Utility/UtilityPrefetchParams.php +++ b/src/Utility/UtilityPrefetchParams.php @@ -14,7 +14,7 @@ use ContextDev\Utility\UtilityPrefetchParams\Type; /** - * Signal that you may fetch brand data soon to improve latency. The type field selects what to prefetch (currently only 'brand') and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). + * Signal that you may fetch data soon to improve latency. The type field selects what to prefetch ('brand' queues a brand data fetch, 'styleguide' queues a styleguide extraction) and identifier carries exactly one lookup key: a domain, or an email whose domain is extracted and validated (free email providers and disposable email addresses are not allowed). * * @see ContextDev\Services\UtilityService::prefetch() * @@ -35,7 +35,7 @@ final class UtilityPrefetchParams implements BaseModel use SdkParams; /** - * Identifier of the brand to prefetch. Provide exactly one of domain or email. + * Identifier of the target to prefetch. Provide exactly one of domain or email. * * @var IdentifierVariants $identifier */ @@ -43,7 +43,7 @@ final class UtilityPrefetchParams implements BaseModel public UtilityPrefetchDomainIdentifier|UtilityPrefetchEmailIdentifier $identifier; /** - * What to prefetch. Currently only 'brand' is supported. + * What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache. * * @var value-of $type */ @@ -110,7 +110,7 @@ public static function with( } /** - * Identifier of the brand to prefetch. Provide exactly one of domain or email. + * Identifier of the target to prefetch. Provide exactly one of domain or email. * * @param IdentifierShape $identifier */ @@ -124,7 +124,7 @@ public function withIdentifier( } /** - * What to prefetch. Currently only 'brand' is supported. + * What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache. * * @param Type|value-of $type */ diff --git a/src/Utility/UtilityPrefetchParams/Identifier.php b/src/Utility/UtilityPrefetchParams/Identifier.php index 1fdb5ab1..8e90897e 100644 --- a/src/Utility/UtilityPrefetchParams/Identifier.php +++ b/src/Utility/UtilityPrefetchParams/Identifier.php @@ -11,7 +11,7 @@ use ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier; /** - * Identifier of the brand to prefetch. Provide exactly one of domain or email. + * Identifier of the target to prefetch. Provide exactly one of domain or email. * * @phpstan-import-type UtilityPrefetchDomainIdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchDomainIdentifier * @phpstan-import-type UtilityPrefetchEmailIdentifierShape from \ContextDev\Utility\UtilityPrefetchParams\Identifier\UtilityPrefetchEmailIdentifier diff --git a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php index 615f897b..7bb39d4f 100644 --- a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php +++ b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchDomainIdentifier.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Prefetch brand data by domain. + * Prefetch by domain. * * @phpstan-type UtilityPrefetchDomainIdentifierShape = array{domain: string} */ @@ -19,7 +19,7 @@ final class UtilityPrefetchDomainIdentifier implements BaseModel use SdkModel; /** - * Domain name to prefetch brand data for. + * Domain name to prefetch data for. */ #[Required] public string $domain; @@ -58,7 +58,7 @@ public static function with(string $domain): self } /** - * Domain name to prefetch brand data for. + * Domain name to prefetch data for. */ public function withDomain(string $domain): self { diff --git a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php index 44142c31..8ea85345 100644 --- a/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php +++ b/src/Utility/UtilityPrefetchParams/Identifier/UtilityPrefetchEmailIdentifier.php @@ -9,7 +9,7 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Prefetch brand data by email. The domain will be extracted and validated. + * Prefetch by email. The domain will be extracted and validated. * * @phpstan-type UtilityPrefetchEmailIdentifierShape = array{email: string} */ @@ -19,7 +19,7 @@ final class UtilityPrefetchEmailIdentifier implements BaseModel use SdkModel; /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + * Email address to prefetch data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. */ #[Required] public string $email; @@ -58,7 +58,7 @@ public static function with(string $email): self } /** - * Email address to prefetch brand data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. + * Email address to prefetch data for. The domain will be extracted from the email. Free email providers (gmail.com, yahoo.com, etc.) and disposable email addresses are not allowed. */ public function withEmail(string $email): self { diff --git a/src/Utility/UtilityPrefetchParams/Type.php b/src/Utility/UtilityPrefetchParams/Type.php index 79bdffa2..ed700b97 100644 --- a/src/Utility/UtilityPrefetchParams/Type.php +++ b/src/Utility/UtilityPrefetchParams/Type.php @@ -5,9 +5,11 @@ namespace ContextDev\Utility\UtilityPrefetchParams; /** - * What to prefetch. Currently only 'brand' is supported. + * What to prefetch: 'brand' warms the brand data cache, 'styleguide' warms the styleguide cache. */ enum Type: string { case BRAND = 'brand'; + + case STYLEGUIDE = 'styleguide'; } diff --git a/src/Utility/UtilityPrefetchResponse.php b/src/Utility/UtilityPrefetchResponse.php index f095c3dc..a0f01e2d 100644 --- a/src/Utility/UtilityPrefetchResponse.php +++ b/src/Utility/UtilityPrefetchResponse.php @@ -51,7 +51,7 @@ final class UtilityPrefetchResponse implements BaseModel public ?string $status; /** - * The type of prefetch that was queued, echoed from the request (currently always 'brand'). + * The type of prefetch that was queued, echoed from the request. * * @var value-of|null $type */ @@ -136,7 +136,7 @@ public function withStatus(string $status): self } /** - * The type of prefetch that was queued, echoed from the request (currently always 'brand'). + * The type of prefetch that was queued, echoed from the request. * * @param Type|value-of $type */ diff --git a/src/Utility/UtilityPrefetchResponse/Type.php b/src/Utility/UtilityPrefetchResponse/Type.php index b1270556..024523c7 100644 --- a/src/Utility/UtilityPrefetchResponse/Type.php +++ b/src/Utility/UtilityPrefetchResponse/Type.php @@ -5,9 +5,11 @@ namespace ContextDev\Utility\UtilityPrefetchResponse; /** - * The type of prefetch that was queued, echoed from the request (currently always 'brand'). + * The type of prefetch that was queued, echoed from the request. */ enum Type: string { case BRAND = 'brand'; + + case STYLEGUIDE = 'styleguide'; } diff --git a/src/Web/WebWebScrapeMdParams.php b/src/Web/WebWebScrapeMdParams.php index f08a7a69..954637b3 100644 --- a/src/Web/WebWebScrapeMdParams.php +++ b/src/Web/WebWebScrapeMdParams.php @@ -13,6 +13,7 @@ use ContextDev\Web\WebWebScrapeMdParams\Country; use ContextDev\Web\WebWebScrapeMdParams\IncludeFrames; use ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1; +use ContextDev\Web\WebWebScrapeMdParams\IncludeHTML; use ContextDev\Web\WebWebScrapeMdParams\IncludeImages; use ContextDev\Web\WebWebScrapeMdParams\IncludeLinks; use ContextDev\Web\WebWebScrapeMdParams\Pdf; @@ -46,6 +47,7 @@ * * @phpstan-import-type ActionVariants from \ContextDev\Web\WebWebScrapeMdParams\Action * @phpstan-import-type IncludeFramesVariants from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames + * @phpstan-import-type IncludeHTMLVariants from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML * @phpstan-import-type IncludeImagesVariants from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksVariants from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type SettleAnimationsVariants from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations @@ -53,6 +55,7 @@ * @phpstan-import-type UseMainContentOnlyVariants from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames + * @phpstan-import-type IncludeHTMLShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf @@ -67,6 +70,7 @@ * excludeSelectors?: list|null, * headers?: array|null, * includeFrames?: IncludeFramesShape|null, + * includeHTML?: IncludeHTMLShape|null, * includeImages?: IncludeImagesShape|null, * includeLinks?: IncludeLinksShape|null, * includeSelectors?: list|null, @@ -133,6 +137,14 @@ final class WebWebScrapeMdParams implements BaseModel #[Optional(union: IncludeFrames::class)] public bool|string|null $includeFrames; + /** + * When true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request. + * + * @var IncludeHTMLVariants|null $includeHTML + */ + #[Optional(union: IncludeHTML::class)] + public bool|string|null $includeHTML; + /** * Include image references in Markdown output. * @@ -250,6 +262,7 @@ public function __construct() * @param list|null $excludeSelectors * @param array|null $headers * @param IncludeFramesShape|null $includeFrames + * @param IncludeHTMLShape|null $includeHTML * @param IncludeImagesShape|null $includeImages * @param IncludeLinksShape|null $includeLinks * @param list|null $includeSelectors @@ -267,6 +280,7 @@ public static function with( ?array $excludeSelectors = null, ?array $headers = null, bool|UnionMember1|string|null $includeFrames = null, + bool|IncludeHTML\UnionMember1|string|null $includeHTML = null, bool|IncludeImages\UnionMember1|string|null $includeImages = null, bool|IncludeLinks\UnionMember1|string|null $includeLinks = null, ?array $includeSelectors = null, @@ -289,6 +303,7 @@ public static function with( null !== $excludeSelectors && $self['excludeSelectors'] = $excludeSelectors; null !== $headers && $self['headers'] = $headers; null !== $includeFrames && $self['includeFrames'] = $includeFrames; + null !== $includeHTML && $self['includeHTML'] = $includeHTML; null !== $includeImages && $self['includeImages'] = $includeImages; null !== $includeLinks && $self['includeLinks'] = $includeLinks; null !== $includeSelectors && $self['includeSelectors'] = $includeSelectors; @@ -382,6 +397,20 @@ public function withIncludeFrames( return $self; } + /** + * When true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request. + * + * @param IncludeHTMLShape $includeHTML + */ + public function withIncludeHTML( + bool|IncludeHTML\UnionMember1|string $includeHTML, + ): self { + $self = clone $this; + $self['includeHTML'] = $includeHTML; + + return $self; + } + /** * Include image references in Markdown output. * diff --git a/src/Web/WebWebScrapeMdParams/IncludeHTML.php b/src/Web/WebWebScrapeMdParams/IncludeHTML.php new file mode 100644 index 00000000..cf7d3940 --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/IncludeHTML.php @@ -0,0 +1,29 @@ + + * @phpstan-type IncludeHTMLShape = IncludeHTMLVariants + */ +final class IncludeHTML implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['bool', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php new file mode 100644 index 00000000..764cb0db --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php @@ -0,0 +1,12 @@ +|null, * actionsHTMLStale?: bool|null, + * html?: string|null, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * } */ @@ -77,6 +78,12 @@ final class WebWebScrapeMdResponse implements BaseModel #[Optional('actionsHtmlStale')] public ?bool $actionsHTMLStale; + /** + * Only present when includeHTML=true: the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request. + */ + #[Optional] + public ?string $html; + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. */ @@ -126,6 +133,7 @@ public static function with( string $url, ?array $actionsApplied = null, ?bool $actionsHTMLStale = null, + ?string $html = null, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; @@ -138,6 +146,7 @@ public static function with( null !== $actionsApplied && $self['actionsApplied'] = $actionsApplied; null !== $actionsHTMLStale && $self['actionsHTMLStale'] = $actionsHTMLStale; + null !== $html && $self['html'] = $html; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; return $self; @@ -224,6 +233,17 @@ public function withActionsHTMLStale(bool $actionsHTMLStale): self return $self; } + /** + * Only present when includeHTML=true: the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request. + */ + public function withHTML(string $html): self + { + $self = clone $this; + $self['html'] = $html; + + return $self; + } + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. * diff --git a/tests/Services/BatchTest.php b/tests/Services/BatchTest.php index e2155462..d9fa5d17 100644 --- a/tests/Services/BatchTest.php +++ b/tests/Services/BatchTest.php @@ -148,6 +148,7 @@ public function testSubmitWithOptionalParams(): void 'options' => [ 'country' => 'de', 'excludeSelectors' => ['x'], + 'includeHTML' => true, 'includeImages' => true, 'includeLinks' => true, 'includeSelectors' => ['x'], diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index eb41d56e..2b048c18 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -369,6 +369,7 @@ public function testWebScrapeMdWithOptionalParams(): void excludeSelectors: ['x'], headers: ['foo' => 'J!'], includeFrames: 'true', + includeHTML: 'true', includeImages: 'true', includeLinks: 'true', includeSelectors: ['x'], From 0ba64c68b8065b84dac3a57733b1fcf939618b5f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 11 Aug 2026 07:47:03 +0000 Subject: [PATCH 101/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f9b95cb4..0829be8a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7f75f39699c1298d16691b5a58b1312a229b78288fba6e2de4040ba1422e530f.yml -openapi_spec_hash: b3ad781596e4c52fde918cfaae54a5d4 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5a88256ce88b7bc7854211e67446bc71bc52975a2d62263e1194bec7cf6c2f16.yml +openapi_spec_hash: f5011cea07c6c4a7d2984d6be85ffe49 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 89c674242f2289040aeebf6079ac4f33fcb53ced Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 09:21:16 +0000 Subject: [PATCH 102/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 0829be8a..9ed440e3 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5a88256ce88b7bc7854211e67446bc71bc52975a2d62263e1194bec7cf6c2f16.yml -openapi_spec_hash: f5011cea07c6c4a7d2984d6be85ffe49 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c0a0223a614d6793c76c77cb5443276adf09ffa1a4d6761aae240d30a65d71e6.yml +openapi_spec_hash: 1aa54f261fd2238035711a73618c51cd config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 191c354c7f024230e57a445c0c6463022dce99e9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 12 Aug 2026 20:43:53 +0000 Subject: [PATCH 103/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9ed440e3..3f88b9d8 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c0a0223a614d6793c76c77cb5443276adf09ffa1a4d6761aae240d30a65d71e6.yml -openapi_spec_hash: 1aa54f261fd2238035711a73618c51cd +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-662e436bab5a74933ca1d08ac370c34ef632285b7aec23d95b1b442b2291d589.yml +openapi_spec_hash: 34399fa7028ac361abee1a0a4f139093 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 1b06b06e6a7adb02519d6fdfb31a3e80e6b44e53 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 13 Aug 2026 20:44:02 +0000 Subject: [PATCH 104/130] feat(api): api update --- .stats.yml | 4 +- .../Input/Crawl/Data/HTML/Options/Pdf.php | 43 ++--- .../Input/Crawl/Data/HTML/Options/Pdf/Ocr.php | 29 ---- .../HTML/Options/Pdf/Ocr/UnionMember1.php | 12 -- .../Data/HTML/Options/Pdf/ShouldParse.php | 29 ---- .../Options/Pdf/ShouldParse/UnionMember1.php | 12 -- .../Input/Crawl/Data/Markdown/Options/Pdf.php | 43 ++--- .../Crawl/Data/Markdown/Options/Pdf/Ocr.php | 29 ---- .../Markdown/Options/Pdf/Ocr/UnionMember1.php | 12 -- .../Data/Markdown/Options/Pdf/ShouldParse.php | 29 ---- .../Options/Pdf/ShouldParse/UnionMember1.php | 12 -- .../Input/Scrape/Data/HTML/Options/Pdf.php | 43 ++--- .../Scrape/Data/HTML/Options/Pdf/Ocr.php | 29 ---- .../HTML/Options/Pdf/Ocr/UnionMember1.php | 12 -- .../Data/HTML/Options/Pdf/ShouldParse.php | 29 ---- .../Options/Pdf/ShouldParse/UnionMember1.php | 12 -- .../Scrape/Data/Markdown/Options/Pdf.php | 43 ++--- .../Scrape/Data/Markdown/Options/Pdf/Ocr.php | 29 ---- .../Markdown/Options/Pdf/Ocr/UnionMember1.php | 12 -- .../Data/Markdown/Options/Pdf/ShouldParse.php | 29 ---- .../Options/Pdf/ShouldParse/UnionMember1.php | 12 -- src/Parse/ParseHandleParams.php | 106 ++++--------- src/Parse/ParseHandleParams/IncludeImages.php | 29 ---- .../IncludeImages/UnionMember1.php | 12 -- src/Parse/ParseHandleParams/IncludeLinks.php | 29 ---- .../IncludeLinks/UnionMember1.php | 12 -- src/Parse/ParseHandleParams/Ocr.php | 29 ---- .../ParseHandleParams/Ocr/UnionMember1.php | 12 -- .../ParseHandleParams/ShortenBase64Images.php | 29 ---- .../ShortenBase64Images/UnionMember1.php | 12 -- .../ParseHandleParams/UseMainContentOnly.php | 29 ---- .../UseMainContentOnly/UnionMember1.php | 12 -- src/ServiceContracts/ParseContract.php | 26 ++- src/ServiceContracts/WebContract.php | 61 +++----- src/Services/ParseRawService.php | 15 +- src/Services/ParseService.php | 26 ++- src/Services/WebRawService.php | 36 ++--- src/Services/WebService.php | 61 +++----- src/Web/WebScreenshotParams.php | 22 +-- .../WebScreenshotParams/HandleCookiePopup.php | 29 ---- .../HandleCookiePopup/UnionMember1.php | 12 -- src/Web/WebWebScrapeHTMLParams.php | 64 +++----- .../WebWebScrapeHTMLParams/IncludeFrames.php | 29 ---- .../IncludeFrames/UnionMember1.php | 12 -- src/Web/WebWebScrapeHTMLParams/Pdf.php | 43 ++--- src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php | 29 ---- .../Pdf/Ocr/UnionMember1.php | 12 -- .../Pdf/ShouldParse.php | 29 ---- .../Pdf/ShouldParse/UnionMember1.php | 12 -- .../SettleAnimations.php | 29 ---- .../SettleAnimations/UnionMember1.php | 12 -- .../UseMainContentOnly.php | 29 ---- .../UseMainContentOnly/UnionMember1.php | 12 -- src/Web/WebWebScrapeImagesParams.php | 19 +-- src/Web/WebWebScrapeImagesParams/Dedupe.php | 29 ---- .../Dedupe/UnionMember1.php | 12 -- .../WebWebScrapeImagesParams/Enrichment.php | 66 +++----- .../Enrichment/Classification.php | 29 ---- .../Classification/UnionMember1.php | 12 -- .../Enrichment/HostedURL.php | 29 ---- .../Enrichment/HostedURL/UnionMember1.php | 12 -- .../Enrichment/Resolution.php | 29 ---- .../Enrichment/Resolution/UnionMember1.php | 12 -- src/Web/WebWebScrapeMdParams.php | 148 +++++------------- .../WebWebScrapeMdParams/IncludeFrames.php | 29 ---- .../IncludeFrames/UnionMember1.php | 12 -- src/Web/WebWebScrapeMdParams/IncludeHTML.php | 29 ---- .../IncludeHTML/UnionMember1.php | 12 -- .../WebWebScrapeMdParams/IncludeImages.php | 29 ---- .../IncludeImages/UnionMember1.php | 12 -- src/Web/WebWebScrapeMdParams/IncludeLinks.php | 29 ---- .../IncludeLinks/UnionMember1.php | 12 -- src/Web/WebWebScrapeMdParams/Pdf.php | 43 ++--- src/Web/WebWebScrapeMdParams/Pdf/Ocr.php | 29 ---- .../Pdf/Ocr/UnionMember1.php | 12 -- .../WebWebScrapeMdParams/Pdf/ShouldParse.php | 29 ---- .../Pdf/ShouldParse/UnionMember1.php | 12 -- .../WebWebScrapeMdParams/SettleAnimations.php | 29 ---- .../SettleAnimations/UnionMember1.php | 12 -- .../ShortenBase64Images.php | 29 ---- .../ShortenBase64Images/UnionMember1.php | 12 -- .../UseMainContentOnly.php | 29 ---- .../UseMainContentOnly/UnionMember1.php | 12 -- tests/Services/BatchTest.php | 2 +- tests/Services/WebTest.php | 32 ++-- 85 files changed, 283 insertions(+), 1975 deletions(-) delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse.php delete mode 100644 src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php delete mode 100644 src/Parse/ParseHandleParams/IncludeImages.php delete mode 100644 src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php delete mode 100644 src/Parse/ParseHandleParams/IncludeLinks.php delete mode 100644 src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php delete mode 100644 src/Parse/ParseHandleParams/Ocr.php delete mode 100644 src/Parse/ParseHandleParams/Ocr/UnionMember1.php delete mode 100644 src/Parse/ParseHandleParams/ShortenBase64Images.php delete mode 100644 src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php delete mode 100644 src/Parse/ParseHandleParams/UseMainContentOnly.php delete mode 100644 src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php delete mode 100644 src/Web/WebScreenshotParams/HandleCookiePopup.php delete mode 100644 src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/IncludeFrames.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/Ocr.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/SettleAnimations.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/UseMainContentOnly.php delete mode 100644 src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Dedupe.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Classification.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Resolution.php delete mode 100644 src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeFrames.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeHTML.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeImages.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeLinks.php delete mode 100644 src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/Pdf/Ocr.php delete mode 100644 src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/Pdf/ShouldParse.php delete mode 100644 src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/SettleAnimations.php delete mode 100644 src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/ShortenBase64Images.php delete mode 100644 src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php delete mode 100644 src/Web/WebWebScrapeMdParams/UseMainContentOnly.php delete mode 100644 src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php diff --git a/.stats.yml b/.stats.yml index 3f88b9d8..ef63af1f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-662e436bab5a74933ca1d08ac370c34ef632285b7aec23d95b1b442b2291d589.yml -openapi_spec_hash: 34399fa7028ac361abee1a0a4f139093 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d31d405927ec58ac97c0a9732130aea18209c65a0f2f0a348aa91c333535305e.yml +openapi_spec_hash: 0ede81f7fd98f41bc6bbc4167300bfb9 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf.php index 2c7060d2..b2180d9c 100644 --- a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf.php +++ b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf.php @@ -4,9 +4,6 @@ namespace ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options; -use ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr; -use ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr\UnionMember1; -use ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\ShouldParse; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; @@ -14,16 +11,8 @@ /** * PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. * - * @phpstan-import-type OcrVariants from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr - * @phpstan-import-type ShouldParseVariants from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\ShouldParse - * @phpstan-import-type OcrShape from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\Ocr - * @phpstan-import-type ShouldParseShape from \ContextDev\Batch\BatchSubmitParams\Input\Crawl\Data\HTML\Options\Pdf\ShouldParse - * * @phpstan-type PdfShape = array{ - * end?: int|null, - * ocr?: OcrShape|null, - * shouldParse?: ShouldParseShape|null, - * start?: int|null, + * end?: int|null, ocr?: bool|null, shouldParse?: bool|null, start?: int|null * } */ final class Pdf implements BaseModel @@ -39,19 +28,15 @@ final class Pdf implements BaseModel /** * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. - * - * @var OcrVariants|null $ocr */ - #[Optional(union: Ocr::class)] - public bool|string|null $ocr; + #[Optional] + public ?bool $ocr; /** * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. - * - * @var ShouldParseVariants|null $shouldParse */ - #[Optional(union: ShouldParse::class)] - public bool|string|null $shouldParse; + #[Optional] + public ?bool $shouldParse; /** * First 1-based PDF page to parse. When omitted, parsing starts at the first page. @@ -68,14 +53,11 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. - * - * @param OcrShape|null $ocr - * @param ShouldParseShape|null $shouldParse */ public static function with( ?int $end = null, - bool|UnionMember1|string|null $ocr = null, - bool|ShouldParse\UnionMember1|string|null $shouldParse = null, + ?bool $ocr = null, + ?bool $shouldParse = null, ?int $start = null, ): self { $self = new self; @@ -101,10 +83,8 @@ public function withEnd(int $end): self /** * When true, OCR the selected PDF pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. - * - * @param OcrShape $ocr */ - public function withOcr(bool|UnionMember1|string $ocr): self + public function withOcr(bool $ocr): self { $self = clone $this; $self['ocr'] = $ocr; @@ -114,12 +94,9 @@ public function withOcr(bool|UnionMember1|string $ocr): self /** * When true, PDF URLs are fetched and parsed. When false, PDF URLs are skipped and a 400 PDF_SKIPPED is returned. - * - * @param ShouldParseShape $shouldParse */ - public function withShouldParse( - bool|ShouldParse\UnionMember1|string $shouldParse, - ): self { + public function withShouldParse(bool $shouldParse): self + { $self = clone $this; $self['shouldParse'] = $shouldParse; diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php deleted file mode 100644 index f6b7285a..00000000 --- a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @phpstan-type OcrShape = OcrVariants - */ -final class Ocr implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php deleted file mode 100644 index 8fa36356..00000000 --- a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/Ocr/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShouldParseShape = ShouldParseVariants - */ -final class ShouldParse implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php deleted file mode 100644 index 7150ad66..00000000 --- a/src/Batch/BatchSubmitParams/Input/Crawl/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type OcrShape = OcrVariants - */ -final class Ocr implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php deleted file mode 100644 index eeaff6f3..00000000 --- a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShouldParseShape = ShouldParseVariants - */ -final class ShouldParse implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php deleted file mode 100644 index c33e42df..00000000 --- a/src/Batch/BatchSubmitParams/Input/Crawl/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type OcrShape = OcrVariants - */ -final class Ocr implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php deleted file mode 100644 index afe8fdaf..00000000 --- a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/Ocr/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShouldParseShape = ShouldParseVariants - */ -final class ShouldParse implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php deleted file mode 100644 index 53f4ef0e..00000000 --- a/src/Batch/BatchSubmitParams/Input/Scrape/Data/HTML/Options/Pdf/ShouldParse/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type OcrShape = OcrVariants - */ -final class Ocr implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php deleted file mode 100644 index b1c5bb86..00000000 --- a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/Ocr/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShouldParseShape = ShouldParseVariants - */ -final class ShouldParse implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php b/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php deleted file mode 100644 index d212a3ff..00000000 --- a/src/Batch/BatchSubmitParams/Input/Scrape/Data/Markdown/Options/Pdf/ShouldParse/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ -, - * includeImages?: IncludeImagesShape|null, - * includeLinks?: IncludeLinksShape|null, - * ocr?: OcrShape|null, + * includeImages?: bool|null, + * includeLinks?: bool|null, + * ocr?: bool|null, * pdf?: null|Pdf|PdfShape, - * shortenBase64Images?: ShortenBase64ImagesShape|null, + * shortenBase64Images?: bool|null, * tags?: list|null, - * useMainContentOnly?: UseMainContentOnlyShape|null, + * useMainContentOnly?: bool|null, * zdr?: null|Zdr|value-of, * } */ @@ -70,27 +54,21 @@ final class ParseHandleParams implements BaseModel /** * Include image references in Markdown output. - * - * @var IncludeImagesVariants|null $includeImages */ - #[Optional(union: IncludeImages::class)] - public bool|string|null $includeImages; + #[Optional] + public ?bool $includeImages; /** * Preserve hyperlinks in Markdown output. - * - * @var IncludeLinksVariants|null $includeLinks */ - #[Optional(union: IncludeLinks::class)] - public bool|string|null $includeLinks; + #[Optional] + public ?bool $includeLinks; /** * When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. - * - * @var OcrVariants|null $ocr */ - #[Optional(union: Ocr::class)] - public bool|string|null $ocr; + #[Optional] + public ?bool $ocr; /** * PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. @@ -100,11 +78,9 @@ final class ParseHandleParams implements BaseModel /** * Shorten base64-encoded image data in the Markdown output. - * - * @var ShortenBase64ImagesVariants|null $shortenBase64Images */ - #[Optional(union: ShortenBase64Images::class)] - public bool|string|null $shortenBase64Images; + #[Optional] + public ?bool $shortenBase64Images; /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -116,11 +92,9 @@ final class ParseHandleParams implements BaseModel /** * Extract only the main content from HTML-like inputs. - * - * @var UseMainContentOnlyVariants|null $useMainContentOnly */ - #[Optional(union: UseMainContentOnly::class)] - public bool|string|null $useMainContentOnly; + #[Optional] + public ?bool $useMainContentOnly; /** * Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. @@ -141,25 +115,20 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param Extension|value-of|null $extension - * @param IncludeImagesShape|null $includeImages - * @param IncludeLinksShape|null $includeLinks - * @param OcrShape|null $ocr * @param Pdf|PdfShape|null $pdf - * @param ShortenBase64ImagesShape|null $shortenBase64Images * @param list|null $tags - * @param UseMainContentOnlyShape|null $useMainContentOnly * @param Zdr|value-of|null $zdr */ public static function with( ?string $client = null, Extension|string|null $extension = null, - bool|UnionMember1|string|null $includeImages = null, - bool|IncludeLinks\UnionMember1|string|null $includeLinks = null, - bool|Ocr\UnionMember1|string|null $ocr = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, + ?bool $ocr = null, Pdf|array|null $pdf = null, - bool|ShortenBase64Images\UnionMember1|string|null $shortenBase64Images = null, + ?bool $shortenBase64Images = null, ?array $tags = null, - bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, + ?bool $useMainContentOnly = null, Zdr|string|null $zdr = null, ): self { $self = new self; @@ -204,12 +173,9 @@ public function withExtension(Extension|string $extension): self /** * Include image references in Markdown output. - * - * @param IncludeImagesShape $includeImages */ - public function withIncludeImages( - bool|UnionMember1|string $includeImages - ): self { + public function withIncludeImages(bool $includeImages): self + { $self = clone $this; $self['includeImages'] = $includeImages; @@ -218,12 +184,9 @@ public function withIncludeImages( /** * Preserve hyperlinks in Markdown output. - * - * @param IncludeLinksShape $includeLinks */ - public function withIncludeLinks( - bool|IncludeLinks\UnionMember1|string $includeLinks, - ): self { + public function withIncludeLinks(bool $includeLinks): self + { $self = clone $this; $self['includeLinks'] = $includeLinks; @@ -232,12 +195,9 @@ public function withIncludeLinks( /** * When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. - * - * @param OcrShape $ocr */ - public function withOcr( - bool|Ocr\UnionMember1|string $ocr - ): self { + public function withOcr(bool $ocr): self + { $self = clone $this; $self['ocr'] = $ocr; @@ -259,12 +219,9 @@ public function withPdf(Pdf|array $pdf): self /** * Shorten base64-encoded image data in the Markdown output. - * - * @param ShortenBase64ImagesShape $shortenBase64Images */ - public function withShortenBase64Images( - bool|ShortenBase64Images\UnionMember1|string $shortenBase64Images, - ): self { + public function withShortenBase64Images(bool $shortenBase64Images): self + { $self = clone $this; $self['shortenBase64Images'] = $shortenBase64Images; @@ -286,12 +243,9 @@ public function withTags(array $tags): self /** * Extract only the main content from HTML-like inputs. - * - * @param UseMainContentOnlyShape $useMainContentOnly */ - public function withUseMainContentOnly( - bool|UseMainContentOnly\UnionMember1|string $useMainContentOnly, - ): self { + public function withUseMainContentOnly(bool $useMainContentOnly): self + { $self = clone $this; $self['useMainContentOnly'] = $useMainContentOnly; diff --git a/src/Parse/ParseHandleParams/IncludeImages.php b/src/Parse/ParseHandleParams/IncludeImages.php deleted file mode 100644 index 0aeba32f..00000000 --- a/src/Parse/ParseHandleParams/IncludeImages.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @phpstan-type IncludeImagesShape = IncludeImagesVariants - */ -final class IncludeImages implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php b/src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php deleted file mode 100644 index 414b4f49..00000000 --- a/src/Parse/ParseHandleParams/IncludeImages/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type IncludeLinksShape = IncludeLinksVariants - */ -final class IncludeLinks implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php b/src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php deleted file mode 100644 index 77b25f62..00000000 --- a/src/Parse/ParseHandleParams/IncludeLinks/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type OcrShape = OcrVariants - */ -final class Ocr implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Parse/ParseHandleParams/Ocr/UnionMember1.php b/src/Parse/ParseHandleParams/Ocr/UnionMember1.php deleted file mode 100644 index e1f1eaf4..00000000 --- a/src/Parse/ParseHandleParams/Ocr/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShortenBase64ImagesShape = ShortenBase64ImagesVariants - */ -final class ShortenBase64Images implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php b/src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php deleted file mode 100644 index 8d28751e..00000000 --- a/src/Parse/ParseHandleParams/ShortenBase64Images/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type UseMainContentOnlyShape = UseMainContentOnlyVariants - */ -final class UseMainContentOnly implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php b/src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php deleted file mode 100644 index af6ff084..00000000 --- a/src/Parse/ParseHandleParams/UseMainContentOnly/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt - * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output - * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param OcrShape $ocr Query param: When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * @param bool $includeImages Query param: Include image references in Markdown output + * @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output + * @param bool $ocr Query param: When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. - * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output + * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * @param UseMainContentOnlyShape $useMainContentOnly Query param: Extract only the main content from HTML-like inputs + * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param Zdr|value-of $zdr Query param: Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * @@ -46,13 +40,13 @@ public function handle( string|FileParam $body, ?string $client = null, Extension|string|null $extension = null, - bool|UnionMember1|string $includeImages = false, - bool|\ContextDev\Parse\ParseHandleParams\IncludeLinks\UnionMember1|string $includeLinks = true, - bool|\ContextDev\Parse\ParseHandleParams\Ocr\UnionMember1|string $ocr = false, + bool $includeImages = false, + bool $includeLinks = true, + bool $ocr = false, Pdf|array $pdf = (object) [], - bool|\ContextDev\Parse\ParseHandleParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, + bool $shortenBase64Images = true, ?array $tags = null, - bool|\ContextDev\Parse\ParseHandleParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + bool $useMainContentOnly = false, Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse; diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index ca76efa5..06b16542 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -14,7 +14,6 @@ use ContextDev\Web\WebExtractStyleguideResponse; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; -use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; use ContextDev\Web\WebScreenshotParams\Zdr; @@ -31,27 +30,15 @@ /** * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf - * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action - * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 - * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 - * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 - * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 - * @phpstan-import-type IncludeHTMLShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML - * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages - * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 - * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations as SettleAnimationsShape1 - * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly as UseMainContentOnlyShape1 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ interface WebContract @@ -168,7 +155,7 @@ public function extractStyleguide( * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). - * @param HandleCookiePopupShape $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * @param bool $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * @param int|null $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. * @param int|null $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. @@ -187,7 +174,7 @@ public function screenshot( ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, - bool|UnionMember1|string $handleCookiePopup = false, + bool $handleCookiePopup = false, ?int $maxAgeMs = 86400000, Page|string|null $page = null, ?int $scrollOffset = null, @@ -293,14 +280,14 @@ public function webCrawlMd( * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML + * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML * @param list|null $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param SettleAnimationsShape $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param UseMainContentOnlyShape $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable + * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). * @param \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions @@ -313,16 +300,16 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool|\ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames\UnionMember1|string $includeFrames = false, + bool $includeFrames = false, ?array $includeSelectors = null, ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool|\ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations\UnionMember1|string $settleAnimations = false, + bool $settleAnimations = false, ?array $tags = null, ?int $timeoutMs = null, - bool|\ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + bool $useMainContentOnly = false, ?int $waitForMs = null, \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, @@ -333,7 +320,7 @@ public function webScrapeHTML( * * @param string $url Page URL to inspect. Must include http:// or https://. * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param DedupeShape $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int|null $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). @@ -347,7 +334,7 @@ public function webScrapeHTML( public function webScrapeImages( string $url, ?array $actions = null, - bool|\ContextDev\Web\WebWebScrapeImagesParams\Dedupe\UnionMember1|string $dedupe = false, + bool $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, ?int $maxAgeMs = 86400000, @@ -365,18 +352,18 @@ public function webScrapeImages( * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown - * @param IncludeHTMLShape $includeHTML when true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request - * @param IncludeImagesShape $includeImages Include image references in Markdown output - * @param IncludeLinksShape $includeLinks Preserve hyperlinks in Markdown output + * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown + * @param bool $includeHTML when true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request + * @param bool $includeImages Include image references in Markdown output + * @param bool $includeLinks Preserve hyperlinks in Markdown output * @param list|null $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param SettleAnimationsShape1 $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * @param ShortenBase64ImagesShape $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param UseMainContentOnlyShape1 $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation + * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). * @param \ContextDev\Web\WebWebScrapeMdParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions @@ -389,20 +376,20 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1|string $includeFrames = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeHTML\UnionMember1|string $includeHTML = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeImages\UnionMember1|string $includeImages = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeLinks\UnionMember1|string $includeLinks = true, + bool $includeFrames = false, + bool $includeHTML = false, + bool $includeImages = false, + bool $includeLinks = true, ?array $includeSelectors = null, ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool|\ContextDev\Web\WebWebScrapeMdParams\SettleAnimations\UnionMember1|string $settleAnimations = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, + bool $settleAnimations = false, + bool $shortenBase64Images = true, ?array $tags = null, ?int $timeoutMs = null, - bool|\ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + bool $useMainContentOnly = false, ?int $waitForMs = null, \ContextDev\Web\WebWebScrapeMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, diff --git a/src/Services/ParseRawService.php b/src/Services/ParseRawService.php index bd76bd49..6ffbe766 100644 --- a/src/Services/ParseRawService.php +++ b/src/Services/ParseRawService.php @@ -17,12 +17,7 @@ use ContextDev\ServiceContracts\ParseRawContract; /** - * @phpstan-import-type IncludeImagesShape from \ContextDev\Parse\ParseHandleParams\IncludeImages - * @phpstan-import-type IncludeLinksShape from \ContextDev\Parse\ParseHandleParams\IncludeLinks - * @phpstan-import-type OcrShape from \ContextDev\Parse\ParseHandleParams\Ocr * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf - * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Parse\ParseHandleParams\ShortenBase64Images - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Parse\ParseHandleParams\UseMainContentOnly * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class ParseRawService implements ParseRawContract @@ -42,13 +37,13 @@ public function __construct(private Client $client) {} * @param array{ * client?: string, * extension?: value-of, - * includeImages?: IncludeImagesShape, - * includeLinks?: IncludeLinksShape, - * ocr?: OcrShape, + * includeImages?: bool, + * includeLinks?: bool, + * ocr?: bool, * pdf?: Pdf|PdfShape, - * shortenBase64Images?: ShortenBase64ImagesShape, + * shortenBase64Images?: bool, * tags?: list, - * useMainContentOnly?: UseMainContentOnlyShape, + * useMainContentOnly?: bool, * zdr?: Zdr|value-of, * }|ParseHandleParams $params * @param RequestOpts|null $requestOptions diff --git a/src/Services/ParseService.php b/src/Services/ParseService.php index 545b7b72..c598e841 100644 --- a/src/Services/ParseService.php +++ b/src/Services/ParseService.php @@ -9,7 +9,6 @@ use ContextDev\Core\FileParam; use ContextDev\Core\Util; use ContextDev\Parse\ParseHandleParams\Extension; -use ContextDev\Parse\ParseHandleParams\IncludeImages\UnionMember1; use ContextDev\Parse\ParseHandleParams\Pdf; use ContextDev\Parse\ParseHandleParams\Zdr; use ContextDev\Parse\ParseHandleResponse; @@ -17,12 +16,7 @@ use ContextDev\ServiceContracts\ParseContract; /** - * @phpstan-import-type IncludeImagesShape from \ContextDev\Parse\ParseHandleParams\IncludeImages - * @phpstan-import-type IncludeLinksShape from \ContextDev\Parse\ParseHandleParams\IncludeLinks - * @phpstan-import-type OcrShape from \ContextDev\Parse\ParseHandleParams\Ocr * @phpstan-import-type PdfShape from \ContextDev\Parse\ParseHandleParams\Pdf - * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Parse\ParseHandleParams\ShortenBase64Images - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Parse\ParseHandleParams\UseMainContentOnly * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class ParseService implements ParseContract @@ -48,13 +42,13 @@ public function __construct(private Client $client) * @param string|FileParam $body Body param * @param string $client query param: Optional client identifier used for usage attribution * @param Extension|value-of $extension query param: Optional file extension hint, such as pdf, docx, xlsx, pptx, html, json, csv, md, py, rtf, jpg, png, or txt - * @param IncludeImagesShape $includeImages Query param: Include image references in Markdown output - * @param IncludeLinksShape $includeLinks Query param: Preserve hyperlinks in Markdown output - * @param OcrShape $ocr Query param: When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. + * @param bool $includeImages Query param: Include image references in Markdown output + * @param bool $includeLinks Query param: Preserve hyperlinks in Markdown output + * @param bool $ocr Query param: When true for PDF inputs, OCR the selected pages that have no usable text layer (scans), replacing each recovered page's text with the OCR result while pages with a real text layer keep it. pdf.start/pdf.end limit the inclusive page range. Billed at 1 credit per page OCR actually recovered, on top of the base request cost. When false, no OCR runs. * @param Pdf|PdfShape $pdf Query param: PDF page-range options as a JSON object, e.g. {"start": 2, "end": 5}. - * @param ShortenBase64ImagesShape $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output + * @param bool $shortenBase64Images Query param: Shorten base64-encoded image data in the Markdown output * @param list $tags Query param: Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. - * @param UseMainContentOnlyShape $useMainContentOnly Query param: Extract only the main content from HTML-like inputs + * @param bool $useMainContentOnly Query param: Extract only the main content from HTML-like inputs * @param Zdr|value-of $zdr Query param: Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * @@ -64,13 +58,13 @@ public function handle( string|FileParam $body, ?string $client = null, Extension|string|null $extension = null, - bool|UnionMember1|string $includeImages = false, - bool|\ContextDev\Parse\ParseHandleParams\IncludeLinks\UnionMember1|string $includeLinks = true, - bool|\ContextDev\Parse\ParseHandleParams\Ocr\UnionMember1|string $ocr = false, + bool $includeImages = false, + bool $includeLinks = true, + bool $ocr = false, Pdf|array $pdf = (object) [], - bool|\ContextDev\Parse\ParseHandleParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, + bool $shortenBase64Images = true, ?array $tags = null, - bool|\ContextDev\Parse\ParseHandleParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + bool $useMainContentOnly = false, Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): ParseHandleResponse { diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index ebf47214..953cac31 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -45,27 +45,15 @@ /** * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf - * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action - * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 - * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 - * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 - * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 - * @phpstan-import-type IncludeHTMLShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML - * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages - * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 - * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations as SettleAnimationsShape1 - * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly as UseMainContentOnlyShape1 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class WebRawService implements WebRawContract @@ -248,7 +236,7 @@ public function extractStyleguide( * directURL?: string, * domain?: string, * fullScreenshot?: FullScreenshot|value-of, - * handleCookiePopup?: HandleCookiePopupShape, + * handleCookiePopup?: bool, * maxAgeMs?: int|null, * page?: Page|value-of, * scrollOffset?: int|null, @@ -392,14 +380,14 @@ public function webCrawlMd( * country?: value-of, * excludeSelectors?: list|null, * headers?: array, - * includeFrames?: IncludeFramesShape, + * includeFrames?: bool, * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: WebWebScrapeHTMLParams\Pdf|PdfShape2, - * settleAnimations?: SettleAnimationsShape, + * settleAnimations?: bool, * tags?: list, * timeoutMs?: int, - * useMainContentOnly?: UseMainContentOnlyShape, + * useMainContentOnly?: bool, * waitForMs?: int|null, * zdr?: WebWebScrapeHTMLParams\Zdr|value-of, * }|WebWebScrapeHTMLParams $params @@ -436,7 +424,7 @@ public function webScrapeHTML( * @param array{ * url: string, * actions?: list|null, - * dedupe?: DedupeShape, + * dedupe?: bool, * enrichment?: Enrichment|EnrichmentShape|null, * headers?: array, * maxAgeMs?: int|null, @@ -498,18 +486,18 @@ public function webScrapeImages( * country?: value-of, * excludeSelectors?: list|null, * headers?: array, - * includeFrames?: IncludeFramesShape1, - * includeHTML?: IncludeHTMLShape, - * includeImages?: IncludeImagesShape, - * includeLinks?: IncludeLinksShape, + * includeFrames?: bool, + * includeHTML?: bool, + * includeImages?: bool, + * includeLinks?: bool, * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: WebWebScrapeMdParams\Pdf|PdfShape3, - * settleAnimations?: SettleAnimationsShape1, - * shortenBase64Images?: ShortenBase64ImagesShape, + * settleAnimations?: bool, + * shortenBase64Images?: bool, * tags?: list, * timeoutMs?: int, - * useMainContentOnly?: UseMainContentOnlyShape1, + * useMainContentOnly?: bool, * waitForMs?: int|null, * zdr?: WebWebScrapeMdParams\Zdr|value-of, * }|WebWebScrapeMdParams $params diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 61798e6d..acf43adb 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -17,7 +17,6 @@ use ContextDev\Web\WebExtractStyleguideResponse; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; -use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; use ContextDev\Web\WebScreenshotParams\Zdr; @@ -34,27 +33,15 @@ /** * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf - * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action - * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 - * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 - * @phpstan-import-type DedupeShape from \ContextDev\Web\WebWebScrapeImagesParams\Dedupe * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 - * @phpstan-import-type IncludeFramesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeFrames as IncludeFramesShape1 - * @phpstan-import-type IncludeHTMLShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeHTML - * @phpstan-import-type IncludeImagesShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeImages - * @phpstan-import-type IncludeLinksShape from \ContextDev\Web\WebWebScrapeMdParams\IncludeLinks * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 - * @phpstan-import-type SettleAnimationsShape from \ContextDev\Web\WebWebScrapeMdParams\SettleAnimations as SettleAnimationsShape1 - * @phpstan-import-type ShortenBase64ImagesShape from \ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images - * @phpstan-import-type UseMainContentOnlyShape from \ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly as UseMainContentOnlyShape1 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ final class WebService implements WebContract @@ -264,7 +251,7 @@ public function extractStyleguide( * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. * @param string $domain Domain name to take screenshot of (e.g., 'example.com', 'google.com'). The domain will be automatically normalized and validated. You must provide either 'domain' or 'directUrl', but not both. * @param FullScreenshot|value-of $fullScreenshot Optional parameter to determine screenshot type. If 'true', takes a full page screenshot capturing all content. If 'false' or not provided, takes a viewport screenshot (standard browser view). - * @param HandleCookiePopupShape $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. + * @param bool $handleCookiePopup Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. * @param int|null $maxAgeMs Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. * @param Page|value-of $page Optional parameter to specify which page type to screenshot. If provided, the system will scrape the domain's links and use heuristics to find the most appropriate URL for the specified page type (30 supported languages). If not provided, screenshots the main domain landing page. Only applicable when using 'domain', not 'directUrl'. * @param int|null $scrollOffset Optional vertical scroll offset in pixels for capturing a long page in viewport-sized chunks. When provided, the full page is captured once and the returned image is the viewport-sized slice that begins at this Y offset (e.g. request scrollOffset=0, then 1080, then 2160 to walk a 1920x1080 landing page top to bottom). The final slice may be shorter than the viewport height. Takes precedence over fullScreenshot. Max: 100000. @@ -283,7 +270,7 @@ public function screenshot( ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, - bool|UnionMember1|string $handleCookiePopup = false, + bool $handleCookiePopup = false, ?int $maxAgeMs = 86400000, Page|string|null $page = null, ?int $scrollOffset = null, @@ -470,14 +457,14 @@ public function webCrawlMd( * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param IncludeFramesShape $includeFrames when true, iframes are rendered inline into the returned HTML + * @param bool $includeFrames when true, iframes are rendered inline into the returned HTML * @param list|null $includeSelectors CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|PdfShape2 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param SettleAnimationsShape $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param UseMainContentOnlyShape $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable + * @param bool $useMainContentOnly when true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). * @param \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions @@ -490,16 +477,16 @@ public function webScrapeHTML( \ContextDev\Web\WebWebScrapeHTMLParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool|\ContextDev\Web\WebWebScrapeHTMLParams\IncludeFrames\UnionMember1|string $includeFrames = false, + bool $includeFrames = false, ?array $includeSelectors = null, ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeHTMLParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool|\ContextDev\Web\WebWebScrapeHTMLParams\SettleAnimations\UnionMember1|string $settleAnimations = false, + bool $settleAnimations = false, ?array $tags = null, ?int $timeoutMs = null, - bool|\ContextDev\Web\WebWebScrapeHTMLParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + bool $useMainContentOnly = false, ?int $waitForMs = null, \ContextDev\Web\WebWebScrapeHTMLParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, @@ -537,7 +524,7 @@ public function webScrapeHTML( * * @param string $url Page URL to inspect. Must include http:// or https://. * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. - * @param DedupeShape $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. + * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. * @param int|null $maxAgeMs Reuse a cached result this many milliseconds old or newer. Default: 86400000 (1 day). Set to 0 to bypass cache. Maximum: 2592000000 (30 days). @@ -551,7 +538,7 @@ public function webScrapeHTML( public function webScrapeImages( string $url, ?array $actions = null, - bool|\ContextDev\Web\WebWebScrapeImagesParams\Dedupe\UnionMember1|string $dedupe = false, + bool $dedupe = false, Enrichment|array|null $enrichment = null, ?array $headers = null, ?int $maxAgeMs = 86400000, @@ -608,18 +595,18 @@ public function webScrapeImages( * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. - * @param IncludeFramesShape1 $includeFrames when true, the contents of iframes are rendered to Markdown - * @param IncludeHTMLShape $includeHTML when true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request - * @param IncludeImagesShape $includeImages Include image references in Markdown output - * @param IncludeLinksShape $includeLinks Preserve hyperlinks in Markdown output + * @param bool $includeFrames when true, the contents of iframes are rendered to Markdown + * @param bool $includeHTML when true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request + * @param bool $includeImages Include image references in Markdown output + * @param bool $includeLinks Preserve hyperlinks in Markdown output * @param list|null $includeSelectors CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". * @param int|null $maxAgeMs Return a cached result if a prior scrape for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always scrape fresh. * @param \ContextDev\Web\WebWebScrapeMdParams\Pdf|PdfShape3 $pdf PDF parsing controls. Use start/end to limit text extraction and embedded-image detection/OCR to an inclusive 1-based page range. - * @param SettleAnimationsShape1 $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * @param ShortenBase64ImagesShape $shortenBase64Images Shorten base64-encoded image data in the Markdown output + * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. + * @param bool $shortenBase64Images Shorten base64-encoded image data in the Markdown output * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param UseMainContentOnlyShape1 $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation + * @param bool $useMainContentOnly Extract only the main content of the page, excluding headers, footers, sidebars, and navigation * @param int|null $waitForMs Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). * @param \ContextDev\Web\WebWebScrapeMdParams\Zdr|value-of<\ContextDev\Web\WebWebScrapeMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions @@ -632,20 +619,20 @@ public function webScrapeMd( \ContextDev\Web\WebWebScrapeMdParams\Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeFrames\UnionMember1|string $includeFrames = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeHTML\UnionMember1|string $includeHTML = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeImages\UnionMember1|string $includeImages = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\IncludeLinks\UnionMember1|string $includeLinks = true, + bool $includeFrames = false, + bool $includeHTML = false, + bool $includeImages = false, + bool $includeLinks = true, ?array $includeSelectors = null, ?int $maxAgeMs = 86400000, \ContextDev\Web\WebWebScrapeMdParams\Pdf|array $pdf = [ 'shouldParse' => true, 'ocr' => false, ], - bool|\ContextDev\Web\WebWebScrapeMdParams\SettleAnimations\UnionMember1|string $settleAnimations = false, - bool|\ContextDev\Web\WebWebScrapeMdParams\ShortenBase64Images\UnionMember1|string $shortenBase64Images = true, + bool $settleAnimations = false, + bool $shortenBase64Images = true, ?array $tags = null, ?int $timeoutMs = null, - bool|\ContextDev\Web\WebWebScrapeMdParams\UseMainContentOnly\UnionMember1|string $useMainContentOnly = false, + bool $useMainContentOnly = false, ?int $waitForMs = null, \ContextDev\Web\WebWebScrapeMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index 0ed6482e..0b40e884 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -11,8 +11,6 @@ use ContextDev\Web\WebScreenshotParams\ColorScheme; use ContextDev\Web\WebScreenshotParams\Country; use ContextDev\Web\WebScreenshotParams\FullScreenshot; -use ContextDev\Web\WebScreenshotParams\HandleCookiePopup; -use ContextDev\Web\WebScreenshotParams\HandleCookiePopup\UnionMember1; use ContextDev\Web\WebScreenshotParams\Page; use ContextDev\Web\WebScreenshotParams\Viewport; use ContextDev\Web\WebScreenshotParams\Zdr; @@ -22,8 +20,6 @@ * * @see ContextDev\Services\WebService::screenshot() * - * @phpstan-import-type HandleCookiePopupVariants from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup - * @phpstan-import-type HandleCookiePopupShape from \ContextDev\Web\WebScreenshotParams\HandleCookiePopup * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * * @phpstan-type WebScreenshotParamsShape = array{ @@ -32,7 +28,7 @@ * directURL?: string|null, * domain?: string|null, * fullScreenshot?: null|FullScreenshot|value-of, - * handleCookiePopup?: HandleCookiePopupShape|null, + * handleCookiePopup?: bool|null, * maxAgeMs?: int|null, * page?: null|Page|value-of, * scrollOffset?: int|null, @@ -87,11 +83,9 @@ final class WebScreenshotParams implements BaseModel /** * Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. - * - * @var HandleCookiePopupVariants|null $handleCookiePopup */ - #[Optional(union: HandleCookiePopup::class)] - public bool|string|null $handleCookiePopup; + #[Optional] + public ?bool $handleCookiePopup; /** * Return a cached screenshot if a prior screenshot for the same parameters exists and is younger than this many milliseconds. Defaults to 1 day (86400000 ms) when omitted. Max is 30 days (2592000000 ms). Set to 0 to always capture fresh. @@ -160,7 +154,6 @@ public function __construct() * @param ColorScheme|value-of|null $colorScheme * @param Country|value-of|null $country * @param FullScreenshot|value-of|null $fullScreenshot - * @param HandleCookiePopupShape|null $handleCookiePopup * @param Page|value-of|null $page * @param list|null $tags * @param Viewport|ViewportShape|null $viewport @@ -172,7 +165,7 @@ public static function with( ?string $directURL = null, ?string $domain = null, FullScreenshot|string|null $fullScreenshot = null, - bool|UnionMember1|string|null $handleCookiePopup = null, + ?bool $handleCookiePopup = null, ?int $maxAgeMs = null, Page|string|null $page = null, ?int $scrollOffset = null, @@ -266,12 +259,9 @@ public function withFullScreenshot( /** * Optional parameter to control cookie/consent popup handling. If 'true', we dismiss cookie banner before capture. If 'false' or not provided, captures the page without that step. - * - * @param HandleCookiePopupShape $handleCookiePopup */ - public function withHandleCookiePopup( - bool|UnionMember1|string $handleCookiePopup - ): self { + public function withHandleCookiePopup(bool $handleCookiePopup): self + { $self = clone $this; $self['handleCookiePopup'] = $handleCookiePopup; diff --git a/src/Web/WebScreenshotParams/HandleCookiePopup.php b/src/Web/WebScreenshotParams/HandleCookiePopup.php deleted file mode 100644 index 0b9f790c..00000000 --- a/src/Web/WebScreenshotParams/HandleCookiePopup.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @phpstan-type HandleCookiePopupShape = HandleCookiePopupVariants - */ -final class HandleCookiePopup implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php b/src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php deleted file mode 100644 index defd4c44..00000000 --- a/src/Web/WebScreenshotParams/HandleCookiePopup/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ -, * excludeSelectors?: list|null, * headers?: array|null, - * includeFrames?: IncludeFramesShape|null, + * includeFrames?: bool|null, * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, - * settleAnimations?: SettleAnimationsShape|null, + * settleAnimations?: bool|null, * tags?: list|null, * timeoutMs?: int|null, - * useMainContentOnly?: UseMainContentOnlyShape|null, + * useMainContentOnly?: bool|null, * waitForMs?: int|null, * zdr?: null|Zdr|value-of, * } @@ -97,11 +87,9 @@ final class WebWebScrapeHTMLParams implements BaseModel /** * When true, iframes are rendered inline into the returned HTML. - * - * @var IncludeFramesVariants|null $includeFrames */ - #[Optional(union: IncludeFrames::class)] - public bool|string|null $includeFrames; + #[Optional] + public ?bool $includeFrames; /** * CSS selectors. When provided, only matching subtrees (and their descendants) are kept and everything else is dropped. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". @@ -125,11 +113,9 @@ final class WebWebScrapeHTMLParams implements BaseModel /** * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * - * @var SettleAnimationsVariants|null $settleAnimations */ - #[Optional(union: SettleAnimations::class)] - public bool|string|null $settleAnimations; + #[Optional] + public ?bool $settleAnimations; /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -147,11 +133,9 @@ final class WebWebScrapeHTMLParams implements BaseModel /** * When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable. - * - * @var UseMainContentOnlyVariants|null $useMainContentOnly */ - #[Optional(union: UseMainContentOnly::class)] - public bool|string|null $useMainContentOnly; + #[Optional] + public ?bool $useMainContentOnly; /** * Optional browser wait time in milliseconds after initial page load. Min: 0. Max: 30000 (30 seconds). @@ -195,12 +179,9 @@ public function __construct() * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers - * @param IncludeFramesShape|null $includeFrames * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf - * @param SettleAnimationsShape|null $settleAnimations * @param list|null $tags - * @param UseMainContentOnlyShape|null $useMainContentOnly * @param Zdr|value-of|null $zdr */ public static function with( @@ -209,14 +190,14 @@ public static function with( Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool|UnionMember1|string|null $includeFrames = null, + ?bool $includeFrames = null, ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, - bool|SettleAnimations\UnionMember1|string|null $settleAnimations = null, + ?bool $settleAnimations = null, ?array $tags = null, ?int $timeoutMs = null, - bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, + ?bool $useMainContentOnly = null, ?int $waitForMs = null, Zdr|string|null $zdr = null, ): self { @@ -307,12 +288,9 @@ public function withHeaders(array $headers): self /** * When true, iframes are rendered inline into the returned HTML. - * - * @param IncludeFramesShape $includeFrames */ - public function withIncludeFrames( - bool|UnionMember1|string $includeFrames - ): self { + public function withIncludeFrames(bool $includeFrames): self + { $self = clone $this; $self['includeFrames'] = $includeFrames; @@ -358,12 +336,9 @@ public function withPdf(Pdf|array $pdf): self /** * When true, waits briefly for CSS and transition animations to settle before extracting HTML. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * - * @param SettleAnimationsShape $settleAnimations */ - public function withSettleAnimations( - bool|SettleAnimations\UnionMember1|string $settleAnimations, - ): self { + public function withSettleAnimations(bool $settleAnimations): self + { $self = clone $this; $self['settleAnimations'] = $settleAnimations; @@ -396,12 +371,9 @@ public function withTimeoutMs(int $timeoutMs): self /** * When true, return only the page's main content in the HTML response, excluding headers, footers, sidebars, and navigation when detectable. - * - * @param UseMainContentOnlyShape $useMainContentOnly */ - public function withUseMainContentOnly( - bool|UseMainContentOnly\UnionMember1|string $useMainContentOnly, - ): self { + public function withUseMainContentOnly(bool $useMainContentOnly): self + { $self = clone $this; $self['useMainContentOnly'] = $useMainContentOnly; diff --git a/src/Web/WebWebScrapeHTMLParams/IncludeFrames.php b/src/Web/WebWebScrapeHTMLParams/IncludeFrames.php deleted file mode 100644 index 84047a8b..00000000 --- a/src/Web/WebWebScrapeHTMLParams/IncludeFrames.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @phpstan-type IncludeFramesShape = IncludeFramesVariants - */ -final class IncludeFrames implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php deleted file mode 100644 index 9d192560..00000000 --- a/src/Web/WebWebScrapeHTMLParams/IncludeFrames/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type OcrShape = OcrVariants - */ -final class Ocr implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php deleted file mode 100644 index dfb79b27..00000000 --- a/src/Web/WebWebScrapeHTMLParams/Pdf/Ocr/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShouldParseShape = ShouldParseVariants - */ -final class ShouldParse implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php deleted file mode 100644 index 9de72ad9..00000000 --- a/src/Web/WebWebScrapeHTMLParams/Pdf/ShouldParse/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type SettleAnimationsShape = SettleAnimationsVariants - */ -final class SettleAnimations implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php deleted file mode 100644 index 899122c3..00000000 --- a/src/Web/WebWebScrapeHTMLParams/SettleAnimations/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type UseMainContentOnlyShape = UseMainContentOnlyVariants - */ -final class UseMainContentOnly implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php deleted file mode 100644 index 38c3ff7f..00000000 --- a/src/Web/WebWebScrapeHTMLParams/UseMainContentOnly/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ -|null, - * dedupe?: DedupeShape|null, + * dedupe?: bool|null, * enrichment?: null|Enrichment|EnrichmentShape, * headers?: array|null, * maxAgeMs?: int|null, @@ -59,11 +55,9 @@ final class WebWebScrapeImagesParams implements BaseModel /** * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. - * - * @var DedupeVariants|null $dedupe */ - #[Optional(union: Dedupe::class)] - public bool|string|null $dedupe; + #[Optional] + public ?bool $dedupe; /** * Optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true. @@ -130,7 +124,6 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param list|null $actions - * @param DedupeShape|null $dedupe * @param Enrichment|EnrichmentShape|null $enrichment * @param array|null $headers * @param list|null $tags @@ -138,7 +131,7 @@ public function __construct() public static function with( string $url, ?array $actions = null, - bool|UnionMember1|string|null $dedupe = null, + ?bool $dedupe = null, Enrichment|array|null $enrichment = null, ?array $headers = null, ?int $maxAgeMs = null, @@ -188,10 +181,8 @@ public function withActions(?array $actions): self /** * When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. - * - * @param DedupeShape $dedupe */ - public function withDedupe(bool|UnionMember1|string $dedupe): self + public function withDedupe(bool $dedupe): self { $self = clone $this; $self['dedupe'] = $dedupe; diff --git a/src/Web/WebWebScrapeImagesParams/Dedupe.php b/src/Web/WebWebScrapeImagesParams/Dedupe.php deleted file mode 100644 index c1fd6ec7..00000000 --- a/src/Web/WebWebScrapeImagesParams/Dedupe.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @phpstan-type DedupeShape = DedupeVariants - */ -final class Dedupe implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php deleted file mode 100644 index 4950f305..00000000 --- a/src/Web/WebWebScrapeImagesParams/Dedupe/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ClassificationShape = ClassificationVariants - */ -final class Classification implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php deleted file mode 100644 index 4d5c01fe..00000000 --- a/src/Web/WebWebScrapeImagesParams/Enrichment/Classification/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type HostedURLShape = HostedURLVariants - */ -final class HostedURL implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php deleted file mode 100644 index c3531093..00000000 --- a/src/Web/WebWebScrapeImagesParams/Enrichment/HostedURL/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ResolutionShape = ResolutionVariants - */ -final class Resolution implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php deleted file mode 100644 index 7dcafd56..00000000 --- a/src/Web/WebWebScrapeImagesParams/Enrichment/Resolution/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ -, * excludeSelectors?: list|null, * headers?: array|null, - * includeFrames?: IncludeFramesShape|null, - * includeHTML?: IncludeHTMLShape|null, - * includeImages?: IncludeImagesShape|null, - * includeLinks?: IncludeLinksShape|null, + * includeFrames?: bool|null, + * includeHTML?: bool|null, + * includeImages?: bool|null, + * includeLinks?: bool|null, * includeSelectors?: list|null, * maxAgeMs?: int|null, * pdf?: null|Pdf|PdfShape, - * settleAnimations?: SettleAnimationsShape|null, - * shortenBase64Images?: ShortenBase64ImagesShape|null, + * settleAnimations?: bool|null, + * shortenBase64Images?: bool|null, * tags?: list|null, * timeoutMs?: int|null, - * useMainContentOnly?: UseMainContentOnlyShape|null, + * useMainContentOnly?: bool|null, * waitForMs?: int|null, * zdr?: null|Zdr|value-of, * } @@ -131,35 +109,27 @@ final class WebWebScrapeMdParams implements BaseModel /** * When true, the contents of iframes are rendered to Markdown. - * - * @var IncludeFramesVariants|null $includeFrames */ - #[Optional(union: IncludeFrames::class)] - public bool|string|null $includeFrames; + #[Optional] + public ?bool $includeFrames; /** * When true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request. - * - * @var IncludeHTMLVariants|null $includeHTML */ - #[Optional(union: IncludeHTML::class)] - public bool|string|null $includeHTML; + #[Optional] + public ?bool $includeHTML; /** * Include image references in Markdown output. - * - * @var IncludeImagesVariants|null $includeImages */ - #[Optional(union: IncludeImages::class)] - public bool|string|null $includeImages; + #[Optional] + public ?bool $includeImages; /** * Preserve hyperlinks in Markdown output. - * - * @var IncludeLinksVariants|null $includeLinks */ - #[Optional(union: IncludeLinks::class)] - public bool|string|null $includeLinks; + #[Optional] + public ?bool $includeLinks; /** * CSS selectors. When provided, only matching HTML subtrees (and their descendants) are kept before conversion to Markdown. When omitted, the entire document is kept. Examples: "article.main", "#content", "[role=main]". @@ -183,19 +153,15 @@ final class WebWebScrapeMdParams implements BaseModel /** * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * - * @var SettleAnimationsVariants|null $settleAnimations */ - #[Optional(union: SettleAnimations::class)] - public bool|string|null $settleAnimations; + #[Optional] + public ?bool $settleAnimations; /** * Shorten base64-encoded image data in the Markdown output. - * - * @var ShortenBase64ImagesVariants|null $shortenBase64Images */ - #[Optional(union: ShortenBase64Images::class)] - public bool|string|null $shortenBase64Images; + #[Optional] + public ?bool $shortenBase64Images; /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. @@ -213,11 +179,9 @@ final class WebWebScrapeMdParams implements BaseModel /** * Extract only the main content of the page, excluding headers, footers, sidebars, and navigation. - * - * @var UseMainContentOnlyVariants|null $useMainContentOnly */ - #[Optional(union: UseMainContentOnly::class)] - public bool|string|null $useMainContentOnly; + #[Optional] + public ?bool $useMainContentOnly; /** * Optional browser wait time in milliseconds after initial page load before converting the page to Markdown. Min: 0. Max: 30000 (30 seconds). @@ -261,16 +225,9 @@ public function __construct() * @param Country|value-of|null $country * @param list|null $excludeSelectors * @param array|null $headers - * @param IncludeFramesShape|null $includeFrames - * @param IncludeHTMLShape|null $includeHTML - * @param IncludeImagesShape|null $includeImages - * @param IncludeLinksShape|null $includeLinks * @param list|null $includeSelectors * @param Pdf|PdfShape|null $pdf - * @param SettleAnimationsShape|null $settleAnimations - * @param ShortenBase64ImagesShape|null $shortenBase64Images * @param list|null $tags - * @param UseMainContentOnlyShape|null $useMainContentOnly * @param Zdr|value-of|null $zdr */ public static function with( @@ -279,18 +236,18 @@ public static function with( Country|string|null $country = null, ?array $excludeSelectors = null, ?array $headers = null, - bool|UnionMember1|string|null $includeFrames = null, - bool|IncludeHTML\UnionMember1|string|null $includeHTML = null, - bool|IncludeImages\UnionMember1|string|null $includeImages = null, - bool|IncludeLinks\UnionMember1|string|null $includeLinks = null, + ?bool $includeFrames = null, + ?bool $includeHTML = null, + ?bool $includeImages = null, + ?bool $includeLinks = null, ?array $includeSelectors = null, ?int $maxAgeMs = null, Pdf|array|null $pdf = null, - bool|SettleAnimations\UnionMember1|string|null $settleAnimations = null, - bool|ShortenBase64Images\UnionMember1|string|null $shortenBase64Images = null, + ?bool $settleAnimations = null, + ?bool $shortenBase64Images = null, ?array $tags = null, ?int $timeoutMs = null, - bool|UseMainContentOnly\UnionMember1|string|null $useMainContentOnly = null, + ?bool $useMainContentOnly = null, ?int $waitForMs = null, Zdr|string|null $zdr = null, ): self { @@ -385,12 +342,9 @@ public function withHeaders(array $headers): self /** * When true, the contents of iframes are rendered to Markdown. - * - * @param IncludeFramesShape $includeFrames */ - public function withIncludeFrames( - bool|UnionMember1|string $includeFrames - ): self { + public function withIncludeFrames(bool $includeFrames): self + { $self = clone $this; $self['includeFrames'] = $includeFrames; @@ -399,12 +353,9 @@ public function withIncludeFrames( /** * When true, the response also includes an `html` field with the page HTML the Markdown was converted from — the same body the Scrape HTML endpoint returns for the equivalent request. - * - * @param IncludeHTMLShape $includeHTML */ - public function withIncludeHTML( - bool|IncludeHTML\UnionMember1|string $includeHTML, - ): self { + public function withIncludeHTML(bool $includeHTML): self + { $self = clone $this; $self['includeHTML'] = $includeHTML; @@ -413,12 +364,9 @@ public function withIncludeHTML( /** * Include image references in Markdown output. - * - * @param IncludeImagesShape $includeImages */ - public function withIncludeImages( - bool|IncludeImages\UnionMember1|string $includeImages, - ): self { + public function withIncludeImages(bool $includeImages): self + { $self = clone $this; $self['includeImages'] = $includeImages; @@ -427,12 +375,9 @@ public function withIncludeImages( /** * Preserve hyperlinks in Markdown output. - * - * @param IncludeLinksShape $includeLinks */ - public function withIncludeLinks( - bool|IncludeLinks\UnionMember1|string $includeLinks, - ): self { + public function withIncludeLinks(bool $includeLinks): self + { $self = clone $this; $self['includeLinks'] = $includeLinks; @@ -478,12 +423,9 @@ public function withPdf(Pdf|array $pdf): self /** * When true, waits briefly for CSS and transition animations to settle before converting to Markdown. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * - * @param SettleAnimationsShape $settleAnimations */ - public function withSettleAnimations( - bool|SettleAnimations\UnionMember1|string $settleAnimations, - ): self { + public function withSettleAnimations(bool $settleAnimations): self + { $self = clone $this; $self['settleAnimations'] = $settleAnimations; @@ -492,12 +434,9 @@ public function withSettleAnimations( /** * Shorten base64-encoded image data in the Markdown output. - * - * @param ShortenBase64ImagesShape $shortenBase64Images */ - public function withShortenBase64Images( - bool|ShortenBase64Images\UnionMember1|string $shortenBase64Images, - ): self { + public function withShortenBase64Images(bool $shortenBase64Images): self + { $self = clone $this; $self['shortenBase64Images'] = $shortenBase64Images; @@ -530,12 +469,9 @@ public function withTimeoutMs(int $timeoutMs): self /** * Extract only the main content of the page, excluding headers, footers, sidebars, and navigation. - * - * @param UseMainContentOnlyShape $useMainContentOnly */ - public function withUseMainContentOnly( - bool|UseMainContentOnly\UnionMember1|string $useMainContentOnly, - ): self { + public function withUseMainContentOnly(bool $useMainContentOnly): self + { $self = clone $this; $self['useMainContentOnly'] = $useMainContentOnly; diff --git a/src/Web/WebWebScrapeMdParams/IncludeFrames.php b/src/Web/WebWebScrapeMdParams/IncludeFrames.php deleted file mode 100644 index dc3254f5..00000000 --- a/src/Web/WebWebScrapeMdParams/IncludeFrames.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @phpstan-type IncludeFramesShape = IncludeFramesVariants - */ -final class IncludeFrames implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php deleted file mode 100644 index d887bb50..00000000 --- a/src/Web/WebWebScrapeMdParams/IncludeFrames/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type IncludeHTMLShape = IncludeHTMLVariants - */ -final class IncludeHTML implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php deleted file mode 100644 index 764cb0db..00000000 --- a/src/Web/WebWebScrapeMdParams/IncludeHTML/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type IncludeImagesShape = IncludeImagesVariants - */ -final class IncludeImages implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php deleted file mode 100644 index 9f1df337..00000000 --- a/src/Web/WebWebScrapeMdParams/IncludeImages/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type IncludeLinksShape = IncludeLinksVariants - */ -final class IncludeLinks implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php b/src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php deleted file mode 100644 index 99b18faf..00000000 --- a/src/Web/WebWebScrapeMdParams/IncludeLinks/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type OcrShape = OcrVariants - */ -final class Ocr implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php b/src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php deleted file mode 100644 index 8bd15b5c..00000000 --- a/src/Web/WebWebScrapeMdParams/Pdf/Ocr/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShouldParseShape = ShouldParseVariants - */ -final class ShouldParse implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php b/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php deleted file mode 100644 index 4db8b2ba..00000000 --- a/src/Web/WebWebScrapeMdParams/Pdf/ShouldParse/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type SettleAnimationsShape = SettleAnimationsVariants - */ -final class SettleAnimations implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php b/src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php deleted file mode 100644 index 915f75ec..00000000 --- a/src/Web/WebWebScrapeMdParams/SettleAnimations/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type ShortenBase64ImagesShape = ShortenBase64ImagesVariants - */ -final class ShortenBase64Images implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php b/src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php deleted file mode 100644 index d064e43b..00000000 --- a/src/Web/WebWebScrapeMdParams/ShortenBase64Images/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - - * @phpstan-type UseMainContentOnlyShape = UseMainContentOnlyVariants - */ -final class UseMainContentOnly implements ConverterSource -{ - use SdkUnion; - - /** - * @return list|array - */ - public static function variants(): array - { - return ['bool', UnionMember1::class]; - } -} diff --git a/src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php b/src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php deleted file mode 100644 index 52449fec..00000000 --- a/src/Web/WebWebScrapeMdParams/UseMainContentOnly/UnionMember1.php +++ /dev/null @@ -1,12 +0,0 @@ - ['x'], 'maxAgeMs' => 0, 'pdf' => [ - 'end' => 1, 'ocr' => 'true', 'shouldParse' => 'true', 'start' => 1, + 'end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1, ], 'settleAnimations' => true, 'shortenBase64Images' => true, diff --git a/tests/Services/WebTest.php b/tests/Services/WebTest.php index 2b048c18..59f3e529 100644 --- a/tests/Services/WebTest.php +++ b/tests/Services/WebTest.php @@ -285,14 +285,14 @@ public function testWebScrapeHTMLWithOptionalParams(): void country: 'de', excludeSelectors: ['x'], headers: ['foo' => 'J!'], - includeFrames: 'true', + includeFrames: true, includeSelectors: ['x'], maxAgeMs: 0, - pdf: ['end' => 1, 'ocr' => 'true', 'shouldParse' => 'true', 'start' => 1], - settleAnimations: 'true', + pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, tags: ['production', 'team-alpha'], timeoutMs: 1, - useMainContentOnly: 'true', + useMainContentOnly: true, waitForMs: 0, zdr: 'enabled', ); @@ -324,12 +324,12 @@ public function testWebScrapeImagesWithOptionalParams(): void $result = $this->client->web->webScrapeImages( url: 'https://example.com', actions: [['do' => 'wait', 'timeMs' => 0]], - dedupe: 'true', + dedupe: true, enrichment: [ - 'classification' => 'true', - 'hostedURL' => 'true', + 'classification' => true, + 'hostedURL' => true, 'maxTimePerMs' => 1, - 'resolution' => 'true', + 'resolution' => true, ], headers: ['foo' => 'J!'], maxAgeMs: 0, @@ -368,18 +368,18 @@ public function testWebScrapeMdWithOptionalParams(): void country: 'de', excludeSelectors: ['x'], headers: ['foo' => 'J!'], - includeFrames: 'true', - includeHTML: 'true', - includeImages: 'true', - includeLinks: 'true', + includeFrames: true, + includeHTML: true, + includeImages: true, + includeLinks: true, includeSelectors: ['x'], maxAgeMs: 0, - pdf: ['end' => 1, 'ocr' => 'true', 'shouldParse' => 'true', 'start' => 1], - settleAnimations: 'true', - shortenBase64Images: 'true', + pdf: ['end' => 1, 'ocr' => true, 'shouldParse' => true, 'start' => 1], + settleAnimations: true, + shortenBase64Images: true, tags: ['production', 'team-alpha'], timeoutMs: 1, - useMainContentOnly: 'true', + useMainContentOnly: true, waitForMs: 0, zdr: 'enabled', ); From d1080065f6f9096659473f660e8a831459426ed7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 01:59:37 +0000 Subject: [PATCH 105/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ef63af1f..f194dd94 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d31d405927ec58ac97c0a9732130aea18209c65a0f2f0a348aa91c333535305e.yml -openapi_spec_hash: 0ede81f7fd98f41bc6bbc4167300bfb9 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-01745494602c4845bf7cf84a8f7449d8e53546eb096e3aa6949b89b452c5c90e.yml +openapi_spec_hash: dd4856e9595fab7a4aaa32a040c3060c config_hash: 920678668dd2da6f8966fbf1b8fde4e2 From 9c099226f195d5679b6d241ce8bf18dafa39dab7 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 14 Aug 2026 02:28:02 +0000 Subject: [PATCH 106/130] chore(internal): codegen related update --- src/Core/BaseClient.php | 9 ++- .../Implementation/StreamingHttpClient.php | 9 ++- tests/Core/RequestTimeoutTest.php | 81 +++++++++++++++++++ 3 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 tests/Core/RequestTimeoutTest.php diff --git a/src/Core/BaseClient.php b/src/Core/BaseClient.php index b74a2cdc..2db4ea47 100644 --- a/src/Core/BaseClient.php +++ b/src/Core/BaseClient.php @@ -12,6 +12,7 @@ use ContextDev\Core\Exceptions\APIConnectionException; use ContextDev\Core\Exceptions\APIStatusException; use ContextDev\Core\Implementation\RawResponse; +use ContextDev\Core\Implementation\StreamingHttpClient; use ContextDev\RequestOptions; use Psr\Http\Client\ClientExceptionInterface; use Psr\Http\Message\RequestInterface; @@ -249,7 +250,13 @@ protected function sendRequest( $err = null; try { - $rsp = $transporter->sendRequest($req); + if ($transporter instanceof StreamingHttpClient) { + $rsp = $transporter->sendRequest($req, timeout: $opts->timeout); + } elseif (is_a($transporter, '\GuzzleHttp\Client')) { + $rsp = $transporter->send($req, ['timeout' => $opts->timeout]); + } else { + $rsp = $transporter->sendRequest($req); + } } catch (ClientExceptionInterface $e) { $err = $e; } diff --git a/src/Core/Implementation/StreamingHttpClient.php b/src/Core/Implementation/StreamingHttpClient.php index 27807d25..ff319dbe 100644 --- a/src/Core/Implementation/StreamingHttpClient.php +++ b/src/Core/Implementation/StreamingHttpClient.php @@ -18,10 +18,15 @@ final class StreamingHttpClient implements ClientInterface { public function __construct(private ClientInterface $inner) {} - public function sendRequest(RequestInterface $request): ResponseInterface + public function sendRequest(RequestInterface $request, ?float $timeout = null): ResponseInterface { if (is_a($this->inner, '\GuzzleHttp\Client')) { - return $this->inner->send($request, ['stream' => true]); + $options = ['stream' => true]; + if (null !== $timeout) { + $options['timeout'] = $timeout; + } + + return $this->inner->send($request, $options); } return $this->inner->sendRequest($request); diff --git a/tests/Core/RequestTimeoutTest.php b/tests/Core/RequestTimeoutTest.php new file mode 100644 index 00000000..8b856391 --- /dev/null +++ b/tests/Core/RequestTimeoutTest.php @@ -0,0 +1,81 @@ +buildClient(); + + $client->request('GET', '/', options: ['timeout' => 1.5]); + + $this->assertSame(1.5, $mock->getLastOptions()['timeout']); + } + + #[Test] + public function testPassesDefaultTimeoutToGuzzleTransporter(): void + { + [$client, $mock] = $this->buildClient(); + + $client->request('GET', '/'); + + $this->assertSame((new RequestOptions)->timeout, $mock->getLastOptions()['timeout']); + } + + #[Test] + public function testPassesTimeoutToStreamingTransporter(): void + { + [$client, $mock] = $this->buildClient(streaming: true); + + $client->request('GET', '/', headers: ['Accept' => 'text/event-stream'], options: ['timeout' => 2.5]); + + $options = $mock->getLastOptions(); + $this->assertTrue($options['stream']); + $this->assertSame(2.5, $options['timeout']); + } + + /** + * @return array{BaseClient, MockHandler} + */ + private function buildClient(bool $streaming = false): array + { + $response = $streaming + ? new Response(200, ['Content-Type' => 'text/event-stream'], '') + : new Response(200, ['Content-Type' => 'application/json'], '{}'); + + $mock = new MockHandler([$response]); + $guzzle = new GuzzleClient(['handler' => HandlerStack::create($mock)]); + + $options = RequestOptions::with( + transporter: $guzzle, + streamingTransporter: new StreamingHttpClient($guzzle), + uriFactory: Psr17FactoryDiscovery::findUriFactory(), + requestFactory: Psr17FactoryDiscovery::findRequestFactory(), + streamFactory: Psr17FactoryDiscovery::findStreamFactory(), + ); + + $client = new class(headers: [], baseUrl: 'http://localhost', options: $options) extends BaseClient {}; + + return [$client, $mock]; + } +} From 60028d551e8635b75e6912619eef31588e965d7d Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 16 Aug 2026 15:49:01 +0000 Subject: [PATCH 107/130] feat(api): api update --- .stats.yml | 4 +- .../PersonEnrichmentCandidateMatch/Person.php | 69 +++++++++++++++++++ .../Person/CurrentRoleStatus.php | 17 +++++ 3 files changed, 88 insertions(+), 2 deletions(-) create mode 100644 src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRoleStatus.php diff --git a/.stats.yml b/.stats.yml index f194dd94..2039ac3b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-01745494602c4845bf7cf84a8f7449d8e53546eb096e3aa6949b89b452c5c90e.yml -openapi_spec_hash: dd4856e9595fab7a4aaa32a040c3060c +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c99300223257d60d7614e76585c62cfea40f43df0547db63c952b20c52f209f4.yml +openapi_spec_hash: 1d4e473f3c566b7a1c3def11b6d84fe0 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php index eff38453..185b3548 100644 --- a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person.php @@ -9,6 +9,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\CurrentRole; +use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\CurrentRoleStatus; use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Education; use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Experience; use ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Location; @@ -22,6 +23,7 @@ * @phpstan-import-type NameShape from \ContextDev\People\PersonEnrichResponse\Match_\PersonEnrichmentCandidateMatch\Person\Name * * @phpstan-type PersonShape = array{ + * currentRoleStatus: CurrentRoleStatus|value-of, * education: list, * experience: list, * skills: list, @@ -29,8 +31,10 @@ * websiteURLs: list, * avatarURL?: string|null, * bio?: string|null, + * checkedAt?: string|null, * currentRole?: null|CurrentRole|CurrentRoleShape, * email?: string|null, + * lastUpdated?: string|null, * location?: null|Location|LocationShape, * name?: null|Name|NameShape, * } @@ -40,6 +44,14 @@ final class Person implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Whether the person's current role is known. `present` — current_role is populated. `none` — the work history explicitly shows every role has ended. `unknown` — our data sources could not confirm either way; treat a missing current_role as unverified rather than vacant. + * + * @var value-of $currentRoleStatus + */ + #[Required('current_role_status', enum: CurrentRoleStatus::class)] + public string $currentRoleStatus; + /** @var list $education */ #[Required(list: Education::class)] public array $education; @@ -66,12 +78,24 @@ final class Person implements BaseModel #[Optional] public ?string $bio; + /** + * When we last refreshed this profile from our data sources (ISO 8601). + */ + #[Optional('checked_at')] + public ?string $checkedAt; + #[Optional('current_role')] public ?CurrentRole $currentRole; #[Optional] public ?string $email; + /** + * When the underlying profile data last changed in our data sources (ISO 8601). Omitted when unknown. + */ + #[Optional('last_updated')] + public ?string $lastUpdated; + #[Optional] public ?Location $location; @@ -84,6 +108,7 @@ final class Person implements BaseModel * To enforce required parameters use * ``` * Person::with( + * currentRoleStatus: ..., * education: ..., * experience: ..., * skills: ..., @@ -96,6 +121,7 @@ final class Person implements BaseModel * * ``` * (new Person) + * ->withCurrentRoleStatus(...) * ->withEducation(...) * ->withExperience(...) * ->withSkills(...) @@ -113,6 +139,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CurrentRoleStatus|value-of $currentRoleStatus * @param list $education * @param list $experience * @param list $skills @@ -123,6 +150,7 @@ public function __construct() * @param Name|NameShape|null $name */ public static function with( + CurrentRoleStatus|string $currentRoleStatus, array $education, array $experience, array $skills, @@ -130,13 +158,16 @@ public static function with( array $websiteURLs, ?string $avatarURL = null, ?string $bio = null, + ?string $checkedAt = null, CurrentRole|array|null $currentRole = null, ?string $email = null, + ?string $lastUpdated = null, Location|array|null $location = null, Name|array|null $name = null, ): self { $self = new self; + $self['currentRoleStatus'] = $currentRoleStatus; $self['education'] = $education; $self['experience'] = $experience; $self['skills'] = $skills; @@ -145,14 +176,30 @@ public static function with( null !== $avatarURL && $self['avatarURL'] = $avatarURL; null !== $bio && $self['bio'] = $bio; + null !== $checkedAt && $self['checkedAt'] = $checkedAt; null !== $currentRole && $self['currentRole'] = $currentRole; null !== $email && $self['email'] = $email; + null !== $lastUpdated && $self['lastUpdated'] = $lastUpdated; null !== $location && $self['location'] = $location; null !== $name && $self['name'] = $name; return $self; } + /** + * Whether the person's current role is known. `present` — current_role is populated. `none` — the work history explicitly shows every role has ended. `unknown` — our data sources could not confirm either way; treat a missing current_role as unverified rather than vacant. + * + * @param CurrentRoleStatus|value-of $currentRoleStatus + */ + public function withCurrentRoleStatus( + CurrentRoleStatus|string $currentRoleStatus + ): self { + $self = clone $this; + $self['currentRoleStatus'] = $currentRoleStatus; + + return $self; + } + /** * @param list $education */ @@ -224,6 +271,17 @@ public function withBio(string $bio): self return $self; } + /** + * When we last refreshed this profile from our data sources (ISO 8601). + */ + public function withCheckedAt(string $checkedAt): self + { + $self = clone $this; + $self['checkedAt'] = $checkedAt; + + return $self; + } + /** * @param CurrentRole|CurrentRoleShape $currentRole */ @@ -243,6 +301,17 @@ public function withEmail(string $email): self return $self; } + /** + * When the underlying profile data last changed in our data sources (ISO 8601). Omitted when unknown. + */ + public function withLastUpdated(string $lastUpdated): self + { + $self = clone $this; + $self['lastUpdated'] = $lastUpdated; + + return $self; + } + /** * @param Location|LocationShape $location */ diff --git a/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRoleStatus.php b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRoleStatus.php new file mode 100644 index 00000000..d10fdcf6 --- /dev/null +++ b/src/People/PersonEnrichResponse/Match_/PersonEnrichmentCandidateMatch/Person/CurrentRoleStatus.php @@ -0,0 +1,17 @@ + Date: Mon, 17 Aug 2026 03:52:51 +0000 Subject: [PATCH 108/130] feat(api): api update --- .stats.yml | 4 +- src/Brand/BrandSearchParams.php | 81 +++++++++++++++++++++++-- src/Brand/BrandSearchParams/QueryBy.php | 12 ++++ src/ServiceContracts/BrandContract.php | 9 ++- src/Services/BrandRawService.php | 11 +++- src/Services/BrandService.php | 21 ++++++- tests/Services/BrandTest.php | 5 +- 7 files changed, 128 insertions(+), 15 deletions(-) create mode 100644 src/Brand/BrandSearchParams/QueryBy.php diff --git a/.stats.yml b/.stats.yml index 2039ac3b..983602e6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-c99300223257d60d7614e76585c62cfea40f43df0547db63c952b20c52f209f4.yml -openapi_spec_hash: 1d4e473f3c566b7a1c3def11b6d84fe0 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4f279e7b1f0a52f5c917d4256e17188dfe330ddf7495146e2b1611e812605fdc.yml +openapi_spec_hash: 53a74c4cccbdec8590db38183840a446 config_hash: 920678668dd2da6f8966fbf1b8fde4e2 diff --git a/src/Brand/BrandSearchParams.php b/src/Brand/BrandSearchParams.php index 2088ad9c..860bb877 100644 --- a/src/Brand/BrandSearchParams.php +++ b/src/Brand/BrandSearchParams.php @@ -4,6 +4,7 @@ namespace ContextDev\Brand; +use ContextDev\Brand\BrandSearchParams\QueryBy; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; @@ -11,12 +12,16 @@ use ContextDev\Core\Contracts\BaseModel; /** - * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo). Name matches rank ahead of domain matches; within each group the most popular brands come first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. + * Search indexed brands by name or domain. * * @see ContextDev\Services\BrandService::search() * * @phpstan-type BrandSearchParamsShape = array{ - * query: string, tags?: list|null + * query: string, + * autocomplete?: bool|null, + * queryBy?: list>|null, + * tags?: list|null, + * typoTolerance?: int|null, * } */ final class BrandSearchParams implements BaseModel @@ -26,11 +31,25 @@ final class BrandSearchParams implements BaseModel use SdkParams; /** - * Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). + * Search term, matched against the fields selected by queryBy (e.g. 'nike', 'nike.com', 'nik'). */ #[Required] public string $query; + /** + * Whether the search term matches by prefix, so partial words match as they are typed (e.g. 'nik' matches Nike). Set to false to match whole words only. + */ + #[Optional] + public ?bool $autocomplete; + + /** + * Fields to match the search term against, as a comma-separated list or repeated parameter: 'name', 'domain', or both. Defaults to both. + * + * @var list>|null $queryBy + */ + #[Optional(list: QueryBy::class)] + public ?array $queryBy; + /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @@ -39,6 +58,12 @@ final class BrandSearchParams implements BaseModel #[Optional(list: 'string')] public ?array $tags; + /** + * Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no typo tolerance). + */ + #[Optional] + public ?int $typoTolerance; + /** * `new BrandSearchParams()` is missing required properties by the API. * @@ -63,21 +88,30 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param list>|null $queryBy * @param list|null $tags */ - public static function with(string $query, ?array $tags = null): self - { + public static function with( + string $query, + ?bool $autocomplete = null, + ?array $queryBy = null, + ?array $tags = null, + ?int $typoTolerance = null, + ): self { $self = new self; $self['query'] = $query; + null !== $autocomplete && $self['autocomplete'] = $autocomplete; + null !== $queryBy && $self['queryBy'] = $queryBy; null !== $tags && $self['tags'] = $tags; + null !== $typoTolerance && $self['typoTolerance'] = $typoTolerance; return $self; } /** - * Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). + * Search term, matched against the fields selected by queryBy (e.g. 'nike', 'nike.com', 'nik'). */ public function withQuery(string $query): self { @@ -87,6 +121,30 @@ public function withQuery(string $query): self return $self; } + /** + * Whether the search term matches by prefix, so partial words match as they are typed (e.g. 'nik' matches Nike). Set to false to match whole words only. + */ + public function withAutocomplete(bool $autocomplete): self + { + $self = clone $this; + $self['autocomplete'] = $autocomplete; + + return $self; + } + + /** + * Fields to match the search term against, as a comma-separated list or repeated parameter: 'name', 'domain', or both. Defaults to both. + * + * @param list> $queryBy + */ + public function withQueryBy(array $queryBy): self + { + $self = clone $this; + $self['queryBy'] = $queryBy; + + return $self; + } + /** * Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. * @@ -99,4 +157,15 @@ public function withTags(array $tags): self return $self; } + + /** + * Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no typo tolerance). + */ + public function withTypoTolerance(int $typoTolerance): self + { + $self = clone $this; + $self['typoTolerance'] = $typoTolerance; + + return $self; + } } diff --git a/src/Brand/BrandSearchParams/QueryBy.php b/src/Brand/BrandSearchParams/QueryBy.php new file mode 100644 index 00000000..f9b0cd23 --- /dev/null +++ b/src/Brand/BrandSearchParams/QueryBy.php @@ -0,0 +1,12 @@ +> $queryBy Fields to match the search term against, as a comma-separated list or repeated parameter: 'name', 'domain', or both. Defaults to both. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param int $typoTolerance Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no typo tolerance). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function search( string $query, + bool $autocomplete = true, + array $queryBy = ['name', 'domain'], ?array $tags = null, + int $typoTolerance = 0, RequestOptions|array|null $requestOptions = null, ): BrandSearchResponse; } diff --git a/src/Services/BrandRawService.php b/src/Services/BrandRawService.php index 46c72922..8dd9e112 100644 --- a/src/Services/BrandRawService.php +++ b/src/Services/BrandRawService.php @@ -12,6 +12,7 @@ use ContextDev\Brand\BrandRetrieveSimplifiedParams; use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; use ContextDev\Brand\BrandSearchParams; +use ContextDev\Brand\BrandSearchParams\QueryBy; use ContextDev\Brand\BrandSearchResponse; use ContextDev\Client; use ContextDev\Core\Contracts\BaseResponse; @@ -123,9 +124,15 @@ public function retrieveSimplified( /** * @api * - * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo). Name matches rank ahead of domain matches; within each group the most popular brands come first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. + * Search indexed brands by name or domain * - * @param array{query: string, tags?: list}|BrandSearchParams $params + * @param array{ + * query: string, + * autocomplete?: bool, + * queryBy?: list>, + * tags?: list, + * typoTolerance?: int, + * }|BrandSearchParams $params * @param RequestOpts|null $requestOptions * * @return BaseResponse diff --git a/src/Services/BrandService.php b/src/Services/BrandService.php index d9d72a42..2b9a4921 100644 --- a/src/Services/BrandService.php +++ b/src/Services/BrandService.php @@ -9,6 +9,7 @@ use ContextDev\Brand\BrandRetrieveParams\ForceLanguage; use ContextDev\Brand\BrandRetrieveParams\Type; use ContextDev\Brand\BrandRetrieveSimplifiedParams\Theme; +use ContextDev\Brand\BrandSearchParams\QueryBy; use ContextDev\Brand\BrandSearchResponse; use ContextDev\Client; use ContextDev\Core\Exceptions\APIException; @@ -154,20 +155,34 @@ public function retrieveSimplified( /** * @api * - * Search brands by name or domain and get back up to 10 lightweight matches (domain, name, logo). Name matches rank ahead of domain matches; within each group the most popular brands come first: by Tranco rank, then market cap for brands outside the Tranco list, with text relevance breaking ties. Matching is prefix-based with no typo tolerance, so it is suited to autocomplete. Only brands already in the Context.dev index are returned — use /brand/retrieve to fetch (and index) a specific domain. Free on Pro and Scale plans; costs 1 credit per request on the Free and Starter plans. + * Search indexed brands by name or domain * - * @param string $query Search term, matched against brand names and domains by prefix (e.g. 'nike', 'nike.com', 'nik'). + * @param string $query Search term, matched against the fields selected by queryBy (e.g. 'nike', 'nike.com', 'nik'). + * @param bool $autocomplete Whether the search term matches by prefix, so partial words match as they are typed (e.g. 'nik' matches Nike). Set to false to match whole words only. + * @param list> $queryBy Fields to match the search term against, as a comma-separated list or repeated parameter: 'name', 'domain', or both. Defaults to both. * @param list $tags Optional comma-separated caller-defined tags for tracking this request. Tags are recorded on the request's usage log and can be used to filter usage on the dashboard usage page. Up to 20 tags, each 1-50 characters. + * @param int $typoTolerance Maximum number of typos tolerated when matching, from 0 to 2. Defaults to 0 (no typo tolerance). * @param RequestOpts|null $requestOptions * * @throws APIException */ public function search( string $query, + bool $autocomplete = true, + array $queryBy = ['name', 'domain'], ?array $tags = null, + int $typoTolerance = 0, RequestOptions|array|null $requestOptions = null, ): BrandSearchResponse { - $params = Util::removeNulls(['query' => $query, 'tags' => $tags]); + $params = Util::removeNulls( + [ + 'query' => $query, + 'autocomplete' => $autocomplete, + 'queryBy' => $queryBy, + 'tags' => $tags, + 'typoTolerance' => $typoTolerance, + ], + ); // @phpstan-ignore-next-line argument.type $response = $this->raw->search(params: $params, requestOptions: $requestOptions); diff --git a/tests/Services/BrandTest.php b/tests/Services/BrandTest.php index e59d2194..ddfd1cdb 100644 --- a/tests/Services/BrandTest.php +++ b/tests/Services/BrandTest.php @@ -137,7 +137,10 @@ public function testSearchWithOptionalParams(): void $result = $this->client->brand->search( query: 'x', - tags: ['production', 'team-alpha'] + autocomplete: true, + queryBy: ['name'], + tags: ['production', 'team-alpha'], + typoTolerance: 0, ); // @phpstan-ignore-next-line method.alreadyNarrowedType From 4595606a8edc4c5066cd2ca355e518c3271e883a Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 04:29:53 +0000 Subject: [PATCH 109/130] feat(api): manual updates --- .stats.yml | 6 +- src/Client.php | 7 + src/News/NewsSearchParams.php | 201 +++++++++++++ src/News/NewsSearchParams/FilterBy.php | 169 +++++++++++ .../FilterBy/ArticleLanguage.php | 34 +++ .../NewsSearchParams/FilterBy/ArticleType.php | 16 + src/News/NewsSearchParams/FilterBy/Date.php | 74 +++++ .../FilterBy/SourceCountry.php | 58 ++++ src/News/NewsSearchParams/SearchBy.php | 113 +++++++ src/News/NewsSearchParams/SearchBy/Entity.php | 47 +++ .../Entity/NewsSearchEntityByDomain.php | 87 ++++++ .../Entity/NewsSearchEntityByIsin.php | 85 ++++++ .../Entity/NewsSearchEntityByName.php | 85 ++++++ .../Entity/NewsSearchEntityByTicker.php | 116 ++++++++ .../NewsSearchEntityByTicker/Exchange.php | 155 ++++++++++ src/News/NewsSearchParams/SearchBy/Type.php | 13 + src/News/NewsSearchParams/SortBy.php | 77 +++++ src/News/NewsSearchParams/SortBy/Type.php | 15 + src/News/NewsSearchResponse.php | 153 ++++++++++ src/News/NewsSearchResponse/Data.php | 275 ++++++++++++++++++ src/News/NewsSearchResponse/Data/Match_.php | 83 ++++++ .../NewsSearchResponse/Data/Match_/Level.php | 12 + src/News/NewsSearchResponse/Data/Source.php | 95 ++++++ src/News/NewsSearchResponse/Data/Type.php | 16 + src/News/NewsSearchResponse/KeyMetadata.php | 92 ++++++ src/News/NewsSearchResponse/Meta.php | 62 ++++ src/ServiceContracts/NewsContract.php | 44 +++ src/ServiceContracts/NewsRawContract.php | 32 ++ src/Services/NewsRawService.php | 71 +++++ src/Services/NewsService.php | 80 +++++ tests/Services/NewsTest.php | 75 +++++ 31 files changed, 2445 insertions(+), 3 deletions(-) create mode 100644 src/News/NewsSearchParams.php create mode 100644 src/News/NewsSearchParams/FilterBy.php create mode 100644 src/News/NewsSearchParams/FilterBy/ArticleLanguage.php create mode 100644 src/News/NewsSearchParams/FilterBy/ArticleType.php create mode 100644 src/News/NewsSearchParams/FilterBy/Date.php create mode 100644 src/News/NewsSearchParams/FilterBy/SourceCountry.php create mode 100644 src/News/NewsSearchParams/SearchBy.php create mode 100644 src/News/NewsSearchParams/SearchBy/Entity.php create mode 100644 src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByDomain.php create mode 100644 src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByIsin.php create mode 100644 src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByName.php create mode 100644 src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker.php create mode 100644 src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker/Exchange.php create mode 100644 src/News/NewsSearchParams/SearchBy/Type.php create mode 100644 src/News/NewsSearchParams/SortBy.php create mode 100644 src/News/NewsSearchParams/SortBy/Type.php create mode 100644 src/News/NewsSearchResponse.php create mode 100644 src/News/NewsSearchResponse/Data.php create mode 100644 src/News/NewsSearchResponse/Data/Match_.php create mode 100644 src/News/NewsSearchResponse/Data/Match_/Level.php create mode 100644 src/News/NewsSearchResponse/Data/Source.php create mode 100644 src/News/NewsSearchResponse/Data/Type.php create mode 100644 src/News/NewsSearchResponse/KeyMetadata.php create mode 100644 src/News/NewsSearchResponse/Meta.php create mode 100644 src/ServiceContracts/NewsContract.php create mode 100644 src/ServiceContracts/NewsRawContract.php create mode 100644 src/Services/NewsRawService.php create mode 100644 src/Services/NewsService.php create mode 100644 tests/Services/NewsTest.php diff --git a/.stats.yml b/.stats.yml index 983602e6..4b9b1cb6 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 40 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-4f279e7b1f0a52f5c917d4256e17188dfe330ddf7495146e2b1611e812605fdc.yml +configured_endpoints: 41 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5dbe631ce516ca688273053ddcb58870561bd6dc76fa75df354c954d7af65a3c.yml openapi_spec_hash: 53a74c4cccbdec8590db38183840a446 -config_hash: 920678668dd2da6f8966fbf1b8fde4e2 +config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/Client.php b/src/Client.php index 638c88c7..a13d003c 100644 --- a/src/Client.php +++ b/src/Client.php @@ -12,6 +12,7 @@ use ContextDev\Services\BrandService; use ContextDev\Services\IndustryService; use ContextDev\Services\MonitorsService; +use ContextDev\Services\NewsService; use ContextDev\Services\ParseService; use ContextDev\Services\PeopleService; use ContextDev\Services\UtilityService; @@ -72,6 +73,11 @@ class Client extends BaseClient */ public PeopleService $people; + /** + * @api + */ + public NewsService $news; + /** * @param RequestOpts|null $requestOptions */ @@ -139,6 +145,7 @@ public function __construct( $this->monitors = new MonitorsService($this); $this->batch = new BatchService($this); $this->people = new PeopleService($this); + $this->news = new NewsService($this); } /** @return array */ diff --git a/src/News/NewsSearchParams.php b/src/News/NewsSearchParams.php new file mode 100644 index 00000000..09b9580b --- /dev/null +++ b/src/News/NewsSearchParams.php @@ -0,0 +1,201 @@ +|null, + * } + */ +final class NewsSearchParams implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + use SdkParams; + + /** + * What to search for. + */ + #[Required] + public SearchBy $searchBy; + + /** + * Opaque next_cursor from the previous response, or null for the first page. + */ + #[Optional(nullable: true)] + public ?string $cursor; + + /** + * Optional result filters. + */ + #[Optional] + public ?FilterBy $filterBy; + + /** + * Maximum results to return. Defaults to 10. + */ + #[Optional] + public ?int $limit; + + /** + * Result ordering. Defaults to newest. + */ + #[Optional] + public ?SortBy $sortBy; + + /** + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * + * @var list|null $tags + */ + #[Optional(list: 'string')] + public ?array $tags; + + /** + * `new NewsSearchParams()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * NewsSearchParams::with(searchBy: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new NewsSearchParams)->withSearchBy(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param SearchBy|SearchByShape $searchBy + * @param FilterBy|FilterByShape|null $filterBy + * @param SortBy|SortByShape|null $sortBy + * @param list|null $tags + */ + public static function with( + SearchBy|array $searchBy, + ?string $cursor = null, + FilterBy|array|null $filterBy = null, + ?int $limit = null, + SortBy|array|null $sortBy = null, + ?array $tags = null, + ): self { + $self = new self; + + $self['searchBy'] = $searchBy; + + null !== $cursor && $self['cursor'] = $cursor; + null !== $filterBy && $self['filterBy'] = $filterBy; + null !== $limit && $self['limit'] = $limit; + null !== $sortBy && $self['sortBy'] = $sortBy; + null !== $tags && $self['tags'] = $tags; + + return $self; + } + + /** + * What to search for. + * + * @param SearchBy|SearchByShape $searchBy + */ + public function withSearchBy(SearchBy|array $searchBy): self + { + $self = clone $this; + $self['searchBy'] = $searchBy; + + return $self; + } + + /** + * Opaque next_cursor from the previous response, or null for the first page. + */ + public function withCursor(?string $cursor): self + { + $self = clone $this; + $self['cursor'] = $cursor; + + return $self; + } + + /** + * Optional result filters. + * + * @param FilterBy|FilterByShape $filterBy + */ + public function withFilterBy(FilterBy|array $filterBy): self + { + $self = clone $this; + $self['filterBy'] = $filterBy; + + return $self; + } + + /** + * Maximum results to return. Defaults to 10. + */ + public function withLimit(int $limit): self + { + $self = clone $this; + $self['limit'] = $limit; + + return $self; + } + + /** + * Result ordering. Defaults to newest. + * + * @param SortBy|SortByShape $sortBy + */ + public function withSortBy(SortBy|array $sortBy): self + { + $self = clone $this; + $self['sortBy'] = $sortBy; + + return $self; + } + + /** + * Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * + * @param list $tags + */ + public function withTags(array $tags): self + { + $self = clone $this; + $self['tags'] = $tags; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/FilterBy.php b/src/News/NewsSearchParams/FilterBy.php new file mode 100644 index 00000000..24964dba --- /dev/null +++ b/src/News/NewsSearchParams/FilterBy.php @@ -0,0 +1,169 @@ +>|null, + * articleType?: list>|null, + * date?: null|Date|DateShape, + * sourceCountry?: list>|null, + * sourceDomain?: list|null, + * } + */ +final class FilterBy implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Article languages to include. Up to 3. + * + * @var list>|null $articleLanguage + */ + #[Optional(list: ArticleLanguage::class)] + public ?array $articleLanguage; + + /** + * Article types to include. Up to 3. + * + * @var list>|null $articleType + */ + #[Optional(list: ArticleType::class)] + public ?array $articleType; + + /** + * Published-at window in epoch milliseconds. + */ + #[Optional] + public ?Date $date; + + /** + * Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3. + * + * @var list>|null $sourceCountry + */ + #[Optional(list: SourceCountry::class)] + public ?array $sourceCountry; + + /** + * Publisher domains to include. Up to 3. + * + * @var list|null $sourceDomain + */ + #[Optional(list: 'string')] + public ?array $sourceDomain; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list>|null $articleLanguage + * @param list>|null $articleType + * @param Date|DateShape|null $date + * @param list>|null $sourceCountry + * @param list|null $sourceDomain + */ + public static function with( + ?array $articleLanguage = null, + ?array $articleType = null, + Date|array|null $date = null, + ?array $sourceCountry = null, + ?array $sourceDomain = null, + ): self { + $self = new self; + + null !== $articleLanguage && $self['articleLanguage'] = $articleLanguage; + null !== $articleType && $self['articleType'] = $articleType; + null !== $date && $self['date'] = $date; + null !== $sourceCountry && $self['sourceCountry'] = $sourceCountry; + null !== $sourceDomain && $self['sourceDomain'] = $sourceDomain; + + return $self; + } + + /** + * Article languages to include. Up to 3. + * + * @param list> $articleLanguage + */ + public function withArticleLanguage(array $articleLanguage): self + { + $self = clone $this; + $self['articleLanguage'] = $articleLanguage; + + return $self; + } + + /** + * Article types to include. Up to 3. + * + * @param list> $articleType + */ + public function withArticleType(array $articleType): self + { + $self = clone $this; + $self['articleType'] = $articleType; + + return $self; + } + + /** + * Published-at window in epoch milliseconds. + * + * @param Date|DateShape $date + */ + public function withDate(Date|array $date): self + { + $self = clone $this; + $self['date'] = $date; + + return $self; + } + + /** + * Publisher countries to include, as lowercase ISO 3166-1 alpha-2 codes. Up to 3. + * + * @param list> $sourceCountry + */ + public function withSourceCountry(array $sourceCountry): self + { + $self = clone $this; + $self['sourceCountry'] = $sourceCountry; + + return $self; + } + + /** + * Publisher domains to include. Up to 3. + * + * @param list $sourceDomain + */ + public function withSourceDomain(array $sourceDomain): self + { + $self = clone $this; + $self['sourceDomain'] = $sourceDomain; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/FilterBy/ArticleLanguage.php b/src/News/NewsSearchParams/FilterBy/ArticleLanguage.php new file mode 100644 index 00000000..7337e079 --- /dev/null +++ b/src/News/NewsSearchParams/FilterBy/ArticleLanguage.php @@ -0,0 +1,34 @@ + */ + use SdkModel; + + /** + * Inclusive start of the published-at window, in epoch milliseconds. + */ + #[Optional] + public ?int $from; + + /** + * Inclusive end of the published-at window, in epoch milliseconds. + */ + #[Optional] + public ?int $to; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(?int $from = null, ?int $to = null): self + { + $self = new self; + + null !== $from && $self['from'] = $from; + null !== $to && $self['to'] = $to; + + return $self; + } + + /** + * Inclusive start of the published-at window, in epoch milliseconds. + */ + public function withFrom(int $from): self + { + $self = clone $this; + $self['from'] = $from; + + return $self; + } + + /** + * Inclusive end of the published-at window, in epoch milliseconds. + */ + public function withTo(int $to): self + { + $self = clone $this; + $self['to'] = $to; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/FilterBy/SourceCountry.php b/src/News/NewsSearchParams/FilterBy/SourceCountry.php new file mode 100644 index 00000000..3919e6a6 --- /dev/null +++ b/src/News/NewsSearchParams/FilterBy/SourceCountry.php @@ -0,0 +1,58 @@ + + * } + */ +final class SearchBy implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * The company to search news for, identified by name, domain, ticker, or ISIN. + * + * @var EntityVariants $entity + */ + #[Required(union: Entity::class)] + public NewsSearchEntityByName|NewsSearchEntityByDomain|NewsSearchEntityByTicker|NewsSearchEntityByIsin $entity; + + /** + * How to search. Only entity search is supported. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new SearchBy()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * SearchBy::with(entity: ..., type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new SearchBy)->withEntity(...)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param EntityShape $entity + * @param Type|value-of $type + */ + public static function with( + NewsSearchEntityByName|array|NewsSearchEntityByDomain|NewsSearchEntityByTicker|NewsSearchEntityByIsin $entity, + Type|string $type, + ): self { + $self = new self; + + $self['entity'] = $entity; + $self['type'] = $type; + + return $self; + } + + /** + * The company to search news for, identified by name, domain, ticker, or ISIN. + * + * @param EntityShape $entity + */ + public function withEntity( + NewsSearchEntityByName|array|NewsSearchEntityByDomain|NewsSearchEntityByTicker|NewsSearchEntityByIsin $entity, + ): self { + $self = clone $this; + $self['entity'] = $entity; + + return $self; + } + + /** + * How to search. Only entity search is supported. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/SearchBy/Entity.php b/src/News/NewsSearchParams/SearchBy/Entity.php new file mode 100644 index 00000000..38fba9d8 --- /dev/null +++ b/src/News/NewsSearchParams/SearchBy/Entity.php @@ -0,0 +1,47 @@ +|array + */ + public static function variants(): array + { + return [ + 'name' => NewsSearchEntityByName::class, + 'domain' => NewsSearchEntityByDomain::class, + 'ticker' => NewsSearchEntityByTicker::class, + 'isin' => NewsSearchEntityByIsin::class, + ]; + } +} diff --git a/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByDomain.php b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByDomain.php new file mode 100644 index 00000000..aa2aa0f3 --- /dev/null +++ b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByDomain.php @@ -0,0 +1,87 @@ + */ + use SdkModel; + + /** @var 'domain' $type */ + #[Required] + public string $type = 'domain'; + + /** + * Company website domain, such as apple.com. + */ + #[Required] + public string $domain; + + /** + * `new NewsSearchEntityByDomain()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * NewsSearchEntityByDomain::with(domain: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new NewsSearchEntityByDomain)->withDomain(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $domain): self + { + $self = new self; + + $self['domain'] = $domain; + + return $self; + } + + /** + * Company website domain, such as apple.com. + */ + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + /** + * @param 'domain' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByIsin.php b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByIsin.php new file mode 100644 index 00000000..a28cb066 --- /dev/null +++ b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByIsin.php @@ -0,0 +1,85 @@ + */ + use SdkModel; + + /** @var 'isin' $type */ + #[Required] + public string $type = 'isin'; + + /** + * International Securities Identification Number. + */ + #[Required] + public string $isin; + + /** + * `new NewsSearchEntityByIsin()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * NewsSearchEntityByIsin::with(isin: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new NewsSearchEntityByIsin)->withIsin(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $isin): self + { + $self = new self; + + $self['isin'] = $isin; + + return $self; + } + + /** + * International Securities Identification Number. + */ + public function withIsin(string $isin): self + { + $self = clone $this; + $self['isin'] = $isin; + + return $self; + } + + /** + * @param 'isin' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByName.php b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByName.php new file mode 100644 index 00000000..26d90676 --- /dev/null +++ b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByName.php @@ -0,0 +1,85 @@ + */ + use SdkModel; + + /** @var 'name' $type */ + #[Required] + public string $type = 'name'; + + /** + * Company name. + */ + #[Required] + public string $name; + + /** + * `new NewsSearchEntityByName()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * NewsSearchEntityByName::with(name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new NewsSearchEntityByName)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $name): self + { + $self = new self; + + $self['name'] = $name; + + return $self; + } + + /** + * Company name. + */ + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } + + /** + * @param 'name' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker.php b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker.php new file mode 100644 index 00000000..fc93c7c0 --- /dev/null +++ b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker.php @@ -0,0 +1,116 @@ + + * } + */ +final class NewsSearchEntityByTicker implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'ticker' $type */ + #[Required] + public string $type = 'ticker'; + + /** + * Public-company ticker. + */ + #[Required] + public string $ticker; + + /** + * Stock exchange the ticker trades on, used to disambiguate tickers listed on multiple exchanges. + * + * @var value-of|null $exchange + */ + #[Optional(enum: Exchange::class)] + public ?string $exchange; + + /** + * `new NewsSearchEntityByTicker()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * NewsSearchEntityByTicker::with(ticker: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new NewsSearchEntityByTicker)->withTicker(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Exchange|value-of|null $exchange + */ + public static function with( + string $ticker, + Exchange|string|null $exchange = null + ): self { + $self = new self; + + $self['ticker'] = $ticker; + + null !== $exchange && $self['exchange'] = $exchange; + + return $self; + } + + /** + * Public-company ticker. + */ + public function withTicker(string $ticker): self + { + $self = clone $this; + $self['ticker'] = $ticker; + + return $self; + } + + /** + * @param 'ticker' $type + */ + public function withType(string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + /** + * Stock exchange the ticker trades on, used to disambiguate tickers listed on multiple exchanges. + * + * @param Exchange|value-of $exchange + */ + public function withExchange(Exchange|string $exchange): self + { + $self = clone $this; + $self['exchange'] = $exchange; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker/Exchange.php b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker/Exchange.php new file mode 100644 index 00000000..a78e6b8b --- /dev/null +++ b/src/News/NewsSearchParams/SearchBy/Entity/NewsSearchEntityByTicker/Exchange.php @@ -0,0 +1,155 @@ +} + */ +final class SortBy implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Result ordering. + * + * @var value-of $type + */ + #[Required(enum: Type::class)] + public string $type; + + /** + * `new SortBy()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * SortBy::with(type: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new SortBy)->withType(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Type|value-of $type + */ + public static function with(Type|string $type): self + { + $self = new self; + + $self['type'] = $type; + + return $self; + } + + /** + * Result ordering. + * + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } +} diff --git a/src/News/NewsSearchParams/SortBy/Type.php b/src/News/NewsSearchParams/SortBy/Type.php new file mode 100644 index 00000000..daa95270 --- /dev/null +++ b/src/News/NewsSearchParams/SortBy/Type.php @@ -0,0 +1,15 @@ +, + * hasMore: bool, + * meta: Meta|MetaShape, + * nextCursor: string|null, + * keyMetadata?: null|KeyMetadata|KeyMetadataShape, + * } + */ +final class NewsSearchResponse implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var list $data */ + #[Required(list: Data::class)] + public array $data; + + #[Required('has_more')] + public bool $hasMore; + + #[Required] + public Meta $meta; + + #[Required('next_cursor')] + public ?string $nextCursor; + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + */ + #[Optional('key_metadata')] + public ?KeyMetadata $keyMetadata; + + /** + * `new NewsSearchResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * NewsSearchResponse::with(data: ..., hasMore: ..., meta: ..., nextCursor: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new NewsSearchResponse) + * ->withData(...) + * ->withHasMore(...) + * ->withMeta(...) + * ->withNextCursor(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $data + * @param Meta|MetaShape $meta + * @param KeyMetadata|KeyMetadataShape|null $keyMetadata + */ + public static function with( + array $data, + bool $hasMore, + Meta|array $meta, + ?string $nextCursor, + KeyMetadata|array|null $keyMetadata = null, + ): self { + $self = new self; + + $self['data'] = $data; + $self['hasMore'] = $hasMore; + $self['meta'] = $meta; + $self['nextCursor'] = $nextCursor; + + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; + + return $self; + } + + /** + * @param list $data + */ + public function withData(array $data): self + { + $self = clone $this; + $self['data'] = $data; + + return $self; + } + + public function withHasMore(bool $hasMore): self + { + $self = clone $this; + $self['hasMore'] = $hasMore; + + return $self; + } + + /** + * @param Meta|MetaShape $meta + */ + public function withMeta(Meta|array $meta): self + { + $self = clone $this; + $self['meta'] = $meta; + + return $self; + } + + public function withNextCursor(?string $nextCursor): self + { + $self = clone $this; + $self['nextCursor'] = $nextCursor; + + return $self; + } + + /** + * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. + * + * @param KeyMetadata|KeyMetadataShape $keyMetadata + */ + public function withKeyMetadata(KeyMetadata|array $keyMetadata): self + { + $self = clone $this; + $self['keyMetadata'] = $keyMetadata; + + return $self; + } +} diff --git a/src/News/NewsSearchResponse/Data.php b/src/News/NewsSearchResponse/Data.php new file mode 100644 index 00000000..f7a21bad --- /dev/null +++ b/src/News/NewsSearchResponse/Data.php @@ -0,0 +1,275 @@ +, + * description: string|null, + * imageURL: string|null, + * language: string|null, + * match: Match_|MatchShape, + * publishedAt: \DateTimeInterface|null, + * source: Source|SourceShape, + * storyID: string, + * title: string, + * type: Type|value-of, + * url: string, + * } + */ +final class Data implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $id; + + /** @var list $authors */ + #[Required(list: 'string')] + public array $authors; + + #[Required] + public ?string $description; + + #[Required('image_url')] + public ?string $imageURL; + + #[Required] + public ?string $language; + + #[Required] + public Match_ $match; + + #[Required('published_at')] + public ?\DateTimeInterface $publishedAt; + + #[Required] + public Source $source; + + /** + * Groups matching normalized headlines published on the same UTC day. + */ + #[Required('story_id')] + public string $storyID; + + #[Required] + public string $title; + + /** @var value-of $type */ + #[Required(enum: Type::class)] + public string $type; + + #[Required] + public string $url; + + /** + * `new Data()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Data::with( + * id: ..., + * authors: ..., + * description: ..., + * imageURL: ..., + * language: ..., + * match: ..., + * publishedAt: ..., + * source: ..., + * storyID: ..., + * title: ..., + * type: ..., + * url: ..., + * ) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Data) + * ->withID(...) + * ->withAuthors(...) + * ->withDescription(...) + * ->withImageURL(...) + * ->withLanguage(...) + * ->withMatch(...) + * ->withPublishedAt(...) + * ->withSource(...) + * ->withStoryID(...) + * ->withTitle(...) + * ->withType(...) + * ->withURL(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param list $authors + * @param Match_|MatchShape $match + * @param Source|SourceShape $source + * @param Type|value-of $type + */ + public static function with( + string $id, + array $authors, + ?string $description, + ?string $imageURL, + ?string $language, + Match_|array $match, + ?\DateTimeInterface $publishedAt, + Source|array $source, + string $storyID, + string $title, + Type|string $type, + string $url, + ): self { + $self = new self; + + $self['id'] = $id; + $self['authors'] = $authors; + $self['description'] = $description; + $self['imageURL'] = $imageURL; + $self['language'] = $language; + $self['match'] = $match; + $self['publishedAt'] = $publishedAt; + $self['source'] = $source; + $self['storyID'] = $storyID; + $self['title'] = $title; + $self['type'] = $type; + $self['url'] = $url; + + return $self; + } + + public function withID(string $id): self + { + $self = clone $this; + $self['id'] = $id; + + return $self; + } + + /** + * @param list $authors + */ + public function withAuthors(array $authors): self + { + $self = clone $this; + $self['authors'] = $authors; + + return $self; + } + + public function withDescription(?string $description): self + { + $self = clone $this; + $self['description'] = $description; + + return $self; + } + + public function withImageURL(?string $imageURL): self + { + $self = clone $this; + $self['imageURL'] = $imageURL; + + return $self; + } + + public function withLanguage(?string $language): self + { + $self = clone $this; + $self['language'] = $language; + + return $self; + } + + /** + * @param Match_|MatchShape $match + */ + public function withMatch(Match_|array $match): self + { + $self = clone $this; + $self['match'] = $match; + + return $self; + } + + public function withPublishedAt(?\DateTimeInterface $publishedAt): self + { + $self = clone $this; + $self['publishedAt'] = $publishedAt; + + return $self; + } + + /** + * @param Source|SourceShape $source + */ + public function withSource(Source|array $source): self + { + $self = clone $this; + $self['source'] = $source; + + return $self; + } + + /** + * Groups matching normalized headlines published on the same UTC day. + */ + public function withStoryID(string $storyID): self + { + $self = clone $this; + $self['storyID'] = $storyID; + + return $self; + } + + public function withTitle(string $title): self + { + $self = clone $this; + $self['title'] = $title; + + return $self; + } + + /** + * @param Type|value-of $type + */ + public function withType(Type|string $type): self + { + $self = clone $this; + $self['type'] = $type; + + return $self; + } + + public function withURL(string $url): self + { + $self = clone $this; + $self['url'] = $url; + + return $self; + } +} diff --git a/src/News/NewsSearchResponse/Data/Match_.php b/src/News/NewsSearchResponse/Data/Match_.php new file mode 100644 index 00000000..c046da10 --- /dev/null +++ b/src/News/NewsSearchResponse/Data/Match_.php @@ -0,0 +1,83 @@ + + * } + */ +final class Match_ implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public ?float $confidence; + + /** @var value-of $level */ + #[Required(enum: Level::class)] + public string $level; + + /** + * `new Match_()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Match_::with(confidence: ..., level: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Match_)->withConfidence(...)->withLevel(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Level|value-of $level + */ + public static function with(?float $confidence, Level|string $level): self + { + $self = new self; + + $self['confidence'] = $confidence; + $self['level'] = $level; + + return $self; + } + + public function withConfidence(?float $confidence): self + { + $self = clone $this; + $self['confidence'] = $confidence; + + return $self; + } + + /** + * @param Level|value-of $level + */ + public function withLevel(Level|string $level): self + { + $self = clone $this; + $self['level'] = $level; + + return $self; + } +} diff --git a/src/News/NewsSearchResponse/Data/Match_/Level.php b/src/News/NewsSearchResponse/Data/Match_/Level.php new file mode 100644 index 00000000..9f11b385 --- /dev/null +++ b/src/News/NewsSearchResponse/Data/Match_/Level.php @@ -0,0 +1,12 @@ + */ + use SdkModel; + + /** + * True when Context observed this article in the publisher-owned feed. + */ + #[Required] + public bool $direct; + + #[Required] + public string $domain; + + #[Required] + public string $name; + + /** + * `new Source()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Source::with(direct: ..., domain: ..., name: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Source)->withDirect(...)->withDomain(...)->withName(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + bool $direct, + string $domain, + string $name + ): self { + $self = new self; + + $self['direct'] = $direct; + $self['domain'] = $domain; + $self['name'] = $name; + + return $self; + } + + /** + * True when Context observed this article in the publisher-owned feed. + */ + public function withDirect(bool $direct): self + { + $self = clone $this; + $self['direct'] = $direct; + + return $self; + } + + public function withDomain(string $domain): self + { + $self = clone $this; + $self['domain'] = $domain; + + return $self; + } + + public function withName(string $name): self + { + $self = clone $this; + $self['name'] = $name; + + return $self; + } +} diff --git a/src/News/NewsSearchResponse/Data/Type.php b/src/News/NewsSearchResponse/Data/Type.php new file mode 100644 index 00000000..42d802a0 --- /dev/null +++ b/src/News/NewsSearchResponse/Data/Type.php @@ -0,0 +1,16 @@ + */ + use SdkModel; + + /** + * The number of credits consumed by this request. + */ + #[Required('credits_consumed')] + public int $creditsConsumed; + + /** + * The number of credits remaining for your organization after this request. + */ + #[Required('credits_remaining')] + public int $creditsRemaining; + + /** + * `new KeyMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * KeyMetadata::with(creditsConsumed: ..., creditsRemaining: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new KeyMetadata)->withCreditsConsumed(...)->withCreditsRemaining(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with( + int $creditsConsumed, + int $creditsRemaining + ): self { + $self = new self; + + $self['creditsConsumed'] = $creditsConsumed; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } + + /** + * The number of credits consumed by this request. + */ + public function withCreditsConsumed(int $creditsConsumed): self + { + $self = clone $this; + $self['creditsConsumed'] = $creditsConsumed; + + return $self; + } + + /** + * The number of credits remaining for your organization after this request. + */ + public function withCreditsRemaining(int $creditsRemaining): self + { + $self = clone $this; + $self['creditsRemaining'] = $creditsRemaining; + + return $self; + } +} diff --git a/src/News/NewsSearchResponse/Meta.php b/src/News/NewsSearchResponse/Meta.php new file mode 100644 index 00000000..e188ea2e --- /dev/null +++ b/src/News/NewsSearchResponse/Meta.php @@ -0,0 +1,62 @@ + */ + use SdkModel; + + #[Required] + public int $count; + + /** + * `new Meta()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * Meta::with(count: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new Meta)->withCount(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $count): self + { + $self = new self; + + $self['count'] = $count; + + return $self; + } + + public function withCount(int $count): self + { + $self = clone $this; + $self['count'] = $count; + + return $self; + } +} diff --git a/src/ServiceContracts/NewsContract.php b/src/ServiceContracts/NewsContract.php new file mode 100644 index 00000000..e38953f4 --- /dev/null +++ b/src/ServiceContracts/NewsContract.php @@ -0,0 +1,44 @@ + $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function search( + SearchBy|array $searchBy, + ?string $cursor = null, + FilterBy|array $filterBy = (object) [], + int $limit = 10, + SortBy|array $sortBy = ['type' => 'newest'], + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): NewsSearchResponse; +} diff --git a/src/ServiceContracts/NewsRawContract.php b/src/ServiceContracts/NewsRawContract.php new file mode 100644 index 00000000..54eb3768 --- /dev/null +++ b/src/ServiceContracts/NewsRawContract.php @@ -0,0 +1,32 @@ +|NewsSearchParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function search( + array|NewsSearchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse; +} diff --git a/src/Services/NewsRawService.php b/src/Services/NewsRawService.php new file mode 100644 index 00000000..779f9614 --- /dev/null +++ b/src/Services/NewsRawService.php @@ -0,0 +1,71 @@ +, + * }|NewsSearchParams $params + * @param RequestOpts|null $requestOptions + * + * @return BaseResponse + * + * @throws APIException + */ + public function search( + array|NewsSearchParams $params, + RequestOptions|array|null $requestOptions = null, + ): BaseResponse { + [$parsed, $options] = NewsSearchParams::parseRequest( + $params, + $requestOptions, + ); + + // @phpstan-ignore-next-line return.type + return $this->client->request( + method: 'post', + path: 'news/search', + body: (object) $parsed, + options: $options, + convert: NewsSearchResponse::class, + ); + } +} diff --git a/src/Services/NewsService.php b/src/Services/NewsService.php new file mode 100644 index 00000000..c0ca9cc3 --- /dev/null +++ b/src/Services/NewsService.php @@ -0,0 +1,80 @@ +raw = new NewsRawService($client); + } + + /** + * @api + * + * Searches live and historical company news for one company, identified in searchBy by name, domain, ticker (optionally disambiguated by exchange), or ISIN. Results can be filtered by publisher domain, publisher country, article language, article type, and published-at date, and include stable story IDs, source metadata, verified entity relevance, and cursor pagination. + * + * @param SearchBy|SearchByShape $searchBy what to search for + * @param string|null $cursor opaque next_cursor from the previous response, or null for the first page + * @param FilterBy|FilterByShape $filterBy optional result filters + * @param int $limit Maximum results to return. Defaults to 10. + * @param SortBy|SortByShape $sortBy Result ordering. Defaults to newest. + * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. + * @param RequestOpts|null $requestOptions + * + * @throws APIException + */ + public function search( + SearchBy|array $searchBy, + ?string $cursor = null, + FilterBy|array $filterBy = (object) [], + int $limit = 10, + SortBy|array $sortBy = ['type' => 'newest'], + ?array $tags = null, + RequestOptions|array|null $requestOptions = null, + ): NewsSearchResponse { + $params = Util::removeNulls( + [ + 'searchBy' => $searchBy, + 'cursor' => $cursor, + 'filterBy' => $filterBy, + 'limit' => $limit, + 'sortBy' => $sortBy, + 'tags' => $tags, + ], + ); + + // @phpstan-ignore-next-line argument.type + $response = $this->raw->search(params: $params, requestOptions: $requestOptions); + + return $response->parse(); + } +} diff --git a/tests/Services/NewsTest.php b/tests/Services/NewsTest.php new file mode 100644 index 00000000..09fd336b --- /dev/null +++ b/tests/Services/NewsTest.php @@ -0,0 +1,75 @@ +client = $client; + } + + #[Test] + public function testSearch(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->news->search( + searchBy: [ + 'entity' => ['name' => 'xx', 'type' => 'name'], 'type' => 'entity', + ], + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(NewsSearchResponse::class, $result); + } + + #[Test] + public function testSearchWithOptionalParams(): void + { + if (UnsupportedMockTests::$skip) { + $this->markTestSkipped('Mock server tests are disabled'); + } + + $result = $this->client->news->search( + searchBy: [ + 'entity' => ['name' => 'xx', 'type' => 'name'], 'type' => 'entity', + ], + cursor: 'cursor', + filterBy: [ + 'articleLanguage' => ['ar'], + 'articleType' => ['editorial'], + 'date' => ['from' => 0, 'to' => 0], + 'sourceCountry' => ['ae'], + 'sourceDomain' => ['x'], + ], + limit: 1, + sortBy: ['type' => 'relevance'], + tags: ['production', 'team-alpha'], + ); + + // @phpstan-ignore-next-line method.alreadyNarrowedType + $this->assertInstanceOf(NewsSearchResponse::class, $result); + } +} From a64254dff3dec17063acef3ac8b0510148618fe9 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 04:37:35 +0000 Subject: [PATCH 110/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 427b8ec4..21f60560 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.9.0" + ".": "2.10.0" } \ No newline at end of file diff --git a/README.md b/README.md index 8272f7d4..462850f4 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.9.0" +composer require "context-dev/context-dev-php 2.10.0" ``` diff --git a/src/Client.php b/src/Client.php index a13d003c..e49b9e6b 100644 --- a/src/Client.php +++ b/src/Client.php @@ -113,7 +113,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.9.0', + 'X-Stainless-Package-Version' => '2.10.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index fc116866..220673a1 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.9.0'; +const VERSION = '2.10.0'; // x-release-please-end From fcd120897273a524114f512fd03b6cc7841ef91c Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 05:38:39 +0000 Subject: [PATCH 111/130] feat(api): api update --- .stats.yml | 4 +- src/News/NewsSearchResponse.php | 25 ++++++- src/News/NewsSearchResponse/Data.php | 72 +++++++++++++++++-- src/News/NewsSearchResponse/Data/Match_.php | 16 ++++- .../NewsSearchResponse/Data/Match_/Level.php | 3 + src/News/NewsSearchResponse/Data/Source.php | 14 ++++ src/News/NewsSearchResponse/Data/Type.php | 3 + src/News/NewsSearchResponse/Meta.php | 8 +++ 8 files changed, 137 insertions(+), 8 deletions(-) diff --git a/.stats.yml b/.stats.yml index 4b9b1cb6..f9f986bc 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5dbe631ce516ca688273053ddcb58870561bd6dc76fa75df354c954d7af65a3c.yml -openapi_spec_hash: 53a74c4cccbdec8590db38183840a446 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5e890b591fcd62757c51fa1decc2cccc3d52d5a83097b10775507e3485776f73.yml +openapi_spec_hash: 432ee63a7d4ffca7d5993dc0853d9c81 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/News/NewsSearchResponse.php b/src/News/NewsSearchResponse.php index 99ddc019..728aa1f3 100644 --- a/src/News/NewsSearchResponse.php +++ b/src/News/NewsSearchResponse.php @@ -30,16 +30,29 @@ final class NewsSearchResponse implements BaseModel /** @use SdkModel */ use SdkModel; - /** @var list $data */ + /** + * Articles matching the search, in the requested order. + * + * @var list $data + */ #[Required(list: Data::class)] public array $data; + /** + * True when more results are available beyond this page. + */ #[Required('has_more')] public bool $hasMore; + /** + * Summary information about this response. + */ #[Required] public Meta $meta; + /** + * Pass as cursor in the next request to fetch the following page. Null when there are no more results. + */ #[Required('next_cursor')] public ?string $nextCursor; @@ -101,6 +114,8 @@ public static function with( } /** + * Articles matching the search, in the requested order. + * * @param list $data */ public function withData(array $data): self @@ -111,6 +126,9 @@ public function withData(array $data): self return $self; } + /** + * True when more results are available beyond this page. + */ public function withHasMore(bool $hasMore): self { $self = clone $this; @@ -120,6 +138,8 @@ public function withHasMore(bool $hasMore): self } /** + * Summary information about this response. + * * @param Meta|MetaShape $meta */ public function withMeta(Meta|array $meta): self @@ -130,6 +150,9 @@ public function withMeta(Meta|array $meta): self return $self; } + /** + * Pass as cursor in the next request to fetch the following page. Null when there are no more results. + */ public function withNextCursor(?string $nextCursor): self { $self = clone $this; diff --git a/src/News/NewsSearchResponse/Data.php b/src/News/NewsSearchResponse/Data.php index f7a21bad..243f6936 100644 --- a/src/News/NewsSearchResponse/Data.php +++ b/src/News/NewsSearchResponse/Data.php @@ -35,44 +35,79 @@ final class Data implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Stable unique identifier for this article. Use it to deduplicate or reference an article across requests. + */ #[Required] public string $id; - /** @var list $authors */ + /** + * Bylined authors. Empty when no byline is available. + * + * @var list $authors + */ #[Required(list: 'string')] public array $authors; + /** + * Short summary or excerpt of the article, when the publisher provides one. + */ #[Required] public ?string $description; + /** + * Lead image for the article, when one is available. + */ #[Required('image_url')] public ?string $imageURL; + /** + * Language the article is written in, as a lowercase ISO 639-1 code such as en. Null when unknown. + */ #[Required] public ?string $language; + /** + * How the article relates to the company you searched for. + */ #[Required] public Match_ $match; + /** + * When the article was published, as an ISO 8601 timestamp. Null when the publisher does not state a reliable date. + */ #[Required('published_at')] public ?\DateTimeInterface $publishedAt; + /** + * The publication that published the article. + */ #[Required] public Source $source; /** - * Groups matching normalized headlines published on the same UTC day. + * Shared by articles covering the same story on the same day. Use it to group or collapse syndicated copies of one announcement across outlets. */ #[Required('story_id')] public string $storyID; + /** + * Article headline. + */ #[Required] public string $title; - /** @var value-of $type */ + /** + * Kind of coverage. Use it to separate independent reporting (editorial) from company-issued content (press_release, regulatory_filing, advisory). + * + * @var value-of $type + */ #[Required(enum: Type::class)] public string $type; + /** + * Link to the article on the publisher site. + */ #[Required] public string $url; @@ -162,6 +197,9 @@ public static function with( return $self; } + /** + * Stable unique identifier for this article. Use it to deduplicate or reference an article across requests. + */ public function withID(string $id): self { $self = clone $this; @@ -171,6 +209,8 @@ public function withID(string $id): self } /** + * Bylined authors. Empty when no byline is available. + * * @param list $authors */ public function withAuthors(array $authors): self @@ -181,6 +221,9 @@ public function withAuthors(array $authors): self return $self; } + /** + * Short summary or excerpt of the article, when the publisher provides one. + */ public function withDescription(?string $description): self { $self = clone $this; @@ -189,6 +232,9 @@ public function withDescription(?string $description): self return $self; } + /** + * Lead image for the article, when one is available. + */ public function withImageURL(?string $imageURL): self { $self = clone $this; @@ -197,6 +243,9 @@ public function withImageURL(?string $imageURL): self return $self; } + /** + * Language the article is written in, as a lowercase ISO 639-1 code such as en. Null when unknown. + */ public function withLanguage(?string $language): self { $self = clone $this; @@ -206,6 +255,8 @@ public function withLanguage(?string $language): self } /** + * How the article relates to the company you searched for. + * * @param Match_|MatchShape $match */ public function withMatch(Match_|array $match): self @@ -216,6 +267,9 @@ public function withMatch(Match_|array $match): self return $self; } + /** + * When the article was published, as an ISO 8601 timestamp. Null when the publisher does not state a reliable date. + */ public function withPublishedAt(?\DateTimeInterface $publishedAt): self { $self = clone $this; @@ -225,6 +279,8 @@ public function withPublishedAt(?\DateTimeInterface $publishedAt): self } /** + * The publication that published the article. + * * @param Source|SourceShape $source */ public function withSource(Source|array $source): self @@ -236,7 +292,7 @@ public function withSource(Source|array $source): self } /** - * Groups matching normalized headlines published on the same UTC day. + * Shared by articles covering the same story on the same day. Use it to group or collapse syndicated copies of one announcement across outlets. */ public function withStoryID(string $storyID): self { @@ -246,6 +302,9 @@ public function withStoryID(string $storyID): self return $self; } + /** + * Article headline. + */ public function withTitle(string $title): self { $self = clone $this; @@ -255,6 +314,8 @@ public function withTitle(string $title): self } /** + * Kind of coverage. Use it to separate independent reporting (editorial) from company-issued content (press_release, regulatory_filing, advisory). + * * @param Type|value-of $type */ public function withType(Type|string $type): self @@ -265,6 +326,9 @@ public function withType(Type|string $type): self return $self; } + /** + * Link to the article on the publisher site. + */ public function withURL(string $url): self { $self = clone $this; diff --git a/src/News/NewsSearchResponse/Data/Match_.php b/src/News/NewsSearchResponse/Data/Match_.php index c046da10..5d2a07f1 100644 --- a/src/News/NewsSearchResponse/Data/Match_.php +++ b/src/News/NewsSearchResponse/Data/Match_.php @@ -10,6 +10,8 @@ use ContextDev\News\NewsSearchResponse\Data\Match_\Level; /** + * How the article relates to the company you searched for. + * * @phpstan-type MatchShape = array{ * confidence: float|null, level: Level|value-of * } @@ -19,10 +21,17 @@ final class Match_ implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * How confident the match is, from 0 to 1. Null when a score is unavailable. + */ #[Required] public ?float $confidence; - /** @var value-of $level */ + /** + * primary when the article is mainly about the company, secondary when the company is mentioned but is not the main subject. + * + * @var value-of $level + */ #[Required(enum: Level::class)] public string $level; @@ -62,6 +71,9 @@ public static function with(?float $confidence, Level|string $level): self return $self; } + /** + * How confident the match is, from 0 to 1. Null when a score is unavailable. + */ public function withConfidence(?float $confidence): self { $self = clone $this; @@ -71,6 +83,8 @@ public function withConfidence(?float $confidence): self } /** + * primary when the article is mainly about the company, secondary when the company is mentioned but is not the main subject. + * * @param Level|value-of $level */ public function withLevel(Level|string $level): self diff --git a/src/News/NewsSearchResponse/Data/Match_/Level.php b/src/News/NewsSearchResponse/Data/Match_/Level.php index 9f11b385..08be9385 100644 --- a/src/News/NewsSearchResponse/Data/Match_/Level.php +++ b/src/News/NewsSearchResponse/Data/Match_/Level.php @@ -4,6 +4,9 @@ namespace ContextDev\News\NewsSearchResponse\Data\Match_; +/** + * primary when the article is mainly about the company, secondary when the company is mentioned but is not the main subject. + */ enum Level: string { case PRIMARY = 'primary'; diff --git a/src/News/NewsSearchResponse/Data/Source.php b/src/News/NewsSearchResponse/Data/Source.php index 27b0bc83..76a18229 100644 --- a/src/News/NewsSearchResponse/Data/Source.php +++ b/src/News/NewsSearchResponse/Data/Source.php @@ -9,6 +9,8 @@ use ContextDev\Core\Contracts\BaseModel; /** + * The publication that published the article. + * * @phpstan-type SourceShape = array{direct: bool, domain: string, name: string} */ final class Source implements BaseModel @@ -22,9 +24,15 @@ final class Source implements BaseModel #[Required] public bool $direct; + /** + * Website domain of the publication. + */ #[Required] public string $domain; + /** + * Name of the publication, such as Reuters. + */ #[Required] public string $name; @@ -77,6 +85,9 @@ public function withDirect(bool $direct): self return $self; } + /** + * Website domain of the publication. + */ public function withDomain(string $domain): self { $self = clone $this; @@ -85,6 +96,9 @@ public function withDomain(string $domain): self return $self; } + /** + * Name of the publication, such as Reuters. + */ public function withName(string $name): self { $self = clone $this; diff --git a/src/News/NewsSearchResponse/Data/Type.php b/src/News/NewsSearchResponse/Data/Type.php index 42d802a0..a3cb9fc3 100644 --- a/src/News/NewsSearchResponse/Data/Type.php +++ b/src/News/NewsSearchResponse/Data/Type.php @@ -4,6 +4,9 @@ namespace ContextDev\News\NewsSearchResponse\Data; +/** + * Kind of coverage. Use it to separate independent reporting (editorial) from company-issued content (press_release, regulatory_filing, advisory). + */ enum Type: string { case EDITORIAL = 'editorial'; diff --git a/src/News/NewsSearchResponse/Meta.php b/src/News/NewsSearchResponse/Meta.php index e188ea2e..8e0909a3 100644 --- a/src/News/NewsSearchResponse/Meta.php +++ b/src/News/NewsSearchResponse/Meta.php @@ -9,6 +9,8 @@ use ContextDev\Core\Contracts\BaseModel; /** + * Summary information about this response. + * * @phpstan-type MetaShape = array{count: int} */ final class Meta implements BaseModel @@ -16,6 +18,9 @@ final class Meta implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Number of articles in this page. + */ #[Required] public int $count; @@ -52,6 +57,9 @@ public static function with(int $count): self return $self; } + /** + * Number of articles in this page. + */ public function withCount(int $count): self { $self = clone $this; From 57c45e7c8364b2450dc02da4606809d30c799ccb Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 06:44:08 +0000 Subject: [PATCH 112/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index f9f986bc..65e1e030 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5e890b591fcd62757c51fa1decc2cccc3d52d5a83097b10775507e3485776f73.yml -openapi_spec_hash: 432ee63a7d4ffca7d5993dc0853d9c81 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a93ee49f1b1f7a2d95a79fa63dba0c825dcc664198a8d6d42a71c4577342cb3b.yml +openapi_spec_hash: 62ec48956bfb06100953840ac780e93f config_hash: 0fb0ceca5946298c416cec0cca5260c7 From 7c11a63d12f66fec19a872b96a3202cd66d5988f Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 17 Aug 2026 06:59:07 +0000 Subject: [PATCH 113/130] feat(api): api update --- .stats.yml | 4 +-- src/Brand/BrandGetResponse/Brand/Color.php | 36 +++++++++++++++++-- .../BrandGetResponse/Brand/Color/Source.php | 15 ++++++++ .../Brand/Color.php | 36 +++++++++++++++++-- .../Brand/Color/Source.php | 15 ++++++++ 5 files changed, 98 insertions(+), 8 deletions(-) create mode 100644 src/Brand/BrandGetResponse/Brand/Color/Source.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/Brand/Color/Source.php diff --git a/.stats.yml b/.stats.yml index 65e1e030..01e56c81 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a93ee49f1b1f7a2d95a79fa63dba0c825dcc664198a8d6d42a71c4577342cb3b.yml -openapi_spec_hash: 62ec48956bfb06100953840ac780e93f +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-f23ab92b85d838bfa0c2741f96f4bf7acf09a22cc17aa88d78ae8a1cafb0c7f0.yml +openapi_spec_hash: 641b62af26fa7bc744bbebc50aeb2ac6 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/Brand/BrandGetResponse/Brand/Color.php b/src/Brand/BrandGetResponse/Brand/Color.php index 5f07da93..aedc2636 100644 --- a/src/Brand/BrandGetResponse/Brand/Color.php +++ b/src/Brand/BrandGetResponse/Brand/Color.php @@ -4,12 +4,15 @@ namespace ContextDev\Brand\BrandGetResponse\Brand; +use ContextDev\Brand\BrandGetResponse\Brand\Color\Source; use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** - * @phpstan-type ColorShape = array{hex?: string|null, name?: string|null} + * @phpstan-type ColorShape = array{ + * hex?: string|null, name?: string|null, source?: null|Source|value-of + * } */ final class Color implements BaseModel { @@ -28,6 +31,14 @@ final class Color implements BaseModel #[Optional] public ?string $name; + /** + * Where the color was observed: 'site' colors come from the website's own theme signals (rendered page colors, manifest, theme-color meta), 'logo' colors from logo image pixels. + * + * @var value-of|null $source + */ + #[Optional(enum: Source::class)] + public ?string $source; + public function __construct() { $this->initialize(); @@ -37,13 +48,19 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param Source|value-of|null $source */ - public static function with(?string $hex = null, ?string $name = null): self - { + public static function with( + ?string $hex = null, + ?string $name = null, + Source|string|null $source = null + ): self { $self = new self; null !== $hex && $self['hex'] = $hex; null !== $name && $self['name'] = $name; + null !== $source && $self['source'] = $source; return $self; } @@ -69,4 +86,17 @@ public function withName(string $name): self return $self; } + + /** + * Where the color was observed: 'site' colors come from the website's own theme signals (rendered page colors, manifest, theme-color meta), 'logo' colors from logo image pixels. + * + * @param Source|value-of $source + */ + public function withSource(Source|string $source): self + { + $self = clone $this; + $self['source'] = $source; + + return $self; + } } diff --git a/src/Brand/BrandGetResponse/Brand/Color/Source.php b/src/Brand/BrandGetResponse/Brand/Color/Source.php new file mode 100644 index 00000000..c70a0aa4 --- /dev/null +++ b/src/Brand/BrandGetResponse/Brand/Color/Source.php @@ -0,0 +1,15 @@ + + * } */ final class Color implements BaseModel { @@ -28,6 +31,14 @@ final class Color implements BaseModel #[Optional] public ?string $name; + /** + * Where the color was observed: 'site' colors come from the website's own theme signals (rendered page colors, manifest, theme-color meta), 'logo' colors from logo image pixels. + * + * @var value-of|null $source + */ + #[Optional(enum: Source::class)] + public ?string $source; + public function __construct() { $this->initialize(); @@ -37,13 +48,19 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param Source|value-of|null $source */ - public static function with(?string $hex = null, ?string $name = null): self - { + public static function with( + ?string $hex = null, + ?string $name = null, + Source|string|null $source = null + ): self { $self = new self; null !== $hex && $self['hex'] = $hex; null !== $name && $self['name'] = $name; + null !== $source && $self['source'] = $source; return $self; } @@ -69,4 +86,17 @@ public function withName(string $name): self return $self; } + + /** + * Where the color was observed: 'site' colors come from the website's own theme signals (rendered page colors, manifest, theme-color meta), 'logo' colors from logo image pixels. + * + * @param Source|value-of $source + */ + public function withSource(Source|string $source): self + { + $self = clone $this; + $self['source'] = $source; + + return $self; + } } diff --git a/src/Brand/BrandGetSimplifiedResponse/Brand/Color/Source.php b/src/Brand/BrandGetSimplifiedResponse/Brand/Color/Source.php new file mode 100644 index 00000000..6f1fc874 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/Brand/Color/Source.php @@ -0,0 +1,15 @@ + Date: Tue, 18 Aug 2026 02:28:40 +0000 Subject: [PATCH 114/130] chore(internal): codegen related update --- src/Core/BaseClient.php | 5 +---- src/Core/Concerns/SdkModel.php | 20 ++++++++++++++++++++ src/Core/Util.php | 2 +- 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Core/BaseClient.php b/src/Core/BaseClient.php index 2db4ea47..4aec6545 100644 --- a/src/Core/BaseClient.php +++ b/src/Core/BaseClient.php @@ -130,10 +130,7 @@ protected function buildRequest( $parsedPath = Util::parsePath($path); /** @var array $mergedQuery */ - $mergedQuery = array_merge_recursive( - $query, - $options->extraQueryParams ?? [] - ); + $mergedQuery = [...$query, ...($options->extraQueryParams ?? [])]; $uri = Util::joinUri($this->baseUrl, path: $parsedPath, query: $mergedQuery)->__toString(); $idempotencyHeaders = $this->idempotencyHeader && !array_key_exists($this->idempotencyHeader, array: $headers) ? [$this->idempotencyHeader => $this->generateIdempotencyKey()] diff --git a/src/Core/Concerns/SdkModel.php b/src/Core/Concerns/SdkModel.php index c5c096e1..289c50bd 100644 --- a/src/Core/Concerns/SdkModel.php +++ b/src/Core/Concerns/SdkModel.php @@ -97,6 +97,26 @@ public function __get(string $key): mixed return null; } + /** + * @internal + * + * Like {@link __unserialize()}, but for raw API payloads, whose keys are + * API property names rather than PHP property names + * + * @param array $data + */ + public function unserializeFromApiPayload(array $data): void + { + foreach (self::$converter->properties as $name => $info) { + if ($name !== $info->apiName && array_key_exists($info->apiName, array: $data)) { + $data[$name] = $data[$info->apiName]; + unset($data[$info->apiName]); + } + } + + $this->__unserialize($data); + } + /** * @internal * diff --git a/src/Core/Util.php b/src/Core/Util.php index c1634798..e0e1f87d 100644 --- a/src/Core/Util.php +++ b/src/Core/Util.php @@ -207,7 +207,7 @@ public static function joinUri( parse_str($base->getQuery(), $q1); parse_str($parsed['query'] ?? '', $q2); - $mergedQuery = array_merge_recursive($q1, $q2, $query); + $mergedQuery = [...$q1, ...$q2, ...$query]; /** @var array */ $normalizedQuery = self::mapRecursive( From fcf5372fb7b5b04e90a6cde38df0f2722b8debd4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 03:25:12 +0000 Subject: [PATCH 115/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 2 ++ src/Services/WebRawService.php | 1 + src/Services/WebService.php | 3 +++ src/Web/WebScreenshotParams.php | 20 ++++++++++++++++++++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 01e56c81..5c58535d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-f23ab92b85d838bfa0c2741f96f4bf7acf09a22cc17aa88d78ae8a1cafb0c7f0.yml -openapi_spec_hash: 641b62af26fa7bc744bbebc50aeb2ac6 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0e9f5a245a9ad4bf712a35826463af573957da6d3714136cfab643140664566.yml +openapi_spec_hash: 20f2776cd458320c8b66fec4ec4f9332 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 06b16542..ddf3b087 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -150,6 +150,7 @@ public function extractStyleguide( /** * @api * + * @param bool $clearPopups Optional parameter for comprehensive popup cleanup. If 'true', the browser dismisses detected cookie/consent UI and clears other detected obstructive popups and overlays before capture. If 'false' or not provided, this parameter requests no cleanup; handleCookiePopup can still request cookie/consent handling independently. * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * @param Country|value-of $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. @@ -169,6 +170,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( + bool $clearPopups = false, \ContextDev\Web\WebScreenshotParams\ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 953cac31..12cb21d7 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -231,6 +231,7 @@ public function extractStyleguide( * Capture a screenshot of a website. * * @param array{ + * clearPopups?: bool, * colorScheme?: WebScreenshotParams\ColorScheme|value-of, * country?: value-of, * directURL?: string, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index acf43adb..e4a40192 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -246,6 +246,7 @@ public function extractStyleguide( * * Capture a screenshot of a website. * + * @param bool $clearPopups Optional parameter for comprehensive popup cleanup. If 'true', the browser dismisses detected cookie/consent UI and clears other detected obstructive popups and overlays before capture. If 'false' or not provided, this parameter requests no cleanup; handleCookiePopup can still request cookie/consent handling independently. * @param \ContextDev\Web\WebScreenshotParams\ColorScheme|value-of<\ContextDev\Web\WebScreenshotParams\ColorScheme> $colorScheme Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * @param Country|value-of $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param string $directURL A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https://example.com/pricing'). When provided, the screenshot is taken of this exact URL. You must provide either 'domain' or 'directUrl', but not both. @@ -265,6 +266,7 @@ public function extractStyleguide( * @throws APIException */ public function screenshot( + bool $clearPopups = false, \ContextDev\Web\WebScreenshotParams\ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, @@ -283,6 +285,7 @@ public function screenshot( ): WebScreenshotResponse { $params = Util::removeNulls( [ + 'clearPopups' => $clearPopups, 'colorScheme' => $colorScheme, 'country' => $country, 'directURL' => $directURL, diff --git a/src/Web/WebScreenshotParams.php b/src/Web/WebScreenshotParams.php index 0b40e884..43e83465 100644 --- a/src/Web/WebScreenshotParams.php +++ b/src/Web/WebScreenshotParams.php @@ -23,6 +23,7 @@ * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * * @phpstan-type WebScreenshotParamsShape = array{ + * clearPopups?: bool|null, * colorScheme?: null|ColorScheme|value-of, * country?: null|Country|value-of, * directURL?: string|null, @@ -45,6 +46,12 @@ final class WebScreenshotParams implements BaseModel use SdkModel; use SdkParams; + /** + * Optional parameter for comprehensive popup cleanup. If 'true', the browser dismisses detected cookie/consent UI and clears other detected obstructive popups and overlays before capture. If 'false' or not provided, this parameter requests no cleanup; handleCookiePopup can still request cookie/consent handling independently. + */ + #[Optional] + public ?bool $clearPopups; + /** * Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * @@ -160,6 +167,7 @@ public function __construct() * @param Zdr|value-of|null $zdr */ public static function with( + ?bool $clearPopups = null, ColorScheme|string|null $colorScheme = null, Country|string|null $country = null, ?string $directURL = null, @@ -177,6 +185,7 @@ public static function with( ): self { $self = new self; + null !== $clearPopups && $self['clearPopups'] = $clearPopups; null !== $colorScheme && $self['colorScheme'] = $colorScheme; null !== $country && $self['country'] = $country; null !== $directURL && $self['directURL'] = $directURL; @@ -195,6 +204,17 @@ public static function with( return $self; } + /** + * Optional parameter for comprehensive popup cleanup. If 'true', the browser dismisses detected cookie/consent UI and clears other detected obstructive popups and overlays before capture. If 'false' or not provided, this parameter requests no cleanup; handleCookiePopup can still request cookie/consent handling independently. + */ + public function withClearPopups(bool $clearPopups): self + { + $self = clone $this; + $self['clearPopups'] = $clearPopups; + + return $self; + } + /** * Optional parameter to choose the site's visual theme in the screenshot. Use 'light' or 'dark' when the site offers both appearances. * From f5843bb77afd9eeeb7e66f974b6904cf51f94dce Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 04:33:42 +0000 Subject: [PATCH 116/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 5c58535d..60361a56 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-a0e9f5a245a9ad4bf712a35826463af573957da6d3714136cfab643140664566.yml -openapi_spec_hash: 20f2776cd458320c8b66fec4ec4f9332 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-813f97d04b6924bbbeb1a89dd8f0d7b38d3241bd0126338fa00ddcb094ab6893.yml +openapi_spec_hash: 3fee1c958d5414b88e964062ea4cc808 config_hash: 0fb0ceca5946298c416cec0cca5260c7 From 179c97f83fe50998b9388327e05bb5a2be545582 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 06:17:00 +0000 Subject: [PATCH 117/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 60361a56..9673209d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-813f97d04b6924bbbeb1a89dd8f0d7b38d3241bd0126338fa00ddcb094ab6893.yml -openapi_spec_hash: 3fee1c958d5414b88e964062ea4cc808 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b0c72d2fe5911c9ce155275b954198bf2152e915a7e5b9f719aad50e222b9ef8.yml +openapi_spec_hash: 5cf943ea5718059b7975417b012cee28 config_hash: 0fb0ceca5946298c416cec0cca5260c7 From 8973ea47557c5a27cc835785889cd45c8bae86df Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 08:00:37 +0000 Subject: [PATCH 118/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 21f60560..e6c39adb 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.10.0" + ".": "2.11.0" } \ No newline at end of file diff --git a/README.md b/README.md index 462850f4..e315b064 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.10.0" +composer require "context-dev/context-dev-php 2.11.0" ``` diff --git a/src/Client.php b/src/Client.php index e49b9e6b..b1e6715e 100644 --- a/src/Client.php +++ b/src/Client.php @@ -113,7 +113,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.10.0', + 'X-Stainless-Package-Version' => '2.11.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 220673a1..41b0b980 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.10.0'; +const VERSION = '2.11.0'; // x-release-please-end From 28074ac40ffa3a379c2bf5bbc4eb33bdcf168e49 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 09:02:55 +0000 Subject: [PATCH 119/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 9673209d..21c2cfca 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-b0c72d2fe5911c9ce155275b954198bf2152e915a7e5b9f719aad50e222b9ef8.yml -openapi_spec_hash: 5cf943ea5718059b7975417b012cee28 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5f711a43f60f18016c38794f4dbd4fa86221e2ac2e50f9875ae84f5a247db136.yml +openapi_spec_hash: 1000553b31fbfe8574b5c7ed47b2166e config_hash: 0fb0ceca5946298c416cec0cca5260c7 From 4075e9c7cb5cbd70819d85de3664303e5f6a12db Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 09:40:13 +0000 Subject: [PATCH 120/130] feat(api): api update --- .stats.yml | 4 ++-- src/News/NewsSearchParams/FilterBy/SourceCountry.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 21c2cfca..ab4d4010 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-5f711a43f60f18016c38794f4dbd4fa86221e2ac2e50f9875ae84f5a247db136.yml -openapi_spec_hash: 1000553b31fbfe8574b5c7ed47b2166e +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-f6a6ca581fd279a5c8028e3e00d84fd5114c0ba206f15e84c24d8abeedbf47d9.yml +openapi_spec_hash: 07010001ef5726f6f0f6ecdea1b36b51 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/News/NewsSearchParams/FilterBy/SourceCountry.php b/src/News/NewsSearchParams/FilterBy/SourceCountry.php index 3919e6a6..efc6d816 100644 --- a/src/News/NewsSearchParams/FilterBy/SourceCountry.php +++ b/src/News/NewsSearchParams/FilterBy/SourceCountry.php @@ -20,6 +20,8 @@ enum SourceCountry: string case CL = 'cl'; + case CZ = 'cz'; + case DE = 'de'; case FI = 'fi'; From 118ca14bd39f0e6338e91a8888056c22f4e218e4 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 18 Aug 2026 12:28:34 +0000 Subject: [PATCH 121/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ab4d4010..91ac12dd 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-f6a6ca581fd279a5c8028e3e00d84fd5114c0ba206f15e84c24d8abeedbf47d9.yml -openapi_spec_hash: 07010001ef5726f6f0f6ecdea1b36b51 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-29a5e9392b60f02d4c19d457b92666bf54d49479670e719f36f23a5d3943f188.yml +openapi_spec_hash: 8a9c44d740853834fb6d7174013c1984 config_hash: 0fb0ceca5946298c416cec0cca5260c7 From 9b65e0fe4d41c4ded7899ca8311e181cc01d69bd Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 02:21:39 +0000 Subject: [PATCH 122/130] feat(api): api update --- .stats.yml | 4 ++-- src/ServiceContracts/WebContract.php | 6 +++--- src/Services/WebService.php | 6 +++--- src/Web/WebWebCrawlMdParams.php | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.stats.yml b/.stats.yml index 91ac12dd..44d16009 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-29a5e9392b60f02d4c19d457b92666bf54d49479670e719f36f23a5d3943f188.yml -openapi_spec_hash: 8a9c44d740853834fb6d7174013c1984 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d4c568ebc1a0f853b02c55ba800c7d7b66189bc6dd22c3cb565a81361c832e2b.yml +openapi_spec_hash: 9a0ecdc06874eee29a3a58a699923405 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index ddf3b087..d09ef462 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -239,9 +239,9 @@ public function search( * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. + * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. An automatic prefix scope in the form ^ follows a redirect of the starting page. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * @param int $waitForMs Browser wait time in milliseconds after initial page load for each crawled page. Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds). * @param \ContextDev\Web\WebWebCrawlMdParams\Zdr|value-of<\ContextDev\Web\WebWebCrawlMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * @@ -269,7 +269,7 @@ public function webCrawlMd( ?int $timeoutMs = null, ?string $urlRegex = null, bool $useMainContentOnly = false, - ?int $waitForMs = null, + int $waitForMs = 3500, \ContextDev\Web\WebWebCrawlMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebCrawlMdResponse; diff --git a/src/Services/WebService.php b/src/Services/WebService.php index e4a40192..ca137c07 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -384,9 +384,9 @@ public function search( * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. After each scrape, the crawler checks the elapsed time and, if exceeded, returns the pages collected so far instead of continuing. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). - * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. + * @param string $urlRegex Regex pattern. Only URLs matching this pattern will be followed and scraped. An automatic prefix scope in the form ^ follows a redirect of the starting page. * @param bool $useMainContentOnly Extract only the main content, stripping headers, footers, sidebars, and navigation - * @param int $waitForMs Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * @param int $waitForMs Browser wait time in milliseconds after initial page load for each crawled page. Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds). * @param \ContextDev\Web\WebWebCrawlMdParams\Zdr|value-of<\ContextDev\Web\WebWebCrawlMdParams\Zdr> $zdr Set to enabled to bypass shared caches and omit request and response content from retained usage logs. Requires zero data retention to be enabled for your organization (contact support@context.dev), otherwise the request fails with ZDR_NOT_ENABLED. Successful ZDR responses include X-Context-ZDR: true. * @param RequestOpts|null $requestOptions * @@ -414,7 +414,7 @@ public function webCrawlMd( ?int $timeoutMs = null, ?string $urlRegex = null, bool $useMainContentOnly = false, - ?int $waitForMs = null, + int $waitForMs = 3500, \ContextDev\Web\WebWebCrawlMdParams\Zdr|string $zdr = 'disabled', RequestOptions|array|null $requestOptions = null, ): WebWebCrawlMdResponse { diff --git a/src/Web/WebWebCrawlMdParams.php b/src/Web/WebWebCrawlMdParams.php index 316c3e52..5979957b 100644 --- a/src/Web/WebWebCrawlMdParams.php +++ b/src/Web/WebWebCrawlMdParams.php @@ -161,7 +161,7 @@ final class WebWebCrawlMdParams implements BaseModel public ?int $timeoutMs; /** - * Regex pattern. Only URLs matching this pattern will be followed and scraped. + * Regex pattern. Only URLs matching this pattern will be followed and scraped. An automatic prefix scope in the form ^ follows a redirect of the starting page. */ #[Optional] public ?string $urlRegex; @@ -173,7 +173,7 @@ final class WebWebCrawlMdParams implements BaseModel public ?bool $useMainContentOnly; /** - * Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * Browser wait time in milliseconds after initial page load for each crawled page. Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds). */ #[Optional] public ?int $waitForMs; @@ -466,7 +466,7 @@ public function withTimeoutMs(int $timeoutMs): self } /** - * Regex pattern. Only URLs matching this pattern will be followed and scraped. + * Regex pattern. Only URLs matching this pattern will be followed and scraped. An automatic prefix scope in the form ^ follows a redirect of the starting page. */ public function withURLRegex(string $urlRegex): self { @@ -488,7 +488,7 @@ public function withUseMainContentOnly(bool $useMainContentOnly): self } /** - * Optional browser wait time in milliseconds after initial page load for each crawled page. Min: 0. Max: 30000 (30 seconds). + * Browser wait time in milliseconds after initial page load for each crawled page. Defaults to 3500 (3.5 seconds). Min: 0. Max: 30000 (30 seconds). */ public function withWaitForMs(int $waitForMs): self { From fc87eee2ee566d4e96d3d8a79f9fc1974a4cdbe5 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Aug 2026 07:22:11 +0000 Subject: [PATCH 123/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index 44d16009..e115f20f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-d4c568ebc1a0f853b02c55ba800c7d7b66189bc6dd22c3cb565a81361c832e2b.yml -openapi_spec_hash: 9a0ecdc06874eee29a3a58a699923405 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7e6b2353ee8631f506bd8ef7657f1684cddf84805c01d89c691d7f98c42127f7.yml +openapi_spec_hash: b63b980d90fc9c2b896b2739a8e15a59 config_hash: 0fb0ceca5946298c416cec0cca5260c7 From 874440953a974eecb45f6b35e62ccfc269c91413 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 21 Aug 2026 10:55:04 +0000 Subject: [PATCH 124/130] feat(api): api update --- .stats.yml | 4 +- src/AI/AIExtractProductResponse/Product.php | 72 ++++++++ .../Product/Availability.php | 25 +++ src/AI/AIExtractProductsResponse/Product.php | 72 ++++++++ .../Product/Availability.php | 25 +++ src/ServiceContracts/WebContract.php | 19 +- src/Services/WebRawService.php | 14 +- src/Services/WebService.php | 20 ++- src/Web/WebExtractParams.php | 36 +++- src/Web/WebExtractParams/Action.php | 41 +++++ .../Action/WebScrapePerformAction.php | 79 ++++++++ .../Action/WebScrapeWaitAction.php | 79 ++++++++ src/Web/WebExtractResponse/Metadata.php | 31 ++++ .../Metadata/ActionsApplied.php | 170 ++++++++++++++++++ .../Metadata/ActionsApplied/Status.php | 17 ++ tests/Services/WebTest.php | 1 + 16 files changed, 677 insertions(+), 28 deletions(-) create mode 100644 src/AI/AIExtractProductResponse/Product/Availability.php create mode 100644 src/AI/AIExtractProductsResponse/Product/Availability.php create mode 100644 src/Web/WebExtractParams/Action.php create mode 100644 src/Web/WebExtractParams/Action/WebScrapePerformAction.php create mode 100644 src/Web/WebExtractParams/Action/WebScrapeWaitAction.php create mode 100644 src/Web/WebExtractResponse/Metadata/ActionsApplied.php create mode 100644 src/Web/WebExtractResponse/Metadata/ActionsApplied/Status.php diff --git a/.stats.yml b/.stats.yml index e115f20f..4aa99bd0 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-7e6b2353ee8631f506bd8ef7657f1684cddf84805c01d89c691d7f98c42127f7.yml -openapi_spec_hash: b63b980d90fc9c2b896b2739a8e15a59 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-bf7ffa610bd4a02ea5bcb157521d17a041a48f78d87bf8fe8d812d3cbb87b489.yml +openapi_spec_hash: 90142d96969dea44c46a01abb683c426 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/AI/AIExtractProductResponse/Product.php b/src/AI/AIExtractProductResponse/Product.php index 5aa93102..be85873b 100644 --- a/src/AI/AIExtractProductResponse/Product.php +++ b/src/AI/AIExtractProductResponse/Product.php @@ -4,6 +4,7 @@ namespace ContextDev\AI\AIExtractProductResponse; +use ContextDev\AI\AIExtractProductResponse\Product\Availability; use ContextDev\AI\AIExtractProductResponse\Product\BillingFrequency; use ContextDev\AI\AIExtractProductResponse\Product\PricingModel; use ContextDev\Core\Attributes\Optional; @@ -22,12 +23,15 @@ * sku: string|null, * tags: list, * targetAudience: list, + * availability?: null|Availability|value-of, * billingFrequency?: null|BillingFrequency|value-of, * category?: string|null, * currency?: string|null, + * dimensions?: list|null, * imageURL?: string|null, * price?: float|null, * pricingModel?: null|PricingModel|value-of, + * regularPrice?: float|null, * url?: string|null, * } */ @@ -86,6 +90,14 @@ final class Product implements BaseModel #[Required('target_audience', list: 'string')] public array $targetAudience; + /** + * Normalized stock or ordering availability. + * + * @var value-of|null $availability + */ + #[Optional(enum: Availability::class, nullable: true)] + public ?string $availability; + /** * Billing frequency for the product. * @@ -110,6 +122,14 @@ enum: BillingFrequency::class, #[Optional(nullable: true)] public ?string $currency; + /** + * Dimension statements shown for the product, preserving labels, values, and units. + * + * @var list|null $dimensions + */ + #[Optional(list: 'string')] + public ?array $dimensions; + /** * URL to the product image. */ @@ -130,6 +150,12 @@ enum: BillingFrequency::class, #[Optional('pricing_model', enum: PricingModel::class, nullable: true)] public ?string $pricingModel; + /** + * Original or regular price before a displayed discount. + */ + #[Optional('regular_price', nullable: true)] + public ?float $regularPrice; + /** * URL to the product page. */ @@ -179,7 +205,9 @@ public function __construct() * @param list $images * @param list $tags * @param list $targetAudience + * @param Availability|value-of|null $availability * @param BillingFrequency|value-of|null $billingFrequency + * @param list|null $dimensions * @param PricingModel|value-of|null $pricingModel */ public static function with( @@ -190,12 +218,15 @@ public static function with( ?string $sku, array $tags, array $targetAudience, + Availability|string|null $availability = null, BillingFrequency|string|null $billingFrequency = null, ?string $category = null, ?string $currency = null, + ?array $dimensions = null, ?string $imageURL = null, ?float $price = null, PricingModel|string|null $pricingModel = null, + ?float $regularPrice = null, ?string $url = null, ): self { $self = new self; @@ -208,12 +239,15 @@ public static function with( $self['tags'] = $tags; $self['targetAudience'] = $targetAudience; + null !== $availability && $self['availability'] = $availability; null !== $billingFrequency && $self['billingFrequency'] = $billingFrequency; null !== $category && $self['category'] = $category; null !== $currency && $self['currency'] = $currency; + null !== $dimensions && $self['dimensions'] = $dimensions; null !== $imageURL && $self['imageURL'] = $imageURL; null !== $price && $self['price'] = $price; null !== $pricingModel && $self['pricingModel'] = $pricingModel; + null !== $regularPrice && $self['regularPrice'] = $regularPrice; null !== $url && $self['url'] = $url; return $self; @@ -304,6 +338,20 @@ public function withTargetAudience(array $targetAudience): self return $self; } + /** + * Normalized stock or ordering availability. + * + * @param Availability|value-of|null $availability + */ + public function withAvailability( + Availability|string|null $availability + ): self { + $self = clone $this; + $self['availability'] = $availability; + + return $self; + } + /** * Billing frequency for the product. * @@ -340,6 +388,19 @@ public function withCurrency(?string $currency): self return $self; } + /** + * Dimension statements shown for the product, preserving labels, values, and units. + * + * @param list $dimensions + */ + public function withDimensions(array $dimensions): self + { + $self = clone $this; + $self['dimensions'] = $dimensions; + + return $self; + } + /** * URL to the product image. */ @@ -376,6 +437,17 @@ public function withPricingModel( return $self; } + /** + * Original or regular price before a displayed discount. + */ + public function withRegularPrice(?float $regularPrice): self + { + $self = clone $this; + $self['regularPrice'] = $regularPrice; + + return $self; + } + /** * URL to the product page. */ diff --git a/src/AI/AIExtractProductResponse/Product/Availability.php b/src/AI/AIExtractProductResponse/Product/Availability.php new file mode 100644 index 00000000..da8e62e4 --- /dev/null +++ b/src/AI/AIExtractProductResponse/Product/Availability.php @@ -0,0 +1,25 @@ +, * targetAudience: list, + * availability?: null|Availability|value-of, * billingFrequency?: null|BillingFrequency|value-of, * category?: string|null, * currency?: string|null, + * dimensions?: list|null, * imageURL?: string|null, * price?: float|null, * pricingModel?: null|PricingModel|value-of, + * regularPrice?: float|null, * url?: string|null, * } */ @@ -84,6 +88,14 @@ final class Product implements BaseModel #[Required('target_audience', list: 'string')] public array $targetAudience; + /** + * Normalized stock or ordering availability. + * + * @var value-of|null $availability + */ + #[Optional(enum: Availability::class, nullable: true)] + public ?string $availability; + /** * Billing frequency for the product. * @@ -108,6 +120,14 @@ enum: BillingFrequency::class, #[Optional(nullable: true)] public ?string $currency; + /** + * Dimension statements shown for the product, preserving labels, values, and units. + * + * @var list|null $dimensions + */ + #[Optional(list: 'string')] + public ?array $dimensions; + /** * URL to the product image. */ @@ -128,6 +148,12 @@ enum: BillingFrequency::class, #[Optional('pricing_model', enum: PricingModel::class, nullable: true)] public ?string $pricingModel; + /** + * Original or regular price before a displayed discount. + */ + #[Optional('regular_price', nullable: true)] + public ?float $regularPrice; + /** * URL to the product page. */ @@ -177,7 +203,9 @@ public function __construct() * @param list $images * @param list $tags * @param list $targetAudience + * @param Availability|value-of|null $availability * @param BillingFrequency|value-of|null $billingFrequency + * @param list|null $dimensions * @param PricingModel|value-of|null $pricingModel */ public static function with( @@ -188,12 +216,15 @@ public static function with( ?string $sku, array $tags, array $targetAudience, + Availability|string|null $availability = null, BillingFrequency|string|null $billingFrequency = null, ?string $category = null, ?string $currency = null, + ?array $dimensions = null, ?string $imageURL = null, ?float $price = null, PricingModel|string|null $pricingModel = null, + ?float $regularPrice = null, ?string $url = null, ): self { $self = new self; @@ -206,12 +237,15 @@ public static function with( $self['tags'] = $tags; $self['targetAudience'] = $targetAudience; + null !== $availability && $self['availability'] = $availability; null !== $billingFrequency && $self['billingFrequency'] = $billingFrequency; null !== $category && $self['category'] = $category; null !== $currency && $self['currency'] = $currency; + null !== $dimensions && $self['dimensions'] = $dimensions; null !== $imageURL && $self['imageURL'] = $imageURL; null !== $price && $self['price'] = $price; null !== $pricingModel && $self['pricingModel'] = $pricingModel; + null !== $regularPrice && $self['regularPrice'] = $regularPrice; null !== $url && $self['url'] = $url; return $self; @@ -302,6 +336,20 @@ public function withTargetAudience(array $targetAudience): self return $self; } + /** + * Normalized stock or ordering availability. + * + * @param Availability|value-of|null $availability + */ + public function withAvailability( + Availability|string|null $availability + ): self { + $self = clone $this; + $self['availability'] = $availability; + + return $self; + } + /** * Billing frequency for the product. * @@ -338,6 +386,19 @@ public function withCurrency(?string $currency): self return $self; } + /** + * Dimension statements shown for the product, preserving labels, values, and units. + * + * @param list $dimensions + */ + public function withDimensions(array $dimensions): self + { + $self = clone $this; + $self['dimensions'] = $dimensions; + + return $self; + } + /** * URL to the product image. */ @@ -374,6 +435,17 @@ public function withPricingModel( return $self; } + /** + * Original or regular price before a displayed discount. + */ + public function withRegularPrice(?float $regularPrice): self + { + $self = clone $this; + $self['regularPrice'] = $regularPrice; + + return $self; + } + /** * URL to the product page. */ diff --git a/src/AI/AIExtractProductsResponse/Product/Availability.php b/src/AI/AIExtractProductsResponse/Product/Availability.php new file mode 100644 index 00000000..f1ce214c --- /dev/null +++ b/src/AI/AIExtractProductsResponse/Product/Availability.php @@ -0,0 +1,25 @@ + $schema JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * @param array $schema JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. * @param string $url The starting website URL to crawl and extract from. Must include http:// or https://. + * @param list $actions Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. * @param bool $factCheck When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. * @param bool $followSubdomains when true, follow links on subdomains of the starting URL's domain * @param bool $includeFrames when true, iframe contents are included in Markdown before extraction @@ -57,7 +59,7 @@ interface WebContract * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. * @param Pdf|PdfShape $pdf * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are provided. * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page @@ -68,6 +70,7 @@ interface WebContract public function extract( array $schema, string $url, + ?array $actions = null, bool $factCheck = false, bool $followSubdomains = false, bool $includeFrames = false, @@ -278,7 +281,7 @@ public function webCrawlMd( * @api * * @param string $url Full URL to scrape (must include http:// or https:// protocol) - * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -321,7 +324,7 @@ public function webScrapeHTML( * @api * * @param string $url Page URL to inspect. Must include http:// or https://. - * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -350,7 +353,7 @@ public function webScrapeImages( * @api * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) - * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. diff --git a/src/Services/WebRawService.php b/src/Services/WebRawService.php index 12cb21d7..f0359907 100644 --- a/src/Services/WebRawService.php +++ b/src/Services/WebRawService.php @@ -44,15 +44,16 @@ use ContextDev\Web\WebWebScrapeSitemapResponse; /** + * @phpstan-import-type ActionShape from \ContextDev\Web\WebExtractParams\Action * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 - * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action as ActionShape1 * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 - * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape2 * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment - * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape3 * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ @@ -72,6 +73,7 @@ public function __construct(private Client $client) {} * @param array{ * schema: array, * url: string, + * actions?: list, * factCheck?: bool, * followSubdomains?: bool, * includeFrames?: bool, @@ -377,7 +379,7 @@ public function webCrawlMd( * * @param array{ * url: string, - * actions?: list|null, + * actions?: list|null, * country?: value-of, * excludeSelectors?: list|null, * headers?: array, @@ -424,7 +426,7 @@ public function webScrapeHTML( * * @param array{ * url: string, - * actions?: list|null, + * actions?: list|null, * dedupe?: bool, * enrichment?: Enrichment|EnrichmentShape|null, * headers?: array, @@ -483,7 +485,7 @@ public function webScrapeImages( * * @param array{ * url: string, - * actions?: list|null, + * actions?: list|null, * country?: value-of, * excludeSelectors?: list|null, * headers?: array, diff --git a/src/Services/WebService.php b/src/Services/WebService.php index ca137c07..737f1203 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -32,15 +32,16 @@ use ContextDev\Web\WebWebScrapeSitemapResponse; /** + * @phpstan-import-type ActionShape from \ContextDev\Web\WebExtractParams\Action * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf * @phpstan-import-type ViewportShape from \ContextDev\Web\WebScreenshotParams\Viewport * @phpstan-import-type MarkdownOptionsShape from \ContextDev\Web\WebSearchParams\MarkdownOptions * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebCrawlMdParams\Pdf as PdfShape1 - * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeHTMLParams\Action as ActionShape1 * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeHTMLParams\Pdf as PdfShape2 - * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape1 + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeImagesParams\Action as ActionShape2 * @phpstan-import-type EnrichmentShape from \ContextDev\Web\WebWebScrapeImagesParams\Enrichment - * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape2 + * @phpstan-import-type ActionShape from \ContextDev\Web\WebWebScrapeMdParams\Action as ActionShape3 * @phpstan-import-type PdfShape from \ContextDev\Web\WebWebScrapeMdParams\Pdf as PdfShape3 * @phpstan-import-type RequestOpts from \ContextDev\RequestOptions */ @@ -64,8 +65,9 @@ public function __construct(private Client $client) * * Crawl a website, use the provided JSON Schema and instructions to prioritize relevant internal links, and extract structured data from the selected pages. * - * @param array $schema JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * @param array $schema JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. * @param string $url The starting website URL to crawl and extract from. Must include http:// or https://. + * @param list $actions Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. * @param bool $factCheck When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. * @param bool $followSubdomains when true, follow links on subdomains of the starting URL's domain * @param bool $includeFrames when true, iframe contents are included in Markdown before extraction @@ -75,7 +77,7 @@ public function __construct(private Client $client) * @param int $maxPages Maximum number of pages to analyze for extraction. Hard cap: 50. Defaults to 5. * @param Pdf|PdfShape $pdf * @param bool $settleAnimations When true, waits briefly for CSS and transition animations to settle before extracting each crawled page. Defaults to false. This adds a bit of latency in exchange for more stable output on animated pages. - * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * @param int $stopAfterMs Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are provided. * @param list $tags Optional tags for tracking usage. Up to 20 tags, each 1 to 50 characters. * @param int $timeoutMs Optional timeout in milliseconds for the request. If the request takes longer than this value, it will be aborted with a 408 status code. Maximum allowed value is 300000ms (5 minutes). * @param int $waitForMs optional browser wait time in milliseconds after initial page load for each crawled page @@ -86,6 +88,7 @@ public function __construct(private Client $client) public function extract( array $schema, string $url, + ?array $actions = null, bool $factCheck = false, bool $followSubdomains = false, bool $includeFrames = false, @@ -105,6 +108,7 @@ public function extract( [ 'schema' => $schema, 'url' => $url, + 'actions' => $actions, 'factCheck' => $factCheck, 'followSubdomains' => $followSubdomains, 'includeFrames' => $includeFrames, @@ -456,7 +460,7 @@ public function webCrawlMd( * Scrapes the given URL and returns the raw HTML content of the page. The base request costs 1 credit; requests with browser actions cost 2 credits. * * @param string $url Full URL to scrape (must include http:// or https:// protocol) - * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeHTMLParams\Country|value-of<\ContextDev\Web\WebWebScrapeHTMLParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove from the result. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -526,7 +530,7 @@ public function webScrapeHTML( * Extract image assets from a web page, including standard URLs, inline SVGs, data URIs, responsive image sources, metadata, CSS backgrounds, video posters, and embeds. The base request costs 1 credit, or 2 credits with browser actions. When enrichment is enabled, the entire call costs 5 credits, including requests that also use actions. * * @param string $url Page URL to inspect. Must include http:// or https://. - * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param bool $dedupe When true, visually duplicate images are removed: every image is loaded and perceptually hashed, and only the highest-resolution copy of each duplicate group is kept. Images that cannot be downloaded or hashed are kept. Default: false. * @param Enrichment|EnrichmentShape|null $enrichment optional per-image processing, sent as deep-object query params such as enrichment[resolution]=true * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. @@ -594,7 +598,7 @@ public function webScrapeImages( * | 500 | No | Internal error | * * @param string $url Full URL to scrape into LLM usable Markdown (must include http:// or https:// protocol) - * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. + * @param list|null $actions Optional browser actions executed in array order after the page loads and before content is captured. Requires a paid plan. Send a JSON array in the query parameter. Maximum: 5 actions. * @param \ContextDev\Web\WebWebScrapeMdParams\Country|value-of<\ContextDev\Web\WebWebScrapeMdParams\Country> $country fetch the target page through a residential proxy in this country (ISO 3166-1 alpha-2) * @param list|null $excludeSelectors CSS selectors to remove before conversion to Markdown. Applied after includeSelectors. Exclusion takes precedence: an element matching both is removed. Examples: "nav", "footer", ".ad-banner", "[aria-hidden=true]". * @param array $headers Optional outbound HTTP headers forwarded only to the target URL, sent as deep-object query params such as headers[X-Custom]=value. When provided, caching is bypassed: the result is neither read from nor written to cache. diff --git a/src/Web/WebExtractParams.php b/src/Web/WebExtractParams.php index 1140f0fb..a6f95ceb 100644 --- a/src/Web/WebExtractParams.php +++ b/src/Web/WebExtractParams.php @@ -9,6 +9,7 @@ use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Concerns\SdkParams; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebExtractParams\Action; use ContextDev\Web\WebExtractParams\Pdf; /** @@ -16,11 +17,14 @@ * * @see ContextDev\Services\WebService::extract() * + * @phpstan-import-type ActionVariants from \ContextDev\Web\WebExtractParams\Action + * @phpstan-import-type ActionShape from \ContextDev\Web\WebExtractParams\Action * @phpstan-import-type PdfShape from \ContextDev\Web\WebExtractParams\Pdf * * @phpstan-type WebExtractParamsShape = array{ * schema: array, * url: string, + * actions?: list|null, * factCheck?: bool|null, * followSubdomains?: bool|null, * includeFrames?: bool|null, @@ -43,7 +47,7 @@ final class WebExtractParams implements BaseModel use SdkParams; /** - * JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. * * @var array $schema */ @@ -56,6 +60,14 @@ final class WebExtractParams implements BaseModel #[Required] public string $url; + /** + * Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. + * + * @var list|null $actions + */ + #[Optional(list: Action::class)] + public ?array $actions; + /** * When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. */ @@ -108,7 +120,7 @@ final class WebExtractParams implements BaseModel public ?bool $settleAnimations; /** - * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are provided. */ #[Optional] public ?int $stopAfterMs; @@ -158,12 +170,14 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param array $schema + * @param list|null $actions * @param Pdf|PdfShape|null $pdf * @param list|null $tags */ public static function with( array $schema, string $url, + ?array $actions = null, ?bool $factCheck = null, ?bool $followSubdomains = null, ?bool $includeFrames = null, @@ -183,6 +197,7 @@ public static function with( $self['schema'] = $schema; $self['url'] = $url; + null !== $actions && $self['actions'] = $actions; null !== $factCheck && $self['factCheck'] = $factCheck; null !== $followSubdomains && $self['followSubdomains'] = $followSubdomains; null !== $includeFrames && $self['includeFrames'] = $includeFrames; @@ -201,7 +216,7 @@ public static function with( } /** - * JSON Schema for the returned data object. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. + * JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. * * @param array $schema */ @@ -224,6 +239,19 @@ public function withURL(string $url): self return $self; } + /** + * Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. + * + * @param list $actions + */ + public function withActions(array $actions): self + { + $self = clone $this; + $self['actions'] = $actions; + + return $self; + } + /** * When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. */ @@ -324,7 +352,7 @@ public function withSettleAnimations(bool $settleAnimations): self } /** - * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Default: 80000 (80s). + * Soft time budget for the crawl in milliseconds. Min: 10000 (10s). Max: 110000 (110s). Defaults to 80000 (80s), or 110000 (110s) when browser actions are provided. */ public function withStopAfterMs(int $stopAfterMs): self { diff --git a/src/Web/WebExtractParams/Action.php b/src/Web/WebExtractParams/Action.php new file mode 100644 index 00000000..c5434e7b --- /dev/null +++ b/src/Web/WebExtractParams/Action.php @@ -0,0 +1,41 @@ +|array + */ + public static function variants(): array + { + return [ + 'wait' => WebScrapeWaitAction::class, + 'perform' => WebScrapePerformAction::class, + ]; + } +} diff --git a/src/Web/WebExtractParams/Action/WebScrapePerformAction.php b/src/Web/WebExtractParams/Action/WebScrapePerformAction.php new file mode 100644 index 00000000..33eb7a11 --- /dev/null +++ b/src/Web/WebExtractParams/Action/WebScrapePerformAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'perform' $do */ + #[Required] + public string $do = 'perform'; + + #[Required] + public string $action; + + /** + * `new WebScrapePerformAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapePerformAction::with(action: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapePerformAction)->withAction(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(string $action): self + { + $self = new self; + + $self['action'] = $action; + + return $self; + } + + public function withAction(string $action): self + { + $self = clone $this; + $self['action'] = $action; + + return $self; + } + + /** + * @param 'perform' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } +} diff --git a/src/Web/WebExtractParams/Action/WebScrapeWaitAction.php b/src/Web/WebExtractParams/Action/WebScrapeWaitAction.php new file mode 100644 index 00000000..1b93ad65 --- /dev/null +++ b/src/Web/WebExtractParams/Action/WebScrapeWaitAction.php @@ -0,0 +1,79 @@ + */ + use SdkModel; + + /** @var 'wait' $do */ + #[Required] + public string $do = 'wait'; + + #[Required] + public int $timeMs; + + /** + * `new WebScrapeWaitAction()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScrapeWaitAction::with(timeMs: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScrapeWaitAction)->withTimeMs(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + */ + public static function with(int $timeMs): self + { + $self = new self; + + $self['timeMs'] = $timeMs; + + return $self; + } + + /** + * @param 'wait' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + public function withTimeMs(int $timeMs): self + { + $self = clone $this; + $self['timeMs'] = $timeMs; + + return $self; + } +} diff --git a/src/Web/WebExtractResponse/Metadata.php b/src/Web/WebExtractResponse/Metadata.php index 35b923d7..56dd6da7 100644 --- a/src/Web/WebExtractResponse/Metadata.php +++ b/src/Web/WebExtractResponse/Metadata.php @@ -4,11 +4,15 @@ namespace ContextDev\Web\WebExtractResponse; +use ContextDev\Core\Attributes\Optional; use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; +use ContextDev\Web\WebExtractResponse\Metadata\ActionsApplied; /** + * @phpstan-import-type ActionsAppliedShape from \ContextDev\Web\WebExtractResponse\Metadata\ActionsApplied + * * @phpstan-type MetadataShape = array{ * maxCrawlDepth: int, * numBlocked: int, @@ -16,6 +20,7 @@ * numSkipped: int, * numSucceeded: int, * numURLs: int, + * actionsApplied?: list|null, * } */ final class Metadata implements BaseModel @@ -44,6 +49,14 @@ final class Metadata implements BaseModel #[Required('numUrls')] public int $numURLs; + /** + * One verified outcome per requested browser action, in request order. + * + * @var list|null $actionsApplied + */ + #[Optional(list: ActionsApplied::class)] + public ?array $actionsApplied; + /** * `new Metadata()` is missing required properties by the API. * @@ -80,6 +93,8 @@ public function __construct() * Construct an instance from the required parameters. * * You must use named parameters to construct any parameters with a default value. + * + * @param list|null $actionsApplied */ public static function with( int $maxCrawlDepth, @@ -88,6 +103,7 @@ public static function with( int $numSkipped, int $numSucceeded, int $numURLs, + ?array $actionsApplied = null, ): self { $self = new self; @@ -98,6 +114,8 @@ public static function with( $self['numSucceeded'] = $numSucceeded; $self['numURLs'] = $numURLs; + null !== $actionsApplied && $self['actionsApplied'] = $actionsApplied; + return $self; } @@ -151,4 +169,17 @@ public function withNumURLs(int $numURLs): self return $self; } + + /** + * One verified outcome per requested browser action, in request order. + * + * @param list $actionsApplied + */ + public function withActionsApplied(array $actionsApplied): self + { + $self = clone $this; + $self['actionsApplied'] = $actionsApplied; + + return $self; + } } diff --git a/src/Web/WebExtractResponse/Metadata/ActionsApplied.php b/src/Web/WebExtractResponse/Metadata/ActionsApplied.php new file mode 100644 index 00000000..17e71de9 --- /dev/null +++ b/src/Web/WebExtractResponse/Metadata/ActionsApplied.php @@ -0,0 +1,170 @@ +, + * completionEvidence?: string|null, + * durationMs?: float|null, + * error?: string|null, + * method?: string|null, + * targetDescription?: string|null, + * } + */ +final class ActionsApplied implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $instruction; + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Visible page evidence used to verify an applied action. + */ + #[Optional] + public ?string $completionEvidence; + + #[Optional] + public ?float $durationMs; + + #[Optional] + public ?string $error; + + #[Optional] + public ?string $method; + + #[Optional] + public ?string $targetDescription; + + /** + * `new ActionsApplied()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ActionsApplied::with(instruction: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ActionsApplied)->withInstruction(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with( + string $instruction, + Status|string $status, + ?string $completionEvidence = null, + ?float $durationMs = null, + ?string $error = null, + ?string $method = null, + ?string $targetDescription = null, + ): self { + $self = new self; + + $self['instruction'] = $instruction; + $self['status'] = $status; + + null !== $completionEvidence && $self['completionEvidence'] = $completionEvidence; + null !== $durationMs && $self['durationMs'] = $durationMs; + null !== $error && $self['error'] = $error; + null !== $method && $self['method'] = $method; + null !== $targetDescription && $self['targetDescription'] = $targetDescription; + + return $self; + } + + public function withInstruction(string $instruction): self + { + $self = clone $this; + $self['instruction'] = $instruction; + + return $self; + } + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Visible page evidence used to verify an applied action. + */ + public function withCompletionEvidence(string $completionEvidence): self + { + $self = clone $this; + $self['completionEvidence'] = $completionEvidence; + + return $self; + } + + public function withDurationMs(float $durationMs): self + { + $self = clone $this; + $self['durationMs'] = $durationMs; + + return $self; + } + + public function withError(string $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + public function withMethod(string $method): self + { + $self = clone $this; + $self['method'] = $method; + + return $self; + } + + public function withTargetDescription(string $targetDescription): self + { + $self = clone $this; + $self['targetDescription'] = $targetDescription; + + return $self; + } +} diff --git a/src/Web/WebExtractResponse/Metadata/ActionsApplied/Status.php b/src/Web/WebExtractResponse/Metadata/ActionsApplied/Status.php new file mode 100644 index 00000000..18c133c9 --- /dev/null +++ b/src/Web/WebExtractResponse/Metadata/ActionsApplied/Status.php @@ -0,0 +1,17 @@ + 'bar', ], url: 'https://example.com', + actions: [['do' => 'wait', 'timeMs' => 0]], factCheck: true, followSubdomains: true, includeFrames: true, From 183caf90c9cbcee5705f8865a659ea9ff302b37e Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Sun, 23 Aug 2026 19:12:44 +0000 Subject: [PATCH 125/130] feat(api): api update --- .stats.yml | 4 +- src/ServiceContracts/WebContract.php | 2 +- src/Services/WebService.php | 2 +- src/Web/WebExtractParams.php | 4 +- src/Web/WebExtractParams/Action.php | 7 +- .../Action/WebScrapeScrollAction.php | 153 ++++++++++++++++ .../Action/WebScrapeScrollAction/Amount.php | 29 +++ .../Amount/UnionMember1.php | 12 ++ .../WebScrapeScrollAction/Direction.php | 19 ++ src/Web/WebWebScrapeHTMLParams/Action.php | 7 +- .../Action/WebScrapeScrollAction.php | 153 ++++++++++++++++ .../Action/WebScrapeScrollAction/Amount.php | 29 +++ .../Amount/UnionMember1.php | 12 ++ .../WebScrapeScrollAction/Direction.php | 19 ++ src/Web/WebWebScrapeImagesParams/Action.php | 7 +- .../Action/WebScrapeScrollAction.php | 153 ++++++++++++++++ .../Action/WebScrapeScrollAction/Amount.php | 29 +++ .../Amount/UnionMember1.php | 12 ++ .../WebScrapeScrollAction/Direction.php | 19 ++ src/Web/WebWebScrapeImagesResponse.php | 27 +++ .../ActionsApplied.php | 170 ++++++++++++++++++ .../ActionsApplied/Status.php | 17 ++ src/Web/WebWebScrapeMdParams/Action.php | 7 +- .../Action/WebScrapeScrollAction.php | 153 ++++++++++++++++ .../Action/WebScrapeScrollAction/Amount.php | 29 +++ .../Amount/UnionMember1.php | 12 ++ .../WebScrapeScrollAction/Direction.php | 19 ++ 27 files changed, 1092 insertions(+), 14 deletions(-) create mode 100644 src/Web/WebExtractParams/Action/WebScrapeScrollAction.php create mode 100644 src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount.php create mode 100644 src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php create mode 100644 src/Web/WebExtractParams/Action/WebScrapeScrollAction/Direction.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php create mode 100644 src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Direction.php create mode 100644 src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction.php create mode 100644 src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount.php create mode 100644 src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php create mode 100644 src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Direction.php create mode 100644 src/Web/WebWebScrapeImagesResponse/ActionsApplied.php create mode 100644 src/Web/WebWebScrapeImagesResponse/ActionsApplied/Status.php create mode 100644 src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction.php create mode 100644 src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount.php create mode 100644 src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php create mode 100644 src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Direction.php diff --git a/.stats.yml b/.stats.yml index 4aa99bd0..ad6cd802 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-bf7ffa610bd4a02ea5bcb157521d17a041a48f78d87bf8fe8d812d3cbb87b489.yml -openapi_spec_hash: 90142d96969dea44c46a01abb683c426 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2c3f4e4b357ca78c019a3aacd006e2bb8b332d4172a300ee6c46c076a216ed3f.yml +openapi_spec_hash: b89be415cf6ee594b521885a9deb25ac config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/ServiceContracts/WebContract.php b/src/ServiceContracts/WebContract.php index 3a20c7c7..e06a3a52 100644 --- a/src/ServiceContracts/WebContract.php +++ b/src/ServiceContracts/WebContract.php @@ -49,7 +49,7 @@ interface WebContract * * @param array $schema JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. * @param string $url The starting website URL to crawl and extract from. Must include http:// or https://. - * @param list $actions Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. + * @param list $actions Optional browser actions executed in order on the requested page after it loads, before links are discovered or additional pages are crawled. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. * @param bool $factCheck When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. * @param bool $followSubdomains when true, follow links on subdomains of the starting URL's domain * @param bool $includeFrames when true, iframe contents are included in Markdown before extraction diff --git a/src/Services/WebService.php b/src/Services/WebService.php index 737f1203..021eaaa4 100644 --- a/src/Services/WebService.php +++ b/src/Services/WebService.php @@ -67,7 +67,7 @@ public function __construct(private Client $client) * * @param array $schema JSON Schema for the returned data object. Image fields such as `image_urls` or `product_photos` automatically make page image references available to extraction, so product data and photos can be returned in one call. TypeScript Zod users can pass a JSON Schema generated from a Zod object; Python users can pass the equivalent JSON Schema object. * @param string $url The starting website URL to crawl and extract from. Must include http:// or https://. - * @param list $actions Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. + * @param list $actions Optional browser actions executed in order on the requested page after it loads, before links are discovered or additional pages are crawled. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. * @param bool $factCheck When true, every returned value must be grounded in facts stated on the page; fields that cannot be supported by the page are returned as null/empty. When false (default), the model may make reasonable inferences and derivations from the page content (e.g. ideal customer, competitor analysis, recommendations) while keeping verifiable specifics (names, quotes, URLs, dates, metrics) faithful to the source. * @param bool $followSubdomains when true, follow links on subdomains of the starting URL's domain * @param bool $includeFrames when true, iframe contents are included in Markdown before extraction diff --git a/src/Web/WebExtractParams.php b/src/Web/WebExtractParams.php index a6f95ceb..377e4db9 100644 --- a/src/Web/WebExtractParams.php +++ b/src/Web/WebExtractParams.php @@ -61,7 +61,7 @@ final class WebExtractParams implements BaseModel public string $url; /** - * Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. + * Optional browser actions executed in order on the requested page after it loads, before links are discovered or additional pages are crawled. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. * * @var list|null $actions */ @@ -240,7 +240,7 @@ public function withURL(string $url): self } /** - * Optional browser actions executed in order on the requested page after it loads and before extraction. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. + * Optional browser actions executed in order on the requested page after it loads, before links are discovered or additional pages are crawled. Requires a paid plan. When actions are provided and stopAfterMs is omitted, the crawl budget defaults to 110000 ms. * * @param list $actions */ diff --git a/src/Web/WebExtractParams/Action.php b/src/Web/WebExtractParams/Action.php index c5434e7b..77e91c2d 100644 --- a/src/Web/WebExtractParams/Action.php +++ b/src/Web/WebExtractParams/Action.php @@ -8,6 +8,7 @@ use ContextDev\Core\Conversion\Contracts\Converter; use ContextDev\Core\Conversion\Contracts\ConverterSource; use ContextDev\Web\WebExtractParams\Action\WebScrapePerformAction; +use ContextDev\Web\WebExtractParams\Action\WebScrapeScrollAction; use ContextDev\Web\WebExtractParams\Action\WebScrapeWaitAction; /** @@ -15,9 +16,10 @@ * * @phpstan-import-type WebScrapeWaitActionShape from \ContextDev\Web\WebExtractParams\Action\WebScrapeWaitAction * @phpstan-import-type WebScrapePerformActionShape from \ContextDev\Web\WebExtractParams\Action\WebScrapePerformAction + * @phpstan-import-type WebScrapeScrollActionShape from \ContextDev\Web\WebExtractParams\Action\WebScrapeScrollAction * - * @phpstan-type ActionVariants = WebScrapeWaitAction|WebScrapePerformAction - * @phpstan-type ActionShape = ActionVariants|WebScrapeWaitActionShape|WebScrapePerformActionShape + * @phpstan-type ActionVariants = WebScrapeWaitAction|WebScrapePerformAction|WebScrapeScrollAction + * @phpstan-type ActionShape = ActionVariants|WebScrapeWaitActionShape|WebScrapePerformActionShape|WebScrapeScrollActionShape */ final class Action implements ConverterSource { @@ -36,6 +38,7 @@ public static function variants(): array return [ 'wait' => WebScrapeWaitAction::class, 'perform' => WebScrapePerformAction::class, + 'scroll' => WebScrapeScrollAction::class, ]; } } diff --git a/src/Web/WebExtractParams/Action/WebScrapeScrollAction.php b/src/Web/WebExtractParams/Action/WebScrapeScrollAction.php new file mode 100644 index 00000000..ac5465c8 --- /dev/null +++ b/src/Web/WebExtractParams/Action/WebScrapeScrollAction.php @@ -0,0 +1,153 @@ +, + * maxScrolls?: int|null, + * } + */ +final class WebScrapeScrollAction implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'scroll' $do */ + #[Required] + public string $do = 'scroll'; + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @var AmountVariants|null $amount + */ + #[Optional(union: Amount::class)] + public int|string|null $amount; + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + #[Optional] + public ?string $container; + + /** + * Direction to scroll. Defaults to down. + * + * @var value-of|null $direction + */ + #[Optional(enum: Direction::class)] + public ?string $direction; + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + #[Optional] + public ?int $maxScrolls; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param AmountShape|null $amount + * @param Direction|value-of|null $direction + */ + public static function with( + int|UnionMember1|string|null $amount = null, + ?string $container = null, + Direction|string|null $direction = null, + ?int $maxScrolls = null, + ): self { + $self = new self; + + null !== $amount && $self['amount'] = $amount; + null !== $container && $self['container'] = $container; + null !== $direction && $self['direction'] = $direction; + null !== $maxScrolls && $self['maxScrolls'] = $maxScrolls; + + return $self; + } + + /** + * @param 'scroll' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @param AmountShape $amount + */ + public function withAmount(int|UnionMember1|string $amount): self + { + $self = clone $this; + $self['amount'] = $amount; + + return $self; + } + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + public function withContainer(string $container): self + { + $self = clone $this; + $self['container'] = $container; + + return $self; + } + + /** + * Direction to scroll. Defaults to down. + * + * @param Direction|value-of $direction + */ + public function withDirection(Direction|string $direction): self + { + $self = clone $this; + $self['direction'] = $direction; + + return $self; + } + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + public function withMaxScrolls(int $maxScrolls): self + { + $self = clone $this; + $self['maxScrolls'] = $maxScrolls; + + return $self; + } +} diff --git a/src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount.php b/src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount.php new file mode 100644 index 00000000..598c8983 --- /dev/null +++ b/src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount.php @@ -0,0 +1,29 @@ + + * @phpstan-type AmountShape = AmountVariants + */ +final class Amount implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['int', UnionMember1::class]; + } +} diff --git a/src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php b/src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php new file mode 100644 index 00000000..f8501236 --- /dev/null +++ b/src/Web/WebExtractParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php @@ -0,0 +1,12 @@ + WebScrapeWaitAction::class, 'perform' => WebScrapePerformAction::class, + 'scroll' => WebScrapeScrollAction::class, ]; } } diff --git a/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction.php b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction.php new file mode 100644 index 00000000..9c7d5617 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction.php @@ -0,0 +1,153 @@ +, + * maxScrolls?: int|null, + * } + */ +final class WebScrapeScrollAction implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'scroll' $do */ + #[Required] + public string $do = 'scroll'; + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @var AmountVariants|null $amount + */ + #[Optional(union: Amount::class)] + public int|string|null $amount; + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + #[Optional] + public ?string $container; + + /** + * Direction to scroll. Defaults to down. + * + * @var value-of|null $direction + */ + #[Optional(enum: Direction::class)] + public ?string $direction; + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + #[Optional] + public ?int $maxScrolls; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param AmountShape|null $amount + * @param Direction|value-of|null $direction + */ + public static function with( + int|UnionMember1|string|null $amount = null, + ?string $container = null, + Direction|string|null $direction = null, + ?int $maxScrolls = null, + ): self { + $self = new self; + + null !== $amount && $self['amount'] = $amount; + null !== $container && $self['container'] = $container; + null !== $direction && $self['direction'] = $direction; + null !== $maxScrolls && $self['maxScrolls'] = $maxScrolls; + + return $self; + } + + /** + * @param 'scroll' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @param AmountShape $amount + */ + public function withAmount(int|UnionMember1|string $amount): self + { + $self = clone $this; + $self['amount'] = $amount; + + return $self; + } + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + public function withContainer(string $container): self + { + $self = clone $this; + $self['container'] = $container; + + return $self; + } + + /** + * Direction to scroll. Defaults to down. + * + * @param Direction|value-of $direction + */ + public function withDirection(Direction|string $direction): self + { + $self = clone $this; + $self['direction'] = $direction; + + return $self; + } + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + public function withMaxScrolls(int $maxScrolls): self + { + $self = clone $this; + $self['maxScrolls'] = $maxScrolls; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount.php b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount.php new file mode 100644 index 00000000..e24eb556 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount.php @@ -0,0 +1,29 @@ + + * @phpstan-type AmountShape = AmountVariants + */ +final class Amount implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['int', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php new file mode 100644 index 00000000..2a0980a3 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php @@ -0,0 +1,12 @@ + WebScrapeWaitAction::class, 'perform' => WebScrapePerformAction::class, + 'scroll' => WebScrapeScrollAction::class, ]; } } diff --git a/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction.php b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction.php new file mode 100644 index 00000000..20f86532 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction.php @@ -0,0 +1,153 @@ +, + * maxScrolls?: int|null, + * } + */ +final class WebScrapeScrollAction implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'scroll' $do */ + #[Required] + public string $do = 'scroll'; + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @var AmountVariants|null $amount + */ + #[Optional(union: Amount::class)] + public int|string|null $amount; + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + #[Optional] + public ?string $container; + + /** + * Direction to scroll. Defaults to down. + * + * @var value-of|null $direction + */ + #[Optional(enum: Direction::class)] + public ?string $direction; + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + #[Optional] + public ?int $maxScrolls; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param AmountShape|null $amount + * @param Direction|value-of|null $direction + */ + public static function with( + int|UnionMember1|string|null $amount = null, + ?string $container = null, + Direction|string|null $direction = null, + ?int $maxScrolls = null, + ): self { + $self = new self; + + null !== $amount && $self['amount'] = $amount; + null !== $container && $self['container'] = $container; + null !== $direction && $self['direction'] = $direction; + null !== $maxScrolls && $self['maxScrolls'] = $maxScrolls; + + return $self; + } + + /** + * @param 'scroll' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @param AmountShape $amount + */ + public function withAmount(int|UnionMember1|string $amount): self + { + $self = clone $this; + $self['amount'] = $amount; + + return $self; + } + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + public function withContainer(string $container): self + { + $self = clone $this; + $self['container'] = $container; + + return $self; + } + + /** + * Direction to scroll. Defaults to down. + * + * @param Direction|value-of $direction + */ + public function withDirection(Direction|string $direction): self + { + $self = clone $this; + $self['direction'] = $direction; + + return $self; + } + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + public function withMaxScrolls(int $maxScrolls): self + { + $self = clone $this; + $self['maxScrolls'] = $maxScrolls; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount.php b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount.php new file mode 100644 index 00000000..9bbf2f7f --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount.php @@ -0,0 +1,29 @@ + + * @phpstan-type AmountShape = AmountVariants + */ +final class Amount implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['int', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php new file mode 100644 index 00000000..38f2b3b5 --- /dev/null +++ b/src/Web/WebWebScrapeImagesParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php @@ -0,0 +1,12 @@ +, * success: bool, * url: string, + * actionsApplied?: list|null, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * } */ @@ -47,6 +50,14 @@ final class WebWebScrapeImagesResponse implements BaseModel #[Required] public string $url; + /** + * One verified outcome per requested browser action, in request order. + * + * @var list|null $actionsApplied + */ + #[Optional(list: ActionsApplied::class)] + public ?array $actionsApplied; + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. */ @@ -81,12 +92,14 @@ public function __construct() * You must use named parameters to construct any parameters with a default value. * * @param list $images + * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( array $images, bool $success, string $url, + ?array $actionsApplied = null, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; @@ -95,6 +108,7 @@ public static function with( $self['success'] = $success; $self['url'] = $url; + null !== $actionsApplied && $self['actionsApplied'] = $actionsApplied; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; return $self; @@ -135,6 +149,19 @@ public function withURL(string $url): self return $self; } + /** + * One verified outcome per requested browser action, in request order. + * + * @param list $actionsApplied + */ + public function withActionsApplied(array $actionsApplied): self + { + $self = clone $this; + $self['actionsApplied'] = $actionsApplied; + + return $self; + } + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. * diff --git a/src/Web/WebWebScrapeImagesResponse/ActionsApplied.php b/src/Web/WebWebScrapeImagesResponse/ActionsApplied.php new file mode 100644 index 00000000..d5dd26a5 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/ActionsApplied.php @@ -0,0 +1,170 @@ +, + * completionEvidence?: string|null, + * durationMs?: float|null, + * error?: string|null, + * method?: string|null, + * targetDescription?: string|null, + * } + */ +final class ActionsApplied implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + #[Required] + public string $instruction; + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * Visible page evidence used to verify an applied action. + */ + #[Optional] + public ?string $completionEvidence; + + #[Optional] + public ?float $durationMs; + + #[Optional] + public ?string $error; + + #[Optional] + public ?string $method; + + #[Optional] + public ?string $targetDescription; + + /** + * `new ActionsApplied()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * ActionsApplied::with(instruction: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new ActionsApplied)->withInstruction(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with( + string $instruction, + Status|string $status, + ?string $completionEvidence = null, + ?float $durationMs = null, + ?string $error = null, + ?string $method = null, + ?string $targetDescription = null, + ): self { + $self = new self; + + $self['instruction'] = $instruction; + $self['status'] = $status; + + null !== $completionEvidence && $self['completionEvidence'] = $completionEvidence; + null !== $durationMs && $self['durationMs'] = $durationMs; + null !== $error && $self['error'] = $error; + null !== $method && $self['method'] = $method; + null !== $targetDescription && $self['targetDescription'] = $targetDescription; + + return $self; + } + + public function withInstruction(string $instruction): self + { + $self = clone $this; + $self['instruction'] = $instruction; + + return $self; + } + + /** + * Applied means the requested page state was visibly verified. Failed means it was not verified. Skipped means it was not attempted. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } + + /** + * Visible page evidence used to verify an applied action. + */ + public function withCompletionEvidence(string $completionEvidence): self + { + $self = clone $this; + $self['completionEvidence'] = $completionEvidence; + + return $self; + } + + public function withDurationMs(float $durationMs): self + { + $self = clone $this; + $self['durationMs'] = $durationMs; + + return $self; + } + + public function withError(string $error): self + { + $self = clone $this; + $self['error'] = $error; + + return $self; + } + + public function withMethod(string $method): self + { + $self = clone $this; + $self['method'] = $method; + + return $self; + } + + public function withTargetDescription(string $targetDescription): self + { + $self = clone $this; + $self['targetDescription'] = $targetDescription; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesResponse/ActionsApplied/Status.php b/src/Web/WebWebScrapeImagesResponse/ActionsApplied/Status.php new file mode 100644 index 00000000..5a88c074 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/ActionsApplied/Status.php @@ -0,0 +1,17 @@ + WebScrapeWaitAction::class, 'perform' => WebScrapePerformAction::class, + 'scroll' => WebScrapeScrollAction::class, ]; } } diff --git a/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction.php b/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction.php new file mode 100644 index 00000000..b263926f --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction.php @@ -0,0 +1,153 @@ +, + * maxScrolls?: int|null, + * } + */ +final class WebScrapeScrollAction implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** @var 'scroll' $do */ + #[Required] + public string $do = 'scroll'; + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @var AmountVariants|null $amount + */ + #[Optional(union: Amount::class)] + public int|string|null $amount; + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + #[Optional] + public ?string $container; + + /** + * Direction to scroll. Defaults to down. + * + * @var value-of|null $direction + */ + #[Optional(enum: Direction::class)] + public ?string $direction; + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + #[Optional] + public ?int $maxScrolls; + + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param AmountShape|null $amount + * @param Direction|value-of|null $direction + */ + public static function with( + int|UnionMember1|string|null $amount = null, + ?string $container = null, + Direction|string|null $direction = null, + ?int $maxScrolls = null, + ): self { + $self = new self; + + null !== $amount && $self['amount'] = $amount; + null !== $container && $self['container'] = $container; + null !== $direction && $self['direction'] = $direction; + null !== $maxScrolls && $self['maxScrolls'] = $maxScrolls; + + return $self; + } + + /** + * @param 'scroll' $do + */ + public function withDo(string $do): self + { + $self = clone $this; + $self['do'] = $do; + + return $self; + } + + /** + * Pixels per scroll, one visible viewport, or the current scroll boundary. Defaults to viewport. + * + * @param AmountShape $amount + */ + public function withAmount(int|UnionMember1|string $amount): self + { + $self = clone $this; + $self['amount'] = $amount; + + return $self; + } + + /** + * CSS selector for the first matching scroll container. Defaults to the page. + */ + public function withContainer(string $container): self + { + $self = clone $this; + $self['container'] = $container; + + return $self; + } + + /** + * Direction to scroll. Defaults to down. + * + * @param Direction|value-of $direction + */ + public function withDirection(Direction|string $direction): self + { + $self = clone $this; + $self['direction'] = $direction; + + return $self; + } + + /** + * Maximum scroll iterations. Stops early when scrolling and scrollable extent stop changing. Defaults to 1. + */ + public function withMaxScrolls(int $maxScrolls): self + { + $self = clone $this; + $self['maxScrolls'] = $maxScrolls; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount.php b/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount.php new file mode 100644 index 00000000..2df0250e --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount.php @@ -0,0 +1,29 @@ + + * @phpstan-type AmountShape = AmountVariants + */ +final class Amount implements ConverterSource +{ + use SdkUnion; + + /** + * @return list|array + */ + public static function variants(): array + { + return ['int', UnionMember1::class]; + } +} diff --git a/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php b/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php new file mode 100644 index 00000000..238d8a0c --- /dev/null +++ b/src/Web/WebWebScrapeMdParams/Action/WebScrapeScrollAction/Amount/UnionMember1.php @@ -0,0 +1,12 @@ + Date: Sun, 23 Aug 2026 19:16:28 +0000 Subject: [PATCH 126/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index e6c39adb..0746cbe2 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.11.0" + ".": "2.12.0" } \ No newline at end of file diff --git a/README.md b/README.md index e315b064..be5e105f 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.11.0" +composer require "context-dev/context-dev-php 2.12.0" ``` diff --git a/src/Client.php b/src/Client.php index b1e6715e..37db3c5e 100644 --- a/src/Client.php +++ b/src/Client.php @@ -113,7 +113,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.11.0', + 'X-Stainless-Package-Version' => '2.12.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 41b0b980..500f4fa8 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.11.0'; +const VERSION = '2.12.0'; // x-release-please-end From 1b95307bf137f3005e52855d389c7810dfa4cc37 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 16:11:28 +0000 Subject: [PATCH 127/130] codegen metadata --- .stats.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.stats.yml b/.stats.yml index ad6cd802..60019ded 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-2c3f4e4b357ca78c019a3aacd006e2bb8b332d4172a300ee6c46c076a216ed3f.yml -openapi_spec_hash: b89be415cf6ee594b521885a9deb25ac +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-05ba8ca01ab3b765bfdca4cdc99248d3169cf4fef049d0ddcf11a807cbf72a08.yml +openapi_spec_hash: 565724dda1e870c0d0469953514ca767 config_hash: 0fb0ceca5946298c416cec0cca5260c7 From 05a88b60c92a55efc6bc48c5bf5ac9497ed49557 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Mon, 24 Aug 2026 22:06:17 +0000 Subject: [PATCH 128/130] feat(api): api update --- .stats.yml | 4 ++-- src/Brand/BrandGetResponse/Brand.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.stats.yml b/.stats.yml index 60019ded..56757d6b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-05ba8ca01ab3b765bfdca4cdc99248d3169cf4fef049d0ddcf11a807cbf72a08.yml -openapi_spec_hash: 565724dda1e870c0d0469953514ca767 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8be9b7cfe70702af909241420da1c61ba6b248345c5faec3b472df540bc6a553.yml +openapi_spec_hash: f98fb82a9ad562fc04d32f7063182de8 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/src/Brand/BrandGetResponse/Brand.php b/src/Brand/BrandGetResponse/Brand.php index a540ecfb..6acb0b98 100644 --- a/src/Brand/BrandGetResponse/Brand.php +++ b/src/Brand/BrandGetResponse/Brand.php @@ -121,7 +121,7 @@ final class Brand implements BaseModel public ?Links $links; /** - * An array of logos associated with the brand. + * An array of logos associated with the brand. When a similarly shaped SVG variant exists, it is returned ahead of its raster equivalent; otherwise relevance order is preserved. * * @var list|null $logos */ @@ -354,7 +354,7 @@ public function withLinks(Links|array $links): self } /** - * An array of logos associated with the brand. + * An array of logos associated with the brand. When a similarly shaped SVG variant exists, it is returned ahead of its raster equivalent; otherwise relevance order is preserved. * * @param list $logos */ From 7689fa990de848e4db84aec3b271c0ee33230911 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Thu, 27 Aug 2026 02:55:31 +0000 Subject: [PATCH 129/130] feat(api): api update --- .stats.yml | 4 +- README.md | 2 +- src/AI/AIExtractProductResponse.php | 41 +++++++ .../CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/AI/AIExtractProductsResponse.php | 43 +++++++- .../CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ .../Data/ScrapedPage.php | 30 ++++- .../Data/ScrapedPage/CacheMetadata.php | 97 +++++++++++++++++ .../Data/ScrapedPage/CacheMetadata/Status.php | 17 +++ src/Batch/BatchSubmitResponse.php | 27 +++++ .../BatchSubmitResponse/CacheMetadata.php | 103 ++++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Brand/BrandGetResponse.php | 41 +++++++ src/Brand/BrandGetResponse/CacheMetadata.php | 97 +++++++++++++++++ .../BrandGetResponse/CacheMetadata/Status.php | 17 +++ src/Brand/BrandGetSimplifiedResponse.php | 41 +++++++ .../CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebExtractFontsResponse.php | 30 ++++- .../WebExtractFontsResponse/CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebExtractResponse.php | 33 +++++- src/Web/WebExtractResponse/CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebExtractStyleguideResponse.php | 41 +++++++ .../CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebScreenshotResponse.php | 41 +++++++ .../WebScreenshotResponse/CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebSearchResponse.php | 34 +++++- src/Web/WebSearchResponse/CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebWebCrawlMdResponse.php | 32 +++++- .../WebWebCrawlMdResponse/CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebWebScrapeHTMLResponse.php | 33 +++++- .../CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebWebScrapeImagesResponse.php | 30 ++++- .../CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ src/Web/WebWebScrapeMdResponse.php | 33 +++++- .../WebWebScrapeMdResponse/CacheMetadata.php | 97 +++++++++++++++++ .../CacheMetadata/Status.php | 17 +++ 47 files changed, 2237 insertions(+), 15 deletions(-) create mode 100644 src/AI/AIExtractProductResponse/CacheMetadata.php create mode 100644 src/AI/AIExtractProductResponse/CacheMetadata/Status.php create mode 100644 src/AI/AIExtractProductsResponse/CacheMetadata.php create mode 100644 src/AI/AIExtractProductsResponse/CacheMetadata/Status.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata.php create mode 100644 src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata/Status.php create mode 100644 src/Batch/BatchSubmitResponse/CacheMetadata.php create mode 100644 src/Batch/BatchSubmitResponse/CacheMetadata/Status.php create mode 100644 src/Brand/BrandGetResponse/CacheMetadata.php create mode 100644 src/Brand/BrandGetResponse/CacheMetadata/Status.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/CacheMetadata.php create mode 100644 src/Brand/BrandGetSimplifiedResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebExtractFontsResponse/CacheMetadata.php create mode 100644 src/Web/WebExtractFontsResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebExtractResponse/CacheMetadata.php create mode 100644 src/Web/WebExtractResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebExtractStyleguideResponse/CacheMetadata.php create mode 100644 src/Web/WebExtractStyleguideResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebScreenshotResponse/CacheMetadata.php create mode 100644 src/Web/WebScreenshotResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebSearchResponse/CacheMetadata.php create mode 100644 src/Web/WebSearchResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebWebCrawlMdResponse/CacheMetadata.php create mode 100644 src/Web/WebWebCrawlMdResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/CacheMetadata.php create mode 100644 src/Web/WebWebScrapeHTMLResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebWebScrapeImagesResponse/CacheMetadata.php create mode 100644 src/Web/WebWebScrapeImagesResponse/CacheMetadata/Status.php create mode 100644 src/Web/WebWebScrapeMdResponse/CacheMetadata.php create mode 100644 src/Web/WebWebScrapeMdResponse/CacheMetadata/Status.php diff --git a/.stats.yml b/.stats.yml index 56757d6b..9aabd7da 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 41 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-8be9b7cfe70702af909241420da1c61ba6b248345c5faec3b472df540bc6a553.yml -openapi_spec_hash: f98fb82a9ad562fc04d32f7063182de8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/context-dev/context.dev-dc61df29e1b6282f9df685fadd65f3683afe352deccae94d0c080092e0eae4b3.yml +openapi_spec_hash: 258caa98cd0de5f7149f6937d071c912 config_hash: 0fb0ceca5946298c416cec0cca5260c7 diff --git a/README.md b/README.md index be5e105f..2107a483 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,7 @@ $client = new Client(apiKey: getenv('CONTEXT_DEV_API_KEY') ?: 'My API Key'); $brand = $client->brand->retrieve(domain: 'REPLACE_ME', type: 'by_domain'); -var_dump($brand->brand); +var_dump($brand->cache_metadata); ``` ### Value Objects diff --git a/src/AI/AIExtractProductResponse.php b/src/AI/AIExtractProductResponse.php index 07f9605a..e99b9904 100644 --- a/src/AI/AIExtractProductResponse.php +++ b/src/AI/AIExtractProductResponse.php @@ -4,18 +4,22 @@ namespace ContextDev\AI; +use ContextDev\AI\AIExtractProductResponse\CacheMetadata; use ContextDev\AI\AIExtractProductResponse\KeyMetadata; use ContextDev\AI\AIExtractProductResponse\Platform; use ContextDev\AI\AIExtractProductResponse\Product; use ContextDev\Core\Attributes\Optional; +use ContextDev\Core\Attributes\Required; use ContextDev\Core\Concerns\SdkModel; use ContextDev\Core\Contracts\BaseModel; /** + * @phpstan-import-type CacheMetadataShape from \ContextDev\AI\AIExtractProductResponse\CacheMetadata * @phpstan-import-type KeyMetadataShape from \ContextDev\AI\AIExtractProductResponse\KeyMetadata * @phpstan-import-type ProductShape from \ContextDev\AI\AIExtractProductResponse\Product * * @phpstan-type AIExtractProductResponseShape = array{ + * cacheMetadata: CacheMetadata|CacheMetadataShape, * isProductPage?: bool|null, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, * platform?: null|Platform|value-of, @@ -27,6 +31,12 @@ final class AIExtractProductResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Whether the given URL is a product detail page. */ @@ -53,6 +63,20 @@ final class AIExtractProductResponse implements BaseModel #[Optional(nullable: true)] public ?Product $product; + /** + * `new AIExtractProductResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AIExtractProductResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AIExtractProductResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -63,11 +87,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param Platform|value-of|null $platform * @param Product|ProductShape|null $product */ public static function with( + CacheMetadata|array $cacheMetadata, ?bool $isProductPage = null, KeyMetadata|array|null $keyMetadata = null, Platform|string|null $platform = null, @@ -75,6 +101,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $isProductPage && $self['isProductPage'] = $isProductPage; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; null !== $platform && $self['platform'] = $platform; @@ -83,6 +111,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Whether the given URL is a product detail page. */ diff --git a/src/AI/AIExtractProductResponse/CacheMetadata.php b/src/AI/AIExtractProductResponse/CacheMetadata.php new file mode 100644 index 00000000..5ceeffab --- /dev/null +++ b/src/AI/AIExtractProductResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/AI/AIExtractProductResponse/CacheMetadata/Status.php b/src/AI/AIExtractProductResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..c487aef4 --- /dev/null +++ b/src/AI/AIExtractProductResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +|null, * } @@ -24,6 +28,12 @@ final class AIExtractProductsResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. */ @@ -38,6 +48,20 @@ final class AIExtractProductsResponse implements BaseModel #[Optional(list: Product::class)] public ?array $products; + /** + * `new AIExtractProductsResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * AIExtractProductsResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new AIExtractProductsResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -48,21 +72,38 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param list|null $products */ public static function with( + CacheMetadata|array $cacheMetadata, KeyMetadata|array|null $keyMetadata = null, - ?array $products = null + ?array $products = null, ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; null !== $products && $self['products'] = $products; return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Metadata about the API key used for the request. Included in every response whenever a valid API key is provided, even when the response status is not 200. * diff --git a/src/AI/AIExtractProductsResponse/CacheMetadata.php b/src/AI/AIExtractProductsResponse/CacheMetadata.php new file mode 100644 index 00000000..3bee8eca --- /dev/null +++ b/src/AI/AIExtractProductsResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/AI/AIExtractProductsResponse/CacheMetadata/Status.php b/src/AI/AIExtractProductsResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..50901c3c --- /dev/null +++ b/src/AI/AIExtractProductsResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +withCacheMetadata(...) * ->withFinalURL(...) * ->withHTTPStatus(...) * ->withMetadata(...) @@ -125,10 +137,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param array|null $meta */ public static function with( + CacheMetadata|array $cacheMetadata, string $finalURL, ?int $httpStatus, Metadata|array $metadata, @@ -141,6 +155,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['finalURL'] = $finalURL; $self['httpStatus'] = $httpStatus; $self['metadata'] = $metadata; @@ -155,6 +170,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * URL the content was read from, after redirects. */ diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata.php new file mode 100644 index 00000000..643a1361 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata/Status.php b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata/Status.php new file mode 100644 index 00000000..ae97dbe2 --- /dev/null +++ b/src/Batch/BatchGetResultsResponse/Data/ScrapedPage/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +withID(...) + * ->withCacheMetadata(...) * ->withCrawl(...) * ->withCreatedAt(...) * ->withCredits(...) @@ -169,6 +180,7 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param CrawlControls|CrawlControlsShape|null $crawl * @param Credits|CreditsShape $credits * @param Format|value-of $format @@ -181,6 +193,7 @@ public function __construct() */ public static function with( string $id, + CacheMetadata|array $cacheMetadata, CrawlControls|array|null $crawl, string $createdAt, Credits|array $credits, @@ -196,6 +209,7 @@ public static function with( $self = new self; $self['id'] = $id; + $self['cacheMetadata'] = $cacheMetadata; $self['crawl'] = $crawl; $self['createdAt'] = $createdAt; $self['credits'] = $credits; @@ -223,6 +237,19 @@ public function withID(string $id): self return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * The crawl controls as submitted, so the limits requested can be compared against what the crawl reached. * diff --git a/src/Batch/BatchSubmitResponse/CacheMetadata.php b/src/Batch/BatchSubmitResponse/CacheMetadata.php new file mode 100644 index 00000000..92da3272 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/CacheMetadata.php @@ -0,0 +1,103 @@ +, + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required( + enum: Status::class + )] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with( + int $ageMs, + Status|string $status, + ): self { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus( + Status|string $status + ): self { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Batch/BatchSubmitResponse/CacheMetadata/Status.php b/src/Batch/BatchSubmitResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..68d3c536 --- /dev/null +++ b/src/Batch/BatchSubmitResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Detailed brand information. */ @@ -50,6 +60,20 @@ final class BrandGetResponse implements BaseModel #[Optional] public ?string $status; + /** + * `new BrandGetResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandGetResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandGetResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -60,10 +84,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Brand|BrandShape|null $brand * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, Brand|array|null $brand = null, ?int $code = null, KeyMetadata|array|null $keyMetadata = null, @@ -71,6 +97,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $brand && $self['brand'] = $brand; null !== $code && $self['code'] = $code; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -79,6 +107,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Detailed brand information. * diff --git a/src/Brand/BrandGetResponse/CacheMetadata.php b/src/Brand/BrandGetResponse/CacheMetadata.php new file mode 100644 index 00000000..b7a530a5 --- /dev/null +++ b/src/Brand/BrandGetResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetResponse/CacheMetadata/Status.php b/src/Brand/BrandGetResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..e36f6c02 --- /dev/null +++ b/src/Brand/BrandGetResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Simplified brand information. */ @@ -50,6 +60,20 @@ final class BrandGetSimplifiedResponse implements BaseModel #[Optional] public ?string $status; + /** + * `new BrandGetSimplifiedResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * BrandGetSimplifiedResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new BrandGetSimplifiedResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -60,10 +84,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Brand|BrandShape|null $brand * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, Brand|array|null $brand = null, ?int $code = null, KeyMetadata|array|null $keyMetadata = null, @@ -71,6 +97,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $brand && $self['brand'] = $brand; null !== $code && $self['code'] = $code; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -79,6 +107,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Simplified brand information. * diff --git a/src/Brand/BrandGetSimplifiedResponse/CacheMetadata.php b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata.php new file mode 100644 index 00000000..28b3b3c3 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Brand/BrandGetSimplifiedResponse/CacheMetadata/Status.php b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..83d0d109 --- /dev/null +++ b/src/Brand/BrandGetSimplifiedResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, @@ -31,6 +34,12 @@ final class WebExtractFontsResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * HTTP status code, e.g., 200. */ @@ -76,13 +85,16 @@ final class WebExtractFontsResponse implements BaseModel * * To enforce required parameters use * ``` - * WebExtractFontsResponse::with(code: ..., domain: ..., fonts: ..., status: ...) + * WebExtractFontsResponse::with( + * cacheMetadata: ..., code: ..., domain: ..., fonts: ..., status: ... + * ) * ``` * * Otherwise ensure the following setters are called * * ``` * (new WebExtractFontsResponse) + * ->withCacheMetadata(...) * ->withCode(...) * ->withDomain(...) * ->withFonts(...) @@ -99,11 +111,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param list $fonts * @param array|null $fontLinks * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, int $code, string $domain, array $fonts, @@ -113,6 +127,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['code'] = $code; $self['domain'] = $domain; $self['fonts'] = $fonts; @@ -124,6 +139,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * HTTP status code, e.g., 200. */ diff --git a/src/Web/WebExtractFontsResponse/CacheMetadata.php b/src/Web/WebExtractFontsResponse/CacheMetadata.php new file mode 100644 index 00000000..9fdceac9 --- /dev/null +++ b/src/Web/WebExtractFontsResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebExtractFontsResponse/CacheMetadata/Status.php b/src/Web/WebExtractFontsResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..da367773 --- /dev/null +++ b/src/Web/WebExtractFontsResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * metadata: Metadata|MetadataShape, * status: string, @@ -29,6 +32,12 @@ final class WebExtractResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Extracted data matching the request schema. * @@ -72,7 +81,12 @@ final class WebExtractResponse implements BaseModel * To enforce required parameters use * ``` * WebExtractResponse::with( - * data: ..., metadata: ..., status: ..., url: ..., urlsAnalyzed: ... + * cacheMetadata: ..., + * data: ..., + * metadata: ..., + * status: ..., + * url: ..., + * urlsAnalyzed: ..., * ) * ``` * @@ -80,6 +94,7 @@ final class WebExtractResponse implements BaseModel * * ``` * (new WebExtractResponse) + * ->withCacheMetadata(...) * ->withData(...) * ->withMetadata(...) * ->withStatus(...) @@ -97,12 +112,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param array $data * @param Metadata|MetadataShape $metadata * @param list $urlsAnalyzed * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, array $data, Metadata|array $metadata, string $status, @@ -112,6 +129,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['data'] = $data; $self['metadata'] = $metadata; $self['status'] = $status; @@ -123,6 +141,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Extracted data matching the request schema. * diff --git a/src/Web/WebExtractResponse/CacheMetadata.php b/src/Web/WebExtractResponse/CacheMetadata.php new file mode 100644 index 00000000..f176b3f3 --- /dev/null +++ b/src/Web/WebExtractResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebExtractResponse/CacheMetadata/Status.php b/src/Web/WebExtractResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..3e0c37ce --- /dev/null +++ b/src/Web/WebExtractResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * HTTP status code. */ @@ -57,6 +67,20 @@ final class WebExtractStyleguideResponse implements BaseModel #[Optional] public ?Styleguide $styleguide; + /** + * `new WebExtractStyleguideResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebExtractStyleguideResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebExtractStyleguideResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -67,10 +91,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param Styleguide|StyleguideShape|null $styleguide */ public static function with( + CacheMetadata|array $cacheMetadata, ?int $code = null, ?string $domain = null, KeyMetadata|array|null $keyMetadata = null, @@ -79,6 +105,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $code && $self['code'] = $code; null !== $domain && $self['domain'] = $domain; null !== $keyMetadata && $self['keyMetadata'] = $keyMetadata; @@ -88,6 +116,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * HTTP status code. */ diff --git a/src/Web/WebExtractStyleguideResponse/CacheMetadata.php b/src/Web/WebExtractStyleguideResponse/CacheMetadata.php new file mode 100644 index 00000000..7b8ef612 --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebExtractStyleguideResponse/CacheMetadata/Status.php b/src/Web/WebExtractStyleguideResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..f37c97dc --- /dev/null +++ b/src/Web/WebExtractStyleguideResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * HTTP status code. */ @@ -79,6 +89,20 @@ final class WebScreenshotResponse implements BaseModel #[Optional] public ?int $width; + /** + * `new WebScreenshotResponse()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * WebScreenshotResponse::with(cacheMetadata: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new WebScreenshotResponse)->withCacheMetadata(...) + * ``` + */ public function __construct() { $this->initialize(); @@ -89,10 +113,12 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param KeyMetadata|KeyMetadataShape|null $keyMetadata * @param ScreenshotType|value-of|null $screenshotType */ public static function with( + CacheMetadata|array $cacheMetadata, ?int $code = null, ?string $domain = null, ?int $height = null, @@ -104,6 +130,8 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; + null !== $code && $self['code'] = $code; null !== $domain && $self['domain'] = $domain; null !== $height && $self['height'] = $height; @@ -116,6 +144,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * HTTP status code. */ diff --git a/src/Web/WebScreenshotResponse/CacheMetadata.php b/src/Web/WebScreenshotResponse/CacheMetadata.php new file mode 100644 index 00000000..77d24e60 --- /dev/null +++ b/src/Web/WebScreenshotResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebScreenshotResponse/CacheMetadata/Status.php b/src/Web/WebScreenshotResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..943957e2 --- /dev/null +++ b/src/Web/WebScreenshotResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, @@ -26,6 +29,12 @@ final class WebSearchResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Echo of the original query (useful when fanout was enabled). */ @@ -47,13 +56,16 @@ final class WebSearchResponse implements BaseModel * * To enforce required parameters use * ``` - * WebSearchResponse::with(query: ..., results: ...) + * WebSearchResponse::with(cacheMetadata: ..., query: ..., results: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new WebSearchResponse)->withQuery(...)->withResults(...) + * (new WebSearchResponse) + * ->withCacheMetadata(...) + * ->withQuery(...) + * ->withResults(...) * ``` */ public function __construct() @@ -66,16 +78,19 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param list $results * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, string $query, array $results, - KeyMetadata|array|null $keyMetadata = null + KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['query'] = $query; $self['results'] = $results; @@ -84,6 +99,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Echo of the original query (useful when fanout was enabled). */ diff --git a/src/Web/WebSearchResponse/CacheMetadata.php b/src/Web/WebSearchResponse/CacheMetadata.php new file mode 100644 index 00000000..3641688e --- /dev/null +++ b/src/Web/WebSearchResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebSearchResponse/CacheMetadata/Status.php b/src/Web/WebSearchResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..54612406 --- /dev/null +++ b/src/Web/WebSearchResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * keyMetadata?: null|KeyMetadata|KeyMetadataShape, @@ -28,6 +31,12 @@ final class WebWebCrawlMdResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + #[Required] public Metadata $metadata; @@ -46,13 +55,16 @@ final class WebWebCrawlMdResponse implements BaseModel * * To enforce required parameters use * ``` - * WebWebCrawlMdResponse::with(metadata: ..., results: ...) + * WebWebCrawlMdResponse::with(cacheMetadata: ..., metadata: ..., results: ...) * ``` * * Otherwise ensure the following setters are called * * ``` - * (new WebWebCrawlMdResponse)->withMetadata(...)->withResults(...) + * (new WebWebCrawlMdResponse) + * ->withCacheMetadata(...) + * ->withMetadata(...) + * ->withResults(...) * ``` */ public function __construct() @@ -65,17 +77,20 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param list $results * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, Metadata|array $metadata, array $results, KeyMetadata|array|null $keyMetadata = null, ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['metadata'] = $metadata; $self['results'] = $results; @@ -84,6 +99,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * @param Metadata|MetadataShape $metadata */ diff --git a/src/Web/WebWebCrawlMdResponse/CacheMetadata.php b/src/Web/WebWebCrawlMdResponse/CacheMetadata.php new file mode 100644 index 00000000..232a6fa0 --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebCrawlMdResponse/CacheMetadata/Status.php b/src/Web/WebWebCrawlMdResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..599211b1 --- /dev/null +++ b/src/Web/WebWebCrawlMdResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * The scraped content of the page. For normal pages this is the raw HTML. When the page is a sitemap or feed served behind an XSL stylesheet (which browsers render into HTML), this is the underlying XML instead — see the `type` field. */ @@ -92,7 +101,12 @@ final class WebWebScrapeHTMLResponse implements BaseModel * To enforce required parameters use * ``` * WebWebScrapeHTMLResponse::with( - * html: ..., metadata: ..., success: ..., type: ..., url: ... + * cacheMetadata: ..., + * html: ..., + * metadata: ..., + * success: ..., + * type: ..., + * url: ..., * ) * ``` * @@ -100,6 +114,7 @@ final class WebWebScrapeHTMLResponse implements BaseModel * * ``` * (new WebWebScrapeHTMLResponse) + * ->withCacheMetadata(...) * ->withHTML(...) * ->withMetadata(...) * ->withSuccess(...) @@ -117,12 +132,14 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param Type|value-of $type * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, string $html, Metadata|array $metadata, bool $success, @@ -134,6 +151,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['html'] = $html; $self['metadata'] = $metadata; $self['success'] = $success; @@ -147,6 +165,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * The scraped content of the page. For normal pages this is the raw HTML. When the page is a sitemap or feed served behind an XSL stylesheet (which browsers render into HTML), this is the underlying XML instead — see the `type` field. */ diff --git a/src/Web/WebWebScrapeHTMLResponse/CacheMetadata.php b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata.php new file mode 100644 index 00000000..e38e1943 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeHTMLResponse/CacheMetadata/Status.php b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..bdfe8f93 --- /dev/null +++ b/src/Web/WebWebScrapeHTMLResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ +, * success: bool, * url: string, @@ -30,6 +33,12 @@ final class WebWebScrapeImagesResponse implements BaseModel /** @use SdkModel */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * Images found on the page. * @@ -69,13 +78,16 @@ final class WebWebScrapeImagesResponse implements BaseModel * * To enforce required parameters use * ``` - * WebWebScrapeImagesResponse::with(images: ..., success: ..., url: ...) + * WebWebScrapeImagesResponse::with( + * cacheMetadata: ..., images: ..., success: ..., url: ... + * ) * ``` * * Otherwise ensure the following setters are called * * ``` * (new WebWebScrapeImagesResponse) + * ->withCacheMetadata(...) * ->withImages(...) * ->withSuccess(...) * ->withURL(...) @@ -91,11 +103,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param list $images * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, array $images, bool $success, string $url, @@ -104,6 +118,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['images'] = $images; $self['success'] = $success; $self['url'] = $url; @@ -114,6 +129,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * Images found on the page. * diff --git a/src/Web/WebWebScrapeImagesResponse/CacheMetadata.php b/src/Web/WebWebScrapeImagesResponse/CacheMetadata.php new file mode 100644 index 00000000..5f5c039d --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeImagesResponse/CacheMetadata/Status.php b/src/Web/WebWebScrapeImagesResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..5eeff115 --- /dev/null +++ b/src/Web/WebWebScrapeImagesResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + */ use SdkModel; + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + */ + #[Required('cache_metadata')] + public CacheMetadata $cacheMetadata; + /** * UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result and compare small values against your workload's minimum useful-content threshold. */ @@ -96,7 +105,12 @@ final class WebWebScrapeMdResponse implements BaseModel * To enforce required parameters use * ``` * WebWebScrapeMdResponse::with( - * contentLength: ..., markdown: ..., metadata: ..., success: ..., url: ... + * cacheMetadata: ..., + * contentLength: ..., + * markdown: ..., + * metadata: ..., + * success: ..., + * url: ..., * ) * ``` * @@ -104,6 +118,7 @@ final class WebWebScrapeMdResponse implements BaseModel * * ``` * (new WebWebScrapeMdResponse) + * ->withCacheMetadata(...) * ->withContentLength(...) * ->withMarkdown(...) * ->withMetadata(...) @@ -121,11 +136,13 @@ public function __construct() * * You must use named parameters to construct any parameters with a default value. * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata * @param Metadata|MetadataShape $metadata * @param list|null $actionsApplied * @param KeyMetadata|KeyMetadataShape|null $keyMetadata */ public static function with( + CacheMetadata|array $cacheMetadata, int $contentLength, string $markdown, Metadata|array $metadata, @@ -138,6 +155,7 @@ public static function with( ): self { $self = new self; + $self['cacheMetadata'] = $cacheMetadata; $self['contentLength'] = $contentLength; $self['markdown'] = $markdown; $self['metadata'] = $metadata; @@ -152,6 +170,19 @@ public static function with( return $self; } + /** + * Cache outcome for this response. Composite responses are hits only when every cache-controlled fetch contributing to the output was a hit; age_ms is the oldest contributing hit. + * + * @param CacheMetadata|CacheMetadataShape $cacheMetadata + */ + public function withCacheMetadata(CacheMetadata|array $cacheMetadata): self + { + $self = clone $this; + $self['cacheMetadata'] = $cacheMetadata; + + return $self; + } + /** * UTF-8 byte length of the returned Markdown. Use 0 to identify an empty result and compare small values against your workload's minimum useful-content threshold. */ diff --git a/src/Web/WebWebScrapeMdResponse/CacheMetadata.php b/src/Web/WebWebScrapeMdResponse/CacheMetadata.php new file mode 100644 index 00000000..17984912 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/CacheMetadata.php @@ -0,0 +1,97 @@ + + * } + */ +final class CacheMetadata implements BaseModel +{ + /** @use SdkModel */ + use SdkModel; + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + #[Required('age_ms')] + public int $ageMs; + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @var value-of $status + */ + #[Required(enum: Status::class)] + public string $status; + + /** + * `new CacheMetadata()` is missing required properties by the API. + * + * To enforce required parameters use + * ``` + * CacheMetadata::with(ageMs: ..., status: ...) + * ``` + * + * Otherwise ensure the following setters are called + * + * ``` + * (new CacheMetadata)->withAgeMs(...)->withStatus(...) + * ``` + */ + public function __construct() + { + $this->initialize(); + } + + /** + * Construct an instance from the required parameters. + * + * You must use named parameters to construct any parameters with a default value. + * + * @param Status|value-of $status + */ + public static function with(int $ageMs, Status|string $status): self + { + $self = new self; + + $self['ageMs'] = $ageMs; + $self['status'] = $status; + + return $self; + } + + /** + * Age of the cached data in milliseconds. Zero for miss and zdr responses. + */ + public function withAgeMs(int $ageMs): self + { + $self = clone $this; + $self['ageMs'] = $ageMs; + + return $self; + } + + /** + * Whether the response was served from cache, required fresh work, or honored zero-data-retention cache bypass. + * + * @param Status|value-of $status + */ + public function withStatus(Status|string $status): self + { + $self = clone $this; + $self['status'] = $status; + + return $self; + } +} diff --git a/src/Web/WebWebScrapeMdResponse/CacheMetadata/Status.php b/src/Web/WebWebScrapeMdResponse/CacheMetadata/Status.php new file mode 100644 index 00000000..412bd263 --- /dev/null +++ b/src/Web/WebWebScrapeMdResponse/CacheMetadata/Status.php @@ -0,0 +1,17 @@ + Date: Thu, 27 Aug 2026 14:13:43 +0000 Subject: [PATCH 130/130] chore(internal): version bump --- .release-please-manifest.json | 2 +- README.md | 2 +- src/Client.php | 2 +- src/Version.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 0746cbe2..e6eadb43 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "2.12.0" + ".": "2.13.0" } \ No newline at end of file diff --git a/README.md b/README.md index 2107a483..5577a7ca 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ The REST API documentation can be found on [docs.context.dev](https://docs.conte ``` -composer require "context-dev/context-dev-php 2.12.0" +composer require "context-dev/context-dev-php 2.13.0" ``` diff --git a/src/Client.php b/src/Client.php index 37db3c5e..e5af29bb 100644 --- a/src/Client.php +++ b/src/Client.php @@ -113,7 +113,7 @@ public function __construct( 'Accept' => 'application/json', 'User-Agent' => sprintf('context.dev/PHP %s', VERSION), 'X-Stainless-Lang' => 'php', - 'X-Stainless-Package-Version' => '2.12.0', + 'X-Stainless-Package-Version' => '2.13.0', 'X-Stainless-Arch' => Util::machtype(), 'X-Stainless-OS' => Util::ostype(), 'X-Stainless-Runtime' => php_sapi_name(), diff --git a/src/Version.php b/src/Version.php index 500f4fa8..570ea43b 100644 --- a/src/Version.php +++ b/src/Version.php @@ -5,5 +5,5 @@ namespace ContextDev; // x-release-please-start-version -const VERSION = '2.12.0'; +const VERSION = '2.13.0'; // x-release-please-end